tars.lex.cpp 57 KB

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