cmListFileLexer.c 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224
  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[28] =
  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, 2, 2, 5, 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, 1, 2, 2, 1, 1, 1
  337. } ;
  338. static yyconst flex_int16_t yy_base[33] =
  339. { 0,
  340. 0, 0, 8, 16, 21, 7, 69, 69, 69, 26,
  341. 69, 69, 36, 45, 6, 69, 69, 50, 5, 0,
  342. 0, 0, 0, 0, 4, 0, 69, 54, 12, 58,
  343. 60, 64
  344. } ;
  345. static yyconst flex_int16_t yy_def[33] =
  346. { 0,
  347. 27, 1, 28, 28, 27, 29, 27, 27, 27, 27,
  348. 27, 27, 27, 29, 30, 27, 27, 30, 29, 14,
  349. 10, 31, 32, 13, 30, 18, 0, 27, 27, 27,
  350. 27, 27
  351. } ;
  352. static yyconst flex_int16_t yy_nxt[80] =
  353. { 0,
  354. 6, 7, 8, 9, 10, 11, 12, 6, 13, 14,
  355. 16, 17, 19, 26, 20, 26, 20, 18, 16, 17,
  356. 27, 27, 27, 27, 27, 18, 21, 22, 27, 22,
  357. 21, 22, 22, 21, 21, 23, 19, 27, 27, 27,
  358. 19, 27, 27, 24, 24, 20, 19, 27, 19, 27,
  359. 19, 19, 25, 25, 15, 15, 15, 15, 25, 25,
  360. 22, 22, 27, 22, 21, 21, 27, 21, 5, 27,
  361. 27, 27, 27, 27, 27, 27, 27, 27, 27
  362. } ;
  363. static yyconst flex_int16_t yy_chk[80] =
  364. { 0,
  365. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  366. 3, 3, 29, 25, 19, 15, 6, 3, 4, 4,
  367. 5, 0, 0, 0, 0, 4, 10, 10, 0, 10,
  368. 10, 10, 10, 10, 10, 10, 13, 0, 0, 0,
  369. 13, 0, 0, 13, 13, 13, 14, 0, 14, 0,
  370. 14, 14, 18, 18, 28, 28, 28, 28, 30, 30,
  371. 31, 31, 0, 31, 32, 32, 0, 32, 27, 27,
  372. 27, 27, 27, 27, 27, 27, 27, 27, 27
  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_DECL int yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
  417. /* Disable some warnings. */
  418. #if defined(_MSC_VER)
  419. # pragma warning ( disable : 4127 )
  420. # pragma warning ( disable : 4131 )
  421. # pragma warning ( disable : 4244 )
  422. # pragma warning ( disable : 4251 )
  423. # pragma warning ( disable : 4267 )
  424. # pragma warning ( disable : 4305 )
  425. # pragma warning ( disable : 4309 )
  426. # pragma warning ( disable : 4706 )
  427. # pragma warning ( disable : 4786 )
  428. #endif
  429. #include "cmListFileLexer.h"
  430. /*--------------------------------------------------------------------------*/
  431. struct cmListFileLexer_s
  432. {
  433. cmListFileLexer_Token token;
  434. int line;
  435. int column;
  436. int size;
  437. FILE* file;
  438. yyscan_t scanner;
  439. };
  440. static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
  441. int length);
  442. static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
  443. int length);
  444. /*--------------------------------------------------------------------------*/
  445. #line 541 "cmListFileLexer.c"
  446. #define INITIAL 0
  447. #define STRING 1
  448. #ifndef YY_NO_UNISTD_H
  449. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  450. * down here because we want the user's section 1 to have been scanned first.
  451. * The user has a chance to override it with an option.
  452. */
  453. #include <unistd.h>
  454. #endif
  455. #ifndef YY_EXTRA_TYPE
  456. #define YY_EXTRA_TYPE void *
  457. #endif
  458. /* Holds the entire state of the reentrant scanner. */
  459. struct yyguts_t
  460. {
  461. /* User-defined. Not touched by flex. */
  462. YY_EXTRA_TYPE yyextra_r;
  463. /* The rest are the same as the globals declared in the non-reentrant scanner. */
  464. FILE *yyin_r, *yyout_r;
  465. size_t yy_buffer_stack_top; /**< index of top of stack. */
  466. size_t yy_buffer_stack_max; /**< capacity of stack. */
  467. YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
  468. char yy_hold_char;
  469. int yy_n_chars;
  470. int yyleng_r;
  471. char *yy_c_buf_p;
  472. int yy_init;
  473. int yy_start;
  474. int yy_did_buffer_switch_on_eof;
  475. int yy_start_stack_ptr;
  476. int yy_start_stack_depth;
  477. int *yy_start_stack;
  478. yy_state_type yy_last_accepting_state;
  479. char* yy_last_accepting_cpos;
  480. int yylineno_r;
  481. int yy_flex_debug_r;
  482. char *yytext_r;
  483. int yy_more_flag;
  484. int yy_more_len;
  485. }; /* end struct yyguts_t */
  486. /* Accessor methods to globals.
  487. These are made visible to non-reentrant scanners for convenience. */
  488. int yylex_destroy (yyscan_t yyscanner );
  489. int yyget_debug (yyscan_t yyscanner );
  490. void yyset_debug (int debug_flag ,yyscan_t yyscanner );
  491. YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
  492. void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
  493. FILE *yyget_in (yyscan_t yyscanner );
  494. void yyset_in (FILE * in_str ,yyscan_t yyscanner );
  495. FILE *yyget_out (yyscan_t yyscanner );
  496. void yyset_out (FILE * out_str ,yyscan_t yyscanner );
  497. int yyget_leng (yyscan_t yyscanner );
  498. char *yyget_text (yyscan_t yyscanner );
  499. int yyget_lineno (yyscan_t yyscanner );
  500. void yyset_lineno (int line_number ,yyscan_t yyscanner );
  501. /* Macros after this point can all be overridden by user definitions in
  502. * section 1.
  503. */
  504. #ifndef YY_SKIP_YYWRAP
  505. #ifdef __cplusplus
  506. extern "C" int yywrap (yyscan_t yyscanner );
  507. #else
  508. extern int yywrap (yyscan_t yyscanner );
  509. #endif
  510. #endif
  511. #ifndef yytext_ptr
  512. static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
  513. #endif
  514. #ifdef YY_NEED_STRLEN
  515. static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
  516. #endif
  517. #ifndef YY_NO_INPUT
  518. #ifdef __cplusplus
  519. static int yyinput (yyscan_t yyscanner );
  520. #else
  521. static int input (yyscan_t yyscanner );
  522. #endif
  523. #endif
  524. /* Amount of stuff to slurp up with each read. */
  525. #ifndef YY_READ_BUF_SIZE
  526. #define YY_READ_BUF_SIZE 8192
  527. #endif
  528. /* Copy whatever the last rule matched to the standard output. */
  529. #ifndef ECHO
  530. /* This used to be an fputs(), but since the string might contain NUL's,
  531. * we now use fwrite().
  532. */
  533. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  534. #endif
  535. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  536. * is returned in "result".
  537. */
  538. #ifndef YY_INPUT
  539. #define YY_INPUT(buf,result,max_size) \
  540. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  541. { \
  542. int c = '*'; \
  543. size_t n; \
  544. for ( n = 0; n < max_size && \
  545. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  546. buf[n] = (char) c; \
  547. if ( c == '\n' ) \
  548. buf[n++] = (char) c; \
  549. if ( c == EOF && ferror( yyin ) ) \
  550. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  551. result = n; \
  552. } \
  553. else \
  554. { \
  555. errno=0; \
  556. while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
  557. { \
  558. if( errno != EINTR) \
  559. { \
  560. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  561. break; \
  562. } \
  563. errno=0; \
  564. clearerr(yyin); \
  565. } \
  566. }\
  567. \
  568. #endif
  569. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  570. * we don't want an extra ';' after the "return" because that will cause
  571. * some compilers to complain about unreachable statements.
  572. */
  573. #ifndef yyterminate
  574. #define yyterminate() return YY_NULL
  575. #endif
  576. /* Number of entries by which start-condition stack grows. */
  577. #ifndef YY_START_STACK_INCR
  578. #define YY_START_STACK_INCR 25
  579. #endif
  580. /* Report a fatal error. */
  581. #ifndef YY_FATAL_ERROR
  582. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
  583. #endif
  584. /* end tables serialization structures and prototypes */
  585. /* Default declaration of generated scanner - a define so the user can
  586. * easily add parameters.
  587. */
  588. #ifndef YY_DECL
  589. #define YY_DECL_IS_OURS 1
  590. extern int yylex (yyscan_t yyscanner);
  591. #define YY_DECL int yylex (yyscan_t yyscanner)
  592. #endif /* !YY_DECL */
  593. /* Code executed at the beginning of each rule, after yytext and yyleng
  594. * have been set up.
  595. */
  596. #ifndef YY_USER_ACTION
  597. #define YY_USER_ACTION
  598. #endif
  599. /* Code executed at the end of each rule. */
  600. #ifndef YY_BREAK
  601. #define YY_BREAK break;
  602. #endif
  603. #define YY_RULE_SETUP \
  604. YY_USER_ACTION
  605. /** The main scanner function which does all the work.
  606. */
  607. YY_DECL
  608. {
  609. register yy_state_type yy_current_state;
  610. register char *yy_cp, *yy_bp;
  611. register int yy_act;
  612. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  613. #line 83 "cmListFileLexer.in.l"
  614. #line 760 "cmListFileLexer.c"
  615. if ( yyg->yy_init )
  616. {
  617. yyg->yy_init = 0;
  618. #ifdef YY_USER_INIT
  619. YY_USER_INIT;
  620. #endif
  621. if ( ! yyg->yy_start )
  622. yyg->yy_start = 1; /* first start state */
  623. if ( ! yyin )
  624. yyin = stdin;
  625. if ( ! yyout )
  626. yyout = stdout;
  627. if ( ! YY_CURRENT_BUFFER ) {
  628. yyensure_buffer_stack (yyscanner);
  629. YY_CURRENT_BUFFER_LVALUE =
  630. yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
  631. }
  632. yy_load_buffer_state(yyscanner );
  633. }
  634. while ( 1 ) /* loops until end-of-file is reached */
  635. {
  636. yy_cp = yyg->yy_c_buf_p;
  637. /* Support of yytext. */
  638. *yy_cp = yyg->yy_hold_char;
  639. /* yy_bp points to the position in yy_ch_buf of the start of
  640. * the current run.
  641. */
  642. yy_bp = yy_cp;
  643. yy_current_state = yyg->yy_start;
  644. yy_match:
  645. do
  646. {
  647. register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  648. if ( yy_accept[yy_current_state] )
  649. {
  650. yyg->yy_last_accepting_state = yy_current_state;
  651. yyg->yy_last_accepting_cpos = yy_cp;
  652. }
  653. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  654. {
  655. yy_current_state = (int) yy_def[yy_current_state];
  656. if ( yy_current_state >= 28 )
  657. yy_c = yy_meta[(unsigned int) yy_c];
  658. }
  659. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  660. ++yy_cp;
  661. }
  662. while ( yy_base[yy_current_state] != 69 );
  663. yy_find_action:
  664. yy_act = yy_accept[yy_current_state];
  665. if ( yy_act == 0 )
  666. { /* have to back up */
  667. yy_cp = yyg->yy_last_accepting_cpos;
  668. yy_current_state = yyg->yy_last_accepting_state;
  669. yy_act = yy_accept[yy_current_state];
  670. }
  671. YY_DO_BEFORE_ACTION;
  672. if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
  673. {
  674. int yyl;
  675. for ( yyl = 0; yyl < yyleng; ++yyl )
  676. if ( yytext[yyl] == '\n' )
  677. do{ yylineno++;
  678. yycolumn=0;
  679. }while(0)
  680. ;
  681. }
  682. do_action: /* This label is used only to access EOF actions. */
  683. switch ( yy_act )
  684. { /* beginning of action switch */
  685. case 0: /* must back up */
  686. /* undo the effects of YY_DO_BEFORE_ACTION */
  687. *yy_cp = yyg->yy_hold_char;
  688. yy_cp = yyg->yy_last_accepting_cpos;
  689. yy_current_state = yyg->yy_last_accepting_state;
  690. goto yy_find_action;
  691. case 1:
  692. /* rule 1 can match eol */
  693. YY_RULE_SETUP
  694. #line 85 "cmListFileLexer.in.l"
  695. {
  696. lexer->token.type = cmListFileLexer_Token_Newline;
  697. cmListFileLexerSetToken(lexer, yytext, yyleng);
  698. ++lexer->line;
  699. lexer->column = 1;
  700. return 1;
  701. }
  702. case 2:
  703. YY_RULE_SETUP
  704. #line 93 "cmListFileLexer.in.l"
  705. {
  706. lexer->column += yyleng;
  707. }
  708. YY_BREAK
  709. case 3:
  710. YY_RULE_SETUP
  711. #line 97 "cmListFileLexer.in.l"
  712. {
  713. lexer->token.type = cmListFileLexer_Token_ParenLeft;
  714. cmListFileLexerSetToken(lexer, yytext, yyleng);
  715. lexer->column += yyleng;
  716. return 1;
  717. }
  718. case 4:
  719. YY_RULE_SETUP
  720. #line 104 "cmListFileLexer.in.l"
  721. {
  722. lexer->token.type = cmListFileLexer_Token_ParenRight;
  723. cmListFileLexerSetToken(lexer, yytext, yyleng);
  724. lexer->column += yyleng;
  725. return 1;
  726. }
  727. case 5:
  728. YY_RULE_SETUP
  729. #line 111 "cmListFileLexer.in.l"
  730. {
  731. lexer->token.type = cmListFileLexer_Token_Identifier;
  732. cmListFileLexerSetToken(lexer, yytext, yyleng);
  733. lexer->column += yyleng;
  734. return 1;
  735. }
  736. case 6:
  737. YY_RULE_SETUP
  738. #line 118 "cmListFileLexer.in.l"
  739. {
  740. lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
  741. cmListFileLexerSetToken(lexer, yytext, yyleng);
  742. lexer->column += yyleng;
  743. return 1;
  744. }
  745. case 7:
  746. YY_RULE_SETUP
  747. #line 125 "cmListFileLexer.in.l"
  748. {
  749. lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
  750. cmListFileLexerSetToken(lexer, "", 0);
  751. lexer->column += yyleng;
  752. BEGIN(STRING);
  753. }
  754. YY_BREAK
  755. case 8:
  756. /* rule 8 can match eol */
  757. YY_RULE_SETUP
  758. #line 132 "cmListFileLexer.in.l"
  759. {
  760. cmListFileLexerAppend(lexer, yytext, yyleng);
  761. lexer->column += yyleng;
  762. }
  763. YY_BREAK
  764. case 9:
  765. /* rule 9 can match eol */
  766. YY_RULE_SETUP
  767. #line 137 "cmListFileLexer.in.l"
  768. {
  769. cmListFileLexerAppend(lexer, yytext, yyleng);
  770. ++lexer->line;
  771. lexer->column = 1;
  772. }
  773. YY_BREAK
  774. case 10:
  775. YY_RULE_SETUP
  776. #line 143 "cmListFileLexer.in.l"
  777. {
  778. lexer->column += yyleng;
  779. BEGIN(INITIAL);
  780. return 1;
  781. }
  782. case 11:
  783. YY_RULE_SETUP
  784. #line 149 "cmListFileLexer.in.l"
  785. {
  786. cmListFileLexerAppend(lexer, yytext, yyleng);
  787. lexer->column += yyleng;
  788. }
  789. YY_BREAK
  790. case 12:
  791. YY_RULE_SETUP
  792. #line 154 "cmListFileLexer.in.l"
  793. {
  794. lexer->column += yyleng;
  795. }
  796. YY_BREAK
  797. case 13:
  798. YY_RULE_SETUP
  799. #line 158 "cmListFileLexer.in.l"
  800. {
  801. lexer->token.type = cmListFileLexer_Token_Error;
  802. cmListFileLexerSetToken(lexer, yytext, yyleng);
  803. lexer->column += yyleng;
  804. return 1;
  805. }
  806. case YY_STATE_EOF(INITIAL):
  807. case YY_STATE_EOF(STRING):
  808. #line 165 "cmListFileLexer.in.l"
  809. {
  810. lexer->token.type = cmListFileLexer_Token_None;
  811. cmListFileLexerSetToken(lexer, 0, 0);
  812. return 0;
  813. }
  814. case 14:
  815. YY_RULE_SETUP
  816. #line 171 "cmListFileLexer.in.l"
  817. ECHO;
  818. YY_BREAK
  819. #line 991 "cmListFileLexer.c"
  820. case YY_END_OF_BUFFER:
  821. {
  822. /* Amount of text matched not including the EOB char. */
  823. int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
  824. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  825. *yy_cp = yyg->yy_hold_char;
  826. YY_RESTORE_YY_MORE_OFFSET
  827. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  828. {
  829. /* We're scanning a new file or input source. It's
  830. * possible that this happened because the user
  831. * just pointed yyin at a new source and called
  832. * yylex(). If so, then we have to assure
  833. * consistency between YY_CURRENT_BUFFER and our
  834. * globals. Here is the right place to do so, because
  835. * this is the first action (other than possibly a
  836. * back-up) that will match for the new input source.
  837. */
  838. yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  839. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  840. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  841. }
  842. /* Note that here we test for yy_c_buf_p "<=" to the position
  843. * of the first EOB in the buffer, since yy_c_buf_p will
  844. * already have been incremented past the NUL character
  845. * (since all states make transitions on EOB to the
  846. * end-of-buffer state). Contrast this with the test
  847. * in input().
  848. */
  849. if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  850. { /* This was really a NUL. */
  851. yy_state_type yy_next_state;
  852. yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
  853. yy_current_state = yy_get_previous_state( yyscanner );
  854. /* Okay, we're now positioned to make the NUL
  855. * transition. We couldn't have
  856. * yy_get_previous_state() go ahead and do it
  857. * for us because it doesn't know how to deal
  858. * with the possibility of jamming (and we don't
  859. * want to build jamming into it because then it
  860. * will run more slowly).
  861. */
  862. yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
  863. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  864. if ( yy_next_state )
  865. {
  866. /* Consume the NUL. */
  867. yy_cp = ++yyg->yy_c_buf_p;
  868. yy_current_state = yy_next_state;
  869. goto yy_match;
  870. }
  871. else
  872. {
  873. yy_cp = yyg->yy_c_buf_p;
  874. goto yy_find_action;
  875. }
  876. }
  877. else switch ( yy_get_next_buffer( yyscanner ) )
  878. {
  879. case EOB_ACT_END_OF_FILE:
  880. {
  881. yyg->yy_did_buffer_switch_on_eof = 0;
  882. if ( yywrap(yyscanner ) )
  883. {
  884. /* Note: because we've taken care in
  885. * yy_get_next_buffer() to have set up
  886. * yytext, we can now set up
  887. * yy_c_buf_p so that if some total
  888. * hoser (like flex itself) wants to
  889. * call the scanner after we return the
  890. * YY_NULL, it'll still work - another
  891. * YY_NULL will get returned.
  892. */
  893. yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
  894. yy_act = YY_STATE_EOF(YY_START);
  895. goto do_action;
  896. }
  897. else
  898. {
  899. if ( ! yyg->yy_did_buffer_switch_on_eof )
  900. YY_NEW_FILE;
  901. }
  902. break;
  903. }
  904. case EOB_ACT_CONTINUE_SCAN:
  905. yyg->yy_c_buf_p =
  906. yyg->yytext_ptr + yy_amount_of_matched_text;
  907. yy_current_state = yy_get_previous_state( yyscanner );
  908. yy_cp = yyg->yy_c_buf_p;
  909. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  910. goto yy_match;
  911. case EOB_ACT_LAST_MATCH:
  912. yyg->yy_c_buf_p =
  913. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
  914. yy_current_state = yy_get_previous_state( yyscanner );
  915. yy_cp = yyg->yy_c_buf_p;
  916. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  917. goto yy_find_action;
  918. }
  919. break;
  920. }
  921. default:
  922. YY_FATAL_ERROR(
  923. "fatal flex scanner internal error--no action found" );
  924. } /* end of action switch */
  925. } /* end of scanning one token */
  926. } /* end of yylex */
  927. /* yy_get_next_buffer - try to read in a new buffer
  928. *
  929. * Returns a code representing an action:
  930. * EOB_ACT_LAST_MATCH -
  931. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  932. * EOB_ACT_END_OF_FILE - end of file
  933. */
  934. static int yy_get_next_buffer (yyscan_t yyscanner)
  935. {
  936. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  937. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  938. register char *source = yyg->yytext_ptr;
  939. register int number_to_move, i;
  940. int ret_val;
  941. if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
  942. YY_FATAL_ERROR(
  943. "fatal flex scanner internal error--end of buffer missed" );
  944. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  945. { /* Don't try to fill the buffer, so this is an EOF. */
  946. if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
  947. {
  948. /* We matched a single character, the EOB, so
  949. * treat this as a final EOF.
  950. */
  951. return EOB_ACT_END_OF_FILE;
  952. }
  953. else
  954. {
  955. /* We matched some text prior to the EOB, first
  956. * process it.
  957. */
  958. return EOB_ACT_LAST_MATCH;
  959. }
  960. }
  961. /* Try to read more data. */
  962. /* First move last chars to start of buffer. */
  963. number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
  964. for ( i = 0; i < number_to_move; ++i )
  965. *(dest++) = *(source++);
  966. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  967. /* don't do the read, it's not guaranteed to return an EOF,
  968. * just force an EOF
  969. */
  970. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
  971. else
  972. {
  973. size_t num_to_read =
  974. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  975. while ( num_to_read <= 0 )
  976. { /* Not enough room in the buffer - grow it. */
  977. /* just a shorter name for the current buffer */
  978. YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
  979. int yy_c_buf_p_offset =
  980. (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
  981. if ( b->yy_is_our_buffer )
  982. {
  983. int new_size = b->yy_buf_size * 2;
  984. if ( new_size <= 0 )
  985. b->yy_buf_size += b->yy_buf_size / 8;
  986. else
  987. b->yy_buf_size *= 2;
  988. b->yy_ch_buf = (char *)
  989. /* Include room in for 2 EOB chars. */
  990. yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
  991. }
  992. else
  993. /* Can't grow it, we don't own it. */
  994. b->yy_ch_buf = 0;
  995. if ( ! b->yy_ch_buf )
  996. YY_FATAL_ERROR(
  997. "fatal error - scanner input buffer overflow" );
  998. yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  999. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1000. number_to_move - 1;
  1001. }
  1002. if ( num_to_read > YY_READ_BUF_SIZE )
  1003. num_to_read = YY_READ_BUF_SIZE;
  1004. /* Read in more data. */
  1005. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1006. yyg->yy_n_chars, num_to_read );
  1007. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1008. }
  1009. if ( yyg->yy_n_chars == 0 )
  1010. {
  1011. if ( number_to_move == YY_MORE_ADJ )
  1012. {
  1013. ret_val = EOB_ACT_END_OF_FILE;
  1014. yyrestart(yyin ,yyscanner);
  1015. }
  1016. else
  1017. {
  1018. ret_val = EOB_ACT_LAST_MATCH;
  1019. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1020. YY_BUFFER_EOF_PENDING;
  1021. }
  1022. }
  1023. else
  1024. ret_val = EOB_ACT_CONTINUE_SCAN;
  1025. yyg->yy_n_chars += number_to_move;
  1026. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1027. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1028. yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1029. return ret_val;
  1030. }
  1031. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1032. static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
  1033. {
  1034. register yy_state_type yy_current_state;
  1035. register char *yy_cp;
  1036. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1037. yy_current_state = yyg->yy_start;
  1038. for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
  1039. {
  1040. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1041. if ( yy_accept[yy_current_state] )
  1042. {
  1043. yyg->yy_last_accepting_state = yy_current_state;
  1044. yyg->yy_last_accepting_cpos = yy_cp;
  1045. }
  1046. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1047. {
  1048. yy_current_state = (int) yy_def[yy_current_state];
  1049. if ( yy_current_state >= 28 )
  1050. yy_c = yy_meta[(unsigned int) yy_c];
  1051. }
  1052. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1053. }
  1054. return yy_current_state;
  1055. }
  1056. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1057. *
  1058. * synopsis
  1059. * next_state = yy_try_NUL_trans( current_state );
  1060. */
  1061. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
  1062. {
  1063. register int yy_is_jam;
  1064. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1065. register char *yy_cp = yyg->yy_c_buf_p;
  1066. register YY_CHAR yy_c = 1;
  1067. if ( yy_accept[yy_current_state] )
  1068. {
  1069. yyg->yy_last_accepting_state = yy_current_state;
  1070. yyg->yy_last_accepting_cpos = yy_cp;
  1071. }
  1072. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1073. {
  1074. yy_current_state = (int) yy_def[yy_current_state];
  1075. if ( yy_current_state >= 28 )
  1076. yy_c = yy_meta[(unsigned int) yy_c];
  1077. }
  1078. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1079. yy_is_jam = (yy_current_state == 27);
  1080. return yy_is_jam ? 0 : yy_current_state;
  1081. }
  1082. #ifndef YY_NO_INPUT
  1083. #ifdef __cplusplus
  1084. static int yyinput (yyscan_t yyscanner)
  1085. #else
  1086. static int input (yyscan_t yyscanner)
  1087. #endif
  1088. {
  1089. int c;
  1090. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1091. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1092. if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1093. {
  1094. /* yy_c_buf_p now points to the character we want to return.
  1095. * If this occurs *before* the EOB characters, then it's a
  1096. * valid NUL; if not, then we've hit the end of the buffer.
  1097. */
  1098. if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  1099. /* This was really a NUL. */
  1100. *yyg->yy_c_buf_p = '\0';
  1101. else
  1102. { /* need more input */
  1103. int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
  1104. ++yyg->yy_c_buf_p;
  1105. switch ( yy_get_next_buffer( yyscanner ) )
  1106. {
  1107. case EOB_ACT_LAST_MATCH:
  1108. /* This happens because yy_g_n_b()
  1109. * sees that we've accumulated a
  1110. * token and flags that we need to
  1111. * try matching the token before
  1112. * proceeding. But for input(),
  1113. * there's no matching to consider.
  1114. * So convert the EOB_ACT_LAST_MATCH
  1115. * to EOB_ACT_END_OF_FILE.
  1116. */
  1117. /* Reset buffer status. */
  1118. yyrestart(yyin ,yyscanner);
  1119. /*FALLTHROUGH*/
  1120. case EOB_ACT_END_OF_FILE:
  1121. {
  1122. if ( yywrap(yyscanner ) )
  1123. return EOF;
  1124. if ( ! yyg->yy_did_buffer_switch_on_eof )
  1125. YY_NEW_FILE;
  1126. #ifdef __cplusplus
  1127. return yyinput(yyscanner);
  1128. #else
  1129. return input(yyscanner);
  1130. #endif
  1131. }
  1132. case EOB_ACT_CONTINUE_SCAN:
  1133. yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
  1134. break;
  1135. }
  1136. }
  1137. }
  1138. c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
  1139. *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
  1140. yyg->yy_hold_char = *++yyg->yy_c_buf_p;
  1141. if ( c == '\n' )
  1142. do{ yylineno++;
  1143. yycolumn=0;
  1144. }while(0)
  1145. ;
  1146. return c;
  1147. }
  1148. #endif /* ifndef YY_NO_INPUT */
  1149. /** Immediately switch to a different input stream.
  1150. * @param input_file A readable stream.
  1151. * @param yyscanner The scanner object.
  1152. * @note This function does not reset the start condition to @c INITIAL .
  1153. */
  1154. void yyrestart (FILE * input_file , yyscan_t yyscanner)
  1155. {
  1156. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1157. if ( ! YY_CURRENT_BUFFER ){
  1158. yyensure_buffer_stack (yyscanner);
  1159. YY_CURRENT_BUFFER_LVALUE =
  1160. yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
  1161. }
  1162. yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
  1163. yy_load_buffer_state(yyscanner );
  1164. }
  1165. /** Switch to a different input buffer.
  1166. * @param new_buffer The new input buffer.
  1167. * @param yyscanner The scanner object.
  1168. */
  1169. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
  1170. {
  1171. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1172. /* TODO. We should be able to replace this entire function body
  1173. * with
  1174. * yypop_buffer_state();
  1175. * yypush_buffer_state(new_buffer);
  1176. */
  1177. yyensure_buffer_stack (yyscanner);
  1178. if ( YY_CURRENT_BUFFER == new_buffer )
  1179. return;
  1180. if ( YY_CURRENT_BUFFER )
  1181. {
  1182. /* Flush out information for old buffer. */
  1183. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1184. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  1185. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1186. }
  1187. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1188. yy_load_buffer_state(yyscanner );
  1189. /* We don't actually know whether we did this switch during
  1190. * EOF (yywrap()) processing, but the only time this flag
  1191. * is looked at is after yywrap() is called, so it's safe
  1192. * to go ahead and always set it.
  1193. */
  1194. yyg->yy_did_buffer_switch_on_eof = 1;
  1195. }
  1196. static void yy_load_buffer_state (yyscan_t yyscanner)
  1197. {
  1198. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1199. yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1200. yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1201. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1202. yyg->yy_hold_char = *yyg->yy_c_buf_p;
  1203. }
  1204. /** Allocate and initialize an input buffer state.
  1205. * @param file A readable stream.
  1206. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1207. * @param yyscanner The scanner object.
  1208. * @return the allocated buffer state.
  1209. */
  1210. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
  1211. {
  1212. YY_BUFFER_STATE b;
  1213. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
  1214. if ( ! b )
  1215. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1216. b->yy_buf_size = size;
  1217. /* yy_ch_buf has to be 2 characters longer than the size given because
  1218. * we need to put in 2 end-of-buffer characters.
  1219. */
  1220. b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
  1221. if ( ! b->yy_ch_buf )
  1222. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1223. b->yy_is_our_buffer = 1;
  1224. yy_init_buffer(b,file ,yyscanner);
  1225. return b;
  1226. }
  1227. /** Destroy the buffer.
  1228. * @param b a buffer created with yy_create_buffer()
  1229. * @param yyscanner The scanner object.
  1230. */
  1231. void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
  1232. {
  1233. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1234. if ( ! b )
  1235. return;
  1236. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1237. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1238. if ( b->yy_is_our_buffer )
  1239. yyfree((void *) b->yy_ch_buf ,yyscanner );
  1240. yyfree((void *) b ,yyscanner );
  1241. }
  1242. #ifndef __cplusplus
  1243. extern int isatty (int );
  1244. #endif /* __cplusplus */
  1245. /* Initializes or reinitializes a buffer.
  1246. * This function is sometimes called more than once on the same buffer,
  1247. * such as during a yyrestart() or at EOF.
  1248. */
  1249. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
  1250. {
  1251. int oerrno = errno;
  1252. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1253. yy_flush_buffer(b ,yyscanner);
  1254. b->yy_input_file = file;
  1255. b->yy_fill_buffer = 1;
  1256. /* If b is the current buffer, then yy_init_buffer was _probably_
  1257. * called from yyrestart() or through yy_get_next_buffer.
  1258. * In that case, we don't want to reset the lineno or column.
  1259. */
  1260. if (b != YY_CURRENT_BUFFER){
  1261. b->yy_bs_lineno = 1;
  1262. b->yy_bs_column = 0;
  1263. }
  1264. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1265. errno = oerrno;
  1266. }
  1267. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1268. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1269. * @param yyscanner The scanner object.
  1270. */
  1271. void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
  1272. {
  1273. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1274. if ( ! b )
  1275. return;
  1276. b->yy_n_chars = 0;
  1277. /* We always need two end-of-buffer characters. The first causes
  1278. * a transition to the end-of-buffer state. The second causes
  1279. * a jam in that state.
  1280. */
  1281. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1282. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1283. b->yy_buf_pos = &b->yy_ch_buf[0];
  1284. b->yy_at_bol = 1;
  1285. b->yy_buffer_status = YY_BUFFER_NEW;
  1286. if ( b == YY_CURRENT_BUFFER )
  1287. yy_load_buffer_state(yyscanner );
  1288. }
  1289. /** Pushes the new state onto the stack. The new state becomes
  1290. * the current state. This function will allocate the stack
  1291. * if necessary.
  1292. * @param new_buffer The new state.
  1293. * @param yyscanner The scanner object.
  1294. */
  1295. void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
  1296. {
  1297. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1298. if (new_buffer == NULL)
  1299. return;
  1300. yyensure_buffer_stack(yyscanner);
  1301. /* This block is copied from yy_switch_to_buffer. */
  1302. if ( YY_CURRENT_BUFFER )
  1303. {
  1304. /* Flush out information for old buffer. */
  1305. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1306. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  1307. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1308. }
  1309. /* Only push if top exists. Otherwise, replace top. */
  1310. if (YY_CURRENT_BUFFER)
  1311. yyg->yy_buffer_stack_top++;
  1312. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1313. /* copied from yy_switch_to_buffer. */
  1314. yy_load_buffer_state(yyscanner );
  1315. yyg->yy_did_buffer_switch_on_eof = 1;
  1316. }
  1317. /** Removes and deletes the top of the stack, if present.
  1318. * The next element becomes the new top.
  1319. * @param yyscanner The scanner object.
  1320. */
  1321. void yypop_buffer_state (yyscan_t yyscanner)
  1322. {
  1323. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1324. if (!YY_CURRENT_BUFFER)
  1325. return;
  1326. yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
  1327. YY_CURRENT_BUFFER_LVALUE = NULL;
  1328. if (yyg->yy_buffer_stack_top > 0)
  1329. --yyg->yy_buffer_stack_top;
  1330. if (YY_CURRENT_BUFFER) {
  1331. yy_load_buffer_state(yyscanner );
  1332. yyg->yy_did_buffer_switch_on_eof = 1;
  1333. }
  1334. }
  1335. /* Allocates the stack if it does not exist.
  1336. * Guarantees space for at least one push.
  1337. */
  1338. static void yyensure_buffer_stack (yyscan_t yyscanner)
  1339. {
  1340. int num_to_alloc;
  1341. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1342. if (!yyg->yy_buffer_stack) {
  1343. /* First allocation is just for 2 elements, since we don't know if this
  1344. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1345. * immediate realloc on the next call.
  1346. */
  1347. num_to_alloc = 1;
  1348. yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
  1349. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1350. , yyscanner);
  1351. memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1352. yyg->yy_buffer_stack_max = num_to_alloc;
  1353. yyg->yy_buffer_stack_top = 0;
  1354. return;
  1355. }
  1356. if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
  1357. /* Increase the buffer to prepare for a possible push. */
  1358. int grow_size = 8 /* arbitrary grow size */;
  1359. num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
  1360. yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
  1361. (yyg->yy_buffer_stack,
  1362. num_to_alloc * sizeof(struct yy_buffer_state*)
  1363. , yyscanner);
  1364. /* zero only the new slots.*/
  1365. memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
  1366. yyg->yy_buffer_stack_max = num_to_alloc;
  1367. }
  1368. }
  1369. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1370. * @param base the character buffer
  1371. * @param size the size in bytes of the character buffer
  1372. * @param yyscanner The scanner object.
  1373. * @return the newly allocated buffer state object.
  1374. */
  1375. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
  1376. {
  1377. YY_BUFFER_STATE b;
  1378. if ( size < 2 ||
  1379. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1380. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1381. /* They forgot to leave room for the EOB's. */
  1382. return 0;
  1383. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
  1384. if ( ! b )
  1385. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1386. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1387. b->yy_buf_pos = b->yy_ch_buf = base;
  1388. b->yy_is_our_buffer = 0;
  1389. b->yy_input_file = 0;
  1390. b->yy_n_chars = b->yy_buf_size;
  1391. b->yy_is_interactive = 0;
  1392. b->yy_at_bol = 1;
  1393. b->yy_fill_buffer = 0;
  1394. b->yy_buffer_status = YY_BUFFER_NEW;
  1395. yy_switch_to_buffer(b ,yyscanner );
  1396. return b;
  1397. }
  1398. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1399. * scan from a @e copy of @a str.
  1400. * @param str a NUL-terminated string to scan
  1401. * @param yyscanner The scanner object.
  1402. * @return the newly allocated buffer state object.
  1403. * @note If you want to scan bytes that may contain NUL values, then use
  1404. * yy_scan_bytes() instead.
  1405. */
  1406. YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
  1407. {
  1408. return yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner);
  1409. }
  1410. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1411. * scan from a @e copy of @a bytes.
  1412. * @param bytes the byte buffer to scan
  1413. * @param len the number of bytes in the buffer pointed to by @a bytes.
  1414. * @param yyscanner The scanner object.
  1415. * @return the newly allocated buffer state object.
  1416. */
  1417. YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner)
  1418. {
  1419. YY_BUFFER_STATE b;
  1420. char *buf;
  1421. yy_size_t n;
  1422. int i;
  1423. /* Get memory for full buffer, including space for trailing EOB's. */
  1424. n = len + 2;
  1425. buf = (char *) yyalloc(n ,yyscanner );
  1426. if ( ! buf )
  1427. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1428. for ( i = 0; i < len; ++i )
  1429. buf[i] = bytes[i];
  1430. buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1431. b = yy_scan_buffer(buf,n ,yyscanner);
  1432. if ( ! b )
  1433. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1434. /* It's okay to grow etc. this buffer, and we should throw it
  1435. * away when we're done.
  1436. */
  1437. b->yy_is_our_buffer = 1;
  1438. return b;
  1439. }
  1440. #ifndef YY_EXIT_FAILURE
  1441. #define YY_EXIT_FAILURE 2
  1442. #endif
  1443. static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
  1444. {
  1445. (void)yyscanner;
  1446. (void) fprintf( stderr, "%s\n", msg );
  1447. exit( YY_EXIT_FAILURE );
  1448. }
  1449. /* Redefine yyless() so it works in section 3 code. */
  1450. #undef yyless
  1451. #define yyless(n) \
  1452. do \
  1453. { \
  1454. /* Undo effects of setting up yytext. */ \
  1455. int yyless_macro_arg = (n); \
  1456. YY_LESS_LINENO(yyless_macro_arg);\
  1457. yytext[yyleng] = yyg->yy_hold_char; \
  1458. yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
  1459. yyg->yy_hold_char = *yyg->yy_c_buf_p; \
  1460. *yyg->yy_c_buf_p = '\0'; \
  1461. yyleng = yyless_macro_arg; \
  1462. } \
  1463. while ( 0 )
  1464. /* Accessor methods (get/set functions) to struct members. */
  1465. /** Get the user-defined data for this scanner.
  1466. * @param yyscanner The scanner object.
  1467. */
  1468. YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
  1469. {
  1470. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1471. return yyextra;
  1472. }
  1473. /** Get the current line number.
  1474. * @param yyscanner The scanner object.
  1475. */
  1476. int yyget_lineno (yyscan_t yyscanner)
  1477. {
  1478. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1479. if (! YY_CURRENT_BUFFER)
  1480. return 0;
  1481. return yylineno;
  1482. }
  1483. /** Get the current column number.
  1484. * @param yyscanner The scanner object.
  1485. */
  1486. int yyget_column (yyscan_t yyscanner)
  1487. {
  1488. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1489. if (! YY_CURRENT_BUFFER)
  1490. return 0;
  1491. return yycolumn;
  1492. }
  1493. /** Get the input stream.
  1494. * @param yyscanner The scanner object.
  1495. */
  1496. FILE *yyget_in (yyscan_t yyscanner)
  1497. {
  1498. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1499. return yyin;
  1500. }
  1501. /** Get the output stream.
  1502. * @param yyscanner The scanner object.
  1503. */
  1504. FILE *yyget_out (yyscan_t yyscanner)
  1505. {
  1506. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1507. return yyout;
  1508. }
  1509. /** Get the length of the current token.
  1510. * @param yyscanner The scanner object.
  1511. */
  1512. int yyget_leng (yyscan_t yyscanner)
  1513. {
  1514. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1515. return yyleng;
  1516. }
  1517. /** Get the current token.
  1518. * @param yyscanner The scanner object.
  1519. */
  1520. char *yyget_text (yyscan_t yyscanner)
  1521. {
  1522. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1523. return yytext;
  1524. }
  1525. /** Set the user-defined data. This data is never touched by the scanner.
  1526. * @param user_defined The data to be associated with this scanner.
  1527. * @param yyscanner The scanner object.
  1528. */
  1529. void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
  1530. {
  1531. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1532. yyextra = user_defined ;
  1533. }
  1534. /** Set the current line number.
  1535. * @param line_number
  1536. * @param yyscanner The scanner object.
  1537. */
  1538. void yyset_lineno (int line_number , yyscan_t yyscanner)
  1539. {
  1540. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1541. /* lineno is only valid if an input buffer exists. */
  1542. if (! YY_CURRENT_BUFFER )
  1543. yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner);
  1544. yylineno = line_number;
  1545. }
  1546. /** Set the current column.
  1547. * @param line_number
  1548. * @param yyscanner The scanner object.
  1549. */
  1550. void yyset_column (int column_no , yyscan_t yyscanner)
  1551. {
  1552. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1553. /* column is only valid if an input buffer exists. */
  1554. if (! YY_CURRENT_BUFFER )
  1555. yy_fatal_error( "yyset_column called with no buffer" , yyscanner);
  1556. yycolumn = column_no;
  1557. }
  1558. /** Set the input stream. This does not discard the current
  1559. * input buffer.
  1560. * @param in_str A readable stream.
  1561. * @param yyscanner The scanner object.
  1562. * @see yy_switch_to_buffer
  1563. */
  1564. void yyset_in (FILE * in_str , yyscan_t yyscanner)
  1565. {
  1566. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1567. yyin = in_str ;
  1568. }
  1569. void yyset_out (FILE * out_str , yyscan_t yyscanner)
  1570. {
  1571. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1572. yyout = out_str ;
  1573. }
  1574. int yyget_debug (yyscan_t yyscanner)
  1575. {
  1576. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1577. return yy_flex_debug;
  1578. }
  1579. void yyset_debug (int bdebug , yyscan_t yyscanner)
  1580. {
  1581. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1582. yy_flex_debug = bdebug ;
  1583. }
  1584. /* Accessor methods for yylval and yylloc */
  1585. static int yy_init_globals (yyscan_t yyscanner)
  1586. {
  1587. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1588. /* Initialization is the same as for the non-reentrant scanner.
  1589. This function is called once per scanner lifetime. */
  1590. yyg->yy_buffer_stack = 0;
  1591. yyg->yy_buffer_stack_top = 0;
  1592. yyg->yy_buffer_stack_max = 0;
  1593. yyg->yy_c_buf_p = (char *) 0;
  1594. yyg->yy_init = 1;
  1595. yyg->yy_start = 0;
  1596. yyg->yy_start_stack_ptr = 0;
  1597. yyg->yy_start_stack_depth = 0;
  1598. yyg->yy_start_stack = (int *) 0;
  1599. /* Defined in main.c */
  1600. #ifdef YY_STDINIT
  1601. yyin = stdin;
  1602. yyout = stdout;
  1603. #else
  1604. yyin = (FILE *) 0;
  1605. yyout = (FILE *) 0;
  1606. #endif
  1607. /* For future reference: Set errno on error, since we are called by
  1608. * yylex_init()
  1609. */
  1610. return 0;
  1611. }
  1612. /* User-visible API */
  1613. /* yylex_init is special because it creates the scanner itself, so it is
  1614. * the ONLY reentrant function that doesn't take the scanner as the last argument.
  1615. * That's why we explicitly handle the declaration, instead of using our macros.
  1616. */
  1617. int yylex_init(yyscan_t* ptr_yy_globals)
  1618. {
  1619. if (ptr_yy_globals == NULL){
  1620. errno = EINVAL;
  1621. return 1;
  1622. }
  1623. *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
  1624. if (*ptr_yy_globals == NULL){
  1625. errno = ENOMEM;
  1626. return 1;
  1627. }
  1628. memset(*ptr_yy_globals,0,sizeof(struct yyguts_t));
  1629. return yy_init_globals ( *ptr_yy_globals );
  1630. }
  1631. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1632. int yylex_destroy (yyscan_t yyscanner)
  1633. {
  1634. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1635. /* Pop the buffer stack, destroying each element. */
  1636. while(YY_CURRENT_BUFFER){
  1637. yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
  1638. YY_CURRENT_BUFFER_LVALUE = NULL;
  1639. yypop_buffer_state(yyscanner);
  1640. }
  1641. /* Destroy the stack itself. */
  1642. yyfree(yyg->yy_buffer_stack ,yyscanner);
  1643. yyg->yy_buffer_stack = NULL;
  1644. /* Destroy the start condition stack. */
  1645. yyfree(yyg->yy_start_stack ,yyscanner );
  1646. yyg->yy_start_stack = NULL;
  1647. /* Destroy the main struct (reentrant only). */
  1648. yyfree ( yyscanner , yyscanner );
  1649. return 0;
  1650. }
  1651. /*
  1652. * Internal utility routines.
  1653. */
  1654. #ifndef yytext_ptr
  1655. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
  1656. {
  1657. register int i;
  1658. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1659. for ( i = 0; i < n; ++i )
  1660. s1[i] = s2[i];
  1661. }
  1662. #endif
  1663. #ifdef YY_NEED_STRLEN
  1664. static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
  1665. {
  1666. register int n;
  1667. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1668. for ( n = 0; s[n]; ++n )
  1669. ;
  1670. return n;
  1671. }
  1672. #endif
  1673. void *yyalloc (yy_size_t size , yyscan_t yyscanner)
  1674. {
  1675. (void)yyscanner;
  1676. return (void *) malloc( size );
  1677. }
  1678. void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
  1679. {
  1680. (void)yyscanner;
  1681. /* The cast to (char *) in the following accommodates both
  1682. * implementations that use char* generic pointers, and those
  1683. * that use void* generic pointers. It works with the latter
  1684. * because both ANSI C and C++ allow castless assignment from
  1685. * any pointer type to void*, and deal with argument conversions
  1686. * as though doing an assignment.
  1687. */
  1688. return (void *) realloc( (char *) ptr, size );
  1689. }
  1690. void yyfree (void * ptr , yyscan_t yyscanner)
  1691. {
  1692. (void)yyscanner;
  1693. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  1694. }
  1695. #define YYTABLES_NAME "yytables"
  1696. #undef YY_NEW_FILE
  1697. #undef YY_FLUSH_BUFFER
  1698. #undef yy_set_bol
  1699. #undef yy_new_buffer
  1700. #undef yy_set_interactive
  1701. #undef yytext_ptr
  1702. #undef YY_DO_BEFORE_ACTION
  1703. #ifdef YY_DECL_IS_OURS
  1704. #undef YY_DECL_IS_OURS
  1705. #undef YY_DECL
  1706. #endif
  1707. #line 171 "cmListFileLexer.in.l"
  1708. /*--------------------------------------------------------------------------*/
  1709. static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
  1710. int length)
  1711. {
  1712. /* Set the token line and column number. */
  1713. lexer->token.line = lexer->line;
  1714. lexer->token.column = lexer->column;
  1715. /* Use the same buffer if possible. */
  1716. if(lexer->token.text)
  1717. {
  1718. if(text && length < lexer->size)
  1719. {
  1720. strcpy(lexer->token.text, text);
  1721. lexer->token.length = length;
  1722. return;
  1723. }
  1724. free(lexer->token.text);
  1725. lexer->token.text = 0;
  1726. lexer->size = 0;
  1727. }
  1728. /* Need to extend the buffer. */
  1729. if(text)
  1730. {
  1731. lexer->token.text = strdup(text);
  1732. lexer->token.length = length;
  1733. lexer->size = length+1;
  1734. }
  1735. else
  1736. {
  1737. lexer->token.length = 0;
  1738. }
  1739. }
  1740. /*--------------------------------------------------------------------------*/
  1741. static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
  1742. int length)
  1743. {
  1744. char* temp;
  1745. int newSize;
  1746. /* If the appended text will fit in the buffer, do not reallocate. */
  1747. newSize = lexer->token.length + length + 1;
  1748. if(lexer->token.text && newSize <= lexer->size)
  1749. {
  1750. strcpy(lexer->token.text+lexer->token.length, text);
  1751. lexer->token.length += length;
  1752. return;
  1753. }
  1754. /* We need to extend the buffer. */
  1755. temp = malloc(newSize);
  1756. if(lexer->token.text)
  1757. {
  1758. memcpy(temp, lexer->token.text, lexer->token.length);
  1759. free(lexer->token.text);
  1760. }
  1761. memcpy(temp+lexer->token.length, text, length);
  1762. temp[lexer->token.length+length] = 0;
  1763. lexer->token.text = temp;
  1764. lexer->token.length += length;
  1765. lexer->size = newSize;
  1766. }
  1767. /*--------------------------------------------------------------------------*/
  1768. cmListFileLexer* cmListFileLexer_New()
  1769. {
  1770. cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
  1771. if(!lexer)
  1772. {
  1773. return 0;
  1774. }
  1775. memset(lexer, 0, sizeof(*lexer));
  1776. lexer->line = 1;
  1777. lexer->column = 1;
  1778. return lexer;
  1779. }
  1780. /*--------------------------------------------------------------------------*/
  1781. void cmListFileLexer_Delete(cmListFileLexer* lexer)
  1782. {
  1783. cmListFileLexer_SetFileName(lexer, 0);
  1784. free(lexer);
  1785. }
  1786. /*--------------------------------------------------------------------------*/
  1787. int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name)
  1788. {
  1789. int result = 1;
  1790. if(lexer->file)
  1791. {
  1792. yylex_destroy(lexer->scanner);
  1793. fclose(lexer->file);
  1794. lexer->file = 0;
  1795. }
  1796. if(name)
  1797. {
  1798. lexer->file = fopen(name, "r");
  1799. if(!lexer->file)
  1800. {
  1801. result = 0;
  1802. }
  1803. }
  1804. if(lexer->file)
  1805. {
  1806. yylex_init(&lexer->scanner);
  1807. yyset_in(lexer->file,lexer->scanner);
  1808. }
  1809. return result;
  1810. }
  1811. /*--------------------------------------------------------------------------*/
  1812. cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
  1813. {
  1814. if(!lexer->file)
  1815. {
  1816. return 0;
  1817. }
  1818. if(yylex(lexer->scanner,lexer))
  1819. {
  1820. return &lexer->token;
  1821. }
  1822. else
  1823. {
  1824. cmListFileLexer_SetFileName(lexer, 0);
  1825. return 0;
  1826. }
  1827. }
  1828. /*--------------------------------------------------------------------------*/
  1829. long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
  1830. {
  1831. if(lexer->file)
  1832. {
  1833. return lexer->line;
  1834. }
  1835. else
  1836. {
  1837. return 0;
  1838. }
  1839. }
  1840. /*--------------------------------------------------------------------------*/
  1841. long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
  1842. {
  1843. if(lexer->file)
  1844. {
  1845. return lexer->column;
  1846. }
  1847. else
  1848. {
  1849. return 0;
  1850. }
  1851. }