lexer.cc 70 KB

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