tars.lex.cpp 57 KB

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