cmListFileLexer.c 69 KB

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