cmListFileLexer.c 78 KB

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