lexer.cc 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276
  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 19
  361. #define YY_END_OF_BUFFER 20
  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_accept[52] =
  370. { 0,
  371. 0, 0, 20, 18, 1, 2, 18, 13, 14, 17,
  372. 18, 12, 5, 5, 18, 15, 16, 18, 18, 18,
  373. 18, 18, 1, 2, 0, 3, 5, 0, 6, 0,
  374. 0, 0, 0, 0, 4, 11, 9, 0, 0, 0,
  375. 0, 0, 8, 0, 0, 7, 0, 0, 0, 10,
  376. 0
  377. } ;
  378. static yyconst flex_int32_t yy_ec[256] =
  379. { 0,
  380. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  381. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  382. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  383. 1, 2, 1, 1, 1, 1, 1, 1, 4, 5,
  384. 6, 1, 1, 7, 8, 9, 1, 10, 11, 11,
  385. 11, 11, 11, 11, 11, 11, 11, 1, 1, 1,
  386. 12, 1, 1, 1, 13, 13, 13, 13, 13, 13,
  387. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  388. 1, 1, 1, 1, 1, 1, 1, 14, 1, 1,
  389. 15, 1, 16, 1, 1, 1, 17, 18, 13, 13,
  390. 19, 13, 20, 21, 22, 1, 1, 23, 1, 24,
  391. 25, 26, 1, 27, 28, 29, 30, 1, 1, 31,
  392. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  393. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  394. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  395. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  396. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  397. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  398. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  399. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  400. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  401. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  402. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  403. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  404. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  405. 1, 1, 1, 1, 1
  406. } ;
  407. static yyconst flex_int32_t yy_meta[32] =
  408. { 0,
  409. 1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
  410. 3, 1, 3, 1, 1, 1, 3, 3, 3, 1,
  411. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  412. 1
  413. } ;
  414. static yyconst flex_int16_t yy_base[54] =
  415. { 0,
  416. 0, 0, 72, 73, 69, 67, 65, 73, 73, 73,
  417. 22, 73, 24, 26, 56, 73, 73, 44, 47, 39,
  418. 34, 44, 60, 58, 56, 73, 29, 0, 73, 36,
  419. 26, 25, 35, 21, 0, 73, 73, 29, 22, 20,
  420. 23, 18, 73, 22, 18, 73, 22, 19, 22, 73,
  421. 73, 55, 38
  422. } ;
  423. static yyconst flex_int16_t yy_def[54] =
  424. { 0,
  425. 51, 1, 51, 51, 51, 51, 52, 51, 51, 51,
  426. 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
  427. 51, 51, 51, 51, 52, 51, 51, 53, 51, 51,
  428. 51, 51, 51, 51, 53, 51, 51, 51, 51, 51,
  429. 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
  430. 0, 51, 51
  431. } ;
  432. static yyconst flex_int16_t yy_nxt[105] =
  433. { 0,
  434. 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
  435. 14, 15, 4, 4, 16, 17, 18, 4, 4, 4,
  436. 19, 4, 4, 4, 20, 4, 4, 21, 22, 4,
  437. 4, 27, 27, 27, 27, 27, 27, 28, 27, 27,
  438. 35, 50, 49, 48, 47, 46, 45, 44, 43, 42,
  439. 41, 40, 39, 38, 28, 25, 37, 25, 36, 26,
  440. 24, 23, 34, 33, 32, 31, 30, 29, 26, 24,
  441. 23, 51, 3, 51, 51, 51, 51, 51, 51, 51,
  442. 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
  443. 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
  444. 51, 51, 51, 51
  445. } ;
  446. static yyconst flex_int16_t yy_chk[105] =
  447. { 0,
  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, 1, 1, 1, 1, 1,
  451. 1, 11, 11, 13, 13, 14, 14, 13, 27, 27,
  452. 53, 49, 48, 47, 45, 44, 42, 41, 40, 39,
  453. 38, 34, 33, 32, 13, 52, 31, 52, 30, 25,
  454. 24, 23, 22, 21, 20, 19, 18, 15, 7, 6,
  455. 5, 3, 51, 51, 51, 51, 51, 51, 51, 51,
  456. 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
  457. 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
  458. 51, 51, 51, 51
  459. } ;
  460. /* Table of booleans, true if rule could match eol. */
  461. static yyconst flex_int32_t yy_rule_can_match_eol[20] =
  462. { 0,
  463. 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  464. };
  465. static yy_state_type yy_last_accepting_state;
  466. static char *yy_last_accepting_cpos;
  467. extern int yy_flex_debug;
  468. int yy_flex_debug = 1;
  469. static yyconst flex_int16_t yy_rule_linenum[19] =
  470. { 0,
  471. 83, 87, 93, 103, 109, 123, 124, 125, 126, 127,
  472. 128, 129, 130, 131, 132, 133, 134, 136
  473. } ;
  474. /* The intent behind this definition is that it'll catch
  475. * any uses of REJECT which flex missed.
  476. */
  477. #define REJECT reject_used_but_not_detected
  478. #define yymore() yymore_used_but_not_detected
  479. #define YY_MORE_ADJ 0
  480. #define YY_RESTORE_YY_MORE_OFFSET
  481. char *yytext;
  482. #line 1 "lexer.ll"
  483. /* Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
  484. Permission to use, copy, modify, and/or distribute this software for any
  485. purpose with or without fee is hereby granted, provided that the above
  486. copyright notice and this permission notice appear in all copies.
  487. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  488. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  489. AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  490. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  491. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  492. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  493. PERFORMANCE OF THIS SOFTWARE. */
  494. #line 16 "lexer.ll"
  495. #include <cerrno>
  496. #include <climits>
  497. #include <cstdlib>
  498. #include <string>
  499. #include <eval/eval_context.h>
  500. #include <eval/parser.h>
  501. #include <boost/lexical_cast.hpp>
  502. // Work around an incompatibility in flex (at least versions
  503. // 2.5.31 through 2.5.33): it generates code that does
  504. // not conform to C89. See Debian bug 333231
  505. // <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>.
  506. # undef yywrap
  507. # define yywrap() 1
  508. // The location of the current token. The lexer will keep updating it. This
  509. // variable will be useful for logging errors.
  510. static isc::eval::location loc;
  511. /* noyywrap disables automatic rewinding for the next file to parse. Since we
  512. always parse only a single string, there's no need to do any wraps. And
  513. using yywrap requires linking with -lfl, which provides the default yywrap
  514. implementation that always returns 1 anyway. */
  515. /* nounput simplifies the lexer, by removing support for putting a character
  516. back into the input stream. We never use such capability anyway. */
  517. /* batch means that we'll never use the generated lexer interactively. */
  518. /* Enables debug mode. To see the debug messages, one needs to also set
  519. yy_flex_debug to 1, then the debug messages will be printed on stderr. */
  520. /* I have no idea what this option does, except it was specified in the bison
  521. examples and Postgres folks added it to remove gcc 4.3 warnings. Let's
  522. be on the safe side and keep it. */
  523. #define YY_NO_INPUT 1
  524. /* This line tells flex to track the line numbers. It's not really that
  525. useful for client classes, which typically are one-liners, but it may be
  526. useful in more complex cases. */
  527. /* These are not token expressions yet, just convenience expressions that
  528. can be used during actual token definitions. */
  529. #line 70 "lexer.ll"
  530. // This code run each time a pattern is matched. It updates the location
  531. // by moving it ahead by yyleng bytes. yyleng specifies the length of the
  532. // currently matched token.
  533. #define YY_USER_ACTION loc.columns(yyleng);
  534. #line 657 "lexer.cc"
  535. #define INITIAL 0
  536. #ifndef YY_NO_UNISTD_H
  537. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  538. * down here because we want the user's section 1 to have been scanned first.
  539. * The user has a chance to override it with an option.
  540. */
  541. /* %if-c-only */
  542. #include <unistd.h>
  543. /* %endif */
  544. /* %if-c++-only */
  545. /* %endif */
  546. #endif
  547. #ifndef YY_EXTRA_TYPE
  548. #define YY_EXTRA_TYPE void *
  549. #endif
  550. /* %if-c-only Reentrant structure and macros (non-C++). */
  551. /* %if-reentrant */
  552. /* %if-c-only */
  553. static int yy_init_globals (void );
  554. /* %endif */
  555. /* %if-reentrant */
  556. /* %endif */
  557. /* %endif End reentrant structures and macros. */
  558. /* Accessor methods to globals.
  559. These are made visible to non-reentrant scanners for convenience. */
  560. int yylex_destroy (void );
  561. int yyget_debug (void );
  562. void yyset_debug (int debug_flag );
  563. YY_EXTRA_TYPE yyget_extra (void );
  564. void yyset_extra (YY_EXTRA_TYPE user_defined );
  565. FILE *yyget_in (void );
  566. void yyset_in (FILE * in_str );
  567. FILE *yyget_out (void );
  568. void yyset_out (FILE * out_str );
  569. yy_size_t yyget_leng (void );
  570. char *yyget_text (void );
  571. int yyget_lineno (void );
  572. void yyset_lineno (int line_number );
  573. /* %if-bison-bridge */
  574. /* %endif */
  575. /* Macros after this point can all be overridden by user definitions in
  576. * section 1.
  577. */
  578. #ifndef YY_SKIP_YYWRAP
  579. #ifdef __cplusplus
  580. extern "C" int yywrap (void );
  581. #else
  582. extern int yywrap (void );
  583. #endif
  584. #endif
  585. /* %not-for-header */
  586. /* %ok-for-header */
  587. /* %endif */
  588. #ifndef yytext_ptr
  589. static void yy_flex_strncpy (char *,yyconst char *,int );
  590. #endif
  591. #ifdef YY_NEED_STRLEN
  592. static int yy_flex_strlen (yyconst char * );
  593. #endif
  594. #ifndef YY_NO_INPUT
  595. /* %if-c-only Standard (non-C++) definition */
  596. /* %not-for-header */
  597. #ifdef __cplusplus
  598. static int yyinput (void );
  599. #else
  600. static int input (void );
  601. #endif
  602. /* %ok-for-header */
  603. /* %endif */
  604. #endif
  605. /* %if-c-only */
  606. /* %endif */
  607. /* Amount of stuff to slurp up with each read. */
  608. #ifndef YY_READ_BUF_SIZE
  609. #define YY_READ_BUF_SIZE 8192
  610. #endif
  611. /* Copy whatever the last rule matched to the standard output. */
  612. #ifndef ECHO
  613. /* %if-c-only Standard (non-C++) definition */
  614. /* This used to be an fputs(), but since the string might contain NUL's,
  615. * we now use fwrite().
  616. */
  617. #define ECHO fwrite( yytext, yyleng, 1, yyout )
  618. /* %endif */
  619. /* %if-c++-only C++ definition */
  620. /* %endif */
  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. /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
  628. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  629. { \
  630. int c = '*'; \
  631. yy_size_t n; \
  632. for ( n = 0; n < max_size && \
  633. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  634. buf[n] = (char) c; \
  635. if ( c == '\n' ) \
  636. buf[n++] = (char) c; \
  637. if ( c == EOF && ferror( yyin ) ) \
  638. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  639. result = n; \
  640. } \
  641. else \
  642. { \
  643. errno=0; \
  644. while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
  645. { \
  646. if( errno != EINTR) \
  647. { \
  648. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  649. break; \
  650. } \
  651. errno=0; \
  652. clearerr(yyin); \
  653. } \
  654. }\
  655. \
  656. /* %if-c++-only C++ definition \ */\
  657. /* %endif */
  658. #endif
  659. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  660. * we don't want an extra ';' after the "return" because that will cause
  661. * some compilers to complain about unreachable statements.
  662. */
  663. #ifndef yyterminate
  664. #define yyterminate() return YY_NULL
  665. #endif
  666. /* Number of entries by which start-condition stack grows. */
  667. #ifndef YY_START_STACK_INCR
  668. #define YY_START_STACK_INCR 25
  669. #endif
  670. /* Report a fatal error. */
  671. #ifndef YY_FATAL_ERROR
  672. /* %if-c-only */
  673. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  674. /* %endif */
  675. /* %if-c++-only */
  676. /* %endif */
  677. #endif
  678. /* %if-tables-serialization structures and prototypes */
  679. /* %not-for-header */
  680. /* %ok-for-header */
  681. /* %not-for-header */
  682. /* %tables-yydmap generated elements */
  683. /* %endif */
  684. /* end tables serialization structures and prototypes */
  685. /* %ok-for-header */
  686. /* Default declaration of generated scanner - a define so the user can
  687. * easily add parameters.
  688. */
  689. #ifndef YY_DECL
  690. #define YY_DECL_IS_OURS 1
  691. /* %if-c-only Standard (non-C++) definition */
  692. extern int yylex (void);
  693. #define YY_DECL int yylex (void)
  694. /* %endif */
  695. /* %if-c++-only C++ definition */
  696. /* %endif */
  697. #endif /* !YY_DECL */
  698. /* Code executed at the beginning of each rule, after yytext and yyleng
  699. * have been set up.
  700. */
  701. #ifndef YY_USER_ACTION
  702. #define YY_USER_ACTION
  703. #endif
  704. /* Code executed at the end of each rule. */
  705. #ifndef YY_BREAK
  706. #define YY_BREAK break;
  707. #endif
  708. /* %% [6.0] YY_RULE_SETUP definition goes here */
  709. #define YY_RULE_SETUP \
  710. YY_USER_ACTION
  711. /* %not-for-header */
  712. /** The main scanner function which does all the work.
  713. */
  714. YY_DECL
  715. {
  716. register yy_state_type yy_current_state;
  717. register char *yy_cp, *yy_bp;
  718. register int yy_act;
  719. /* %% [7.0] user's declarations go here */
  720. #line 76 "lexer.ll"
  721. // Code run each time yylex is called.
  722. loc.step();
  723. #line 905 "lexer.cc"
  724. if ( !(yy_init) )
  725. {
  726. (yy_init) = 1;
  727. #ifdef YY_USER_INIT
  728. YY_USER_INIT;
  729. #endif
  730. if ( ! (yy_start) )
  731. (yy_start) = 1; /* first start state */
  732. if ( ! yyin )
  733. /* %if-c-only */
  734. yyin = stdin;
  735. /* %endif */
  736. /* %if-c++-only */
  737. /* %endif */
  738. if ( ! yyout )
  739. /* %if-c-only */
  740. yyout = stdout;
  741. /* %endif */
  742. /* %if-c++-only */
  743. /* %endif */
  744. if ( ! YY_CURRENT_BUFFER ) {
  745. yyensure_buffer_stack ();
  746. YY_CURRENT_BUFFER_LVALUE =
  747. yy_create_buffer(yyin,YY_BUF_SIZE );
  748. }
  749. yy_load_buffer_state( );
  750. }
  751. while ( 1 ) /* loops until end-of-file is reached */
  752. {
  753. /* %% [8.0] yymore()-related code goes here */
  754. yy_cp = (yy_c_buf_p);
  755. /* Support of yytext. */
  756. *yy_cp = (yy_hold_char);
  757. /* yy_bp points to the position in yy_ch_buf of the start of
  758. * the current run.
  759. */
  760. yy_bp = yy_cp;
  761. /* %% [9.0] code to set up and find next match goes here */
  762. yy_current_state = (yy_start);
  763. yy_match:
  764. do
  765. {
  766. register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  767. if ( yy_accept[yy_current_state] )
  768. {
  769. (yy_last_accepting_state) = yy_current_state;
  770. (yy_last_accepting_cpos) = yy_cp;
  771. }
  772. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  773. {
  774. yy_current_state = (int) yy_def[yy_current_state];
  775. if ( yy_current_state >= 52 )
  776. yy_c = yy_meta[(unsigned int) yy_c];
  777. }
  778. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  779. ++yy_cp;
  780. }
  781. while ( yy_current_state != 51 );
  782. yy_cp = (yy_last_accepting_cpos);
  783. yy_current_state = (yy_last_accepting_state);
  784. yy_find_action:
  785. /* %% [10.0] code to find the action number goes here */
  786. yy_act = yy_accept[yy_current_state];
  787. YY_DO_BEFORE_ACTION;
  788. /* %% [11.0] code for yylineno update goes here */
  789. if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
  790. {
  791. yy_size_t yyl;
  792. for ( yyl = 0; yyl < yyleng; ++yyl )
  793. if ( yytext[yyl] == '\n' )
  794. yylineno++;
  795. ;
  796. }
  797. do_action: /* This label is used only to access EOF actions. */
  798. /* %% [12.0] debug code goes here */
  799. if ( yy_flex_debug )
  800. {
  801. if ( yy_act == 0 )
  802. fprintf( stderr, "--scanner backing up\n" );
  803. else if ( yy_act < 19 )
  804. fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
  805. (long)yy_rule_linenum[yy_act], yytext );
  806. else if ( yy_act == 19 )
  807. fprintf( stderr, "--accepting default rule (\"%s\")\n",
  808. yytext );
  809. else if ( yy_act == 20 )
  810. fprintf( stderr, "--(end of buffer or a NUL)\n" );
  811. else
  812. fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
  813. }
  814. switch ( yy_act )
  815. { /* beginning of action switch */
  816. /* %% [13.0] actions go here */
  817. case 0: /* must back up */
  818. /* undo the effects of YY_DO_BEFORE_ACTION */
  819. *yy_cp = (yy_hold_char);
  820. yy_cp = (yy_last_accepting_cpos);
  821. yy_current_state = (yy_last_accepting_state);
  822. goto yy_find_action;
  823. case 1:
  824. YY_RULE_SETUP
  825. #line 83 "lexer.ll"
  826. {
  827. // Ok, we found a with space. Let's ignore it and update loc variable.
  828. loc.step();
  829. }
  830. YY_BREAK
  831. case 2:
  832. /* rule 2 can match eol */
  833. YY_RULE_SETUP
  834. #line 87 "lexer.ll"
  835. {
  836. // Newline found. Let's update the location and continue.
  837. loc.lines(yyleng);
  838. loc.step();
  839. }
  840. YY_BREAK
  841. case 3:
  842. YY_RULE_SETUP
  843. #line 93 "lexer.ll"
  844. {
  845. // A string has been matched. It contains the actual string and single quotes.
  846. // We need to get those quotes out of the way and just use its content, e.g.
  847. // for 'foo' we should get foo
  848. std::string tmp(yytext+1);
  849. tmp.resize(tmp.size() - 1);
  850. return isc::eval::EvalParser::make_STRING(tmp, loc);
  851. }
  852. YY_BREAK
  853. case 4:
  854. YY_RULE_SETUP
  855. #line 103 "lexer.ll"
  856. {
  857. // A hex string has been matched. It contains the '0x' or '0X' header
  858. // followed by at least one hexadecimal digit.
  859. return isc::eval::EvalParser::make_HEXSTRING(yytext, loc);
  860. }
  861. YY_BREAK
  862. case 5:
  863. YY_RULE_SETUP
  864. #line 109 "lexer.ll"
  865. {
  866. // An integer was found.
  867. std::string tmp(yytext);
  868. try {
  869. static_cast<void>(boost::lexical_cast<int>(tmp));
  870. } catch (const boost::bad_lexical_cast &) {
  871. driver.error(loc, "Failed to convert " + tmp + " to an integer.");
  872. }
  873. // The parser needs the string form as double conversion is no lossless
  874. return isc::eval::EvalParser::make_INTEGER(tmp, loc);
  875. }
  876. YY_BREAK
  877. case 6:
  878. YY_RULE_SETUP
  879. #line 123 "lexer.ll"
  880. return isc::eval::EvalParser::make_EQUAL(loc);
  881. YY_BREAK
  882. case 7:
  883. YY_RULE_SETUP
  884. #line 124 "lexer.ll"
  885. return isc::eval::EvalParser::make_OPTION(loc);
  886. YY_BREAK
  887. case 8:
  888. YY_RULE_SETUP
  889. #line 125 "lexer.ll"
  890. return isc::eval::EvalParser::make_TEXT(loc);
  891. YY_BREAK
  892. case 9:
  893. YY_RULE_SETUP
  894. #line 126 "lexer.ll"
  895. return isc::eval::EvalParser::make_HEX(loc);
  896. YY_BREAK
  897. case 10:
  898. YY_RULE_SETUP
  899. #line 127 "lexer.ll"
  900. return isc::eval::EvalParser::make_SUBSTRING(loc);
  901. YY_BREAK
  902. case 11:
  903. YY_RULE_SETUP
  904. #line 128 "lexer.ll"
  905. return isc::eval::EvalParser::make_ALL(loc);
  906. YY_BREAK
  907. case 12:
  908. YY_RULE_SETUP
  909. #line 129 "lexer.ll"
  910. return isc::eval::EvalParser::make_DOT(loc);
  911. YY_BREAK
  912. case 13:
  913. YY_RULE_SETUP
  914. #line 130 "lexer.ll"
  915. return isc::eval::EvalParser::make_LPAREN(loc);
  916. YY_BREAK
  917. case 14:
  918. YY_RULE_SETUP
  919. #line 131 "lexer.ll"
  920. return isc::eval::EvalParser::make_RPAREN(loc);
  921. YY_BREAK
  922. case 15:
  923. YY_RULE_SETUP
  924. #line 132 "lexer.ll"
  925. return isc::eval::EvalParser::make_LBRACKET(loc);
  926. YY_BREAK
  927. case 16:
  928. YY_RULE_SETUP
  929. #line 133 "lexer.ll"
  930. return isc::eval::EvalParser::make_RBRACKET(loc);
  931. YY_BREAK
  932. case 17:
  933. YY_RULE_SETUP
  934. #line 134 "lexer.ll"
  935. return isc::eval::EvalParser::make_COMA(loc);
  936. YY_BREAK
  937. case 18:
  938. YY_RULE_SETUP
  939. #line 136 "lexer.ll"
  940. driver.error (loc, "Invalid character: " + std::string(yytext));
  941. YY_BREAK
  942. case YY_STATE_EOF(INITIAL):
  943. #line 137 "lexer.ll"
  944. return isc::eval::EvalParser::make_END(loc);
  945. YY_BREAK
  946. case 19:
  947. YY_RULE_SETUP
  948. #line 138 "lexer.ll"
  949. ECHO;
  950. YY_BREAK
  951. #line 1156 "lexer.cc"
  952. case YY_END_OF_BUFFER:
  953. {
  954. /* Amount of text matched not including the EOB char. */
  955. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  956. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  957. *yy_cp = (yy_hold_char);
  958. YY_RESTORE_YY_MORE_OFFSET
  959. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  960. {
  961. /* We're scanning a new file or input source. It's
  962. * possible that this happened because the user
  963. * just pointed yyin at a new source and called
  964. * yylex(). If so, then we have to assure
  965. * consistency between YY_CURRENT_BUFFER and our
  966. * globals. Here is the right place to do so, because
  967. * this is the first action (other than possibly a
  968. * back-up) that will match for the new input source.
  969. */
  970. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  971. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  972. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  973. }
  974. /* Note that here we test for yy_c_buf_p "<=" to the position
  975. * of the first EOB in the buffer, since yy_c_buf_p will
  976. * already have been incremented past the NUL character
  977. * (since all states make transitions on EOB to the
  978. * end-of-buffer state). Contrast this with the test
  979. * in input().
  980. */
  981. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  982. { /* This was really a NUL. */
  983. yy_state_type yy_next_state;
  984. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  985. yy_current_state = yy_get_previous_state( );
  986. /* Okay, we're now positioned to make the NUL
  987. * transition. We couldn't have
  988. * yy_get_previous_state() go ahead and do it
  989. * for us because it doesn't know how to deal
  990. * with the possibility of jamming (and we don't
  991. * want to build jamming into it because then it
  992. * will run more slowly).
  993. */
  994. yy_next_state = yy_try_NUL_trans( yy_current_state );
  995. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  996. if ( yy_next_state )
  997. {
  998. /* Consume the NUL. */
  999. yy_cp = ++(yy_c_buf_p);
  1000. yy_current_state = yy_next_state;
  1001. goto yy_match;
  1002. }
  1003. else
  1004. {
  1005. /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
  1006. yy_cp = (yy_last_accepting_cpos);
  1007. yy_current_state = (yy_last_accepting_state);
  1008. goto yy_find_action;
  1009. }
  1010. }
  1011. else switch ( yy_get_next_buffer( ) )
  1012. {
  1013. case EOB_ACT_END_OF_FILE:
  1014. {
  1015. (yy_did_buffer_switch_on_eof) = 0;
  1016. if ( yywrap( ) )
  1017. {
  1018. /* Note: because we've taken care in
  1019. * yy_get_next_buffer() to have set up
  1020. * yytext, we can now set up
  1021. * yy_c_buf_p so that if some total
  1022. * hoser (like flex itself) wants to
  1023. * call the scanner after we return the
  1024. * YY_NULL, it'll still work - another
  1025. * YY_NULL will get returned.
  1026. */
  1027. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  1028. yy_act = YY_STATE_EOF(YY_START);
  1029. goto do_action;
  1030. }
  1031. else
  1032. {
  1033. if ( ! (yy_did_buffer_switch_on_eof) )
  1034. YY_NEW_FILE;
  1035. }
  1036. break;
  1037. }
  1038. case EOB_ACT_CONTINUE_SCAN:
  1039. (yy_c_buf_p) =
  1040. (yytext_ptr) + yy_amount_of_matched_text;
  1041. yy_current_state = yy_get_previous_state( );
  1042. yy_cp = (yy_c_buf_p);
  1043. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1044. goto yy_match;
  1045. case EOB_ACT_LAST_MATCH:
  1046. (yy_c_buf_p) =
  1047. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  1048. yy_current_state = yy_get_previous_state( );
  1049. yy_cp = (yy_c_buf_p);
  1050. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1051. goto yy_find_action;
  1052. }
  1053. break;
  1054. }
  1055. default:
  1056. YY_FATAL_ERROR(
  1057. "fatal flex scanner internal error--no action found" );
  1058. } /* end of action switch */
  1059. } /* end of scanning one token */
  1060. } /* end of yylex */
  1061. /* %ok-for-header */
  1062. /* %if-c++-only */
  1063. /* %not-for-header */
  1064. /* %ok-for-header */
  1065. /* %endif */
  1066. /* yy_get_next_buffer - try to read in a new buffer
  1067. *
  1068. * Returns a code representing an action:
  1069. * EOB_ACT_LAST_MATCH -
  1070. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1071. * EOB_ACT_END_OF_FILE - end of file
  1072. */
  1073. /* %if-c-only */
  1074. static int yy_get_next_buffer (void)
  1075. /* %endif */
  1076. /* %if-c++-only */
  1077. /* %endif */
  1078. {
  1079. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1080. register char *source = (yytext_ptr);
  1081. register int number_to_move, i;
  1082. int ret_val;
  1083. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  1084. YY_FATAL_ERROR(
  1085. "fatal flex scanner internal error--end of buffer missed" );
  1086. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  1087. { /* Don't try to fill the buffer, so this is an EOF. */
  1088. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  1089. {
  1090. /* We matched a single character, the EOB, so
  1091. * treat this as a final EOF.
  1092. */
  1093. return EOB_ACT_END_OF_FILE;
  1094. }
  1095. else
  1096. {
  1097. /* We matched some text prior to the EOB, first
  1098. * process it.
  1099. */
  1100. return EOB_ACT_LAST_MATCH;
  1101. }
  1102. }
  1103. /* Try to read more data. */
  1104. /* First move last chars to start of buffer. */
  1105. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
  1106. for ( i = 0; i < number_to_move; ++i )
  1107. *(dest++) = *(source++);
  1108. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1109. /* don't do the read, it's not guaranteed to return an EOF,
  1110. * just force an EOF
  1111. */
  1112. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  1113. else
  1114. {
  1115. yy_size_t num_to_read =
  1116. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1117. while ( num_to_read <= 0 )
  1118. { /* Not enough room in the buffer - grow it. */
  1119. /* just a shorter name for the current buffer */
  1120. YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
  1121. int yy_c_buf_p_offset =
  1122. (int) ((yy_c_buf_p) - b->yy_ch_buf);
  1123. if ( b->yy_is_our_buffer )
  1124. {
  1125. yy_size_t new_size = b->yy_buf_size * 2;
  1126. if ( new_size <= 0 )
  1127. b->yy_buf_size += b->yy_buf_size / 8;
  1128. else
  1129. b->yy_buf_size *= 2;
  1130. b->yy_ch_buf = (char *)
  1131. /* Include room in for 2 EOB chars. */
  1132. yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
  1133. }
  1134. else
  1135. /* Can't grow it, we don't own it. */
  1136. b->yy_ch_buf = 0;
  1137. if ( ! b->yy_ch_buf )
  1138. YY_FATAL_ERROR(
  1139. "fatal error - scanner input buffer overflow" );
  1140. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1141. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1142. number_to_move - 1;
  1143. }
  1144. if ( num_to_read > YY_READ_BUF_SIZE )
  1145. num_to_read = YY_READ_BUF_SIZE;
  1146. /* Read in more data. */
  1147. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1148. (yy_n_chars), num_to_read );
  1149. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1150. }
  1151. if ( (yy_n_chars) == 0 )
  1152. {
  1153. if ( number_to_move == YY_MORE_ADJ )
  1154. {
  1155. ret_val = EOB_ACT_END_OF_FILE;
  1156. yyrestart(yyin );
  1157. }
  1158. else
  1159. {
  1160. ret_val = EOB_ACT_LAST_MATCH;
  1161. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1162. YY_BUFFER_EOF_PENDING;
  1163. }
  1164. }
  1165. else
  1166. ret_val = EOB_ACT_CONTINUE_SCAN;
  1167. if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1168. /* Extend the array by 50%, plus the number we really need. */
  1169. yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1170. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
  1171. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1172. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1173. }
  1174. (yy_n_chars) += number_to_move;
  1175. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1176. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1177. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1178. return ret_val;
  1179. }
  1180. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1181. /* %if-c-only */
  1182. /* %not-for-header */
  1183. static yy_state_type yy_get_previous_state (void)
  1184. /* %endif */
  1185. /* %if-c++-only */
  1186. /* %endif */
  1187. {
  1188. register yy_state_type yy_current_state;
  1189. register char *yy_cp;
  1190. /* %% [15.0] code to get the start state into yy_current_state goes here */
  1191. yy_current_state = (yy_start);
  1192. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1193. {
  1194. /* %% [16.0] code to find the next state goes here */
  1195. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1196. if ( yy_accept[yy_current_state] )
  1197. {
  1198. (yy_last_accepting_state) = yy_current_state;
  1199. (yy_last_accepting_cpos) = yy_cp;
  1200. }
  1201. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1202. {
  1203. yy_current_state = (int) yy_def[yy_current_state];
  1204. if ( yy_current_state >= 52 )
  1205. yy_c = yy_meta[(unsigned int) yy_c];
  1206. }
  1207. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1208. }
  1209. return yy_current_state;
  1210. }
  1211. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1212. *
  1213. * synopsis
  1214. * next_state = yy_try_NUL_trans( current_state );
  1215. */
  1216. /* %if-c-only */
  1217. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
  1218. /* %endif */
  1219. /* %if-c++-only */
  1220. /* %endif */
  1221. {
  1222. register int yy_is_jam;
  1223. /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
  1224. register char *yy_cp = (yy_c_buf_p);
  1225. register YY_CHAR yy_c = 1;
  1226. if ( yy_accept[yy_current_state] )
  1227. {
  1228. (yy_last_accepting_state) = yy_current_state;
  1229. (yy_last_accepting_cpos) = yy_cp;
  1230. }
  1231. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1232. {
  1233. yy_current_state = (int) yy_def[yy_current_state];
  1234. if ( yy_current_state >= 52 )
  1235. yy_c = yy_meta[(unsigned int) yy_c];
  1236. }
  1237. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1238. yy_is_jam = (yy_current_state == 51);
  1239. return yy_is_jam ? 0 : yy_current_state;
  1240. }
  1241. /* %if-c-only */
  1242. /* %endif */
  1243. /* %if-c-only */
  1244. #ifndef YY_NO_INPUT
  1245. #ifdef __cplusplus
  1246. static int yyinput (void)
  1247. #else
  1248. static int input (void)
  1249. #endif
  1250. /* %endif */
  1251. /* %if-c++-only */
  1252. /* %endif */
  1253. {
  1254. int c;
  1255. *(yy_c_buf_p) = (yy_hold_char);
  1256. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1257. {
  1258. /* yy_c_buf_p now points to the character we want to return.
  1259. * If this occurs *before* the EOB characters, then it's a
  1260. * valid NUL; if not, then we've hit the end of the buffer.
  1261. */
  1262. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1263. /* This was really a NUL. */
  1264. *(yy_c_buf_p) = '\0';
  1265. else
  1266. { /* need more input */
  1267. yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
  1268. ++(yy_c_buf_p);
  1269. switch ( yy_get_next_buffer( ) )
  1270. {
  1271. case EOB_ACT_LAST_MATCH:
  1272. /* This happens because yy_g_n_b()
  1273. * sees that we've accumulated a
  1274. * token and flags that we need to
  1275. * try matching the token before
  1276. * proceeding. But for input(),
  1277. * there's no matching to consider.
  1278. * So convert the EOB_ACT_LAST_MATCH
  1279. * to EOB_ACT_END_OF_FILE.
  1280. */
  1281. /* Reset buffer status. */
  1282. yyrestart(yyin );
  1283. /*FALLTHROUGH*/
  1284. case EOB_ACT_END_OF_FILE:
  1285. {
  1286. if ( yywrap( ) )
  1287. return 0;
  1288. if ( ! (yy_did_buffer_switch_on_eof) )
  1289. YY_NEW_FILE;
  1290. #ifdef __cplusplus
  1291. return yyinput();
  1292. #else
  1293. return input();
  1294. #endif
  1295. }
  1296. case EOB_ACT_CONTINUE_SCAN:
  1297. (yy_c_buf_p) = (yytext_ptr) + offset;
  1298. break;
  1299. }
  1300. }
  1301. }
  1302. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  1303. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1304. (yy_hold_char) = *++(yy_c_buf_p);
  1305. /* %% [19.0] update BOL and yylineno */
  1306. if ( c == '\n' )
  1307. yylineno++;
  1308. ;
  1309. return c;
  1310. }
  1311. /* %if-c-only */
  1312. #endif /* ifndef YY_NO_INPUT */
  1313. /* %endif */
  1314. /** Immediately switch to a different input stream.
  1315. * @param input_file A readable stream.
  1316. *
  1317. * @note This function does not reset the start condition to @c INITIAL .
  1318. */
  1319. /* %if-c-only */
  1320. void yyrestart (FILE * input_file )
  1321. /* %endif */
  1322. /* %if-c++-only */
  1323. /* %endif */
  1324. {
  1325. if ( ! YY_CURRENT_BUFFER ){
  1326. yyensure_buffer_stack ();
  1327. YY_CURRENT_BUFFER_LVALUE =
  1328. yy_create_buffer(yyin,YY_BUF_SIZE );
  1329. }
  1330. yy_init_buffer(YY_CURRENT_BUFFER,input_file );
  1331. yy_load_buffer_state( );
  1332. }
  1333. /** Switch to a different input buffer.
  1334. * @param new_buffer The new input buffer.
  1335. *
  1336. */
  1337. /* %if-c-only */
  1338. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
  1339. /* %endif */
  1340. /* %if-c++-only */
  1341. /* %endif */
  1342. {
  1343. /* TODO. We should be able to replace this entire function body
  1344. * with
  1345. * yypop_buffer_state();
  1346. * yypush_buffer_state(new_buffer);
  1347. */
  1348. yyensure_buffer_stack ();
  1349. if ( YY_CURRENT_BUFFER == new_buffer )
  1350. return;
  1351. if ( YY_CURRENT_BUFFER )
  1352. {
  1353. /* Flush out information for old buffer. */
  1354. *(yy_c_buf_p) = (yy_hold_char);
  1355. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1356. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1357. }
  1358. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1359. yy_load_buffer_state( );
  1360. /* We don't actually know whether we did this switch during
  1361. * EOF (yywrap()) processing, but the only time this flag
  1362. * is looked at is after yywrap() is called, so it's safe
  1363. * to go ahead and always set it.
  1364. */
  1365. (yy_did_buffer_switch_on_eof) = 1;
  1366. }
  1367. /* %if-c-only */
  1368. static void yy_load_buffer_state (void)
  1369. /* %endif */
  1370. /* %if-c++-only */
  1371. /* %endif */
  1372. {
  1373. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1374. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1375. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1376. (yy_hold_char) = *(yy_c_buf_p);
  1377. }
  1378. /** Allocate and initialize an input buffer state.
  1379. * @param file A readable stream.
  1380. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1381. *
  1382. * @return the allocated buffer state.
  1383. */
  1384. /* %if-c-only */
  1385. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
  1386. /* %endif */
  1387. /* %if-c++-only */
  1388. /* %endif */
  1389. {
  1390. YY_BUFFER_STATE b;
  1391. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1392. if ( ! b )
  1393. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1394. b->yy_buf_size = size;
  1395. /* yy_ch_buf has to be 2 characters longer than the size given because
  1396. * we need to put in 2 end-of-buffer characters.
  1397. */
  1398. b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
  1399. if ( ! b->yy_ch_buf )
  1400. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1401. b->yy_is_our_buffer = 1;
  1402. yy_init_buffer(b,file );
  1403. return b;
  1404. }
  1405. /** Destroy the buffer.
  1406. * @param b a buffer created with yy_create_buffer()
  1407. *
  1408. */
  1409. /* %if-c-only */
  1410. void yy_delete_buffer (YY_BUFFER_STATE b )
  1411. /* %endif */
  1412. /* %if-c++-only */
  1413. /* %endif */
  1414. {
  1415. if ( ! b )
  1416. return;
  1417. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1418. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1419. if ( b->yy_is_our_buffer )
  1420. yyfree((void *) b->yy_ch_buf );
  1421. yyfree((void *) b );
  1422. }
  1423. /* %if-c-only */
  1424. #ifndef __cplusplus
  1425. extern int isatty (int );
  1426. #endif /* __cplusplus */
  1427. /* %endif */
  1428. /* %if-c++-only */
  1429. /* %endif */
  1430. /* Initializes or reinitializes a buffer.
  1431. * This function is sometimes called more than once on the same buffer,
  1432. * such as during a yyrestart() or at EOF.
  1433. */
  1434. /* %if-c-only */
  1435. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
  1436. /* %endif */
  1437. /* %if-c++-only */
  1438. /* %endif */
  1439. {
  1440. int oerrno = errno;
  1441. yy_flush_buffer(b );
  1442. b->yy_input_file = file;
  1443. b->yy_fill_buffer = 1;
  1444. /* If b is the current buffer, then yy_init_buffer was _probably_
  1445. * called from yyrestart() or through yy_get_next_buffer.
  1446. * In that case, we don't want to reset the lineno or column.
  1447. */
  1448. if (b != YY_CURRENT_BUFFER){
  1449. b->yy_bs_lineno = 1;
  1450. b->yy_bs_column = 0;
  1451. }
  1452. /* %if-c-only */
  1453. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  1454. /* %endif */
  1455. /* %if-c++-only */
  1456. /* %endif */
  1457. errno = oerrno;
  1458. }
  1459. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1460. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1461. *
  1462. */
  1463. /* %if-c-only */
  1464. void yy_flush_buffer (YY_BUFFER_STATE b )
  1465. /* %endif */
  1466. /* %if-c++-only */
  1467. /* %endif */
  1468. {
  1469. if ( ! b )
  1470. return;
  1471. b->yy_n_chars = 0;
  1472. /* We always need two end-of-buffer characters. The first causes
  1473. * a transition to the end-of-buffer state. The second causes
  1474. * a jam in that state.
  1475. */
  1476. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1477. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1478. b->yy_buf_pos = &b->yy_ch_buf[0];
  1479. b->yy_at_bol = 1;
  1480. b->yy_buffer_status = YY_BUFFER_NEW;
  1481. if ( b == YY_CURRENT_BUFFER )
  1482. yy_load_buffer_state( );
  1483. }
  1484. /* %if-c-or-c++ */
  1485. /** Pushes the new state onto the stack. The new state becomes
  1486. * the current state. This function will allocate the stack
  1487. * if necessary.
  1488. * @param new_buffer The new state.
  1489. *
  1490. */
  1491. /* %if-c-only */
  1492. void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
  1493. /* %endif */
  1494. /* %if-c++-only */
  1495. /* %endif */
  1496. {
  1497. if (new_buffer == NULL)
  1498. return;
  1499. yyensure_buffer_stack();
  1500. /* This block is copied from yy_switch_to_buffer. */
  1501. if ( YY_CURRENT_BUFFER )
  1502. {
  1503. /* Flush out information for old buffer. */
  1504. *(yy_c_buf_p) = (yy_hold_char);
  1505. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1506. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1507. }
  1508. /* Only push if top exists. Otherwise, replace top. */
  1509. if (YY_CURRENT_BUFFER)
  1510. (yy_buffer_stack_top)++;
  1511. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1512. /* copied from yy_switch_to_buffer. */
  1513. yy_load_buffer_state( );
  1514. (yy_did_buffer_switch_on_eof) = 1;
  1515. }
  1516. /* %endif */
  1517. /* %if-c-or-c++ */
  1518. /** Removes and deletes the top of the stack, if present.
  1519. * The next element becomes the new top.
  1520. *
  1521. */
  1522. /* %if-c-only */
  1523. void yypop_buffer_state (void)
  1524. /* %endif */
  1525. /* %if-c++-only */
  1526. /* %endif */
  1527. {
  1528. if (!YY_CURRENT_BUFFER)
  1529. return;
  1530. yy_delete_buffer(YY_CURRENT_BUFFER );
  1531. YY_CURRENT_BUFFER_LVALUE = NULL;
  1532. if ((yy_buffer_stack_top) > 0)
  1533. --(yy_buffer_stack_top);
  1534. if (YY_CURRENT_BUFFER) {
  1535. yy_load_buffer_state( );
  1536. (yy_did_buffer_switch_on_eof) = 1;
  1537. }
  1538. }
  1539. /* %endif */
  1540. /* %if-c-or-c++ */
  1541. /* Allocates the stack if it does not exist.
  1542. * Guarantees space for at least one push.
  1543. */
  1544. /* %if-c-only */
  1545. static void yyensure_buffer_stack (void)
  1546. /* %endif */
  1547. /* %if-c++-only */
  1548. /* %endif */
  1549. {
  1550. yy_size_t num_to_alloc;
  1551. if (!(yy_buffer_stack)) {
  1552. /* First allocation is just for 2 elements, since we don't know if this
  1553. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1554. * immediate realloc on the next call.
  1555. */
  1556. num_to_alloc = 1;
  1557. (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
  1558. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1559. );
  1560. if ( ! (yy_buffer_stack) )
  1561. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1562. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1563. (yy_buffer_stack_max) = num_to_alloc;
  1564. (yy_buffer_stack_top) = 0;
  1565. return;
  1566. }
  1567. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  1568. /* Increase the buffer to prepare for a possible push. */
  1569. int grow_size = 8 /* arbitrary grow size */;
  1570. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1571. (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
  1572. ((yy_buffer_stack),
  1573. num_to_alloc * sizeof(struct yy_buffer_state*)
  1574. );
  1575. if ( ! (yy_buffer_stack) )
  1576. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1577. /* zero only the new slots.*/
  1578. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  1579. (yy_buffer_stack_max) = num_to_alloc;
  1580. }
  1581. }
  1582. /* %endif */
  1583. /* %if-c-only */
  1584. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1585. * @param base the character buffer
  1586. * @param size the size in bytes of the character buffer
  1587. *
  1588. * @return the newly allocated buffer state object.
  1589. */
  1590. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
  1591. {
  1592. YY_BUFFER_STATE b;
  1593. if ( size < 2 ||
  1594. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1595. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1596. /* They forgot to leave room for the EOB's. */
  1597. return 0;
  1598. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1599. if ( ! b )
  1600. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1601. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1602. b->yy_buf_pos = b->yy_ch_buf = base;
  1603. b->yy_is_our_buffer = 0;
  1604. b->yy_input_file = 0;
  1605. b->yy_n_chars = b->yy_buf_size;
  1606. b->yy_is_interactive = 0;
  1607. b->yy_at_bol = 1;
  1608. b->yy_fill_buffer = 0;
  1609. b->yy_buffer_status = YY_BUFFER_NEW;
  1610. yy_switch_to_buffer(b );
  1611. return b;
  1612. }
  1613. /* %endif */
  1614. /* %if-c-only */
  1615. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1616. * scan from a @e copy of @a str.
  1617. * @param yystr a NUL-terminated string to scan
  1618. *
  1619. * @return the newly allocated buffer state object.
  1620. * @note If you want to scan bytes that may contain NUL values, then use
  1621. * yy_scan_bytes() instead.
  1622. */
  1623. YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
  1624. {
  1625. return yy_scan_bytes(yystr,strlen(yystr) );
  1626. }
  1627. /* %endif */
  1628. /* %if-c-only */
  1629. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1630. * scan from a @e copy of @a bytes.
  1631. * @param bytes the byte buffer to scan
  1632. * @param len the number of bytes in the buffer pointed to by @a bytes.
  1633. *
  1634. * @return the newly allocated buffer state object.
  1635. */
  1636. YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
  1637. {
  1638. YY_BUFFER_STATE b;
  1639. char *buf;
  1640. yy_size_t n, i;
  1641. /* Get memory for full buffer, including space for trailing EOB's. */
  1642. n = _yybytes_len + 2;
  1643. buf = (char *) yyalloc(n );
  1644. if ( ! buf )
  1645. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1646. for ( i = 0; i < _yybytes_len; ++i )
  1647. buf[i] = yybytes[i];
  1648. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  1649. b = yy_scan_buffer(buf,n );
  1650. if ( ! b )
  1651. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1652. /* It's okay to grow etc. this buffer, and we should throw it
  1653. * away when we're done.
  1654. */
  1655. b->yy_is_our_buffer = 1;
  1656. return b;
  1657. }
  1658. /* %endif */
  1659. #ifndef YY_EXIT_FAILURE
  1660. #define YY_EXIT_FAILURE 2
  1661. #endif
  1662. /* %if-c-only */
  1663. static void yy_fatal_error (yyconst char* msg )
  1664. {
  1665. (void) fprintf( stderr, "%s\n", msg );
  1666. exit( YY_EXIT_FAILURE );
  1667. }
  1668. /* %endif */
  1669. /* %if-c++-only */
  1670. /* %endif */
  1671. /* Redefine yyless() so it works in section 3 code. */
  1672. #undef yyless
  1673. #define yyless(n) \
  1674. do \
  1675. { \
  1676. /* Undo effects of setting up yytext. */ \
  1677. int yyless_macro_arg = (n); \
  1678. YY_LESS_LINENO(yyless_macro_arg);\
  1679. yytext[yyleng] = (yy_hold_char); \
  1680. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  1681. (yy_hold_char) = *(yy_c_buf_p); \
  1682. *(yy_c_buf_p) = '\0'; \
  1683. yyleng = yyless_macro_arg; \
  1684. } \
  1685. while ( 0 )
  1686. /* Accessor methods (get/set functions) to struct members. */
  1687. /* %if-c-only */
  1688. /* %if-reentrant */
  1689. /* %endif */
  1690. /** Get the current line number.
  1691. *
  1692. */
  1693. int yyget_lineno (void)
  1694. {
  1695. return yylineno;
  1696. }
  1697. /** Get the input stream.
  1698. *
  1699. */
  1700. FILE *yyget_in (void)
  1701. {
  1702. return yyin;
  1703. }
  1704. /** Get the output stream.
  1705. *
  1706. */
  1707. FILE *yyget_out (void)
  1708. {
  1709. return yyout;
  1710. }
  1711. /** Get the length of the current token.
  1712. *
  1713. */
  1714. yy_size_t yyget_leng (void)
  1715. {
  1716. return yyleng;
  1717. }
  1718. /** Get the current token.
  1719. *
  1720. */
  1721. char *yyget_text (void)
  1722. {
  1723. return yytext;
  1724. }
  1725. /* %if-reentrant */
  1726. /* %endif */
  1727. /** Set the current line number.
  1728. * @param line_number
  1729. *
  1730. */
  1731. void yyset_lineno (int line_number )
  1732. {
  1733. yylineno = line_number;
  1734. }
  1735. /** Set the input stream. This does not discard the current
  1736. * input buffer.
  1737. * @param in_str A readable stream.
  1738. *
  1739. * @see yy_switch_to_buffer
  1740. */
  1741. void yyset_in (FILE * in_str )
  1742. {
  1743. yyin = in_str ;
  1744. }
  1745. void yyset_out (FILE * out_str )
  1746. {
  1747. yyout = out_str ;
  1748. }
  1749. int yyget_debug (void)
  1750. {
  1751. return yy_flex_debug;
  1752. }
  1753. void yyset_debug (int bdebug )
  1754. {
  1755. yy_flex_debug = bdebug ;
  1756. }
  1757. /* %endif */
  1758. /* %if-reentrant */
  1759. /* %if-bison-bridge */
  1760. /* %endif */
  1761. /* %endif if-c-only */
  1762. /* %if-c-only */
  1763. static int yy_init_globals (void)
  1764. {
  1765. /* Initialization is the same as for the non-reentrant scanner.
  1766. * This function is called from yylex_destroy(), so don't allocate here.
  1767. */
  1768. /* We do not touch yylineno unless the option is enabled. */
  1769. yylineno = 1;
  1770. (yy_buffer_stack) = 0;
  1771. (yy_buffer_stack_top) = 0;
  1772. (yy_buffer_stack_max) = 0;
  1773. (yy_c_buf_p) = (char *) 0;
  1774. (yy_init) = 0;
  1775. (yy_start) = 0;
  1776. /* Defined in main.c */
  1777. #ifdef YY_STDINIT
  1778. yyin = stdin;
  1779. yyout = stdout;
  1780. #else
  1781. yyin = (FILE *) 0;
  1782. yyout = (FILE *) 0;
  1783. #endif
  1784. /* For future reference: Set errno on error, since we are called by
  1785. * yylex_init()
  1786. */
  1787. return 0;
  1788. }
  1789. /* %endif */
  1790. /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
  1791. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1792. int yylex_destroy (void)
  1793. {
  1794. /* Pop the buffer stack, destroying each element. */
  1795. while(YY_CURRENT_BUFFER){
  1796. yy_delete_buffer(YY_CURRENT_BUFFER );
  1797. YY_CURRENT_BUFFER_LVALUE = NULL;
  1798. yypop_buffer_state();
  1799. }
  1800. /* Destroy the stack itself. */
  1801. yyfree((yy_buffer_stack) );
  1802. (yy_buffer_stack) = NULL;
  1803. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  1804. * yylex() is called, initialization will occur. */
  1805. yy_init_globals( );
  1806. /* %if-reentrant */
  1807. /* %endif */
  1808. return 0;
  1809. }
  1810. /* %endif */
  1811. /*
  1812. * Internal utility routines.
  1813. */
  1814. #ifndef yytext_ptr
  1815. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
  1816. {
  1817. register int i;
  1818. for ( i = 0; i < n; ++i )
  1819. s1[i] = s2[i];
  1820. }
  1821. #endif
  1822. #ifdef YY_NEED_STRLEN
  1823. static int yy_flex_strlen (yyconst char * s )
  1824. {
  1825. register int n;
  1826. for ( n = 0; s[n]; ++n )
  1827. ;
  1828. return n;
  1829. }
  1830. #endif
  1831. void *yyalloc (yy_size_t size )
  1832. {
  1833. return (void *) malloc( size );
  1834. }
  1835. void *yyrealloc (void * ptr, yy_size_t size )
  1836. {
  1837. /* The cast to (char *) in the following accommodates both
  1838. * implementations that use char* generic pointers, and those
  1839. * that use void* generic pointers. It works with the latter
  1840. * because both ANSI C and C++ allow castless assignment from
  1841. * any pointer type to void*, and deal with argument conversions
  1842. * as though doing an assignment.
  1843. */
  1844. return (void *) realloc( (char *) ptr, size );
  1845. }
  1846. void yyfree (void * ptr )
  1847. {
  1848. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  1849. }
  1850. /* %if-tables-serialization definitions */
  1851. /* %define-yytables The name for this specific scanner's tables. */
  1852. #define YYTABLES_NAME "yytables"
  1853. /* %endif */
  1854. /* %ok-for-header */
  1855. #line 138 "lexer.ll"
  1856. using namespace isc::eval;
  1857. void
  1858. EvalContext::scanStringBegin()
  1859. {
  1860. loc.initialize(&file_);
  1861. yy_flex_debug = trace_scanning_;
  1862. YY_BUFFER_STATE buffer;
  1863. buffer = yy_scan_bytes(string_.c_str(),string_.size());
  1864. if (!buffer) {
  1865. error("cannot scan string");
  1866. exit(EXIT_FAILURE);
  1867. }
  1868. }
  1869. void
  1870. EvalContext::scanStringEnd()
  1871. {
  1872. yy_delete_buffer(YY_CURRENT_BUFFER);
  1873. }