scanner.c 67 KB

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