cmListFileLexer.c 80 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923
  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[77] =
  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, 17, 19, 20, 21, 10, 11, 8, 12,
  494. 9, 4, 13, 0, 13, 0, 22, 0, 0, 7,
  495. 13, 0, 13, 0, 2, 0, 13, 17, 0, 18,
  496. 10, 8, 4, 0, 14, 0, 0, 0, 0, 14,
  497. 0, 0, 14, 0, 0, 0, 2, 14, 0, 0,
  498. 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[16] =
  530. { 0,
  531. 1, 1, 2, 3, 4, 3, 1, 3, 5, 6,
  532. 1, 6, 1, 1, 7
  533. } ;
  534. static const flex_int16_t yy_base[95] =
  535. { 0,
  536. 0, 0, 13, 25, 14, 16, 17, 18, 90, 88,
  537. 88, 39, 20, 237, 237, 74, 78, 237, 237, 13,
  538. 54, 0, 71, 237, 237, 31, 0, 237, 73, 237,
  539. 237, 0, 0, 65, 75, 0, 33, 30, 72, 0,
  540. 0, 75, 70, 0, 74, 0, 0, 62, 70, 237,
  541. 0, 63, 0, 85, 99, 65, 111, 62, 34, 0,
  542. 54, 116, 0, 54, 127, 51, 237, 50, 0, 48,
  543. 47, 39, 33, 29, 17, 237, 136, 143, 150, 157,
  544. 164, 171, 178, 184, 191, 198, 201, 207, 214, 217,
  545. 219, 225, 228, 230
  546. } ;
  547. static const flex_int16_t yy_def[95] =
  548. { 0,
  549. 76, 1, 77, 77, 78, 78, 79, 79, 80, 80,
  550. 76, 76, 76, 76, 76, 76, 12, 76, 76, 12,
  551. 76, 81, 82, 76, 76, 82, 83, 76, 76, 76,
  552. 76, 84, 12, 85, 12, 86, 76, 76, 87, 20,
  553. 12, 88, 12, 21, 76, 89, 12, 82, 82, 76,
  554. 83, 76, 84, 85, 76, 54, 85, 90, 76, 55,
  555. 87, 88, 55, 62, 88, 91, 76, 55, 92, 93,
  556. 90, 94, 91, 93, 94, 0, 76, 76, 76, 76,
  557. 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
  558. 76, 76, 76, 76
  559. } ;
  560. static const flex_int16_t yy_nxt[253] =
  561. { 0,
  562. 12, 13, 14, 13, 15, 16, 17, 18, 19, 12,
  563. 12, 20, 21, 22, 12, 24, 28, 25, 28, 28,
  564. 28, 37, 40, 37, 40, 62, 26, 24, 29, 25,
  565. 29, 31, 31, 50, 37, 48, 37, 54, 26, 33,
  566. 59, 63, 45, 34, 59, 35, 45, 62, 33, 33,
  567. 33, 33, 36, 33, 41, 55, 54, 58, 42, 63,
  568. 43, 72, 60, 41, 44, 41, 45, 46, 41, 55,
  569. 55, 56, 70, 52, 48, 49, 67, 66, 57, 63,
  570. 60, 64, 58, 52, 49, 39, 38, 76, 65, 55,
  571. 14, 56, 14, 76, 76, 76, 76, 76, 57, 55,
  572. 76, 76, 76, 34, 76, 68, 76, 76, 55, 55,
  573. 55, 55, 69, 55, 54, 76, 54, 76, 54, 54,
  574. 63, 76, 64, 76, 76, 76, 76, 76, 76, 65,
  575. 62, 76, 62, 76, 62, 62, 23, 23, 23, 23,
  576. 23, 23, 23, 27, 27, 27, 27, 27, 27, 27,
  577. 30, 30, 30, 30, 30, 30, 30, 32, 32, 32,
  578. 32, 32, 32, 32, 47, 76, 47, 47, 47, 47,
  579. 47, 48, 76, 48, 76, 48, 48, 48, 51, 76,
  580. 51, 51, 51, 51, 53, 76, 53, 53, 53, 53,
  581. 53, 54, 76, 76, 54, 76, 54, 54, 33, 76,
  582. 33, 33, 33, 33, 33, 61, 61, 62, 76, 76,
  583. 62, 76, 62, 62, 41, 76, 41, 41, 41, 41,
  584. 41, 71, 71, 73, 73, 55, 76, 55, 55, 55,
  585. 55, 55, 74, 74, 75, 75, 11, 76, 76, 76,
  586. 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
  587. 76, 76
  588. } ;
  589. static const flex_int16_t yy_chk[253] =
  590. { 0,
  591. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  592. 1, 1, 1, 1, 1, 3, 5, 3, 6, 7,
  593. 8, 13, 20, 13, 20, 75, 3, 4, 5, 4,
  594. 6, 7, 8, 26, 37, 26, 37, 74, 4, 12,
  595. 38, 73, 38, 12, 59, 12, 59, 72, 12, 12,
  596. 12, 12, 12, 12, 21, 71, 70, 68, 21, 66,
  597. 21, 64, 61, 21, 21, 21, 21, 21, 21, 34,
  598. 58, 34, 56, 52, 49, 48, 45, 43, 34, 42,
  599. 39, 42, 35, 29, 23, 17, 16, 11, 42, 54,
  600. 10, 54, 9, 0, 0, 0, 0, 0, 54, 55,
  601. 0, 0, 0, 55, 0, 55, 0, 0, 55, 55,
  602. 55, 55, 55, 55, 57, 0, 57, 0, 57, 57,
  603. 62, 0, 62, 0, 0, 0, 0, 0, 0, 62,
  604. 65, 0, 65, 0, 65, 65, 77, 77, 77, 77,
  605. 77, 77, 77, 78, 78, 78, 78, 78, 78, 78,
  606. 79, 79, 79, 79, 79, 79, 79, 80, 80, 80,
  607. 80, 80, 80, 80, 81, 0, 81, 81, 81, 81,
  608. 81, 82, 0, 82, 0, 82, 82, 82, 83, 0,
  609. 83, 83, 83, 83, 84, 0, 84, 84, 84, 84,
  610. 84, 85, 0, 0, 85, 0, 85, 85, 86, 0,
  611. 86, 86, 86, 86, 86, 87, 87, 88, 0, 0,
  612. 88, 0, 88, 88, 89, 0, 89, 89, 89, 89,
  613. 89, 90, 90, 91, 91, 92, 0, 92, 92, 92,
  614. 92, 92, 93, 93, 94, 94, 76, 76, 76, 76,
  615. 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
  616. 76, 76
  617. } ;
  618. /* Table of booleans, true if rule could match eol. */
  619. static const flex_int32_t yy_rule_can_match_eol[25] =
  620. { 0,
  621. 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1,
  622. 0, 0, 0, 0, 0, };
  623. /* The intent behind this definition is that it'll catch
  624. * any uses of REJECT which flex missed.
  625. */
  626. #define REJECT reject_used_but_not_detected
  627. #define yymore() yymore_used_but_not_detected
  628. #define YY_MORE_ADJ 0
  629. #define YY_RESTORE_YY_MORE_OFFSET
  630. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  631. file LICENSE.rst or https://cmake.org/licensing for details. */
  632. /*
  633. This file must be translated to C and modified to build everywhere.
  634. Run flex >= 2.6 like this:
  635. flex --nounistd -DFLEXINT_H --noline -ocmListFileLexer.c cmListFileLexer.in.l
  636. Modify cmListFileLexer.c:
  637. - remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
  638. - remove blank lines at end of file: sed -i '${/^$/d;}' cmListFileLexer.c
  639. - #include "cmStandardLexer.h" at the top: sed -i '1i#include "cmStandardLexer.h"' cmListFileLexer.c
  640. */
  641. /* IWYU pragma: no_forward_declare yyguts_t */
  642. #ifdef _WIN32
  643. #include "cmsys/Encoding.h"
  644. #endif
  645. /* Setup the proper cmListFileLexer_yylex declaration. */
  646. #define YY_EXTRA_TYPE cmListFileLexer*
  647. #define YY_DECL int cmListFileLexer_yylex (yyscan_t yyscanner, cmListFileLexer* lexer)
  648. #include "cmListFileLexer.h"
  649. /*--------------------------------------------------------------------------*/
  650. struct cmListFileLexer_s
  651. {
  652. cmListFileLexer_Token token;
  653. int bracket;
  654. int comment;
  655. int line;
  656. int column;
  657. size_t size;
  658. FILE* file;
  659. size_t cr;
  660. char read_buffer[4];
  661. size_t read_size;
  662. size_t read_position;
  663. char* string_buffer;
  664. char* string_position;
  665. size_t string_left;
  666. yyscan_t scanner;
  667. };
  668. static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
  669. size_t length);
  670. static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
  671. size_t length);
  672. static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
  673. size_t bufferSize);
  674. static void cmListFileLexerInit(cmListFileLexer* lexer);
  675. static void cmListFileLexerDestroy(cmListFileLexer* lexer);
  676. /* Replace the lexer input function. */
  677. #undef YY_INPUT
  678. #define YY_INPUT(buf, result, max_size) \
  679. do { result = cmListFileLexerInput(cmListFileLexer_yyget_extra(yyscanner), buf, max_size); } while (0)
  680. /*--------------------------------------------------------------------------*/
  681. #define INITIAL 0
  682. #define STRING 1
  683. #define BRACKET 2
  684. #define BRACKETEND 3
  685. #define COMMENT 4
  686. #ifndef YY_EXTRA_TYPE
  687. #define YY_EXTRA_TYPE void *
  688. #endif
  689. /* Holds the entire state of the reentrant scanner. */
  690. struct yyguts_t
  691. {
  692. /* User-defined. Not touched by flex. */
  693. YY_EXTRA_TYPE yyextra_r;
  694. /* The rest are the same as the globals declared in the non-reentrant scanner. */
  695. FILE *yyin_r, *yyout_r;
  696. size_t yy_buffer_stack_top; /**< index of top of stack. */
  697. size_t yy_buffer_stack_max; /**< capacity of stack. */
  698. YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
  699. char yy_hold_char;
  700. int yy_n_chars;
  701. int yyleng_r;
  702. char *yy_c_buf_p;
  703. int yy_init;
  704. int yy_start;
  705. int yy_did_buffer_switch_on_eof;
  706. int yy_start_stack_ptr;
  707. int yy_start_stack_depth;
  708. int *yy_start_stack;
  709. yy_state_type yy_last_accepting_state;
  710. char* yy_last_accepting_cpos;
  711. int yylineno_r;
  712. int yy_flex_debug_r;
  713. char *yytext_r;
  714. int yy_more_flag;
  715. int yy_more_len;
  716. }; /* end struct yyguts_t */
  717. static int yy_init_globals ( yyscan_t yyscanner );
  718. int yylex_init (yyscan_t* scanner);
  719. int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
  720. /* Accessor methods to globals.
  721. These are made visible to non-reentrant scanners for convenience. */
  722. int yylex_destroy ( yyscan_t yyscanner );
  723. int yyget_debug ( yyscan_t yyscanner );
  724. void yyset_debug ( int debug_flag , yyscan_t yyscanner );
  725. YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
  726. void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
  727. FILE *yyget_in ( yyscan_t yyscanner );
  728. void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
  729. FILE *yyget_out ( yyscan_t yyscanner );
  730. void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
  731. int yyget_leng ( yyscan_t yyscanner );
  732. char *yyget_text ( yyscan_t yyscanner );
  733. int yyget_lineno ( yyscan_t yyscanner );
  734. void yyset_lineno ( int _line_number , yyscan_t yyscanner );
  735. int yyget_column ( yyscan_t yyscanner );
  736. void yyset_column ( int _column_no , yyscan_t yyscanner );
  737. /* Macros after this point can all be overridden by user definitions in
  738. * section 1.
  739. */
  740. #ifndef YY_SKIP_YYWRAP
  741. #ifdef __cplusplus
  742. extern "C" int yywrap ( yyscan_t yyscanner );
  743. #else
  744. extern int yywrap ( yyscan_t yyscanner );
  745. #endif
  746. #endif
  747. #ifndef YY_NO_UNPUT
  748. static void yyunput ( int c, char *buf_ptr , yyscan_t yyscanner);
  749. #endif
  750. #ifndef yytext_ptr
  751. static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
  752. #endif
  753. #ifdef YY_NEED_STRLEN
  754. static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
  755. #endif
  756. #ifndef YY_NO_INPUT
  757. #ifdef __cplusplus
  758. static int yyinput ( yyscan_t yyscanner );
  759. #else
  760. static int input ( yyscan_t yyscanner );
  761. #endif
  762. #endif
  763. /* Amount of stuff to slurp up with each read. */
  764. #ifndef YY_READ_BUF_SIZE
  765. #ifdef __ia64__
  766. /* On IA-64, the buffer size is 16k, not 8k */
  767. #define YY_READ_BUF_SIZE 16384
  768. #else
  769. #define YY_READ_BUF_SIZE 8192
  770. #endif /* __ia64__ */
  771. #endif
  772. /* Copy whatever the last rule matched to the standard output. */
  773. #ifndef ECHO
  774. /* This used to be an fputs(), but since the string might contain NUL's,
  775. * we now use fwrite().
  776. */
  777. #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
  778. #endif
  779. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  780. * is returned in "result".
  781. */
  782. #ifndef YY_INPUT
  783. #define YY_INPUT(buf,result,max_size) \
  784. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  785. { \
  786. int c = '*'; \
  787. int n; \
  788. for ( n = 0; n < max_size && \
  789. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  790. buf[n] = (char) c; \
  791. if ( c == '\n' ) \
  792. buf[n++] = (char) c; \
  793. if ( c == EOF && ferror( yyin ) ) \
  794. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  795. result = n; \
  796. } \
  797. else \
  798. { \
  799. errno=0; \
  800. while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
  801. { \
  802. if( errno != EINTR) \
  803. { \
  804. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  805. break; \
  806. } \
  807. errno=0; \
  808. clearerr(yyin); \
  809. } \
  810. }\
  811. \
  812. #endif
  813. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  814. * we don't want an extra ';' after the "return" because that will cause
  815. * some compilers to complain about unreachable statements.
  816. */
  817. #ifndef yyterminate
  818. #define yyterminate() return YY_NULL
  819. #endif
  820. /* Number of entries by which start-condition stack grows. */
  821. #ifndef YY_START_STACK_INCR
  822. #define YY_START_STACK_INCR 25
  823. #endif
  824. /* Report a fatal error. */
  825. #ifndef YY_FATAL_ERROR
  826. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
  827. #endif
  828. /* end tables serialization structures and prototypes */
  829. /* Default declaration of generated scanner - a define so the user can
  830. * easily add parameters.
  831. */
  832. #ifndef YY_DECL
  833. #define YY_DECL_IS_OURS 1
  834. extern int yylex (yyscan_t yyscanner);
  835. #define YY_DECL int yylex (yyscan_t yyscanner)
  836. #endif /* !YY_DECL */
  837. /* Code executed at the beginning of each rule, after yytext and yyleng
  838. * have been set up.
  839. */
  840. #ifndef YY_USER_ACTION
  841. #define YY_USER_ACTION
  842. #endif
  843. /* Code executed at the end of each rule. */
  844. #ifndef YY_BREAK
  845. #define YY_BREAK /*LINTED*/break;
  846. #endif
  847. #define YY_RULE_SETUP \
  848. YY_USER_ACTION
  849. /** The main scanner function which does all the work.
  850. */
  851. YY_DECL
  852. {
  853. yy_state_type yy_current_state;
  854. char *yy_cp, *yy_bp;
  855. int yy_act;
  856. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  857. if ( !yyg->yy_init )
  858. {
  859. yyg->yy_init = 1;
  860. #ifdef YY_USER_INIT
  861. YY_USER_INIT;
  862. #endif
  863. if ( ! yyg->yy_start )
  864. yyg->yy_start = 1; /* first start state */
  865. if ( ! yyin )
  866. yyin = stdin;
  867. if ( ! yyout )
  868. yyout = stdout;
  869. if ( ! YY_CURRENT_BUFFER ) {
  870. yyensure_buffer_stack (yyscanner);
  871. YY_CURRENT_BUFFER_LVALUE =
  872. yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
  873. }
  874. yy_load_buffer_state( yyscanner );
  875. }
  876. {
  877. while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
  878. {
  879. yy_cp = yyg->yy_c_buf_p;
  880. /* Support of yytext. */
  881. *yy_cp = yyg->yy_hold_char;
  882. /* yy_bp points to the position in yy_ch_buf of the start of
  883. * the current run.
  884. */
  885. yy_bp = yy_cp;
  886. yy_current_state = yyg->yy_start;
  887. yy_match:
  888. do
  889. {
  890. YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
  891. if ( yy_accept[yy_current_state] )
  892. {
  893. yyg->yy_last_accepting_state = yy_current_state;
  894. yyg->yy_last_accepting_cpos = yy_cp;
  895. }
  896. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  897. {
  898. yy_current_state = (int) yy_def[yy_current_state];
  899. if ( yy_current_state >= 77 )
  900. yy_c = yy_meta[yy_c];
  901. }
  902. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  903. ++yy_cp;
  904. }
  905. while ( yy_base[yy_current_state] != 237 );
  906. yy_find_action:
  907. yy_act = yy_accept[yy_current_state];
  908. if ( yy_act == 0 )
  909. { /* have to back up */
  910. yy_cp = yyg->yy_last_accepting_cpos;
  911. yy_current_state = yyg->yy_last_accepting_state;
  912. yy_act = yy_accept[yy_current_state];
  913. }
  914. YY_DO_BEFORE_ACTION;
  915. if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
  916. {
  917. int yyl;
  918. for ( yyl = 0; yyl < yyleng; ++yyl )
  919. if ( yytext[yyl] == '\n' )
  920. do{ yylineno++;
  921. yycolumn=0;
  922. }while(0)
  923. ;
  924. }
  925. do_action: /* This label is used only to access EOF actions. */
  926. switch ( yy_act )
  927. { /* beginning of action switch */
  928. case 0: /* must back up */
  929. /* undo the effects of YY_DO_BEFORE_ACTION */
  930. *yy_cp = yyg->yy_hold_char;
  931. yy_cp = yyg->yy_last_accepting_cpos;
  932. yy_current_state = yyg->yy_last_accepting_state;
  933. goto yy_find_action;
  934. case 1:
  935. /* rule 1 can match eol */
  936. YY_RULE_SETUP
  937. {
  938. lexer->token.type = cmListFileLexer_Token_Newline;
  939. cmListFileLexerSetToken(lexer, yytext, yyleng);
  940. ++lexer->line;
  941. lexer->column = 1;
  942. BEGIN(INITIAL);
  943. return 1;
  944. }
  945. YY_BREAK
  946. case 2:
  947. /* rule 2 can match eol */
  948. YY_RULE_SETUP
  949. {
  950. const char* bracket = yytext;
  951. size_t length = yyleng;
  952. lexer->comment = yytext[0] == '#';
  953. if (lexer->comment) {
  954. lexer->token.type = cmListFileLexer_Token_CommentBracket;
  955. bracket += 1;
  956. --length;
  957. } else {
  958. lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
  959. }
  960. cmListFileLexerSetToken(lexer, "", 0);
  961. lexer->bracket = (char*)memchr(bracket + 1, '[', length - 1) - bracket;
  962. if (yytext[yyleng-1] == '\n') {
  963. ++lexer->line;
  964. lexer->column = 1;
  965. } else {
  966. lexer->column += yyleng;
  967. }
  968. BEGIN(BRACKET);
  969. }
  970. YY_BREAK
  971. case 3:
  972. YY_RULE_SETUP
  973. {
  974. lexer->column += yyleng;
  975. BEGIN(COMMENT);
  976. }
  977. YY_BREAK
  978. case 4:
  979. YY_RULE_SETUP
  980. {
  981. if (memchr(yytext, '\0', yyleng) != NULL) {
  982. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  983. }
  984. lexer->column += yyleng;
  985. }
  986. YY_BREAK
  987. case 5:
  988. YY_RULE_SETUP
  989. {
  990. lexer->token.type = cmListFileLexer_Token_ParenLeft;
  991. cmListFileLexerSetToken(lexer, yytext, yyleng);
  992. lexer->column += yyleng;
  993. return 1;
  994. }
  995. YY_BREAK
  996. case 6:
  997. YY_RULE_SETUP
  998. {
  999. lexer->token.type = cmListFileLexer_Token_ParenRight;
  1000. cmListFileLexerSetToken(lexer, yytext, yyleng);
  1001. lexer->column += yyleng;
  1002. return 1;
  1003. }
  1004. YY_BREAK
  1005. case 7:
  1006. YY_RULE_SETUP
  1007. {
  1008. lexer->token.type = cmListFileLexer_Token_Identifier;
  1009. cmListFileLexerSetToken(lexer, yytext, yyleng);
  1010. lexer->column += yyleng;
  1011. return 1;
  1012. }
  1013. YY_BREAK
  1014. case 8:
  1015. YY_RULE_SETUP
  1016. {
  1017. /* Handle ]]====]=======]*/
  1018. cmListFileLexerAppend(lexer, yytext, yyleng);
  1019. lexer->column += yyleng;
  1020. if (yyleng == lexer->bracket) {
  1021. BEGIN(BRACKETEND);
  1022. }
  1023. }
  1024. YY_BREAK
  1025. case 9:
  1026. YY_RULE_SETUP
  1027. {
  1028. lexer->column += yyleng;
  1029. /* Erase the partial bracket from the token. */
  1030. lexer->token.length -= lexer->bracket;
  1031. BEGIN(INITIAL);
  1032. return 1;
  1033. }
  1034. YY_BREAK
  1035. case 10:
  1036. YY_RULE_SETUP
  1037. {
  1038. if (memchr(yytext, '\0', yyleng) != NULL) {
  1039. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  1040. }
  1041. cmListFileLexerAppend(lexer, yytext, yyleng);
  1042. lexer->column += yyleng;
  1043. }
  1044. YY_BREAK
  1045. case 11:
  1046. /* rule 11 can match eol */
  1047. YY_RULE_SETUP
  1048. {
  1049. cmListFileLexerAppend(lexer, yytext, yyleng);
  1050. ++lexer->line;
  1051. lexer->column = 1;
  1052. BEGIN(BRACKET);
  1053. }
  1054. YY_BREAK
  1055. case 12:
  1056. YY_RULE_SETUP
  1057. {
  1058. if (memchr(yytext, '\0', yyleng) != NULL) {
  1059. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  1060. }
  1061. cmListFileLexerAppend(lexer, yytext, yyleng);
  1062. lexer->column += yyleng;
  1063. BEGIN(BRACKET);
  1064. }
  1065. YY_BREAK
  1066. case YY_STATE_EOF(BRACKET):
  1067. case YY_STATE_EOF(BRACKETEND):
  1068. {
  1069. lexer->token.type = cmListFileLexer_Token_BadBracket;
  1070. BEGIN(INITIAL);
  1071. return 1;
  1072. }
  1073. YY_BREAK
  1074. case 13:
  1075. YY_RULE_SETUP
  1076. {
  1077. if (memchr(yytext, '\0', yyleng) != NULL) {
  1078. /* An unquoted argument that contains a null character. */
  1079. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  1080. } else {
  1081. lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
  1082. }
  1083. cmListFileLexerSetToken(lexer, yytext, yyleng);
  1084. lexer->column += yyleng;
  1085. return 1;
  1086. }
  1087. YY_BREAK
  1088. case 14:
  1089. YY_RULE_SETUP
  1090. {
  1091. lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
  1092. cmListFileLexerSetToken(lexer, yytext, yyleng);
  1093. lexer->column += yyleng;
  1094. return 1;
  1095. }
  1096. YY_BREAK
  1097. case 15:
  1098. YY_RULE_SETUP
  1099. {
  1100. lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
  1101. cmListFileLexerSetToken(lexer, yytext, yyleng);
  1102. lexer->column += yyleng;
  1103. return 1;
  1104. }
  1105. YY_BREAK
  1106. case 16:
  1107. YY_RULE_SETUP
  1108. {
  1109. lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
  1110. cmListFileLexerSetToken(lexer, "", 0);
  1111. lexer->column += yyleng;
  1112. BEGIN(STRING);
  1113. }
  1114. YY_BREAK
  1115. case 17:
  1116. YY_RULE_SETUP
  1117. {
  1118. if (memchr(yytext, '\0', yyleng) != NULL) {
  1119. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  1120. }
  1121. cmListFileLexerAppend(lexer, yytext, yyleng);
  1122. lexer->column += yyleng;
  1123. }
  1124. YY_BREAK
  1125. case 18:
  1126. /* rule 18 can match eol */
  1127. YY_RULE_SETUP
  1128. {
  1129. /* Continuation: text is not part of string */
  1130. ++lexer->line;
  1131. lexer->column = 1;
  1132. }
  1133. YY_BREAK
  1134. case 19:
  1135. /* rule 19 can match eol */
  1136. YY_RULE_SETUP
  1137. {
  1138. cmListFileLexerAppend(lexer, yytext, yyleng);
  1139. ++lexer->line;
  1140. lexer->column = 1;
  1141. }
  1142. YY_BREAK
  1143. case 20:
  1144. YY_RULE_SETUP
  1145. {
  1146. lexer->column += yyleng;
  1147. BEGIN(INITIAL);
  1148. return 1;
  1149. }
  1150. YY_BREAK
  1151. case 21:
  1152. YY_RULE_SETUP
  1153. {
  1154. if (memchr(yytext, '\0', yyleng) != NULL) {
  1155. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  1156. }
  1157. cmListFileLexerAppend(lexer, yytext, yyleng);
  1158. lexer->column += yyleng;
  1159. }
  1160. YY_BREAK
  1161. case YY_STATE_EOF(STRING):
  1162. {
  1163. lexer->token.type = cmListFileLexer_Token_BadString;
  1164. BEGIN(INITIAL);
  1165. return 1;
  1166. }
  1167. YY_BREAK
  1168. case 22:
  1169. YY_RULE_SETUP
  1170. {
  1171. lexer->token.type = cmListFileLexer_Token_Space;
  1172. cmListFileLexerSetToken(lexer, yytext, yyleng);
  1173. lexer->column += yyleng;
  1174. return 1;
  1175. }
  1176. YY_BREAK
  1177. case 23:
  1178. YY_RULE_SETUP
  1179. {
  1180. lexer->token.type = cmListFileLexer_Token_BadCharacter;
  1181. cmListFileLexerSetToken(lexer, yytext, yyleng);
  1182. lexer->column += yyleng;
  1183. return 1;
  1184. }
  1185. YY_BREAK
  1186. case YY_STATE_EOF(INITIAL):
  1187. case YY_STATE_EOF(COMMENT):
  1188. {
  1189. lexer->token.type = cmListFileLexer_Token_None;
  1190. cmListFileLexerSetToken(lexer, 0, 0);
  1191. return 0;
  1192. }
  1193. YY_BREAK
  1194. case 24:
  1195. YY_RULE_SETUP
  1196. ECHO;
  1197. YY_BREAK
  1198. case YY_END_OF_BUFFER:
  1199. {
  1200. /* Amount of text matched not including the EOB char. */
  1201. int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
  1202. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1203. *yy_cp = yyg->yy_hold_char;
  1204. YY_RESTORE_YY_MORE_OFFSET
  1205. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  1206. {
  1207. /* We're scanning a new file or input source. It's
  1208. * possible that this happened because the user
  1209. * just pointed yyin at a new source and called
  1210. * yylex(). If so, then we have to assure
  1211. * consistency between YY_CURRENT_BUFFER and our
  1212. * globals. Here is the right place to do so, because
  1213. * this is the first action (other than possibly a
  1214. * back-up) that will match for the new input source.
  1215. */
  1216. yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1217. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1218. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1219. }
  1220. /* Note that here we test for yy_c_buf_p "<=" to the position
  1221. * of the first EOB in the buffer, since yy_c_buf_p will
  1222. * already have been incremented past the NUL character
  1223. * (since all states make transitions on EOB to the
  1224. * end-of-buffer state). Contrast this with the test
  1225. * in input().
  1226. */
  1227. if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  1228. { /* This was really a NUL. */
  1229. yy_state_type yy_next_state;
  1230. yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
  1231. yy_current_state = yy_get_previous_state( yyscanner );
  1232. /* Okay, we're now positioned to make the NUL
  1233. * transition. We couldn't have
  1234. * yy_get_previous_state() go ahead and do it
  1235. * for us because it doesn't know how to deal
  1236. * with the possibility of jamming (and we don't
  1237. * want to build jamming into it because then it
  1238. * will run more slowly).
  1239. */
  1240. yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
  1241. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  1242. if ( yy_next_state )
  1243. {
  1244. /* Consume the NUL. */
  1245. yy_cp = ++yyg->yy_c_buf_p;
  1246. yy_current_state = yy_next_state;
  1247. goto yy_match;
  1248. }
  1249. else
  1250. {
  1251. yy_cp = yyg->yy_c_buf_p;
  1252. goto yy_find_action;
  1253. }
  1254. }
  1255. else switch ( yy_get_next_buffer( yyscanner ) )
  1256. {
  1257. case EOB_ACT_END_OF_FILE:
  1258. {
  1259. yyg->yy_did_buffer_switch_on_eof = 0;
  1260. if ( yywrap( yyscanner ) )
  1261. {
  1262. /* Note: because we've taken care in
  1263. * yy_get_next_buffer() to have set up
  1264. * yytext, we can now set up
  1265. * yy_c_buf_p so that if some total
  1266. * hoser (like flex itself) wants to
  1267. * call the scanner after we return the
  1268. * YY_NULL, it'll still work - another
  1269. * YY_NULL will get returned.
  1270. */
  1271. yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
  1272. yy_act = YY_STATE_EOF(YY_START);
  1273. goto do_action;
  1274. }
  1275. else
  1276. {
  1277. if ( ! yyg->yy_did_buffer_switch_on_eof )
  1278. YY_NEW_FILE;
  1279. }
  1280. break;
  1281. }
  1282. case EOB_ACT_CONTINUE_SCAN:
  1283. yyg->yy_c_buf_p =
  1284. yyg->yytext_ptr + yy_amount_of_matched_text;
  1285. yy_current_state = yy_get_previous_state( yyscanner );
  1286. yy_cp = yyg->yy_c_buf_p;
  1287. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  1288. goto yy_match;
  1289. case EOB_ACT_LAST_MATCH:
  1290. yyg->yy_c_buf_p =
  1291. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
  1292. yy_current_state = yy_get_previous_state( yyscanner );
  1293. yy_cp = yyg->yy_c_buf_p;
  1294. yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
  1295. goto yy_find_action;
  1296. }
  1297. break;
  1298. }
  1299. default:
  1300. YY_FATAL_ERROR(
  1301. "fatal flex scanner internal error--no action found" );
  1302. } /* end of action switch */
  1303. } /* end of scanning one token */
  1304. } /* end of user's declarations */
  1305. } /* end of yylex */
  1306. /* yy_get_next_buffer - try to read in a new buffer
  1307. *
  1308. * Returns a code representing an action:
  1309. * EOB_ACT_LAST_MATCH -
  1310. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1311. * EOB_ACT_END_OF_FILE - end of file
  1312. */
  1313. static int yy_get_next_buffer (yyscan_t yyscanner)
  1314. {
  1315. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1316. char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1317. char *source = yyg->yytext_ptr;
  1318. int number_to_move, i;
  1319. int ret_val;
  1320. if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
  1321. YY_FATAL_ERROR(
  1322. "fatal flex scanner internal error--end of buffer missed" );
  1323. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  1324. { /* Don't try to fill the buffer, so this is an EOF. */
  1325. if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
  1326. {
  1327. /* We matched a single character, the EOB, so
  1328. * treat this as a final EOF.
  1329. */
  1330. return EOB_ACT_END_OF_FILE;
  1331. }
  1332. else
  1333. {
  1334. /* We matched some text prior to the EOB, first
  1335. * process it.
  1336. */
  1337. return EOB_ACT_LAST_MATCH;
  1338. }
  1339. }
  1340. /* Try to read more data. */
  1341. /* First move last chars to start of buffer. */
  1342. number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
  1343. for ( i = 0; i < number_to_move; ++i )
  1344. *(dest++) = *(source++);
  1345. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1346. /* don't do the read, it's not guaranteed to return an EOF,
  1347. * just force an EOF
  1348. */
  1349. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
  1350. else
  1351. {
  1352. int num_to_read =
  1353. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1354. while ( num_to_read <= 0 )
  1355. { /* Not enough room in the buffer - grow it. */
  1356. /* just a shorter name for the current buffer */
  1357. YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
  1358. int yy_c_buf_p_offset =
  1359. (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
  1360. if ( b->yy_is_our_buffer )
  1361. {
  1362. int new_size = b->yy_buf_size * 2;
  1363. if ( new_size <= 0 )
  1364. b->yy_buf_size += b->yy_buf_size / 8;
  1365. else
  1366. b->yy_buf_size *= 2;
  1367. b->yy_ch_buf = (char *)
  1368. /* Include room in for 2 EOB chars. */
  1369. yyrealloc( (void *) b->yy_ch_buf,
  1370. (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
  1371. }
  1372. else
  1373. /* Can't grow it, we don't own it. */
  1374. b->yy_ch_buf = NULL;
  1375. if ( ! b->yy_ch_buf )
  1376. YY_FATAL_ERROR(
  1377. "fatal error - scanner input buffer overflow" );
  1378. yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  1379. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1380. number_to_move - 1;
  1381. }
  1382. if ( num_to_read > YY_READ_BUF_SIZE )
  1383. num_to_read = YY_READ_BUF_SIZE;
  1384. /* Read in more data. */
  1385. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1386. yyg->yy_n_chars, num_to_read );
  1387. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1388. }
  1389. if ( yyg->yy_n_chars == 0 )
  1390. {
  1391. if ( number_to_move == YY_MORE_ADJ )
  1392. {
  1393. ret_val = EOB_ACT_END_OF_FILE;
  1394. yyrestart( yyin , yyscanner);
  1395. }
  1396. else
  1397. {
  1398. ret_val = EOB_ACT_LAST_MATCH;
  1399. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1400. YY_BUFFER_EOF_PENDING;
  1401. }
  1402. }
  1403. else
  1404. ret_val = EOB_ACT_CONTINUE_SCAN;
  1405. if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1406. /* Extend the array by 50%, plus the number we really need. */
  1407. int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
  1408. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
  1409. (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
  1410. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1411. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1412. /* "- 2" to take care of EOB's */
  1413. YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
  1414. }
  1415. yyg->yy_n_chars += number_to_move;
  1416. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  1417. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  1418. yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1419. return ret_val;
  1420. }
  1421. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1422. static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
  1423. {
  1424. yy_state_type yy_current_state;
  1425. char *yy_cp;
  1426. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1427. yy_current_state = yyg->yy_start;
  1428. for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
  1429. {
  1430. YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1431. if ( yy_accept[yy_current_state] )
  1432. {
  1433. yyg->yy_last_accepting_state = yy_current_state;
  1434. yyg->yy_last_accepting_cpos = yy_cp;
  1435. }
  1436. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1437. {
  1438. yy_current_state = (int) yy_def[yy_current_state];
  1439. if ( yy_current_state >= 77 )
  1440. yy_c = yy_meta[yy_c];
  1441. }
  1442. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1443. }
  1444. return yy_current_state;
  1445. }
  1446. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1447. *
  1448. * synopsis
  1449. * next_state = yy_try_NUL_trans( current_state );
  1450. */
  1451. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
  1452. {
  1453. int yy_is_jam;
  1454. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
  1455. char *yy_cp = yyg->yy_c_buf_p;
  1456. YY_CHAR yy_c = 1;
  1457. if ( yy_accept[yy_current_state] )
  1458. {
  1459. yyg->yy_last_accepting_state = yy_current_state;
  1460. yyg->yy_last_accepting_cpos = yy_cp;
  1461. }
  1462. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1463. {
  1464. yy_current_state = (int) yy_def[yy_current_state];
  1465. if ( yy_current_state >= 77 )
  1466. yy_c = yy_meta[yy_c];
  1467. }
  1468. yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  1469. yy_is_jam = (yy_current_state == 76);
  1470. (void)yyg;
  1471. return yy_is_jam ? 0 : yy_current_state;
  1472. }
  1473. #ifndef YY_NO_UNPUT
  1474. static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
  1475. {
  1476. char *yy_cp;
  1477. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1478. yy_cp = yyg->yy_c_buf_p;
  1479. /* undo effects of setting up yytext */
  1480. *yy_cp = yyg->yy_hold_char;
  1481. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1482. { /* need to shift things up to make room */
  1483. /* +2 for EOB chars. */
  1484. int number_to_move = yyg->yy_n_chars + 2;
  1485. char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
  1486. YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
  1487. char *source =
  1488. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
  1489. while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1490. *--dest = *--source;
  1491. yy_cp += (int) (dest - source);
  1492. yy_bp += (int) (dest - source);
  1493. YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
  1494. yyg->yy_n_chars = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
  1495. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  1496. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  1497. }
  1498. *--yy_cp = (char) c;
  1499. if ( c == '\n' ){
  1500. --yylineno;
  1501. }
  1502. yyg->yytext_ptr = yy_bp;
  1503. yyg->yy_hold_char = *yy_cp;
  1504. yyg->yy_c_buf_p = yy_cp;
  1505. }
  1506. #endif
  1507. #ifndef YY_NO_INPUT
  1508. #ifdef __cplusplus
  1509. static int yyinput (yyscan_t yyscanner)
  1510. #else
  1511. static int input (yyscan_t yyscanner)
  1512. #endif
  1513. {
  1514. int c;
  1515. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1516. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1517. if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  1518. {
  1519. /* yy_c_buf_p now points to the character we want to return.
  1520. * If this occurs *before* the EOB characters, then it's a
  1521. * valid NUL; if not, then we've hit the end of the buffer.
  1522. */
  1523. if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
  1524. /* This was really a NUL. */
  1525. *yyg->yy_c_buf_p = '\0';
  1526. else
  1527. { /* need more input */
  1528. int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
  1529. ++yyg->yy_c_buf_p;
  1530. switch ( yy_get_next_buffer( yyscanner ) )
  1531. {
  1532. case EOB_ACT_LAST_MATCH:
  1533. /* This happens because yy_g_n_b()
  1534. * sees that we've accumulated a
  1535. * token and flags that we need to
  1536. * try matching the token before
  1537. * proceeding. But for input(),
  1538. * there's no matching to consider.
  1539. * So convert the EOB_ACT_LAST_MATCH
  1540. * to EOB_ACT_END_OF_FILE.
  1541. */
  1542. /* Reset buffer status. */
  1543. yyrestart( yyin , yyscanner);
  1544. /*FALLTHROUGH*/
  1545. case EOB_ACT_END_OF_FILE:
  1546. {
  1547. if ( yywrap( yyscanner ) )
  1548. return 0;
  1549. if ( ! yyg->yy_did_buffer_switch_on_eof )
  1550. YY_NEW_FILE;
  1551. #ifdef __cplusplus
  1552. return yyinput(yyscanner);
  1553. #else
  1554. return input(yyscanner);
  1555. #endif
  1556. }
  1557. case EOB_ACT_CONTINUE_SCAN:
  1558. yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
  1559. break;
  1560. }
  1561. }
  1562. }
  1563. c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
  1564. *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
  1565. yyg->yy_hold_char = *++yyg->yy_c_buf_p;
  1566. if ( c == '\n' )
  1567. do{ yylineno++;
  1568. yycolumn=0;
  1569. }while(0)
  1570. ;
  1571. return c;
  1572. }
  1573. #endif /* ifndef YY_NO_INPUT */
  1574. /** Immediately switch to a different input stream.
  1575. * @param input_file A readable stream.
  1576. * @param yyscanner The scanner object.
  1577. * @note This function does not reset the start condition to @c INITIAL .
  1578. */
  1579. void yyrestart (FILE * input_file , yyscan_t yyscanner)
  1580. {
  1581. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1582. if ( ! YY_CURRENT_BUFFER ){
  1583. yyensure_buffer_stack (yyscanner);
  1584. YY_CURRENT_BUFFER_LVALUE =
  1585. yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
  1586. }
  1587. yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
  1588. yy_load_buffer_state( yyscanner );
  1589. }
  1590. /** Switch to a different input buffer.
  1591. * @param new_buffer The new input buffer.
  1592. * @param yyscanner The scanner object.
  1593. */
  1594. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
  1595. {
  1596. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1597. /* TODO. We should be able to replace this entire function body
  1598. * with
  1599. * yypop_buffer_state();
  1600. * yypush_buffer_state(new_buffer);
  1601. */
  1602. yyensure_buffer_stack (yyscanner);
  1603. if ( YY_CURRENT_BUFFER == new_buffer )
  1604. return;
  1605. if ( YY_CURRENT_BUFFER )
  1606. {
  1607. /* Flush out information for old buffer. */
  1608. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1609. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  1610. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1611. }
  1612. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1613. yy_load_buffer_state( yyscanner );
  1614. /* We don't actually know whether we did this switch during
  1615. * EOF (yywrap()) processing, but the only time this flag
  1616. * is looked at is after yywrap() is called, so it's safe
  1617. * to go ahead and always set it.
  1618. */
  1619. yyg->yy_did_buffer_switch_on_eof = 1;
  1620. }
  1621. static void yy_load_buffer_state (yyscan_t yyscanner)
  1622. {
  1623. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1624. yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1625. yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1626. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1627. yyg->yy_hold_char = *yyg->yy_c_buf_p;
  1628. }
  1629. /** Allocate and initialize an input buffer state.
  1630. * @param file A readable stream.
  1631. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1632. * @param yyscanner The scanner object.
  1633. * @return the allocated buffer state.
  1634. */
  1635. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
  1636. {
  1637. YY_BUFFER_STATE b;
  1638. b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
  1639. if ( ! b )
  1640. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1641. b->yy_buf_size = size;
  1642. /* yy_ch_buf has to be 2 characters longer than the size given because
  1643. * we need to put in 2 end-of-buffer characters.
  1644. */
  1645. b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
  1646. if ( ! b->yy_ch_buf )
  1647. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1648. b->yy_is_our_buffer = 1;
  1649. yy_init_buffer( b, file , yyscanner);
  1650. return b;
  1651. }
  1652. /** Destroy the buffer.
  1653. * @param b a buffer created with yy_create_buffer()
  1654. * @param yyscanner The scanner object.
  1655. */
  1656. void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
  1657. {
  1658. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1659. if ( ! b )
  1660. return;
  1661. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1662. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1663. if ( b->yy_is_our_buffer )
  1664. yyfree( (void *) b->yy_ch_buf , yyscanner );
  1665. yyfree( (void *) b , yyscanner );
  1666. }
  1667. /* Initializes or reinitializes a buffer.
  1668. * This function is sometimes called more than once on the same buffer,
  1669. * such as during a yyrestart() or at EOF.
  1670. */
  1671. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
  1672. {
  1673. int oerrno = errno;
  1674. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1675. yy_flush_buffer( b , yyscanner);
  1676. b->yy_input_file = file;
  1677. b->yy_fill_buffer = 1;
  1678. /* If b is the current buffer, then yy_init_buffer was _probably_
  1679. * called from yyrestart() or through yy_get_next_buffer.
  1680. * In that case, we don't want to reset the lineno or column.
  1681. */
  1682. if (b != YY_CURRENT_BUFFER){
  1683. b->yy_bs_lineno = 1;
  1684. b->yy_bs_column = 0;
  1685. }
  1686. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1687. errno = oerrno;
  1688. }
  1689. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1690. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1691. * @param yyscanner The scanner object.
  1692. */
  1693. void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
  1694. {
  1695. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1696. if ( ! b )
  1697. return;
  1698. b->yy_n_chars = 0;
  1699. /* We always need two end-of-buffer characters. The first causes
  1700. * a transition to the end-of-buffer state. The second causes
  1701. * a jam in that state.
  1702. */
  1703. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1704. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1705. b->yy_buf_pos = &b->yy_ch_buf[0];
  1706. b->yy_at_bol = 1;
  1707. b->yy_buffer_status = YY_BUFFER_NEW;
  1708. if ( b == YY_CURRENT_BUFFER )
  1709. yy_load_buffer_state( yyscanner );
  1710. }
  1711. /** Pushes the new state onto the stack. The new state becomes
  1712. * the current state. This function will allocate the stack
  1713. * if necessary.
  1714. * @param new_buffer The new state.
  1715. * @param yyscanner The scanner object.
  1716. */
  1717. void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
  1718. {
  1719. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1720. if (new_buffer == NULL)
  1721. return;
  1722. yyensure_buffer_stack(yyscanner);
  1723. /* This block is copied from yy_switch_to_buffer. */
  1724. if ( YY_CURRENT_BUFFER )
  1725. {
  1726. /* Flush out information for old buffer. */
  1727. *yyg->yy_c_buf_p = yyg->yy_hold_char;
  1728. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
  1729. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
  1730. }
  1731. /* Only push if top exists. Otherwise, replace top. */
  1732. if (YY_CURRENT_BUFFER)
  1733. yyg->yy_buffer_stack_top++;
  1734. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1735. /* copied from yy_switch_to_buffer. */
  1736. yy_load_buffer_state( yyscanner );
  1737. yyg->yy_did_buffer_switch_on_eof = 1;
  1738. }
  1739. /** Removes and deletes the top of the stack, if present.
  1740. * The next element becomes the new top.
  1741. * @param yyscanner The scanner object.
  1742. */
  1743. void yypop_buffer_state (yyscan_t yyscanner)
  1744. {
  1745. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1746. if (!YY_CURRENT_BUFFER)
  1747. return;
  1748. yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
  1749. YY_CURRENT_BUFFER_LVALUE = NULL;
  1750. if (yyg->yy_buffer_stack_top > 0)
  1751. --yyg->yy_buffer_stack_top;
  1752. if (YY_CURRENT_BUFFER) {
  1753. yy_load_buffer_state( yyscanner );
  1754. yyg->yy_did_buffer_switch_on_eof = 1;
  1755. }
  1756. }
  1757. /* Allocates the stack if it does not exist.
  1758. * Guarantees space for at least one push.
  1759. */
  1760. static void yyensure_buffer_stack (yyscan_t yyscanner)
  1761. {
  1762. yy_size_t num_to_alloc;
  1763. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1764. if (!yyg->yy_buffer_stack) {
  1765. /* First allocation is just for 2 elements, since we don't know if this
  1766. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1767. * immediate realloc on the next call.
  1768. */
  1769. num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
  1770. yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
  1771. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1772. , yyscanner);
  1773. if ( ! yyg->yy_buffer_stack )
  1774. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1775. memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1776. yyg->yy_buffer_stack_max = num_to_alloc;
  1777. yyg->yy_buffer_stack_top = 0;
  1778. return;
  1779. }
  1780. if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
  1781. /* Increase the buffer to prepare for a possible push. */
  1782. yy_size_t grow_size = 8 /* arbitrary grow size */;
  1783. num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
  1784. yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
  1785. (yyg->yy_buffer_stack,
  1786. num_to_alloc * sizeof(struct yy_buffer_state*)
  1787. , yyscanner);
  1788. if ( ! yyg->yy_buffer_stack )
  1789. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1790. /* zero only the new slots.*/
  1791. memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
  1792. yyg->yy_buffer_stack_max = num_to_alloc;
  1793. }
  1794. }
  1795. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1796. * @param base the character buffer
  1797. * @param size the size in bytes of the character buffer
  1798. * @param yyscanner The scanner object.
  1799. * @return the newly allocated buffer state object.
  1800. */
  1801. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
  1802. {
  1803. YY_BUFFER_STATE b;
  1804. if ( size < 2 ||
  1805. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1806. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1807. /* They forgot to leave room for the EOB's. */
  1808. return NULL;
  1809. b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
  1810. if ( ! b )
  1811. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1812. b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
  1813. b->yy_buf_pos = b->yy_ch_buf = base;
  1814. b->yy_is_our_buffer = 0;
  1815. b->yy_input_file = NULL;
  1816. b->yy_n_chars = b->yy_buf_size;
  1817. b->yy_is_interactive = 0;
  1818. b->yy_at_bol = 1;
  1819. b->yy_fill_buffer = 0;
  1820. b->yy_buffer_status = YY_BUFFER_NEW;
  1821. yy_switch_to_buffer( b , yyscanner );
  1822. return b;
  1823. }
  1824. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1825. * scan from a @e copy of @a str.
  1826. * @param yystr a NUL-terminated string to scan
  1827. * @param yyscanner The scanner object.
  1828. * @return the newly allocated buffer state object.
  1829. * @note If you want to scan bytes that may contain NUL values, then use
  1830. * yy_scan_bytes() instead.
  1831. */
  1832. YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
  1833. {
  1834. return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
  1835. }
  1836. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1837. * scan from a @e copy of @a bytes.
  1838. * @param yybytes the byte buffer to scan
  1839. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  1840. * @param yyscanner The scanner object.
  1841. * @return the newly allocated buffer state object.
  1842. */
  1843. YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
  1844. {
  1845. YY_BUFFER_STATE b;
  1846. char *buf;
  1847. yy_size_t n;
  1848. int i;
  1849. /* Get memory for full buffer, including space for trailing EOB's. */
  1850. n = (yy_size_t) (_yybytes_len + 2);
  1851. buf = (char *) yyalloc( n , yyscanner );
  1852. if ( ! buf )
  1853. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1854. for ( i = 0; i < _yybytes_len; ++i )
  1855. buf[i] = yybytes[i];
  1856. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  1857. b = yy_scan_buffer( buf, n , yyscanner);
  1858. if ( ! b )
  1859. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1860. /* It's okay to grow etc. this buffer, and we should throw it
  1861. * away when we're done.
  1862. */
  1863. b->yy_is_our_buffer = 1;
  1864. return b;
  1865. }
  1866. #ifndef YY_EXIT_FAILURE
  1867. #define YY_EXIT_FAILURE 2
  1868. #endif
  1869. static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
  1870. {
  1871. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1872. (void)yyg;
  1873. fprintf( stderr, "%s\n", msg );
  1874. exit( YY_EXIT_FAILURE );
  1875. }
  1876. /* Redefine yyless() so it works in section 3 code. */
  1877. #undef yyless
  1878. #define yyless(n) \
  1879. do \
  1880. { \
  1881. /* Undo effects of setting up yytext. */ \
  1882. int yyless_macro_arg = (n); \
  1883. YY_LESS_LINENO(yyless_macro_arg);\
  1884. yytext[yyleng] = yyg->yy_hold_char; \
  1885. yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
  1886. yyg->yy_hold_char = *yyg->yy_c_buf_p; \
  1887. *yyg->yy_c_buf_p = '\0'; \
  1888. yyleng = yyless_macro_arg; \
  1889. } \
  1890. while ( 0 )
  1891. /* Accessor methods (get/set functions) to struct members. */
  1892. /** Get the user-defined data for this scanner.
  1893. * @param yyscanner The scanner object.
  1894. */
  1895. YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
  1896. {
  1897. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1898. return yyextra;
  1899. }
  1900. /** Get the current line number.
  1901. * @param yyscanner The scanner object.
  1902. */
  1903. int yyget_lineno (yyscan_t yyscanner)
  1904. {
  1905. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1906. if (! YY_CURRENT_BUFFER)
  1907. return 0;
  1908. return yylineno;
  1909. }
  1910. /** Get the current column number.
  1911. * @param yyscanner The scanner object.
  1912. */
  1913. int yyget_column (yyscan_t yyscanner)
  1914. {
  1915. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1916. if (! YY_CURRENT_BUFFER)
  1917. return 0;
  1918. return yycolumn;
  1919. }
  1920. /** Get the input stream.
  1921. * @param yyscanner The scanner object.
  1922. */
  1923. FILE *yyget_in (yyscan_t yyscanner)
  1924. {
  1925. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1926. return yyin;
  1927. }
  1928. /** Get the output stream.
  1929. * @param yyscanner The scanner object.
  1930. */
  1931. FILE *yyget_out (yyscan_t yyscanner)
  1932. {
  1933. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1934. return yyout;
  1935. }
  1936. /** Get the length of the current token.
  1937. * @param yyscanner The scanner object.
  1938. */
  1939. int yyget_leng (yyscan_t yyscanner)
  1940. {
  1941. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1942. return yyleng;
  1943. }
  1944. /** Get the current token.
  1945. * @param yyscanner The scanner object.
  1946. */
  1947. char *yyget_text (yyscan_t yyscanner)
  1948. {
  1949. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1950. return yytext;
  1951. }
  1952. /** Set the user-defined data. This data is never touched by the scanner.
  1953. * @param user_defined The data to be associated with this scanner.
  1954. * @param yyscanner The scanner object.
  1955. */
  1956. void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
  1957. {
  1958. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1959. yyextra = user_defined ;
  1960. }
  1961. /** Set the current line number.
  1962. * @param _line_number line number
  1963. * @param yyscanner The scanner object.
  1964. */
  1965. void yyset_lineno (int _line_number , yyscan_t yyscanner)
  1966. {
  1967. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1968. /* lineno is only valid if an input buffer exists. */
  1969. if (! YY_CURRENT_BUFFER )
  1970. YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
  1971. yylineno = _line_number;
  1972. }
  1973. /** Set the current column.
  1974. * @param _column_no column number
  1975. * @param yyscanner The scanner object.
  1976. */
  1977. void yyset_column (int _column_no , yyscan_t yyscanner)
  1978. {
  1979. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1980. /* column is only valid if an input buffer exists. */
  1981. if (! YY_CURRENT_BUFFER )
  1982. YY_FATAL_ERROR( "yyset_column called with no buffer" );
  1983. yycolumn = _column_no;
  1984. }
  1985. /** Set the input stream. This does not discard the current
  1986. * input buffer.
  1987. * @param _in_str A readable stream.
  1988. * @param yyscanner The scanner object.
  1989. * @see yy_switch_to_buffer
  1990. */
  1991. void yyset_in (FILE * _in_str , yyscan_t yyscanner)
  1992. {
  1993. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1994. yyin = _in_str ;
  1995. }
  1996. void yyset_out (FILE * _out_str , yyscan_t yyscanner)
  1997. {
  1998. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  1999. yyout = _out_str ;
  2000. }
  2001. int yyget_debug (yyscan_t yyscanner)
  2002. {
  2003. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2004. return yy_flex_debug;
  2005. }
  2006. void yyset_debug (int _bdebug , yyscan_t yyscanner)
  2007. {
  2008. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2009. yy_flex_debug = _bdebug ;
  2010. }
  2011. /* Accessor methods for yylval and yylloc */
  2012. /* User-visible API */
  2013. /* yylex_init is special because it creates the scanner itself, so it is
  2014. * the ONLY reentrant function that doesn't take the scanner as the last argument.
  2015. * That's why we explicitly handle the declaration, instead of using our macros.
  2016. */
  2017. int yylex_init(yyscan_t* ptr_yy_globals)
  2018. {
  2019. if (ptr_yy_globals == NULL){
  2020. errno = EINVAL;
  2021. return 1;
  2022. }
  2023. *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
  2024. if (*ptr_yy_globals == NULL){
  2025. errno = ENOMEM;
  2026. return 1;
  2027. }
  2028. /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
  2029. memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
  2030. return yy_init_globals ( *ptr_yy_globals );
  2031. }
  2032. /* yylex_init_extra has the same functionality as yylex_init, but follows the
  2033. * convention of taking the scanner as the last argument. Note however, that
  2034. * this is a *pointer* to a scanner, as it will be allocated by this call (and
  2035. * is the reason, too, why this function also must handle its own declaration).
  2036. * The user defined value in the first argument will be available to yyalloc in
  2037. * the yyextra field.
  2038. */
  2039. int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
  2040. {
  2041. struct yyguts_t dummy_yyguts;
  2042. yyset_extra (yy_user_defined, &dummy_yyguts);
  2043. if (ptr_yy_globals == NULL){
  2044. errno = EINVAL;
  2045. return 1;
  2046. }
  2047. *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
  2048. if (*ptr_yy_globals == NULL){
  2049. errno = ENOMEM;
  2050. return 1;
  2051. }
  2052. /* By setting to 0xAA, we expose bugs in
  2053. yy_init_globals. Leave at 0x00 for releases. */
  2054. memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
  2055. yyset_extra (yy_user_defined, *ptr_yy_globals);
  2056. return yy_init_globals ( *ptr_yy_globals );
  2057. }
  2058. static int yy_init_globals (yyscan_t yyscanner)
  2059. {
  2060. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2061. /* Initialization is the same as for the non-reentrant scanner.
  2062. * This function is called from yylex_destroy(), so don't allocate here.
  2063. */
  2064. yyg->yy_buffer_stack = NULL;
  2065. yyg->yy_buffer_stack_top = 0;
  2066. yyg->yy_buffer_stack_max = 0;
  2067. yyg->yy_c_buf_p = NULL;
  2068. yyg->yy_init = 0;
  2069. yyg->yy_start = 0;
  2070. yyg->yy_start_stack_ptr = 0;
  2071. yyg->yy_start_stack_depth = 0;
  2072. yyg->yy_start_stack = NULL;
  2073. /* Defined in main.c */
  2074. #ifdef YY_STDINIT
  2075. yyin = stdin;
  2076. yyout = stdout;
  2077. #else
  2078. yyin = NULL;
  2079. yyout = NULL;
  2080. #endif
  2081. /* For future reference: Set errno on error, since we are called by
  2082. * yylex_init()
  2083. */
  2084. return 0;
  2085. }
  2086. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  2087. int yylex_destroy (yyscan_t yyscanner)
  2088. {
  2089. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2090. /* Pop the buffer stack, destroying each element. */
  2091. while(YY_CURRENT_BUFFER){
  2092. yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
  2093. YY_CURRENT_BUFFER_LVALUE = NULL;
  2094. yypop_buffer_state(yyscanner);
  2095. }
  2096. /* Destroy the stack itself. */
  2097. yyfree(yyg->yy_buffer_stack , yyscanner);
  2098. yyg->yy_buffer_stack = NULL;
  2099. /* Destroy the start condition stack. */
  2100. yyfree( yyg->yy_start_stack , yyscanner );
  2101. yyg->yy_start_stack = NULL;
  2102. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  2103. * yylex() is called, initialization will occur. */
  2104. yy_init_globals( yyscanner);
  2105. /* Destroy the main struct (reentrant only). */
  2106. yyfree ( yyscanner , yyscanner );
  2107. yyscanner = NULL;
  2108. return 0;
  2109. }
  2110. /*
  2111. * Internal utility routines.
  2112. */
  2113. #ifndef yytext_ptr
  2114. static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
  2115. {
  2116. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2117. (void)yyg;
  2118. int i;
  2119. for ( i = 0; i < n; ++i )
  2120. s1[i] = s2[i];
  2121. }
  2122. #endif
  2123. #ifdef YY_NEED_STRLEN
  2124. static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
  2125. {
  2126. int n;
  2127. for ( n = 0; s[n]; ++n )
  2128. ;
  2129. return n;
  2130. }
  2131. #endif
  2132. void *yyalloc (yy_size_t size , yyscan_t yyscanner)
  2133. {
  2134. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2135. (void)yyg;
  2136. return malloc(size);
  2137. }
  2138. void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
  2139. {
  2140. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2141. (void)yyg;
  2142. /* The cast to (char *) in the following accommodates both
  2143. * implementations that use char* generic pointers, and those
  2144. * that use void* generic pointers. It works with the latter
  2145. * because both ANSI C and C++ allow castless assignment from
  2146. * any pointer type to void*, and deal with argument conversions
  2147. * as though doing an assignment.
  2148. */
  2149. return realloc(ptr, size);
  2150. }
  2151. void yyfree (void * ptr , yyscan_t yyscanner)
  2152. {
  2153. struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
  2154. (void)yyg;
  2155. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  2156. }
  2157. #define YYTABLES_NAME "yytables"
  2158. /*--------------------------------------------------------------------------*/
  2159. static void cmListFileLexerSetToken(cmListFileLexer* lexer, const char* text,
  2160. size_t length)
  2161. {
  2162. /* Set the token line and column number. */
  2163. lexer->token.line = lexer->line;
  2164. lexer->token.column = lexer->column;
  2165. /* Use the same buffer if possible. */
  2166. if (lexer->token.text) {
  2167. if (text && length < lexer->size) {
  2168. memcpy(lexer->token.text, text, length);
  2169. lexer->token.length = length;
  2170. return;
  2171. }
  2172. free(lexer->token.text);
  2173. lexer->token.text = 0;
  2174. lexer->size = 0;
  2175. }
  2176. /* Need to extend the buffer. */
  2177. if (length > 0) {
  2178. lexer->token.text = (char*)malloc(length);
  2179. memcpy(lexer->token.text, text, length);
  2180. lexer->token.length = length;
  2181. lexer->size = length;
  2182. } else {
  2183. lexer->token.length = 0;
  2184. }
  2185. }
  2186. /*--------------------------------------------------------------------------*/
  2187. static void cmListFileLexerAppend(cmListFileLexer* lexer, const char* text,
  2188. size_t length)
  2189. {
  2190. char* temp;
  2191. size_t newSize;
  2192. /* If the appended text will fit in the buffer, do not reallocate. */
  2193. newSize = lexer->token.length + length;
  2194. if (lexer->token.text && newSize <= lexer->size) {
  2195. memcpy(lexer->token.text + lexer->token.length, text, length);
  2196. lexer->token.length += length;
  2197. return;
  2198. }
  2199. /* We need to extend the buffer. */
  2200. temp = malloc(newSize);
  2201. if (lexer->token.text) {
  2202. memcpy(temp, lexer->token.text, lexer->token.length);
  2203. free(lexer->token.text);
  2204. }
  2205. memcpy(temp + lexer->token.length, text, length);
  2206. lexer->token.text = temp;
  2207. lexer->token.length += length;
  2208. lexer->size = newSize;
  2209. }
  2210. /*--------------------------------------------------------------------------*/
  2211. static int cmListFileLexerInput(cmListFileLexer* lexer, char* buffer,
  2212. size_t bufferSize)
  2213. {
  2214. if (lexer) {
  2215. if (lexer->file) {
  2216. /* Convert CRLF -> LF explicitly. The C FILE "t"ext mode
  2217. does not convert newlines on all platforms. Move any
  2218. trailing CR to the start of the buffer for the next read. */
  2219. size_t cr = lexer->cr;
  2220. size_t n = 0;
  2221. buffer[0] = '\r';
  2222. size_t actualBufferSize = bufferSize - cr;
  2223. char* p = buffer + cr;
  2224. size_t readLeft = lexer->read_size - lexer->read_position;
  2225. /* Absorb the bytes that were read during BOM detection, if any. */
  2226. if (readLeft > 0) {
  2227. size_t actualReadSize =
  2228. actualBufferSize >= readLeft ? readLeft : actualBufferSize;
  2229. memcpy(p, lexer->read_buffer + lexer->read_position, actualReadSize);
  2230. lexer->read_position += actualReadSize;
  2231. p += actualReadSize;
  2232. n += actualReadSize;
  2233. actualBufferSize -= actualReadSize;
  2234. }
  2235. n += fread(p, 1, actualBufferSize, lexer->file);
  2236. if (n) {
  2237. char* o = buffer;
  2238. const char* i = buffer;
  2239. const char* e;
  2240. n += cr;
  2241. cr = (buffer[n - 1] == '\r') ? 1 : 0;
  2242. e = buffer + n - cr;
  2243. while (i != e) {
  2244. if (i[0] == '\r' && i[1] == '\n') {
  2245. ++i;
  2246. }
  2247. *o++ = *i++;
  2248. }
  2249. n = o - buffer;
  2250. } else {
  2251. n = cr;
  2252. cr = 0;
  2253. }
  2254. lexer->cr = cr;
  2255. return n;
  2256. } else if (lexer->string_left) {
  2257. size_t length = lexer->string_left;
  2258. if (bufferSize < length) {
  2259. length = bufferSize;
  2260. }
  2261. memcpy(buffer, lexer->string_position, length);
  2262. lexer->string_position += length;
  2263. lexer->string_left -= length;
  2264. return length;
  2265. }
  2266. }
  2267. return 0;
  2268. }
  2269. /*--------------------------------------------------------------------------*/
  2270. static void cmListFileLexerInit(cmListFileLexer* lexer)
  2271. {
  2272. if (lexer->file || lexer->string_buffer) {
  2273. cmListFileLexer_yylex_init(&lexer->scanner);
  2274. cmListFileLexer_yyset_extra(lexer, lexer->scanner);
  2275. }
  2276. }
  2277. /*--------------------------------------------------------------------------*/
  2278. static void cmListFileLexerDestroy(cmListFileLexer* lexer)
  2279. {
  2280. cmListFileLexerSetToken(lexer, 0, 0);
  2281. if (lexer->file || lexer->string_buffer) {
  2282. cmListFileLexer_yylex_destroy(lexer->scanner);
  2283. if (lexer->file) {
  2284. fclose(lexer->file);
  2285. lexer->file = 0;
  2286. }
  2287. if (lexer->read_size != 0) {
  2288. memset(lexer->read_buffer, 0, sizeof(lexer->read_buffer));
  2289. lexer->read_size = 0;
  2290. lexer->read_position = 0;
  2291. }
  2292. if (lexer->string_buffer) {
  2293. free(lexer->string_buffer);
  2294. lexer->string_buffer = 0;
  2295. lexer->string_left = 0;
  2296. lexer->string_position = 0;
  2297. }
  2298. }
  2299. }
  2300. /*--------------------------------------------------------------------------*/
  2301. cmListFileLexer* cmListFileLexer_New(void)
  2302. {
  2303. cmListFileLexer* lexer = (cmListFileLexer*)malloc(sizeof(cmListFileLexer));
  2304. if (!lexer) {
  2305. return 0;
  2306. }
  2307. memset(lexer, 0, sizeof(*lexer));
  2308. lexer->line = 1;
  2309. lexer->column = 1;
  2310. return lexer;
  2311. }
  2312. /*--------------------------------------------------------------------------*/
  2313. void cmListFileLexer_Delete(cmListFileLexer* lexer)
  2314. {
  2315. cmListFileLexer_SetFileName(lexer, 0, 0);
  2316. free(lexer);
  2317. }
  2318. /*--------------------------------------------------------------------------*/
  2319. static cmListFileLexer_BOM cmListFileLexer_ReadBOM(FILE* f,
  2320. unsigned char readBuffer[4],
  2321. size_t* readSize)
  2322. {
  2323. /* Read the up to four bytes that might correspond to a BOM. In case these
  2324. bytes turn out not to represent a BOM, save them for later consumption in
  2325. order to avoid seeking the file (which might not be seekable, e.g., if
  2326. it's a pipe). */
  2327. unsigned char* b = readBuffer;
  2328. size_t n = fread(b, 1, 2, f);
  2329. *readSize = n; /* Initialize first and then accumulate */
  2330. if (n == 2) {
  2331. if (b[0] == 0xEF && b[1] == 0xBB) {
  2332. n = fread(b + 2, 1, 1, f);
  2333. *readSize += n;
  2334. if (n == 1) {
  2335. if (b[2] == 0xBF) {
  2336. *readSize = 0; /* We consumed the BOM: discard it */
  2337. return cmListFileLexer_BOM_UTF8;
  2338. }
  2339. }
  2340. } else if (b[0] == 0xFE && b[1] == 0xFF) {
  2341. *readSize = 0; /* We consumed the BOM: discard it */
  2342. /* UTF-16 BE */
  2343. return cmListFileLexer_BOM_UTF16BE;
  2344. } else if (b[0] == 0 && b[1] == 0) {
  2345. n = fread(b + 2, 1, 2, f);
  2346. *readSize += n;
  2347. if (n == 2) {
  2348. if (b[2] == 0xFE && b[3] == 0xFF) {
  2349. *readSize = 0; /* We consumed the BOM: discard it */
  2350. return cmListFileLexer_BOM_UTF32BE;
  2351. }
  2352. }
  2353. } else if (b[0] == 0xFF && b[1] == 0xFE) {
  2354. n = fread(b + 2, 1, 2, f);
  2355. *readSize += n;
  2356. if (n == 2 && b[2] == 0 && b[3] == 0) {
  2357. *readSize = 0; /* We consumed the BOM: discard it */
  2358. return cmListFileLexer_BOM_UTF32LE;
  2359. }
  2360. /* In case we were able to subsequently read only a single byte out of two
  2361. (i.e., three in total), the file must be corrupt and the BOM cannot
  2362. represent a UTF-16-LE BOM since each code unit must consist of two
  2363. bytes. This avoids incorrectly detecting an incomplete UTF-32-LE BOM as
  2364. UTF-16-LE input. */
  2365. if (n % 2 == 0) {
  2366. *readSize = n; /* We consumed the read bytes as BOM only partially */
  2367. memmove(b, b + 2, n);
  2368. return cmListFileLexer_BOM_UTF16LE;
  2369. }
  2370. }
  2371. }
  2372. return cmListFileLexer_BOM_None;
  2373. }
  2374. /*--------------------------------------------------------------------------*/
  2375. int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name,
  2376. cmListFileLexer_BOM* bom)
  2377. {
  2378. int result = 1;
  2379. cmListFileLexerDestroy(lexer);
  2380. if (name) {
  2381. #ifdef _WIN32
  2382. wchar_t* wname = cmsysEncoding_DupToWide(name);
  2383. lexer->file = _wfopen(wname, L"rb");
  2384. free(wname);
  2385. #else
  2386. lexer->file = fopen(name, "rb");
  2387. #endif
  2388. if (lexer->file) {
  2389. if (bom) {
  2390. *bom = cmListFileLexer_ReadBOM(
  2391. lexer->file, (unsigned char*)lexer->read_buffer, &lexer->read_size);
  2392. lexer->read_position = 0;
  2393. } else {
  2394. memset(lexer->read_buffer, 0, sizeof(lexer->read_buffer));
  2395. lexer->read_size = 0;
  2396. lexer->read_position = 0;
  2397. }
  2398. } else {
  2399. result = 0;
  2400. }
  2401. }
  2402. cmListFileLexerInit(lexer);
  2403. return result;
  2404. }
  2405. /*--------------------------------------------------------------------------*/
  2406. int cmListFileLexer_SetString(cmListFileLexer* lexer, char const* text,
  2407. size_t length)
  2408. {
  2409. int result = 1;
  2410. cmListFileLexerDestroy(lexer);
  2411. /* text might be not NULL while length is 0. However, on some platforms
  2412. malloc(0) will return NULL. To avoid signaling an error to the caller in
  2413. such cases, ensure nonzero length. */
  2414. size_t read_size = lexer->read_size - lexer->read_position;
  2415. size_t string_size = read_size + length;
  2416. if (string_size > 0) {
  2417. lexer->string_buffer = (char*)malloc(string_size);
  2418. if (lexer->string_buffer) {
  2419. memcpy(lexer->string_buffer, lexer->read_buffer + lexer->read_position,
  2420. read_size);
  2421. memcpy(lexer->string_buffer + read_size, text, length);
  2422. lexer->read_position += read_size;
  2423. lexer->string_position = lexer->string_buffer;
  2424. lexer->string_left = length;
  2425. } else {
  2426. result = 0;
  2427. }
  2428. }
  2429. cmListFileLexerInit(lexer);
  2430. return result;
  2431. }
  2432. /*--------------------------------------------------------------------------*/
  2433. cmListFileLexer_Token* cmListFileLexer_Scan(cmListFileLexer* lexer)
  2434. {
  2435. if (!lexer->file && !lexer->string_buffer) {
  2436. return 0;
  2437. }
  2438. if (cmListFileLexer_yylex(lexer->scanner, lexer)) {
  2439. return &lexer->token;
  2440. } else {
  2441. cmListFileLexer_SetFileName(lexer, 0, 0);
  2442. return 0;
  2443. }
  2444. }
  2445. /*--------------------------------------------------------------------------*/
  2446. long cmListFileLexer_GetCurrentLine(cmListFileLexer* lexer)
  2447. {
  2448. return lexer->line;
  2449. }
  2450. /*--------------------------------------------------------------------------*/
  2451. long cmListFileLexer_GetCurrentColumn(cmListFileLexer* lexer)
  2452. {
  2453. return lexer->column;
  2454. }
  2455. /*--------------------------------------------------------------------------*/
  2456. const char* cmListFileLexer_GetTypeAsString(cmListFileLexer* lexer,
  2457. cmListFileLexer_Type type)
  2458. {
  2459. (void)lexer;
  2460. switch (type) {
  2461. case cmListFileLexer_Token_None:
  2462. return "nothing";
  2463. case cmListFileLexer_Token_Space:
  2464. return "space";
  2465. case cmListFileLexer_Token_Newline:
  2466. return "newline";
  2467. case cmListFileLexer_Token_Identifier:
  2468. return "identifier";
  2469. case cmListFileLexer_Token_ParenLeft:
  2470. return "left paren";
  2471. case cmListFileLexer_Token_ParenRight:
  2472. return "right paren";
  2473. case cmListFileLexer_Token_ArgumentUnquoted:
  2474. return "unquoted argument";
  2475. case cmListFileLexer_Token_ArgumentQuoted:
  2476. return "quoted argument";
  2477. case cmListFileLexer_Token_ArgumentBracket:
  2478. return "bracket argument";
  2479. case cmListFileLexer_Token_CommentBracket:
  2480. return "bracket comment";
  2481. case cmListFileLexer_Token_BadCharacter:
  2482. return "bad character";
  2483. case cmListFileLexer_Token_BadBracket:
  2484. return "unterminated bracket";
  2485. case cmListFileLexer_Token_BadString:
  2486. return "unterminated string";
  2487. }
  2488. return "unknown token";
  2489. }