cmListFileLexer.c 72 KB

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