cmListFileLexer.c 71 KB

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