cmListFileLexer.c 85 KB

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