scanner.c 67 KB

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