cmListFileLexer.c 76 KB

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