cmListFileLexer.c 78 KB

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