cmListFileLexer.c 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340
  1. #line 2 "cmListFileLexer.c"
  2. #line 4 "cmListFileLexer.c"
  3. #define YY_INT_ALIGNED short int
  4. /* A lexical scanner generated by flex */
  5. #define FLEX_SCANNER
  6. #define YY_FLEX_MAJOR_VERSION 2
  7. #define YY_FLEX_MINOR_VERSION 5
  8. #define YY_FLEX_SUBMINOR_VERSION 31
  9. #if YY_FLEX_SUBMINOR_VERSION > 0
  10. #define FLEX_BETA
  11. #endif
  12. /* First, we deal with platform-specific or compiler-specific issues. */
  13. /* begin standard C headers. */
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include <errno.h>
  17. #include <stdlib.h>
  18. /* end standard C headers. */
  19. /* flex integer type definitions */
  20. #ifndef FLEXINT_H
  21. #define FLEXINT_H
  22. /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
  23. #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
  24. #include <inttypes.h>
  25. typedef int8_t flex_int8_t;
  26. typedef uint8_t flex_uint8_t;
  27. typedef int16_t flex_int16_t;
  28. typedef uint16_t flex_uint16_t;
  29. typedef int32_t flex_int32_t;
  30. typedef uint32_t flex_uint32_t;
  31. #else
  32. typedef signed char flex_int8_t;
  33. typedef short int flex_int16_t;
  34. typedef int flex_int32_t;
  35. typedef unsigned char flex_uint8_t;
  36. typedef unsigned short int flex_uint16_t;
  37. typedef unsigned int flex_uint32_t;
  38. #endif /* ! C99 */
  39. /* Limits of integral types. */
  40. #ifndef INT8_MIN
  41. #define INT8_MIN (-128)
  42. #endif
  43. #ifndef INT16_MIN
  44. #define INT16_MIN (-32767-1)
  45. #endif
  46. #ifndef INT32_MIN
  47. #define INT32_MIN (-2147483647-1)
  48. #endif
  49. #ifndef INT8_MAX
  50. #define INT8_MAX (127)
  51. #endif
  52. #ifndef INT16_MAX
  53. #define INT16_MAX (32767)
  54. #endif
  55. #ifndef INT32_MAX
  56. #define INT32_MAX (2147483647)
  57. #endif
  58. #ifndef UINT8_MAX
  59. #define UINT8_MAX (255U)
  60. #endif
  61. #ifndef UINT16_MAX
  62. #define UINT16_MAX (65535U)
  63. #endif
  64. #ifndef UINT32_MAX
  65. #define UINT32_MAX (4294967295U)
  66. #endif
  67. #endif /* ! FLEXINT_H */
  68. #ifdef __cplusplus
  69. /* The "const" storage-class-modifier is valid. */
  70. #define YY_USE_CONST
  71. #else /* ! __cplusplus */
  72. #if __STDC__
  73. #define YY_USE_CONST
  74. #endif /* __STDC__ */
  75. #endif /* ! __cplusplus */
  76. #ifdef YY_USE_CONST
  77. #define yyconst const
  78. #else
  79. #define yyconst
  80. #endif
  81. /* Returned upon end-of-file. */
  82. #define YY_NULL 0
  83. /* Promotes a possibly negative, possibly signed char to an unsigned
  84. * integer for use as an array index. If the signed char is negative,
  85. * we want to instead treat it as an 8-bit unsigned char, hence the
  86. * double cast.
  87. */
  88. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  89. /* An opaque pointer. */
  90. #ifndef YY_TYPEDEF_YY_SCANNER_T
  91. #define YY_TYPEDEF_YY_SCANNER_T
  92. typedef void* yyscan_t;
  93. #endif
  94. /* For convenience, these vars (plus the bison vars far below)
  95. are macros in the reentrant scanner. */
  96. #define yyin yyg->yyin_r
  97. #define yyout yyg->yyout_r
  98. #define yyextra yyg->yyextra_r
  99. #define yyleng yyg->yyleng_r
  100. #define yytext yyg->yytext_r
  101. #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
  102. #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
  103. #define yy_flex_debug yyg->yy_flex_debug_r
  104. int yylex_init (yyscan_t* scanner);
  105. /* Enter a start condition. This macro really ought to take a parameter,
  106. * but we do it the disgusting crufty way forced on us by the ()-less
  107. * definition of BEGIN.
  108. */
  109. #define BEGIN yyg->yy_start = 1 + 2 *
  110. /* Translate the current start state into a value that can be later handed
  111. * to BEGIN to return to the state. The YYSTATE alias is for lex
  112. * compatibility.
  113. */
  114. #define YY_START ((yyg->yy_start - 1) / 2)
  115. #define YYSTATE YY_START
  116. /* Action number for EOF rule of a given start state. */
  117. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  118. /* Special action meaning "start processing a new file". */
  119. #define YY_NEW_FILE yyrestart(yyin ,yyscanner )
  120. #define YY_END_OF_BUFFER_CHAR 0
  121. /* Size of default input buffer. */
  122. #ifndef YY_BUF_SIZE
  123. #define YY_BUF_SIZE 16384
  124. #endif
  125. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  126. #define YY_TYPEDEF_YY_BUFFER_STATE
  127. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  128. #endif
  129. #define EOB_ACT_CONTINUE_SCAN 0
  130. #define EOB_ACT_END_OF_FILE 1
  131. #define EOB_ACT_LAST_MATCH 2
  132. /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
  133. * access to the local variable yy_act. Since yyless() is a macro, it would break
  134. * existing scanners that call yyless() from OUTSIDE yylex.
  135. * One obvious solution it to make yy_act a global. I tried that, and saw
  136. * a 5% performance hit in a non-yylineno scanner, because yy_act is
  137. * normally declared as a register variable-- so it is not worth it.
  138. */
  139. #define YY_LESS_LINENO(n) \
  140. do { \
  141. int yyl;\
  142. for ( yyl = n; yyl < yyleng; ++yyl )\
  143. if ( yytext[yyl] == '\n' )\
  144. --yylineno;\
  145. }while(0)
  146. /* Return all but the first "n" matched characters back to the input stream. */
  147. #define yyless(n) \
  148. do \
  149. { \
  150. /* Undo effects of setting up yytext. */ \
  151. int yyless_macro_arg = (n); \
  152. YY_LESS_LINENO(yyless_macro_arg);\
  153. *yy_cp = yyg->yy_hold_char; \
  154. YY_RESTORE_YY_MORE_OFFSET \
  155. yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  156. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  157. } \
  158. while ( 0 )
  159. /* The following is because we cannot portably get our hands on size_t
  160. * (without autoconf's help, which isn't available because we want
  161. * flex-generated scanners to compile on their own).
  162. */
  163. #ifndef YY_TYPEDEF_YY_SIZE_T
  164. #define YY_TYPEDEF_YY_SIZE_T
  165. typedef unsigned int yy_size_t;
  166. #endif
  167. #ifndef YY_STRUCT_YY_BUFFER_STATE
  168. #define YY_STRUCT_YY_BUFFER_STATE
  169. struct yy_buffer_state
  170. {
  171. FILE *yy_input_file;
  172. char *yy_ch_buf; /* input buffer */
  173. char *yy_buf_pos; /* current position in input buffer */
  174. /* Size of input buffer in bytes, not including room for EOB
  175. * characters.
  176. */
  177. yy_size_t yy_buf_size;
  178. /* Number of characters read into yy_ch_buf, not including EOB
  179. * characters.
  180. */
  181. int yy_n_chars;
  182. /* Whether we "own" the buffer - i.e., we know we created it,
  183. * and can realloc() it to grow it, and should free() it to
  184. * delete it.
  185. */
  186. int yy_is_our_buffer;
  187. /* Whether this is an "interactive" input source; if so, and
  188. * if we're using stdio for input, then we want to use getc()
  189. * instead of fread(), to make sure we stop fetching input after
  190. * each newline.
  191. */
  192. int yy_is_interactive;
  193. /* Whether we're considered to be at the beginning of a line.
  194. * If so, '^' rules will be active on the next match, otherwise
  195. * not.
  196. */
  197. int yy_at_bol;
  198. int yy_bs_lineno; /**< The line count. */
  199. int yy_bs_column; /**< The column count. */
  200. /* Whether to try to fill the input buffer when we reach the
  201. * end of it.
  202. */
  203. int yy_fill_buffer;
  204. int yy_buffer_status;
  205. #define YY_BUFFER_NEW 0
  206. #define YY_BUFFER_NORMAL 1
  207. /* When an EOF's been seen but there's still some text to process
  208. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  209. * shouldn't try reading from the input source any more. We might
  210. * still have a bunch of tokens to match, though, because of
  211. * possible backing-up.
  212. *
  213. * When we actually see the EOF, we change the status to "new"
  214. * (via yyrestart()), so that the user can continue scanning by
  215. * just pointing yyin at a new input file.
  216. */
  217. #define YY_BUFFER_EOF_PENDING 2
  218. };
  219. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  220. /* We provide macros for accessing buffer states in case in the
  221. * future we want to put the buffer states in a more general
  222. * "scanner state".
  223. *
  224. * Returns the top of the stack, or NULL.
  225. */
  226. #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
  227. ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
  228. : NULL)
  229. /* Same as previous macro, but useful when we know that the buffer stack is not
  230. * NULL or when we need an lvalue. For internal use only.
  231. */
  232. #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
  233. void yyrestart (FILE *input_file ,yyscan_t yyscanner );
  234. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
  235. YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
  236. void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
  237. void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
  238. void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
  239. void yypop_buffer_state (yyscan_t yyscanner );
  240. static void yyensure_buffer_stack (yyscan_t yyscanner );
  241. static void yy_load_buffer_state (yyscan_t yyscanner );
  242. static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
  243. #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
  244. YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
  245. YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
  246. YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
  247. void *yyalloc (yy_size_t ,yyscan_t yyscanner );
  248. void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
  249. void yyfree (void * ,yyscan_t yyscanner );
  250. #define yy_new_buffer yy_create_buffer
  251. #define yy_set_interactive(is_interactive) \
  252. { \
  253. if ( ! YY_CURRENT_BUFFER ){ \
  254. yyensure_buffer_stack (yyscanner); \
  255. YY_CURRENT_BUFFER_LVALUE = \
  256. yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
  257. } \
  258. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  259. }
  260. #define yy_set_bol(at_bol) \
  261. { \
  262. if ( ! YY_CURRENT_BUFFER ){\
  263. yyensure_buffer_stack (yyscanner); \
  264. YY_CURRENT_BUFFER_LVALUE = \
  265. yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
  266. } \
  267. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  268. }
  269. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  270. /* Begin user sect3 */
  271. #define yywrap(n) 1
  272. #define YY_SKIP_YYWRAP
  273. typedef unsigned char YY_CHAR;
  274. typedef int yy_state_type;
  275. #define yytext_ptr yytext_r
  276. static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
  277. static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
  278. static int yy_get_next_buffer (yyscan_t yyscanner );
  279. static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
  280. /* Done after the current pattern has been matched and before the
  281. * corresponding action - sets up yytext.
  282. */
  283. #define YY_DO_BEFORE_ACTION \
  284. yyg->yytext_ptr = yy_bp; \
  285. yyleng = (size_t) (yy_cp - yy_bp); \
  286. yyg->yy_hold_char = *yy_cp; \
  287. *yy_cp = '\0'; \
  288. yyg->yy_c_buf_p = yy_cp;
  289. #define YY_NUM_RULES 14
  290. #define YY_END_OF_BUFFER 15
  291. /* This struct is not used in this scanner,
  292. but its presence is necessary. */
  293. struct yy_trans_info
  294. {
  295. flex_int32_t yy_verify;
  296. flex_int32_t yy_nxt;
  297. };
  298. static yyconst flex_int16_t yy_accept[33] =
  299. { 0,
  300. 0, 0, 0, 0, 15, 6, 12, 1, 7, 2,
  301. 6, 3, 4, 6, 13, 8, 9, 10, 11, 6,
  302. 6, 0, 2, 0, 5, 6, 8, 0, 0, 0,
  303. 0, 0
  304. } ;
  305. static yyconst flex_int32_t yy_ec[256] =
  306. { 0,
  307. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  308. 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
  309. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  310. 1, 2, 1, 4, 5, 6, 1, 1, 1, 7,
  311. 8, 1, 1, 1, 1, 1, 1, 9, 9, 9,
  312. 9, 9, 9, 9, 9, 9, 9, 1, 1, 1,
  313. 1, 1, 1, 1, 10, 10, 10, 10, 10, 10,
  314. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  315. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  316. 1, 11, 1, 1, 10, 1, 10, 10, 10, 10,
  317. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  318. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  319. 10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
  320. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  321. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  322. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  323. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  324. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  325. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  326. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  327. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  328. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  329. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  330. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  331. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  332. 1, 1, 1, 1, 1
  333. } ;
  334. static yyconst flex_int32_t yy_meta[12] =
  335. { 0,
  336. 1, 2, 3, 4, 2, 1, 2, 5, 6, 6,
  337. 1
  338. } ;
  339. static yyconst flex_int16_t yy_base[40] =
  340. { 0,
  341. 0, 0, 9, 18, 26, 24, 91, 91, 91, 0,
  342. 30, 91, 91, 35, 0, 14, 91, 91, 43, 17,
  343. 16, 46, 0, 11, 0, 11, 6, 52, 8, 7,
  344. 6, 91, 56, 62, 68, 74, 80, 82, 84
  345. } ;
  346. static yyconst flex_int16_t yy_def[40] =
  347. { 0,
  348. 32, 1, 33, 33, 32, 34, 32, 32, 32, 35,
  349. 34, 32, 32, 11, 36, 37, 32, 32, 37, 11,
  350. 11, 34, 35, 38, 14, 11, 37, 37, 39, 38,
  351. 39, 0, 32, 32, 32, 32, 32, 32, 32
  352. } ;
  353. static yyconst flex_int16_t yy_nxt[103] =
  354. { 0,
  355. 6, 7, 8, 9, 10, 11, 12, 13, 6, 14,
  356. 15, 17, 18, 20, 26, 20, 28, 32, 26, 19,
  357. 17, 18, 29, 32, 28, 32, 32, 32, 19, 21,
  358. 32, 32, 32, 32, 22, 21, 24, 32, 32, 32,
  359. 22, 32, 32, 25, 25, 27, 27, 20, 32, 32,
  360. 20, 32, 20, 20, 27, 27, 16, 16, 16, 16,
  361. 16, 16, 20, 32, 32, 20, 32, 20, 23, 23,
  362. 32, 23, 23, 23, 26, 26, 32, 26, 26, 26,
  363. 27, 27, 32, 32, 27, 27, 30, 30, 31, 31,
  364. 5, 32, 32, 32, 32, 32, 32, 32, 32, 32,
  365. 32, 32
  366. } ;
  367. static yyconst flex_int16_t yy_chk[103] =
  368. { 0,
  369. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  370. 1, 3, 3, 31, 30, 29, 27, 26, 24, 3,
  371. 4, 4, 21, 20, 16, 5, 0, 0, 4, 6,
  372. 0, 0, 0, 0, 6, 11, 11, 0, 0, 0,
  373. 11, 14, 0, 14, 14, 19, 19, 22, 0, 0,
  374. 22, 0, 22, 22, 28, 28, 33, 33, 33, 33,
  375. 33, 33, 34, 0, 0, 34, 0, 34, 35, 35,
  376. 0, 35, 35, 35, 36, 36, 0, 36, 36, 36,
  377. 37, 37, 0, 0, 37, 37, 38, 38, 39, 39,
  378. 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
  379. 32, 32
  380. } ;
  381. /* Table of booleans, true if rule could match eol. */
  382. static yyconst flex_int32_t yy_rule_can_match_eol[15] =
  383. { 0,
  384. 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, };
  385. /* The intent behind this definition is that it'll catch
  386. * any uses of REJECT which flex missed.
  387. */
  388. #define REJECT reject_used_but_not_detected
  389. #define yymore() yymore_used_but_not_detected
  390. #define YY_MORE_ADJ 0
  391. #define YY_RESTORE_YY_MORE_OFFSET
  392. #line 1 "cmListFileLexer.in.l"
  393. #line 2 "cmListFileLexer.in.l"
  394. /*=========================================================================
  395. Program: CMake - Cross-Platform Makefile Generator
  396. Module: $RCSfile$
  397. Language: C++
  398. Date: $Date$
  399. Version: $Revision$
  400. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  401. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  402. This software is distributed WITHOUT ANY WARRANTY; without even
  403. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  404. PURPOSE. See the above copyright notices for more information.
  405. =========================================================================*/
  406. /*
  407. This file must be translated to C and modified to build everywhere.
  408. Run flex like this:
  409. flex -ocmListFileLexer.c cmListFileLexer.in.l
  410. Modify cmListFileLexer.c:
  411. - remove TABs
  412. - remove the yyunput function
  413. - add a statement "(void)yyscanner;" to the top of these methods:
  414. yy_fatal_error, yyalloc, yyrealloc, yyfree
  415. - remove all YY_BREAK lines occurring right after return statements
  416. */
  417. /* Disable features we do not need. */
  418. #define YY_NEVER_INTERACTIVE 1
  419. #define YY_NO_UNPUT 1
  420. #define YY_NO_UNISTD_H 1
  421. #define ECHO
  422. /* Setup the proper yylex declaration. */
  423. #define YY_EXTRA_TYPE cmListFileLexer*
  424. #define YY_DECL int yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
  425. /* Disable some warnings. */
  426. #if defined(_MSC_VER)
  427. # pragma warning ( disable : 4127 )
  428. # pragma warning ( disable : 4131 )
  429. # pragma warning ( disable : 4244 )
  430. # pragma warning ( disable : 4251 )
  431. # pragma warning ( disable : 4267 )
  432. # pragma warning ( disable : 4305 )
  433. # pragma warning ( disable : 4309 )
  434. # pragma warning ( disable : 4706 )
  435. # pragma warning ( disable : 4786 )
  436. #endif
  437. #include "cmListFileLexer.h"
  438. /*--------------------------------------------------------------------------*/
  439. struct cmListFileLexer_s
  440. {
  441. cmListFileLexer_Token token;
  442. int line;
  443. int column;
  444. int size;
  445. FILE* file;
  446. char* string_buffer;
  447. char* string_position;
  448. int string_left;
  449. yyscan_t scanner;
  450. };
  451. static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
  452. int length);
  453. static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
  454. int length);
  455. static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
  456. size_t bufferSize);
  457. static void cmListFileLexerInit(cmListFileLexer* lexer);
  458. static void cmListFileLexerDestroy(cmListFileLexer* lexer);
  459. /* Replace the lexer input function. */
  460. #undef YY_INPUT
  461. #define YY_INPUT(buf, result, max_size) \
  462. { result = cmListFileLexerInput(yyget_extra(yyscanner), buf, max_size); }
  463. /*--------------------------------------------------------------------------*/
  464. #line 565 "cmListFileLexer.c"
  465. #define INITIAL 0
  466. #define STRING 1
  467. #ifndef YY_NO_UNISTD_H
  468. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  469. * down here because we want the user's section 1 to have been scanned first.
  470. * The user has a chance to override it with an option.
  471. */
  472. #include <unistd.h>
  473. #endif
  474. #ifndef YY_EXTRA_TYPE
  475. #define YY_EXTRA_TYPE void *
  476. #endif
  477. /* Holds the entire state of the reentrant scanner. */
  478. struct yyguts_t
  479. {
  480. /* User-defined. Not touched by flex. */
  481. YY_EXTRA_TYPE yyextra_r;
  482. /* The rest are the same as the globals declared in the non-reentrant scanner. */
  483. FILE *yyin_r, *yyout_r;
  484. size_t yy_buffer_stack_top; /**< index of top of stack. */
  485. size_t yy_buffer_stack_max; /**< capacity of stack. */
  486. YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
  487. char yy_hold_char;
  488. int yy_n_chars;
  489. int yyleng_r;
  490. char *yy_c_buf_p;
  491. int yy_init;
  492. int yy_start;
  493. int yy_did_buffer_switch_on_eof;
  494. int yy_start_stack_ptr;
  495. int yy_start_stack_depth;
  496. int *yy_start_stack;
  497. yy_state_type yy_last_accepting_state;
  498. char* yy_last_accepting_cpos;
  499. int yylineno_r;
  500. int yy_flex_debug_r;
  501. char *yytext_r;
  502. int yy_more_flag;
  503. int yy_more_len;
  504. }; /* end struct yyguts_t */
  505. /* Accessor methods to globals.
  506. These are made visible to non-reentrant scanners for convenience. */
  507. int yylex_destroy (yyscan_t yyscanner );
  508. int yyget_debug (yyscan_t yyscanner );
  509. void yyset_debug (int debug_flag ,yyscan_t yyscanner );
  510. YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
  511. void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
  512. FILE *yyget_in (yyscan_t yyscanner );
  513. void yyset_in (FILE * in_str ,yyscan_t yyscanner );
  514. FILE *yyget_out (yyscan_t yyscanner );
  515. void yyset_out (FILE * out_str ,yyscan_t yyscanner );
  516. int yyget_leng (yyscan_t yyscanner );
  517. char *yyget_text (yyscan_t yyscanner );
  518. int yyget_lineno (yyscan_t yyscanner );
  519. void yyset_lineno (int line_number ,yyscan_t yyscanner );
  520. /* Macros after this point can all be overridden by user definitions in
  521. * section 1.
  522. */
  523. #ifndef YY_SKIP_YYWRAP
  524. #ifdef __cplusplus
  525. extern "C" int yywrap (yyscan_t yyscanner );
  526. #else
  527. extern int yywrap (yyscan_t yyscanner );
  528. #endif
  529. #endif
  530. #ifndef yytext_ptr
  531. static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
  532. #endif
  533. #ifdef YY_NEED_STRLEN
  534. static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
  535. #endif
  536. #ifndef YY_NO_INPUT
  537. #ifdef __cplusplus
  538. static int yyinput (yyscan_t yyscanner );
  539. #else
  540. static int input (yyscan_t yyscanner );
  541. #endif
  542. #endif
  543. /* Amount of stuff to slurp up with each read. */
  544. #ifndef YY_READ_BUF_SIZE
  545. #define YY_READ_BUF_SIZE 8192
  546. #endif
  547. /* Copy whatever the last rule matched to the standard output. */
  548. #ifndef ECHO
  549. /* This used to be an fputs(), but since the string might contain NUL's,
  550. * we now use fwrite().
  551. */
  552. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  553. #endif
  554. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  555. * is returned in "result".
  556. */
  557. #ifndef YY_INPUT
  558. #define YY_INPUT(buf,result,max_size) \
  559. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  560. { \
  561. int c = '*'; \
  562. size_t n; \
  563. for ( n = 0; n < max_size && \
  564. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  565. buf[n] = (char) c; \
  566. if ( c == '\n' ) \
  567. buf[n++] = (char) c; \
  568. if ( c == EOF && ferror( yyin ) ) \
  569. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  570. result = n; \
  571. } \
  572. else \
  573. { \
  574. errno=0; \
  575. while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
  576. { \
  577. if( errno != EINTR) \
  578. { \
  579. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  580. break; \
  581. } \
  582. errno=0; \
  583. clearerr(yyin); \
  584. } \
  585. }\
  586. \
  587. #endif
  588. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  589. * we don't want an extra ';' after the "return" because that will cause
  590. * some compilers to complain about unreachable statements.
  591. */
  592. #ifndef yyterminate
  593. #define yyterminate() return YY_NULL
  594. #endif
  595. /* Number of entries by which start-condition stack grows. */
  596. #ifndef YY_START_STACK_INCR
  597. #define YY_START_STACK_INCR 25
  598. #endif
  599. /* Report a fatal error. */
  600. #ifndef YY_FATAL_ERROR
  601. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
  602. #endif
  603. /* end tables serialization structures and prototypes */
  604. /* Default declaration of generated scanner - a define so the user can
  605. * easily add parameters.
  606. */
  607. #ifndef YY_DECL
  608. #define YY_DECL_IS_OURS 1
  609. extern int yylex (yyscan_t yyscanner);
  610. #define YY_DECL int yylex (yyscan_t yyscanner)
  611. #endif /* !YY_DECL */
  612. /* Code executed at the beginning of each rule, after yytext and yyleng
  613. * have been set up.
  614. */
  615. #ifndef YY_USER_ACTION
  616. #define YY_USER_ACTION
  617. #endif
  618. /* Code executed at the end of each rule. */
  619. #ifndef YY_BREAK
  620. #define YY_BREAK break;
  621. #endif
  622. #define YY_RULE_SETUP \
  623. YY_USER_ACTION
  624. /** The main scanner function which does all the work.
  625. */
  626. YY_DECL
  627. {
  628. register yy_state_type yy_current_state;
  629. register char *yy_cp, *yy_bp;
  630. register int yy_act;
  631. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  632. #line 99 "cmListFileLexer.in.l"
  633. #line 784 "cmListFileLexer.c"
  634. if ( yyg->yy_init )
  635. {
  636. yyg->yy_init = 0;
  637. #ifdef YY_USER_INIT
  638. YY_USER_INIT;
  639. #endif
  640. if ( ! yyg->yy_start )
  641. yyg->yy_start = 1; /* first start state */
  642. if ( ! yyin )
  643. yyin = stdin;
  644. if ( ! yyout )
  645. yyout = stdout;
  646. if ( ! YY_CURRENT_BUFFER ) {
  647. yyensure_buffer_stack (yyscanner);
  648. YY_CURRENT_BUFFER_LVALUE =
  649. yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
  650. }
  651. yy_load_buffer_state(yyscanner );
  652. }
  653. while ( 1 ) /* loops until end-of-file is reached */
  654. {
  655. yy_cp = yyg->yy_c_buf_p;
  656. /* Support of yytext. */
  657. *yy_cp = yyg->yy_hold_char;
  658. /* yy_bp points to the position in yy_ch_buf of the start of
  659. * the current run.
  660. */
  661. yy_bp = yy_cp;
  662. yy_current_state = yyg->yy_start;
  663. yy_match:
  664. do
  665. {
  666. register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  667. if ( yy_accept[yy_current_state] )
  668. {
  669. yyg->yy_last_accepting_state = yy_current_state;
  670. yyg->yy_last_accepting_cpos = yy_cp;
  671. }
  672. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  673. {
  674. yy_current_state = (int) yy_def[yy_current_state];
  675. if ( yy_current_state >= 33 )
  676. yy_c = yy_meta[(unsigned int) yy_c];
  677. }
  678. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  679. ++yy_cp;
  680. }
  681. while ( yy_base[yy_current_state] != 91 );
  682. yy_find_action:
  683. yy_act = yy_accept[yy_current_state];
  684. if ( yy_act == 0 )
  685. { /* have to back up */
  686. yy_cp = yyg->yy_last_accepting_cpos;
  687. yy_current_state = yyg->yy_last_accepting_state;
  688. yy_act = yy_accept[yy_current_state];
  689. }
  690. YY_DO_BEFORE_ACTION;
  691. if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
  692. {
  693. int yyl;
  694. for ( yyl = 0; yyl < yyleng; ++yyl )
  695. if ( yytext[yyl] == '\n' )
  696. do{ yylineno++;
  697. yycolumn=0;
  698. }while(0)
  699. ;
  700. }
  701. do_action: /* This label is used only to access EOF actions. */
  702. switch ( yy_act )
  703. { /* beginning of action switch */
  704. case 0: /* must back up */
  705. /* undo the effects of YY_DO_BEFORE_ACTION */
  706. *yy_cp = yyg->yy_hold_char;
  707. yy_cp = yyg->yy_last_accepting_cpos;
  708. yy_current_state = yyg->yy_last_accepting_state;
  709. goto yy_find_action;
  710. case 1:
  711. /* rule 1 can match eol */
  712. YY_RULE_SETUP
  713. #line 101 "cmListFileLexer.in.l"
  714. {
  715. lexer->token.type = cmListFileLexer_Token_Newline;
  716. cmListFileLexerSetToken(lexer, yytext, yyleng);
  717. ++lexer->line;
  718. lexer->column = 1;
  719. return 1;
  720. }
  721. case 2:
  722. YY_RULE_SETUP
  723. #line 109 "cmListFileLexer.in.l"
  724. {
  725. lexer->column += yyleng;
  726. }
  727. YY_BREAK
  728. case 3:
  729. YY_RULE_SETUP
  730. #line 113 "cmListFileLexer.in.l"
  731. {
  732. lexer->token.type = cmListFileLexer_Token_ParenLeft;
  733. cmListFileLexerSetToken(lexer, yytext, yyleng);
  734. lexer->column += yyleng;
  735. return 1;
  736. }
  737. case 4:
  738. YY_RULE_SETUP
  739. #line 120 "cmListFileLexer.in.l"
  740. {
  741. lexer->token.type = cmListFileLexer_Token_ParenRight;
  742. cmListFileLexerSetToken(lexer, yytext, yyleng);
  743. lexer->column += yyleng;
  744. return 1;
  745. }
  746. case 5:
  747. YY_RULE_SETUP
  748. #line 127 "cmListFileLexer.in.l"
  749. {
  750. lexer->token.type = cmListFileLexer_Token_Identifier;
  751. cmListFileLexerSetToken(lexer, yytext, yyleng);
  752. lexer->column += yyleng;
  753. return 1;
  754. }
  755. case 6:
  756. YY_RULE_SETUP
  757. #line 134 "cmListFileLexer.in.l"
  758. {
  759. lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
  760. cmListFileLexerSetToken(lexer, yytext, yyleng);
  761. lexer->column += yyleng;
  762. return 1;
  763. }
  764. case 7:
  765. YY_RULE_SETUP
  766. #line 141 "cmListFileLexer.in.l"
  767. {
  768. lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
  769. cmListFileLexerSetToken(lexer, "", 0);
  770. lexer->column += yyleng;
  771. BEGIN(STRING);
  772. }
  773. YY_BREAK
  774. case 8:
  775. /* rule 8 can match eol */
  776. YY_RULE_SETUP
  777. #line 148 "cmListFileLexer.in.l"
  778. {
  779. cmListFileLexerAppend(lexer, yytext, yyleng);
  780. lexer->column += yyleng;
  781. }
  782. YY_BREAK
  783. case 9:
  784. /* rule 9 can match eol */
  785. YY_RULE_SETUP
  786. #line 153 "cmListFileLexer.in.l"
  787. {
  788. cmListFileLexerAppend(lexer, yytext, yyleng);
  789. ++lexer->line;
  790. lexer->column = 1;
  791. }
  792. YY_BREAK
  793. case 10:
  794. YY_RULE_SETUP
  795. #line 159 "cmListFileLexer.in.l"
  796. {
  797. lexer->column += yyleng;
  798. BEGIN(INITIAL);
  799. return 1;
  800. }
  801. case 11:
  802. YY_RULE_SETUP
  803. #line 165 "cmListFileLexer.in.l"
  804. {
  805. cmListFileLexerAppend(lexer, yytext, yyleng);
  806. lexer->column += yyleng;
  807. }
  808. YY_BREAK
  809. case YY_STATE_EOF(STRING):
  810. #line 170 "cmListFileLexer.in.l"
  811. {
  812. lexer->token.type = cmListFileLexer_Token_BadString;
  813. BEGIN(INITIAL);
  814. return 1;
  815. }
  816. case 12:
  817. YY_RULE_SETUP
  818. #line 176 "cmListFileLexer.in.l"
  819. {
  820. lexer->column += yyleng;
  821. }
  822. YY_BREAK
  823. case 13:
  824. YY_RULE_SETUP
  825. #line 180 "cmListFileLexer.in.l"
  826. {
  827. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  828. cmListFileLexerSetToken(lexer, yytext, yyleng);
  829. lexer->column += yyleng;
  830. return 1;
  831. }
  832. case YY_STATE_EOF(INITIAL):
  833. #line 187 "cmListFileLexer.in.l"
  834. {
  835. lexer->token.type = cmListFileLexer_Token_None;
  836. cmListFileLexerSetToken(lexer, 0, 0);
  837. return 0;
  838. }
  839. case 14:
  840. YY_RULE_SETUP
  841. #line 193 "cmListFileLexer.in.l"
  842. ECHO;
  843. YY_BREAK
  844. #line 1022 "cmListFileLexer.c"
  845. case YY_END_OF_BUFFER:
  846. {
  847. /* Amount of text matched not including the EOB char. */
  848. int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
  849. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  850. *yy_cp = yyg->yy_hold_char;
  851. YY_RESTORE_YY_MORE_OFFSET
  852. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  853. {
  854. /* We're scanning a new file or input source. It's
  855. * possible that this happened because the user
  856. * just pointed yyin at a new source and called
  857. * yylex(). If so, then we have to assure
  858. * consistency between YY_CURRENT_BUFFER and our
  859. * globals. Here is the right place to do so, because
  860. * this is the first action (other than possibly a
  861. * back-up) that will match for the new input source.
  862. */
  863. yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  864. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  865. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  866. }
  867. /* Note that here we test for yy_c_buf_p "<=" to the position
  868. * of the first EOB in the buffer, since yy_c_buf_p will
  869. * already have been incremented past the NUL character
  870. * (since all states make transitions on EOB to the
  871. * end-of-buffer state). Contrast this with the test
  872. * in input().
  873. */
  874. if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  875. { /* This was really a NUL. */
  876. yy_state_type yy_next_state;
  877. yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
  878. yy_current_state = yy_get_previous_state( yyscanner );
  879. /* Okay, we're now positioned to make the NUL
  880. * transition. We couldn't have
  881. * yy_get_previous_state() go ahead and do it
  882. * for us because it doesn't know how to deal
  883. * with the possibility of jamming (and we don't
  884. * want to build jamming into it because then it
  885. * will run more slowly).
  886. */
  887. yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
  888. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  889. if ( yy_next_state )
  890. {
  891. /* Consume the NUL. */
  892. yy_cp = ++yyg->yy_c_buf_p;
  893. yy_current_state = yy_next_state;
  894. goto yy_match;
  895. }
  896. else
  897. {
  898. yy_cp = yyg->yy_c_buf_p;
  899. goto yy_find_action;
  900. }
  901. }
  902. else switch ( yy_get_next_buffer( yyscanner ) )
  903. {
  904. case EOB_ACT_END_OF_FILE:
  905. {
  906. yyg->yy_did_buffer_switch_on_eof = 0;
  907. if ( yywrap(yyscanner ) )
  908. {
  909. /* Note: because we've taken care in
  910. * yy_get_next_buffer() to have set up
  911. * yytext, we can now set up
  912. * yy_c_buf_p so that if some total
  913. * hoser (like flex itself) wants to
  914. * call the scanner after we return the
  915. * YY_NULL, it'll still work - another
  916. * YY_NULL will get returned.
  917. */
  918. yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
  919. yy_act = YY_STATE_EOF(YY_START);
  920. goto do_action;
  921. }
  922. else
  923. {
  924. if ( ! yyg->yy_did_buffer_switch_on_eof )
  925. YY_NEW_FILE;
  926. }
  927. break;
  928. }
  929. case EOB_ACT_CONTINUE_SCAN:
  930. yyg->yy_c_buf_p =
  931. yyg->yytext_ptr + yy_amount_of_matched_text;
  932. yy_current_state = yy_get_previous_state( yyscanner );
  933. yy_cp = yyg->yy_c_buf_p;
  934. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  935. goto yy_match;
  936. case EOB_ACT_LAST_MATCH:
  937. yyg->yy_c_buf_p =
  938. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
  939. yy_current_state = yy_get_previous_state( yyscanner );
  940. yy_cp = yyg->yy_c_buf_p;
  941. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  942. goto yy_find_action;
  943. }
  944. break;
  945. }
  946. default:
  947. YY_FATAL_ERROR(
  948. "fatal flex scanner internal error--no action found" );
  949. } /* end of action switch */
  950. } /* end of scanning one token */
  951. } /* end of yylex */
  952. /* yy_get_next_buffer - try to read in a new buffer
  953. *
  954. * Returns a code representing an action:
  955. * EOB_ACT_LAST_MATCH -
  956. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  957. * EOB_ACT_END_OF_FILE - end of file
  958. */
  959. static int yy_get_next_buffer (yyscan_t yyscanner)
  960. {
  961. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  962. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  963. register char *source = yyg->yytext_ptr;
  964. register int number_to_move, i;
  965. int ret_val;
  966. if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
  967. YY_FATAL_ERROR(
  968. "fatal flex scanner internal error--end of buffer missed" );
  969. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  970. { /* Don't try to fill the buffer, so this is an EOF. */
  971. if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
  972. {
  973. /* We matched a single character, the EOB, so
  974. * treat this as a final EOF.
  975. */
  976. return EOB_ACT_END_OF_FILE;
  977. }
  978. else
  979. {
  980. /* We matched some text prior to the EOB, first
  981. * process it.
  982. */
  983. return EOB_ACT_LAST_MATCH;
  984. }
  985. }
  986. /* Try to read more data. */
  987. /* First move last chars to start of buffer. */
  988. number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
  989. for ( i = 0; i < number_to_move; ++i )
  990. *(dest++) = *(source++);
  991. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  992. /* don't do the read, it's not guaranteed to return an EOF,
  993. * just force an EOF
  994. */
  995. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
  996. else
  997. {
  998. size_t num_to_read =
  999. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1000. while ( num_to_read <= 0 )
  1001. { /* Not enough room in the buffer - grow it. */
  1002. /* just a shorter name for the current buffer */
  1003. YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
  1004. int yy_c_buf_p_offset =
  1005. (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
  1006. if ( b->yy_is_our_buffer )
  1007. {
  1008. int new_size = b->yy_buf_size * 2;
  1009. if ( new_size <= 0 )
  1010. b->yy_buf_size += b->yy_buf_size / 8;
  1011. else
  1012. b->yy_buf_size *= 2;
  1013. b->yy_ch_buf = (char *)
  1014. /* Include room in for 2 EOB chars. */
  1015. yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
  1016. }
  1017. else
  1018. /* Can't grow it, we don't own it. */
  1019. b->yy_ch_buf = 0;
  1020. if ( ! b->yy_ch_buf )
  1021. YY_FATAL_ERROR(
  1022. "fatal error - scanner input buffer overflow" );
  1023. yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  1024. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1025. number_to_move - 1;
  1026. }
  1027. if ( num_to_read > YY_READ_BUF_SIZE )
  1028. num_to_read = YY_READ_BUF_SIZE;
  1029. /* Read in more data. */
  1030. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1031. yyg->yy_n_chars, num_to_read );
  1032. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1033. }
  1034. if ( yyg->yy_n_chars == 0 )
  1035. {
  1036. if ( number_to_move == YY_MORE_ADJ )
  1037. {
  1038. ret_val = EOB_ACT_END_OF_FILE;
  1039. yyrestart(yyin ,yyscanner);
  1040. }
  1041. else
  1042. {
  1043. ret_val = EOB_ACT_LAST_MATCH;
  1044. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1045. YY_BUFFER_EOF_PENDING;
  1046. }
  1047. }
  1048. else
  1049. ret_val = EOB_ACT_CONTINUE_SCAN;
  1050. yyg->yy_n_chars += number_to_move;
  1051. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1052. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1053. yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1054. return ret_val;
  1055. }
  1056. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1057. static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
  1058. {
  1059. register yy_state_type yy_current_state;
  1060. register char *yy_cp;
  1061. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1062. yy_current_state = yyg->yy_start;
  1063. for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
  1064. {
  1065. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1066. if ( yy_accept[yy_current_state] )
  1067. {
  1068. yyg->yy_last_accepting_state = yy_current_state;
  1069. yyg->yy_last_accepting_cpos = yy_cp;
  1070. }
  1071. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1072. {
  1073. yy_current_state = (int) yy_def[yy_current_state];
  1074. if ( yy_current_state >= 33 )
  1075. yy_c = yy_meta[(unsigned int) yy_c];
  1076. }
  1077. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1078. }
  1079. return yy_current_state;
  1080. }
  1081. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1082. *
  1083. * synopsis
  1084. * next_state = yy_try_NUL_trans( current_state );
  1085. */
  1086. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
  1087. {
  1088. register int yy_is_jam;
  1089. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1090. register char *yy_cp = yyg->yy_c_buf_p;
  1091. register YY_CHAR yy_c = 1;
  1092. if ( yy_accept[yy_current_state] )
  1093. {
  1094. yyg->yy_last_accepting_state = yy_current_state;
  1095. yyg->yy_last_accepting_cpos = yy_cp;
  1096. }
  1097. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1098. {
  1099. yy_current_state = (int) yy_def[yy_current_state];
  1100. if ( yy_current_state >= 33 )
  1101. yy_c = yy_meta[(unsigned int) yy_c];
  1102. }
  1103. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1104. yy_is_jam = (yy_current_state == 32);
  1105. return yy_is_jam ? 0 : yy_current_state;
  1106. }
  1107. #ifndef YY_NO_INPUT
  1108. #ifdef __cplusplus
  1109. static int yyinput (yyscan_t yyscanner)
  1110. #else
  1111. static int input (yyscan_t yyscanner)
  1112. #endif
  1113. {
  1114. int c;
  1115. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1116. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1117. if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1118. {
  1119. /* yy_c_buf_p now points to the character we want to return.
  1120. * If this occurs *before* the EOB characters, then it's a
  1121. * valid NUL; if not, then we've hit the end of the buffer.
  1122. */
  1123. if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  1124. /* This was really a NUL. */
  1125. *yyg->yy_c_buf_p = '\0';
  1126. else
  1127. { /* need more input */
  1128. int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
  1129. ++yyg->yy_c_buf_p;
  1130. switch ( yy_get_next_buffer( yyscanner ) )
  1131. {
  1132. case EOB_ACT_LAST_MATCH:
  1133. /* This happens because yy_g_n_b()
  1134. * sees that we've accumulated a
  1135. * token and flags that we need to
  1136. * try matching the token before
  1137. * proceeding. But for input(),
  1138. * there's no matching to consider.
  1139. * So convert the EOB_ACT_LAST_MATCH
  1140. * to EOB_ACT_END_OF_FILE.
  1141. */
  1142. /* Reset buffer status. */
  1143. yyrestart(yyin ,yyscanner);
  1144. /*FALLTHROUGH*/
  1145. case EOB_ACT_END_OF_FILE:
  1146. {
  1147. if ( yywrap(yyscanner ) )
  1148. return EOF;
  1149. if ( ! yyg->yy_did_buffer_switch_on_eof )
  1150. YY_NEW_FILE;
  1151. #ifdef __cplusplus
  1152. return yyinput(yyscanner);
  1153. #else
  1154. return input(yyscanner);
  1155. #endif
  1156. }
  1157. case EOB_ACT_CONTINUE_SCAN:
  1158. yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
  1159. break;
  1160. }
  1161. }
  1162. }
  1163. c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
  1164. *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
  1165. yyg->yy_hold_char = *++yyg->yy_c_buf_p;
  1166. if ( c == '\n' )
  1167. do{ yylineno++;
  1168. yycolumn=0;
  1169. }while(0)
  1170. ;
  1171. return c;
  1172. }
  1173. #endif /* ifndef YY_NO_INPUT */
  1174. /** Immediately switch to a different input stream.
  1175. * @param input_file A readable stream.
  1176. * @param yyscanner The scanner object.
  1177. * @note This function does not reset the start condition to @c INITIAL .
  1178. */
  1179. void yyrestart (FILE * input_file , yyscan_t yyscanner)
  1180. {
  1181. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1182. if ( ! YY_CURRENT_BUFFER ){
  1183. yyensure_buffer_stack (yyscanner);
  1184. YY_CURRENT_BUFFER_LVALUE =
  1185. yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
  1186. }
  1187. yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
  1188. yy_load_buffer_state(yyscanner );
  1189. }
  1190. /** Switch to a different input buffer.
  1191. * @param new_buffer The new input buffer.
  1192. * @param yyscanner The scanner object.
  1193. */
  1194. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
  1195. {
  1196. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1197. /* TODO. We should be able to replace this entire function body
  1198. * with
  1199. * yypop_buffer_state();
  1200. * yypush_buffer_state(new_buffer);
  1201. */
  1202. yyensure_buffer_stack (yyscanner);
  1203. if ( YY_CURRENT_BUFFER == new_buffer )
  1204. return;
  1205. if ( YY_CURRENT_BUFFER )
  1206. {
  1207. /* Flush out information for old buffer. */
  1208. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1209. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  1210. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1211. }
  1212. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1213. yy_load_buffer_state(yyscanner );
  1214. /* We don't actually know whether we did this switch during
  1215. * EOF (yywrap()) processing, but the only time this flag
  1216. * is looked at is after yywrap() is called, so it's safe
  1217. * to go ahead and always set it.
  1218. */
  1219. yyg->yy_did_buffer_switch_on_eof = 1;
  1220. }
  1221. static void yy_load_buffer_state (yyscan_t yyscanner)
  1222. {
  1223. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1224. yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1225. yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1226. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1227. yyg->yy_hold_char = *yyg->yy_c_buf_p;
  1228. }
  1229. /** Allocate and initialize an input buffer state.
  1230. * @param file A readable stream.
  1231. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1232. * @param yyscanner The scanner object.
  1233. * @return the allocated buffer state.
  1234. */
  1235. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
  1236. {
  1237. YY_BUFFER_STATE b;
  1238. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
  1239. if ( ! b )
  1240. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1241. b->yy_buf_size = size;
  1242. /* yy_ch_buf has to be 2 characters longer than the size given because
  1243. * we need to put in 2 end-of-buffer characters.
  1244. */
  1245. b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
  1246. if ( ! b->yy_ch_buf )
  1247. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1248. b->yy_is_our_buffer = 1;
  1249. yy_init_buffer(b,file ,yyscanner);
  1250. return b;
  1251. }
  1252. /** Destroy the buffer.
  1253. * @param b a buffer created with yy_create_buffer()
  1254. * @param yyscanner The scanner object.
  1255. */
  1256. void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
  1257. {
  1258. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1259. if ( ! b )
  1260. return;
  1261. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1262. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1263. if ( b->yy_is_our_buffer )
  1264. yyfree((void *) b->yy_ch_buf ,yyscanner );
  1265. yyfree((void *) b ,yyscanner );
  1266. }
  1267. #ifndef __cplusplus
  1268. extern int isatty (int );
  1269. #endif /* __cplusplus */
  1270. /* Initializes or reinitializes a buffer.
  1271. * This function is sometimes called more than once on the same buffer,
  1272. * such as during a yyrestart() or at EOF.
  1273. */
  1274. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
  1275. {
  1276. int oerrno = errno;
  1277. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1278. yy_flush_buffer(b ,yyscanner);
  1279. b->yy_input_file = file;
  1280. b->yy_fill_buffer = 1;
  1281. /* If b is the current buffer, then yy_init_buffer was _probably_
  1282. * called from yyrestart() or through yy_get_next_buffer.
  1283. * In that case, we don't want to reset the lineno or column.
  1284. */
  1285. if (b != YY_CURRENT_BUFFER){
  1286. b->yy_bs_lineno = 1;
  1287. b->yy_bs_column = 0;
  1288. }
  1289. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1290. errno = oerrno;
  1291. }
  1292. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1293. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1294. * @param yyscanner The scanner object.
  1295. */
  1296. void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
  1297. {
  1298. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1299. if ( ! b )
  1300. return;
  1301. b->yy_n_chars = 0;
  1302. /* We always need two end-of-buffer characters. The first causes
  1303. * a transition to the end-of-buffer state. The second causes
  1304. * a jam in that state.
  1305. */
  1306. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1307. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1308. b->yy_buf_pos = &b->yy_ch_buf[0];
  1309. b->yy_at_bol = 1;
  1310. b->yy_buffer_status = YY_BUFFER_NEW;
  1311. if ( b == YY_CURRENT_BUFFER )
  1312. yy_load_buffer_state(yyscanner );
  1313. }
  1314. /** Pushes the new state onto the stack. The new state becomes
  1315. * the current state. This function will allocate the stack
  1316. * if necessary.
  1317. * @param new_buffer The new state.
  1318. * @param yyscanner The scanner object.
  1319. */
  1320. void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
  1321. {
  1322. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1323. if (new_buffer == NULL)
  1324. return;
  1325. yyensure_buffer_stack(yyscanner);
  1326. /* This block is copied from yy_switch_to_buffer. */
  1327. if ( YY_CURRENT_BUFFER )
  1328. {
  1329. /* Flush out information for old buffer. */
  1330. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1331. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  1332. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1333. }
  1334. /* Only push if top exists. Otherwise, replace top. */
  1335. if (YY_CURRENT_BUFFER)
  1336. yyg->yy_buffer_stack_top++;
  1337. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1338. /* copied from yy_switch_to_buffer. */
  1339. yy_load_buffer_state(yyscanner );
  1340. yyg->yy_did_buffer_switch_on_eof = 1;
  1341. }
  1342. /** Removes and deletes the top of the stack, if present.
  1343. * The next element becomes the new top.
  1344. * @param yyscanner The scanner object.
  1345. */
  1346. void yypop_buffer_state (yyscan_t yyscanner)
  1347. {
  1348. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1349. if (!YY_CURRENT_BUFFER)
  1350. return;
  1351. yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
  1352. YY_CURRENT_BUFFER_LVALUE = NULL;
  1353. if (yyg->yy_buffer_stack_top > 0)
  1354. --yyg->yy_buffer_stack_top;
  1355. if (YY_CURRENT_BUFFER) {
  1356. yy_load_buffer_state(yyscanner );
  1357. yyg->yy_did_buffer_switch_on_eof = 1;
  1358. }
  1359. }
  1360. /* Allocates the stack if it does not exist.
  1361. * Guarantees space for at least one push.
  1362. */
  1363. static void yyensure_buffer_stack (yyscan_t yyscanner)
  1364. {
  1365. int num_to_alloc;
  1366. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1367. if (!yyg->yy_buffer_stack) {
  1368. /* First allocation is just for 2 elements, since we don't know if this
  1369. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1370. * immediate realloc on the next call.
  1371. */
  1372. num_to_alloc = 1;
  1373. yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
  1374. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1375. , yyscanner);
  1376. memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1377. yyg->yy_buffer_stack_max = num_to_alloc;
  1378. yyg->yy_buffer_stack_top = 0;
  1379. return;
  1380. }
  1381. if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
  1382. /* Increase the buffer to prepare for a possible push. */
  1383. int grow_size = 8 /* arbitrary grow size */;
  1384. num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
  1385. yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
  1386. (yyg->yy_buffer_stack,
  1387. num_to_alloc * sizeof(struct yy_buffer_state*)
  1388. , yyscanner);
  1389. /* zero only the new slots.*/
  1390. memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
  1391. yyg->yy_buffer_stack_max = num_to_alloc;
  1392. }
  1393. }
  1394. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1395. * @param base the character buffer
  1396. * @param size the size in bytes of the character buffer
  1397. * @param yyscanner The scanner object.
  1398. * @return the newly allocated buffer state object.
  1399. */
  1400. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
  1401. {
  1402. YY_BUFFER_STATE b;
  1403. if ( size < 2 ||
  1404. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1405. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1406. /* They forgot to leave room for the EOB's. */
  1407. return 0;
  1408. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
  1409. if ( ! b )
  1410. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1411. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1412. b->yy_buf_pos = b->yy_ch_buf = base;
  1413. b->yy_is_our_buffer = 0;
  1414. b->yy_input_file = 0;
  1415. b->yy_n_chars = b->yy_buf_size;
  1416. b->yy_is_interactive = 0;
  1417. b->yy_at_bol = 1;
  1418. b->yy_fill_buffer = 0;
  1419. b->yy_buffer_status = YY_BUFFER_NEW;
  1420. yy_switch_to_buffer(b ,yyscanner );
  1421. return b;
  1422. }
  1423. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1424. * scan from a @e copy of @a str.
  1425. * @param str a NUL-terminated string to scan
  1426. * @param yyscanner The scanner object.
  1427. * @return the newly allocated buffer state object.
  1428. * @note If you want to scan bytes that may contain NUL values, then use
  1429. * yy_scan_bytes() instead.
  1430. */
  1431. YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
  1432. {
  1433. return yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner);
  1434. }
  1435. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1436. * scan from a @e copy of @a bytes.
  1437. * @param bytes the byte buffer to scan
  1438. * @param len the number of bytes in the buffer pointed to by @a bytes.
  1439. * @param yyscanner The scanner object.
  1440. * @return the newly allocated buffer state object.
  1441. */
  1442. YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner)
  1443. {
  1444. YY_BUFFER_STATE b;
  1445. char *buf;
  1446. yy_size_t n;
  1447. int i;
  1448. /* Get memory for full buffer, including space for trailing EOB's. */
  1449. n = len + 2;
  1450. buf = (char *) yyalloc(n ,yyscanner );
  1451. if ( ! buf )
  1452. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1453. for ( i = 0; i < len; ++i )
  1454. buf[i] = bytes[i];
  1455. buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1456. b = yy_scan_buffer(buf,n ,yyscanner);
  1457. if ( ! b )
  1458. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1459. /* It's okay to grow etc. this buffer, and we should throw it
  1460. * away when we're done.
  1461. */
  1462. b->yy_is_our_buffer = 1;
  1463. return b;
  1464. }
  1465. #ifndef YY_EXIT_FAILURE
  1466. #define YY_EXIT_FAILURE 2
  1467. #endif
  1468. static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
  1469. {
  1470. (void)yyscanner;
  1471. (void) fprintf( stderr, "%s\n", msg );
  1472. exit( YY_EXIT_FAILURE );
  1473. }
  1474. /* Redefine yyless() so it works in section 3 code. */
  1475. #undef yyless
  1476. #define yyless(n) \
  1477. do \
  1478. { \
  1479. /* Undo effects of setting up yytext. */ \
  1480. int yyless_macro_arg = (n); \
  1481. YY_LESS_LINENO(yyless_macro_arg);\
  1482. yytext[yyleng] = yyg->yy_hold_char; \
  1483. yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
  1484. yyg->yy_hold_char = *yyg->yy_c_buf_p; \
  1485. *yyg->yy_c_buf_p = '\0'; \
  1486. yyleng = yyless_macro_arg; \
  1487. } \
  1488. while ( 0 )
  1489. /* Accessor methods (get/set functions) to struct members. */
  1490. /** Get the user-defined data for this scanner.
  1491. * @param yyscanner The scanner object.
  1492. */
  1493. YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
  1494. {
  1495. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1496. return yyextra;
  1497. }
  1498. /** Get the current line number.
  1499. * @param yyscanner The scanner object.
  1500. */
  1501. int yyget_lineno (yyscan_t yyscanner)
  1502. {
  1503. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1504. if (! YY_CURRENT_BUFFER)
  1505. return 0;
  1506. return yylineno;
  1507. }
  1508. /** Get the current column number.
  1509. * @param yyscanner The scanner object.
  1510. */
  1511. int yyget_column (yyscan_t yyscanner)
  1512. {
  1513. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1514. if (! YY_CURRENT_BUFFER)
  1515. return 0;
  1516. return yycolumn;
  1517. }
  1518. /** Get the input stream.
  1519. * @param yyscanner The scanner object.
  1520. */
  1521. FILE *yyget_in (yyscan_t yyscanner)
  1522. {
  1523. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1524. return yyin;
  1525. }
  1526. /** Get the output stream.
  1527. * @param yyscanner The scanner object.
  1528. */
  1529. FILE *yyget_out (yyscan_t yyscanner)
  1530. {
  1531. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1532. return yyout;
  1533. }
  1534. /** Get the length of the current token.
  1535. * @param yyscanner The scanner object.
  1536. */
  1537. int yyget_leng (yyscan_t yyscanner)
  1538. {
  1539. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1540. return yyleng;
  1541. }
  1542. /** Get the current token.
  1543. * @param yyscanner The scanner object.
  1544. */
  1545. char *yyget_text (yyscan_t yyscanner)
  1546. {
  1547. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1548. return yytext;
  1549. }
  1550. /** Set the user-defined data. This data is never touched by the scanner.
  1551. * @param user_defined The data to be associated with this scanner.
  1552. * @param yyscanner The scanner object.
  1553. */
  1554. void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
  1555. {
  1556. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1557. yyextra = user_defined ;
  1558. }
  1559. /** Set the current line number.
  1560. * @param line_number
  1561. * @param yyscanner The scanner object.
  1562. */
  1563. void yyset_lineno (int line_number , yyscan_t yyscanner)
  1564. {
  1565. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1566. /* lineno is only valid if an input buffer exists. */
  1567. if (! YY_CURRENT_BUFFER )
  1568. yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner);
  1569. yylineno = line_number;
  1570. }
  1571. /** Set the current column.
  1572. * @param line_number
  1573. * @param yyscanner The scanner object.
  1574. */
  1575. void yyset_column (int column_no , yyscan_t yyscanner)
  1576. {
  1577. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1578. /* column is only valid if an input buffer exists. */
  1579. if (! YY_CURRENT_BUFFER )
  1580. yy_fatal_error( "yyset_column called with no buffer" , yyscanner);
  1581. yycolumn = column_no;
  1582. }
  1583. /** Set the input stream. This does not discard the current
  1584. * input buffer.
  1585. * @param in_str A readable stream.
  1586. * @param yyscanner The scanner object.
  1587. * @see yy_switch_to_buffer
  1588. */
  1589. void yyset_in (FILE * in_str , yyscan_t yyscanner)
  1590. {
  1591. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1592. yyin = in_str ;
  1593. }
  1594. void yyset_out (FILE * out_str , yyscan_t yyscanner)
  1595. {
  1596. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1597. yyout = out_str ;
  1598. }
  1599. int yyget_debug (yyscan_t yyscanner)
  1600. {
  1601. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1602. return yy_flex_debug;
  1603. }
  1604. void yyset_debug (int bdebug , yyscan_t yyscanner)
  1605. {
  1606. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1607. yy_flex_debug = bdebug ;
  1608. }
  1609. /* Accessor methods for yylval and yylloc */
  1610. static int yy_init_globals (yyscan_t yyscanner)
  1611. {
  1612. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1613. /* Initialization is the same as for the non-reentrant scanner.
  1614. This function is called once per scanner lifetime. */
  1615. yyg->yy_buffer_stack = 0;
  1616. yyg->yy_buffer_stack_top = 0;
  1617. yyg->yy_buffer_stack_max = 0;
  1618. yyg->yy_c_buf_p = (char *) 0;
  1619. yyg->yy_init = 1;
  1620. yyg->yy_start = 0;
  1621. yyg->yy_start_stack_ptr = 0;
  1622. yyg->yy_start_stack_depth = 0;
  1623. yyg->yy_start_stack = (int *) 0;
  1624. /* Defined in main.c */
  1625. #ifdef YY_STDINIT
  1626. yyin = stdin;
  1627. yyout = stdout;
  1628. #else
  1629. yyin = (FILE *) 0;
  1630. yyout = (FILE *) 0;
  1631. #endif
  1632. /* For future reference: Set errno on error, since we are called by
  1633. * yylex_init()
  1634. */
  1635. return 0;
  1636. }
  1637. /* User-visible API */
  1638. /* yylex_init is special because it creates the scanner itself, so it is
  1639. * the ONLY reentrant function that doesn't take the scanner as the last argument.
  1640. * That's why we explicitly handle the declaration, instead of using our macros.
  1641. */
  1642. int yylex_init(yyscan_t* ptr_yy_globals)
  1643. {
  1644. if (ptr_yy_globals == NULL){
  1645. errno = EINVAL;
  1646. return 1;
  1647. }
  1648. *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
  1649. if (*ptr_yy_globals == NULL){
  1650. errno = ENOMEM;
  1651. return 1;
  1652. }
  1653. memset(*ptr_yy_globals,0,sizeof(struct yyguts_t));
  1654. return yy_init_globals ( *ptr_yy_globals );
  1655. }
  1656. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1657. int yylex_destroy (yyscan_t yyscanner)
  1658. {
  1659. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1660. /* Pop the buffer stack, destroying each element. */
  1661. while(YY_CURRENT_BUFFER){
  1662. yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
  1663. YY_CURRENT_BUFFER_LVALUE = NULL;
  1664. yypop_buffer_state(yyscanner);
  1665. }
  1666. /* Destroy the stack itself. */
  1667. yyfree(yyg->yy_buffer_stack ,yyscanner);
  1668. yyg->yy_buffer_stack = NULL;
  1669. /* Destroy the start condition stack. */
  1670. yyfree(yyg->yy_start_stack ,yyscanner );
  1671. yyg->yy_start_stack = NULL;
  1672. /* Destroy the main struct (reentrant only). */
  1673. yyfree ( yyscanner , yyscanner );
  1674. return 0;
  1675. }
  1676. /*
  1677. * Internal utility routines.
  1678. */
  1679. #ifndef yytext_ptr
  1680. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
  1681. {
  1682. register int i;
  1683. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1684. for ( i = 0; i < n; ++i )
  1685. s1[i] = s2[i];
  1686. }
  1687. #endif
  1688. #ifdef YY_NEED_STRLEN
  1689. static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
  1690. {
  1691. register int n;
  1692. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1693. for ( n = 0; s[n]; ++n )
  1694. ;
  1695. return n;
  1696. }
  1697. #endif
  1698. void *yyalloc (yy_size_t size , yyscan_t yyscanner)
  1699. {
  1700. (void)yyscanner;
  1701. return (void *) malloc( size );
  1702. }
  1703. void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
  1704. {
  1705. (void)yyscanner;
  1706. /* The cast to (char *) in the following accommodates both
  1707. * implementations that use char* generic pointers, and those
  1708. * that use void* generic pointers. It works with the latter
  1709. * because both ANSI C and C++ allow castless assignment from
  1710. * any pointer type to void*, and deal with argument conversions
  1711. * as though doing an assignment.
  1712. */
  1713. return (void *) realloc( (char *) ptr, size );
  1714. }
  1715. void yyfree (void * ptr , yyscan_t yyscanner)
  1716. {
  1717. (void)yyscanner;
  1718. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  1719. }
  1720. #define YYTABLES_NAME "yytables"
  1721. #undef YY_NEW_FILE
  1722. #undef YY_FLUSH_BUFFER
  1723. #undef yy_set_bol
  1724. #undef yy_new_buffer
  1725. #undef yy_set_interactive
  1726. #undef yytext_ptr
  1727. #undef YY_DO_BEFORE_ACTION
  1728. #ifdef YY_DECL_IS_OURS
  1729. #undef YY_DECL_IS_OURS
  1730. #undef YY_DECL
  1731. #endif
  1732. #line 193 "cmListFileLexer.in.l"
  1733. /*--------------------------------------------------------------------------*/
  1734. static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
  1735. int length)
  1736. {
  1737. /* Set the token line and column number. */
  1738. lexer->token.line = lexer->line;
  1739. lexer->token.column = lexer->column;
  1740. /* Use the same buffer if possible. */
  1741. if(lexer->token.text)
  1742. {
  1743. if(text && length < lexer->size)
  1744. {
  1745. strcpy(lexer->token.text, text);
  1746. lexer->token.length = length;
  1747. return;
  1748. }
  1749. free(lexer->token.text);
  1750. lexer->token.text = 0;
  1751. lexer->size = 0;
  1752. }
  1753. /* Need to extend the buffer. */
  1754. if(text)
  1755. {
  1756. lexer->token.text = strdup(text);
  1757. lexer->token.length = length;
  1758. lexer->size = length+1;
  1759. }
  1760. else
  1761. {
  1762. lexer->token.length = 0;
  1763. }
  1764. }
  1765. /*--------------------------------------------------------------------------*/
  1766. static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
  1767. int length)
  1768. {
  1769. char* temp;
  1770. int newSize;
  1771. /* If the appended text will fit in the buffer, do not reallocate. */
  1772. newSize = lexer->token.length + length + 1;
  1773. if(lexer->token.text && newSize <= lexer->size)
  1774. {
  1775. strcpy(lexer->token.text+lexer->token.length, text);
  1776. lexer->token.length += length;
  1777. return;
  1778. }
  1779. /* We need to extend the buffer. */
  1780. temp = malloc(newSize);
  1781. if(lexer->token.text)
  1782. {
  1783. memcpy(temp, lexer->token.text, lexer->token.length);
  1784. free(lexer->token.text);
  1785. }
  1786. memcpy(temp+lexer->token.length, text, length);
  1787. temp[lexer->token.length+length] = 0;
  1788. lexer->token.text = temp;
  1789. lexer->token.length += length;
  1790. lexer->size = newSize;
  1791. }
  1792. /*--------------------------------------------------------------------------*/
  1793. static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
  1794. size_t bufferSize)
  1795. {
  1796. if(lexer)
  1797. {
  1798. if(lexer->file)
  1799. {
  1800. return (int)fread(buffer, 1, bufferSize, lexer->file);
  1801. }
  1802. else if(lexer->string_left)
  1803. {
  1804. int length = lexer->string_left;
  1805. if((int)bufferSize < length) { length = (int)bufferSize; }
  1806. memcpy(buffer, lexer->string_position, length);
  1807. lexer->string_position += length;
  1808. lexer->string_left -= length;
  1809. return length;
  1810. }
  1811. }
  1812. return 0;
  1813. }
  1814. /*--------------------------------------------------------------------------*/
  1815. static void cmListFileLexerInit(cmListFileLexer* lexer)
  1816. {
  1817. if(lexer->file || lexer->string_buffer)
  1818. {
  1819. yylex_init(&lexer->scanner);
  1820. yyset_extra(lexer,lexer->scanner);
  1821. }
  1822. }
  1823. /*--------------------------------------------------------------------------*/
  1824. static void cmListFileLexerDestroy(cmListFileLexer* lexer)
  1825. {
  1826. if(lexer->file || lexer->string_buffer)
  1827. {
  1828. yylex_destroy(lexer->scanner);
  1829. if(lexer->file)
  1830. {
  1831. fclose(lexer->file);
  1832. lexer->file = 0;
  1833. }
  1834. if(lexer->string_buffer)
  1835. {
  1836. free(lexer->string_buffer);
  1837. lexer->string_buffer = 0;
  1838. lexer->string_left = 0;
  1839. lexer->string_position = 0;
  1840. }
  1841. }
  1842. }
  1843. /*--------------------------------------------------------------------------*/
  1844. cmListFileLexer* cmListFileLexer_New()
  1845. {
  1846. cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
  1847. if(!lexer)
  1848. {
  1849. return 0;
  1850. }
  1851. memset(lexer, 0, sizeof(*lexer));
  1852. lexer->line = 1;
  1853. lexer->column = 1;
  1854. return lexer;
  1855. }
  1856. /*--------------------------------------------------------------------------*/
  1857. void cmListFileLexer_Delete(cmListFileLexer* lexer)
  1858. {
  1859. cmListFileLexer_SetFileName(lexer, 0);
  1860. free(lexer);
  1861. }
  1862. /*--------------------------------------------------------------------------*/
  1863. int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name)
  1864. {
  1865. int result = 1;
  1866. cmListFileLexerDestroy(lexer);
  1867. if(name)
  1868. {
  1869. lexer->file = fopen(name, "r");
  1870. if(!lexer->file)
  1871. {
  1872. result = 0;
  1873. }
  1874. }
  1875. cmListFileLexerInit(lexer);
  1876. return result;
  1877. }
  1878. /*--------------------------------------------------------------------------*/
  1879. int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text)
  1880. {
  1881. int result = 1;
  1882. cmListFileLexerDestroy(lexer);
  1883. if(text)
  1884. {
  1885. int length = (int)strlen(text);
  1886. lexer->string_buffer = (char*)malloc(length+1);
  1887. if(lexer->string_buffer)
  1888. {
  1889. strcpy(lexer->string_buffer, text);
  1890. lexer->string_position = lexer->string_buffer;
  1891. lexer->string_left = length;
  1892. }
  1893. else
  1894. {
  1895. result = 0;
  1896. }
  1897. }
  1898. cmListFileLexerInit(lexer);
  1899. return result;
  1900. }
  1901. /*--------------------------------------------------------------------------*/
  1902. cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
  1903. {
  1904. if(!lexer->file)
  1905. {
  1906. return 0;
  1907. }
  1908. if(yylex(lexer->scanner,lexer))
  1909. {
  1910. return &lexer->token;
  1911. }
  1912. else
  1913. {
  1914. cmListFileLexer_SetFileName(lexer, 0);
  1915. return 0;
  1916. }
  1917. }
  1918. /*--------------------------------------------------------------------------*/
  1919. long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
  1920. {
  1921. if(lexer->file)
  1922. {
  1923. return lexer->line;
  1924. }
  1925. else
  1926. {
  1927. return 0;
  1928. }
  1929. }
  1930. /*--------------------------------------------------------------------------*/
  1931. long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
  1932. {
  1933. if(lexer->file)
  1934. {
  1935. return lexer->column;
  1936. }
  1937. else
  1938. {
  1939. return 0;
  1940. }
  1941. }
  1942. /*--------------------------------------------------------------------------*/
  1943. const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
  1944. cmListFileLexer_Type type)
  1945. {
  1946. (void)lexer;
  1947. switch(type)
  1948. {
  1949. case cmListFileLexer_Token_None: return "nothing";
  1950. case cmListFileLexer_Token_Newline: return "newline";
  1951. case cmListFileLexer_Token_Identifier: return "identifier";
  1952. case cmListFileLexer_Token_ParenLeft: return "left paren";
  1953. case cmListFileLexer_Token_ParenRight: return "right paren";
  1954. case cmListFileLexer_Token_ArgumentUnquoted: return "unquoted argument";
  1955. case cmListFileLexer_Token_ArgumentQuoted: return "quoted argument";
  1956. case cmListFileLexer_Token_BadCharacter: return "bad character";
  1957. case cmListFileLexer_Token_BadString: return "unterminated string";
  1958. }
  1959. return "unknown token";
  1960. }