flex.skl 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551
  1. /* A lexical scanner generated by flex */
  2. /* Scanner skeleton version:
  3. * $Header: /opt/vlysenkov/CVSROOT/arcadia/contrib/tools/flex-old/flex.skl,v 1.1 2007-11-27 08:43:20 pg Exp $
  4. */
  5. #define FLEX_SCANNER
  6. #define YY_FLEX_MAJOR_VERSION 2
  7. #define YY_FLEX_MINOR_VERSION 5
  8. %-
  9. #include <stdio.h>
  10. #include <errno.h>
  11. %*
  12. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  13. #ifdef c_plusplus
  14. #ifndef __cplusplus
  15. #define __cplusplus
  16. #endif
  17. #endif
  18. #ifdef __cplusplus
  19. #include <stdlib.h>
  20. %+
  21. #include <iostream>
  22. class istream;
  23. using std::cin;
  24. using std::cout;
  25. using std::cerr;
  26. %*
  27. #ifndef _WIN32
  28. #include <unistd.h>
  29. #endif
  30. /* Use prototypes in function declarations. */
  31. #define YY_USE_PROTOS
  32. /* The "const" storage-class-modifier is valid. */
  33. #define YY_USE_CONST
  34. #else /* ! __cplusplus */
  35. #if __STDC__
  36. #define YY_USE_PROTOS
  37. #define YY_USE_CONST
  38. #endif /* __STDC__ */
  39. #endif /* ! __cplusplus */
  40. #ifdef __TURBOC__
  41. #pragma warn -rch
  42. #pragma warn -use
  43. #include <io.h>
  44. #include <stdlib.h>
  45. #define YY_USE_CONST
  46. #define YY_USE_PROTOS
  47. #endif
  48. #ifdef YY_USE_CONST
  49. #define yyconst const
  50. #else
  51. #define yyconst
  52. #endif
  53. #ifdef YY_USE_PROTOS
  54. #define YY_PROTO(proto) proto
  55. #else
  56. #define YY_PROTO(proto) ()
  57. #endif
  58. /* Returned upon end-of-file. */
  59. #define YY_NULL 0
  60. /* Promotes a possibly negative, possibly signed char to an unsigned
  61. * integer for use as an array index. If the signed char is negative,
  62. * we want to instead treat it as an 8-bit unsigned char, hence the
  63. * double cast.
  64. */
  65. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  66. /* Enter a start condition. This macro really ought to take a parameter,
  67. * but we do it the disgusting crufty way forced on us by the ()-less
  68. * definition of BEGIN.
  69. */
  70. #define BEGIN yy_start = 1 + 2 *
  71. /* Translate the current start state into a value that can be later handed
  72. * to BEGIN to return to the state. The YYSTATE alias is for lex
  73. * compatibility.
  74. */
  75. #define YY_START ((yy_start - 1) / 2)
  76. #define YYSTATE YY_START
  77. /* Action number for EOF rule of a given start state. */
  78. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  79. /* Special action meaning "start processing a new file". */
  80. #define YY_NEW_FILE yyrestart( yyin )
  81. #define YY_END_OF_BUFFER_CHAR 0
  82. /* Size of default input buffer. */
  83. #define YY_BUF_SIZE 16384
  84. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  85. extern int yyleng;
  86. %-
  87. extern FILE *yyin, *yyout;
  88. %*
  89. #define EOB_ACT_CONTINUE_SCAN 0
  90. #define EOB_ACT_END_OF_FILE 1
  91. #define EOB_ACT_LAST_MATCH 2
  92. /* The funky do-while in the following #define is used to turn the definition
  93. * int a single C statement (which needs a semi-colon terminator). This
  94. * avoids problems with code like:
  95. *
  96. * if ( condition_holds )
  97. * yyless( 5 );
  98. * else
  99. * do_something_else();
  100. *
  101. * Prior to using the do-while the compiler would get upset at the
  102. * "else" because it interpreted the "if" statement as being all
  103. * done when it reached the ';' after the yyless() call.
  104. */
  105. /* Return all but the first 'n' matched characters back to the input stream. */
  106. #define yyless(n) \
  107. do \
  108. { \
  109. /* Undo effects of setting up yytext. */ \
  110. *yy_cp = yy_hold_char; \
  111. YY_RESTORE_YY_MORE_OFFSET \
  112. yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  113. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  114. } \
  115. while ( 0 )
  116. #define unput(c) yyunput( c, yytext_ptr )
  117. /* The following is because we cannot portably get our hands on size_t
  118. * (without autoconf's help, which isn't available because we want
  119. * flex-generated scanners to compile on their own).
  120. */
  121. typedef unsigned int yy_size_t;
  122. struct yy_buffer_state
  123. {
  124. %-
  125. FILE *yy_input_file;
  126. %+
  127. istream* yy_input_file;
  128. %*
  129. char *yy_ch_buf; /* input buffer */
  130. char *yy_buf_pos; /* current position in input buffer */
  131. /* Size of input buffer in bytes, not including room for EOB
  132. * characters.
  133. */
  134. yy_size_t yy_buf_size;
  135. /* Number of characters read into yy_ch_buf, not including EOB
  136. * characters.
  137. */
  138. int yy_n_chars;
  139. /* Whether we "own" the buffer - i.e., we know we created it,
  140. * and can realloc() it to grow it, and should free() it to
  141. * delete it.
  142. */
  143. int yy_is_our_buffer;
  144. /* Whether this is an "interactive" input source; if so, and
  145. * if we're using stdio for input, then we want to use getc()
  146. * instead of fread(), to make sure we stop fetching input after
  147. * each newline.
  148. */
  149. int yy_is_interactive;
  150. /* Whether we're considered to be at the beginning of a line.
  151. * If so, '^' rules will be active on the next match, otherwise
  152. * not.
  153. */
  154. int yy_at_bol;
  155. /* Whether to try to fill the input buffer when we reach the
  156. * end of it.
  157. */
  158. int yy_fill_buffer;
  159. int yy_buffer_status;
  160. #define YY_BUFFER_NEW 0
  161. #define YY_BUFFER_NORMAL 1
  162. /* When an EOF's been seen but there's still some text to process
  163. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  164. * shouldn't try reading from the input source any more. We might
  165. * still have a bunch of tokens to match, though, because of
  166. * possible backing-up.
  167. *
  168. * When we actually see the EOF, we change the status to "new"
  169. * (via yyrestart()), so that the user can continue scanning by
  170. * just pointing yyin at a new input file.
  171. */
  172. #define YY_BUFFER_EOF_PENDING 2
  173. };
  174. %- Standard (non-C++) definition
  175. static YY_BUFFER_STATE yy_current_buffer = 0;
  176. %*
  177. /* We provide macros for accessing buffer states in case in the
  178. * future we want to put the buffer states in a more general
  179. * "scanner state".
  180. */
  181. #define YY_CURRENT_BUFFER yy_current_buffer
  182. %- Standard (non-C++) definition
  183. /* yy_hold_char holds the character lost when yytext is formed. */
  184. static char yy_hold_char;
  185. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  186. int yyleng;
  187. /* Points to current character in buffer. */
  188. static char *yy_c_buf_p = (char *) 0;
  189. static int yy_init = 1; /* whether we need to initialize */
  190. static int yy_start = 0; /* start state number */
  191. /* Flag which is used to allow yywrap()'s to do buffer switches
  192. * instead of setting up a fresh yyin. A bit of a hack ...
  193. */
  194. static int yy_did_buffer_switch_on_eof;
  195. void yyrestart YY_PROTO(( FILE *input_file ));
  196. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  197. void yy_load_buffer_state YY_PROTO(( void ));
  198. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  199. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  200. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  201. void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  202. #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
  203. YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
  204. YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
  205. YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
  206. %*
  207. static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
  208. static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
  209. static void yy_flex_free YY_PROTO(( void * ));
  210. #define yy_new_buffer yy_create_buffer
  211. #define yy_set_interactive(is_interactive) \
  212. { \
  213. if ( ! yy_current_buffer ) \
  214. yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  215. yy_current_buffer->yy_is_interactive = is_interactive; \
  216. }
  217. #define yy_set_bol(at_bol) \
  218. { \
  219. if ( ! yy_current_buffer ) \
  220. yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  221. yy_current_buffer->yy_at_bol = at_bol; \
  222. }
  223. #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
  224. %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
  225. %- Standard (non-C++) definition
  226. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  227. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  228. static int yy_get_next_buffer YY_PROTO(( void ));
  229. static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
  230. %*
  231. /* Done after the current pattern has been matched and before the
  232. * corresponding action - sets up yytext.
  233. */
  234. #define YY_DO_BEFORE_ACTION \
  235. yytext_ptr = yy_bp; \
  236. %% code to fiddle yytext and yyleng for yymore() goes here
  237. yy_hold_char = *yy_cp; \
  238. *yy_cp = '\0'; \
  239. %% code to copy yytext_ptr to yytext[] goes here, if %array
  240. yy_c_buf_p = yy_cp;
  241. %% data tables for the DFA and the user's section 1 definitions go here
  242. /* Macros after this point can all be overridden by user definitions in
  243. * section 1.
  244. */
  245. #ifndef YY_SKIP_YYWRAP
  246. #ifdef __cplusplus
  247. extern "C" int yywrap YY_PROTO(( void ));
  248. #else
  249. extern int yywrap YY_PROTO(( void ));
  250. #endif
  251. #endif
  252. %-
  253. #ifndef YY_NO_UNPUT
  254. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  255. #endif
  256. %*
  257. #ifndef yytext_ptr
  258. static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
  259. #endif
  260. #ifdef YY_NEED_STRLEN
  261. static int yy_flex_strlen YY_PROTO(( yyconst char * ));
  262. #endif
  263. #ifndef YY_NO_INPUT
  264. %- Standard (non-C++) definition
  265. #ifdef __cplusplus
  266. static int yyinput YY_PROTO(( void ));
  267. #else
  268. static int input YY_PROTO(( void ));
  269. #endif
  270. %*
  271. #endif
  272. #if YY_STACK_USED
  273. static int yy_start_stack_ptr = 0;
  274. static int yy_start_stack_depth = 0;
  275. static int *yy_start_stack = 0;
  276. #ifndef YY_NO_PUSH_STATE
  277. static void yy_push_state YY_PROTO(( int new_state ));
  278. #endif
  279. #ifndef YY_NO_POP_STATE
  280. static void yy_pop_state YY_PROTO(( void ));
  281. #endif
  282. #ifndef YY_NO_TOP_STATE
  283. static int yy_top_state YY_PROTO(( void ));
  284. #endif
  285. #else
  286. #define YY_NO_PUSH_STATE 1
  287. #define YY_NO_POP_STATE 1
  288. #define YY_NO_TOP_STATE 1
  289. #endif
  290. #ifdef YY_MALLOC_DECL
  291. YY_MALLOC_DECL
  292. #else
  293. #if __STDC__
  294. #ifndef __cplusplus
  295. #include <stdlib.h>
  296. #endif
  297. #else
  298. /* Just try to get by without declaring the routines. This will fail
  299. * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  300. * or sizeof(void*) != sizeof(int).
  301. */
  302. #endif
  303. #endif
  304. /* Amount of stuff to slurp up with each read. */
  305. #ifndef YY_READ_BUF_SIZE
  306. #define YY_READ_BUF_SIZE 8192
  307. #endif
  308. /* Copy whatever the last rule matched to the standard output. */
  309. #ifndef ECHO
  310. %- Standard (non-C++) definition
  311. /* This used to be an fputs(), but since the string might contain NUL's,
  312. * we now use fwrite().
  313. */
  314. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  315. %+ C++ definition
  316. #define ECHO LexerOutput( yytext, yyleng )
  317. %*
  318. #endif
  319. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  320. * is returned in "result".
  321. */
  322. #ifndef YY_INPUT
  323. #define YY_INPUT(buf,result,max_size) \
  324. %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
  325. %+ C++ definition
  326. if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
  327. YY_FATAL_ERROR( "input in flex scanner failed" );
  328. %*
  329. #endif
  330. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  331. * we don't want an extra ';' after the "return" because that will cause
  332. * some compilers to complain about unreachable statements.
  333. */
  334. #ifndef yyterminate
  335. #define yyterminate() return YY_NULL
  336. #endif
  337. /* Number of entries by which start-condition stack grows. */
  338. #ifndef YY_START_STACK_INCR
  339. #define YY_START_STACK_INCR 25
  340. #endif
  341. /* Report a fatal error. */
  342. #ifndef YY_FATAL_ERROR
  343. %-
  344. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  345. %+
  346. #define YY_FATAL_ERROR(msg) LexerError( msg )
  347. %*
  348. #endif
  349. /* Default declaration of generated scanner - a define so the user can
  350. * easily add parameters.
  351. */
  352. #ifndef YY_DECL
  353. %- Standard (non-C++) definition
  354. #define YY_DECL int yylex YY_PROTO(( void ))
  355. %+ C++ definition
  356. #define YY_DECL int yyFlexLexer::yylex()
  357. %*
  358. #endif
  359. /* Code executed at the beginning of each rule, after yytext and yyleng
  360. * have been set up.
  361. */
  362. #ifndef YY_USER_ACTION
  363. #define YY_USER_ACTION
  364. #endif
  365. /* Code executed at the end of each rule. */
  366. #ifndef YY_BREAK
  367. #define YY_BREAK break;
  368. #endif
  369. %% YY_RULE_SETUP definition goes here
  370. YY_DECL
  371. {
  372. yy_state_type yy_current_state;
  373. char *yy_cp, *yy_bp;
  374. int yy_act;
  375. %% user's declarations go here
  376. if ( yy_init )
  377. {
  378. yy_init = 0;
  379. #ifdef YY_USER_INIT
  380. YY_USER_INIT;
  381. #endif
  382. if ( ! yy_start )
  383. yy_start = 1; /* first start state */
  384. if ( ! yyin )
  385. %-
  386. yyin = stdin;
  387. %+
  388. yyin = &cin;
  389. %*
  390. if ( ! yyout )
  391. %-
  392. yyout = stdout;
  393. %+
  394. yyout = &cout;
  395. %*
  396. if ( ! yy_current_buffer )
  397. yy_current_buffer =
  398. yy_create_buffer( yyin, YY_BUF_SIZE );
  399. yy_load_buffer_state();
  400. }
  401. while ( 1 ) /* loops until end-of-file is reached */
  402. {
  403. %% yymore()-related code goes here
  404. yy_cp = yy_c_buf_p;
  405. /* Support of yytext. */
  406. *yy_cp = yy_hold_char;
  407. /* yy_bp points to the position in yy_ch_buf of the start of
  408. * the current run.
  409. */
  410. yy_bp = yy_cp;
  411. %% code to set up and find next match goes here
  412. yy_find_action:
  413. %% code to find the action number goes here
  414. YY_DO_BEFORE_ACTION;
  415. %% code for yylineno update goes here
  416. do_action: /* This label is used only to access EOF actions. */
  417. %% debug code goes here
  418. switch ( yy_act )
  419. { /* beginning of action switch */
  420. %% actions go here
  421. case YY_END_OF_BUFFER:
  422. {
  423. /* Amount of text matched not including the EOB char. */
  424. int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
  425. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  426. *yy_cp = yy_hold_char;
  427. YY_RESTORE_YY_MORE_OFFSET
  428. if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
  429. {
  430. /* We're scanning a new file or input source. It's
  431. * possible that this happened because the user
  432. * just pointed yyin at a new source and called
  433. * yylex(). If so, then we have to assure
  434. * consistency between yy_current_buffer and our
  435. * globals. Here is the right place to do so, because
  436. * this is the first action (other than possibly a
  437. * back-up) that will match for the new input source.
  438. */
  439. yy_n_chars = yy_current_buffer->yy_n_chars;
  440. yy_current_buffer->yy_input_file = yyin;
  441. yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  442. }
  443. /* Note that here we test for yy_c_buf_p "<=" to the position
  444. * of the first EOB in the buffer, since yy_c_buf_p will
  445. * already have been incremented past the NUL character
  446. * (since all states make transitions on EOB to the
  447. * end-of-buffer state). Contrast this with the test
  448. * in input().
  449. */
  450. if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  451. { /* This was really a NUL. */
  452. yy_state_type yy_next_state;
  453. yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  454. yy_current_state = yy_get_previous_state();
  455. /* Okay, we're now positioned to make the NUL
  456. * transition. We couldn't have
  457. * yy_get_previous_state() go ahead and do it
  458. * for us because it doesn't know how to deal
  459. * with the possibility of jamming (and we don't
  460. * want to build jamming into it because then it
  461. * will run more slowly).
  462. */
  463. yy_next_state = yy_try_NUL_trans( yy_current_state );
  464. yy_bp = yytext_ptr + YY_MORE_ADJ;
  465. if ( yy_next_state )
  466. {
  467. /* Consume the NUL. */
  468. yy_cp = ++yy_c_buf_p;
  469. yy_current_state = yy_next_state;
  470. goto yy_match;
  471. }
  472. else
  473. {
  474. %% code to do back-up for compressed tables and set up yy_cp goes here
  475. goto yy_find_action;
  476. }
  477. }
  478. else switch ( yy_get_next_buffer() )
  479. {
  480. case EOB_ACT_END_OF_FILE:
  481. {
  482. yy_did_buffer_switch_on_eof = 0;
  483. if ( yywrap() )
  484. {
  485. /* Note: because we've taken care in
  486. * yy_get_next_buffer() to have set up
  487. * yytext, we can now set up
  488. * yy_c_buf_p so that if some total
  489. * hoser (like flex itself) wants to
  490. * call the scanner after we return the
  491. * YY_NULL, it'll still work - another
  492. * YY_NULL will get returned.
  493. */
  494. yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  495. yy_act = YY_STATE_EOF(YY_START);
  496. goto do_action;
  497. }
  498. else
  499. {
  500. if ( ! yy_did_buffer_switch_on_eof )
  501. YY_NEW_FILE;
  502. }
  503. break;
  504. }
  505. case EOB_ACT_CONTINUE_SCAN:
  506. yy_c_buf_p =
  507. yytext_ptr + yy_amount_of_matched_text;
  508. yy_current_state = yy_get_previous_state();
  509. yy_cp = yy_c_buf_p;
  510. yy_bp = yytext_ptr + YY_MORE_ADJ;
  511. goto yy_match;
  512. case EOB_ACT_LAST_MATCH:
  513. yy_c_buf_p =
  514. &yy_current_buffer->yy_ch_buf[yy_n_chars];
  515. yy_current_state = yy_get_previous_state();
  516. yy_cp = yy_c_buf_p;
  517. yy_bp = yytext_ptr + YY_MORE_ADJ;
  518. goto yy_find_action;
  519. }
  520. break;
  521. }
  522. default:
  523. YY_FATAL_ERROR(
  524. "fatal flex scanner internal error--no action found" );
  525. } /* end of action switch */
  526. } /* end of scanning one token */
  527. } /* end of yylex */
  528. %+
  529. yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
  530. {
  531. yyin = arg_yyin;
  532. yyout = arg_yyout;
  533. yy_c_buf_p = 0;
  534. yy_init = 1;
  535. yy_start = 0;
  536. yy_flex_debug = 0;
  537. yylineno = 1; // this will only get updated if %option yylineno
  538. yy_did_buffer_switch_on_eof = 0;
  539. yy_looking_for_trail_begin = 0;
  540. yy_more_flag = 0;
  541. yy_more_len = 0;
  542. yy_more_offset = yy_prev_more_offset = 0;
  543. yy_start_stack_ptr = yy_start_stack_depth = 0;
  544. yy_start_stack = 0;
  545. yy_current_buffer = 0;
  546. #ifdef YY_USES_REJECT
  547. yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
  548. #else
  549. yy_state_buf = 0;
  550. #endif
  551. }
  552. yyFlexLexer::~yyFlexLexer()
  553. {
  554. delete[] yy_state_buf;
  555. yy_delete_buffer( yy_current_buffer );
  556. }
  557. void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
  558. {
  559. if ( new_in )
  560. {
  561. yy_delete_buffer( yy_current_buffer );
  562. yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
  563. }
  564. if ( new_out )
  565. yyout = new_out;
  566. }
  567. #ifdef YY_INTERACTIVE
  568. int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
  569. #else
  570. int yyFlexLexer::LexerInput( char* buf, int max_size )
  571. #endif
  572. {
  573. if ( yyin->eof() || yyin->fail() )
  574. return 0;
  575. #ifdef YY_INTERACTIVE
  576. yyin->get( buf[0] );
  577. if ( yyin->eof() )
  578. return 0;
  579. if ( yyin->bad() )
  580. return -1;
  581. return 1;
  582. #else
  583. (void) yyin->read( buf, max_size );
  584. if ( yyin->bad() )
  585. return -1;
  586. else
  587. return yyin->gcount();
  588. #endif
  589. }
  590. void yyFlexLexer::LexerOutput( const char* buf, int size )
  591. {
  592. (void) yyout->write( buf, size );
  593. }
  594. %*
  595. /* yy_get_next_buffer - try to read in a new buffer
  596. *
  597. * Returns a code representing an action:
  598. * EOB_ACT_LAST_MATCH -
  599. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  600. * EOB_ACT_END_OF_FILE - end of file
  601. */
  602. %-
  603. static int yy_get_next_buffer()
  604. %+
  605. int yyFlexLexer::yy_get_next_buffer()
  606. %*
  607. {
  608. char *dest = yy_current_buffer->yy_ch_buf;
  609. char *source = yytext_ptr;
  610. int number_to_move, i;
  611. int ret_val;
  612. if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  613. YY_FATAL_ERROR(
  614. "fatal flex scanner internal error--end of buffer missed" );
  615. if ( yy_current_buffer->yy_fill_buffer == 0 )
  616. { /* Don't try to fill the buffer, so this is an EOF. */
  617. if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  618. {
  619. /* We matched a single character, the EOB, so
  620. * treat this as a final EOF.
  621. */
  622. return EOB_ACT_END_OF_FILE;
  623. }
  624. else
  625. {
  626. /* We matched some text prior to the EOB, first
  627. * process it.
  628. */
  629. return EOB_ACT_LAST_MATCH;
  630. }
  631. }
  632. /* Try to read more data. */
  633. /* First move last chars to start of buffer. */
  634. number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
  635. for ( i = 0; i < number_to_move; ++i )
  636. *(dest++) = *(source++);
  637. if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  638. /* don't do the read, it's not guaranteed to return an EOF,
  639. * just force an EOF
  640. */
  641. yy_current_buffer->yy_n_chars = yy_n_chars = 0;
  642. else
  643. {
  644. int num_to_read =
  645. yy_current_buffer->yy_buf_size - number_to_move - 1;
  646. while ( num_to_read <= 0 )
  647. { /* Not enough room in the buffer - grow it. */
  648. #ifdef YY_USES_REJECT
  649. YY_FATAL_ERROR(
  650. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  651. #else
  652. /* just a shorter name for the current buffer */
  653. YY_BUFFER_STATE b = yy_current_buffer;
  654. int yy_c_buf_p_offset =
  655. (int) (yy_c_buf_p - b->yy_ch_buf);
  656. if ( b->yy_is_our_buffer )
  657. {
  658. int new_size = b->yy_buf_size * 2;
  659. if ( new_size <= 0 )
  660. b->yy_buf_size += b->yy_buf_size / 8;
  661. else
  662. b->yy_buf_size *= 2;
  663. b->yy_ch_buf = (char *)
  664. /* Include room in for 2 EOB chars. */
  665. yy_flex_realloc( (void *) b->yy_ch_buf,
  666. b->yy_buf_size + 2 );
  667. }
  668. else
  669. /* Can't grow it, we don't own it. */
  670. b->yy_ch_buf = 0;
  671. if ( ! b->yy_ch_buf )
  672. YY_FATAL_ERROR(
  673. "fatal error - scanner input buffer overflow" );
  674. yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  675. num_to_read = yy_current_buffer->yy_buf_size -
  676. number_to_move - 1;
  677. #endif
  678. }
  679. if ( num_to_read > YY_READ_BUF_SIZE )
  680. num_to_read = YY_READ_BUF_SIZE;
  681. /* Read in more data. */
  682. YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  683. yy_n_chars, num_to_read );
  684. yy_current_buffer->yy_n_chars = yy_n_chars;
  685. }
  686. if ( yy_n_chars == 0 )
  687. {
  688. if ( number_to_move == YY_MORE_ADJ )
  689. {
  690. ret_val = EOB_ACT_END_OF_FILE;
  691. yyrestart( yyin );
  692. }
  693. else
  694. {
  695. ret_val = EOB_ACT_LAST_MATCH;
  696. yy_current_buffer->yy_buffer_status =
  697. YY_BUFFER_EOF_PENDING;
  698. }
  699. }
  700. else
  701. ret_val = EOB_ACT_CONTINUE_SCAN;
  702. yy_n_chars += number_to_move;
  703. yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  704. yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  705. yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
  706. return ret_val;
  707. }
  708. /* yy_get_previous_state - get the state just before the EOB char was reached */
  709. %-
  710. static yy_state_type yy_get_previous_state()
  711. %+
  712. yy_state_type yyFlexLexer::yy_get_previous_state()
  713. %*
  714. {
  715. yy_state_type yy_current_state;
  716. char *yy_cp;
  717. %% code to get the start state into yy_current_state goes here
  718. for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  719. {
  720. %% code to find the next state goes here
  721. }
  722. return yy_current_state;
  723. }
  724. /* yy_try_NUL_trans - try to make a transition on the NUL character
  725. *
  726. * synopsis
  727. * next_state = yy_try_NUL_trans( current_state );
  728. */
  729. %-
  730. #ifdef YY_USE_PROTOS
  731. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  732. #else
  733. static yy_state_type yy_try_NUL_trans( yy_current_state )
  734. yy_state_type yy_current_state;
  735. #endif
  736. %+
  737. yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
  738. %*
  739. {
  740. int yy_is_jam;
  741. %% code to find the next state, and perhaps do backing up, goes here
  742. return yy_is_jam ? 0 : yy_current_state;
  743. }
  744. %-
  745. #ifndef YY_NO_UNPUT
  746. #ifdef YY_USE_PROTOS
  747. static void yyunput( int c, char *yy_bp )
  748. #else
  749. static void yyunput( c, yy_bp )
  750. int c;
  751. char *yy_bp;
  752. #endif
  753. %+
  754. void yyFlexLexer::yyunput( int c, char* yy_bp )
  755. %*
  756. {
  757. char *yy_cp = yy_c_buf_p;
  758. /* undo effects of setting up yytext */
  759. *yy_cp = yy_hold_char;
  760. if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  761. { /* need to shift things up to make room */
  762. /* +2 for EOB chars. */
  763. int number_to_move = yy_n_chars + 2;
  764. char *dest = &yy_current_buffer->yy_ch_buf[
  765. yy_current_buffer->yy_buf_size + 2];
  766. char *source =
  767. &yy_current_buffer->yy_ch_buf[number_to_move];
  768. while ( source > yy_current_buffer->yy_ch_buf )
  769. *--dest = *--source;
  770. yy_cp += (int) (dest - source);
  771. yy_bp += (int) (dest - source);
  772. yy_current_buffer->yy_n_chars =
  773. yy_n_chars = yy_current_buffer->yy_buf_size;
  774. if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  775. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  776. }
  777. *--yy_cp = (char) c;
  778. %% update yylineno here
  779. yytext_ptr = yy_bp;
  780. yy_hold_char = *yy_cp;
  781. yy_c_buf_p = yy_cp;
  782. }
  783. %-
  784. #endif /* ifndef YY_NO_UNPUT */
  785. %*
  786. %-
  787. #ifdef __cplusplus
  788. static int yyinput()
  789. #else
  790. static int input()
  791. #endif
  792. %+
  793. int yyFlexLexer::yyinput()
  794. %*
  795. {
  796. int c;
  797. *yy_c_buf_p = yy_hold_char;
  798. if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  799. {
  800. /* yy_c_buf_p now points to the character we want to return.
  801. * If this occurs *before* the EOB characters, then it's a
  802. * valid NUL; if not, then we've hit the end of the buffer.
  803. */
  804. if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  805. /* This was really a NUL. */
  806. *yy_c_buf_p = '\0';
  807. else
  808. { /* need more input */
  809. int offset = yy_c_buf_p - yytext_ptr;
  810. ++yy_c_buf_p;
  811. switch ( yy_get_next_buffer() )
  812. {
  813. case EOB_ACT_LAST_MATCH:
  814. /* This happens because yy_g_n_b()
  815. * sees that we've accumulated a
  816. * token and flags that we need to
  817. * try matching the token before
  818. * proceeding. But for input(),
  819. * there's no matching to consider.
  820. * So convert the EOB_ACT_LAST_MATCH
  821. * to EOB_ACT_END_OF_FILE.
  822. */
  823. /* Reset buffer status. */
  824. yyrestart( yyin );
  825. /* fall through */
  826. case EOB_ACT_END_OF_FILE:
  827. {
  828. if ( yywrap() )
  829. return EOF;
  830. if ( ! yy_did_buffer_switch_on_eof )
  831. YY_NEW_FILE;
  832. #ifdef __cplusplus
  833. return yyinput();
  834. #else
  835. return input();
  836. #endif
  837. }
  838. case EOB_ACT_CONTINUE_SCAN:
  839. yy_c_buf_p = yytext_ptr + offset;
  840. break;
  841. }
  842. }
  843. }
  844. c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
  845. *yy_c_buf_p = '\0'; /* preserve yytext */
  846. yy_hold_char = *++yy_c_buf_p;
  847. %% update BOL and yylineno
  848. return c;
  849. }
  850. %-
  851. #ifdef YY_USE_PROTOS
  852. void yyrestart( FILE *input_file )
  853. #else
  854. void yyrestart( input_file )
  855. FILE *input_file;
  856. #endif
  857. %+
  858. void yyFlexLexer::yyrestart( istream* input_file )
  859. %*
  860. {
  861. if ( ! yy_current_buffer )
  862. yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  863. yy_init_buffer( yy_current_buffer, input_file );
  864. yy_load_buffer_state();
  865. }
  866. %-
  867. #ifdef YY_USE_PROTOS
  868. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  869. #else
  870. void yy_switch_to_buffer( new_buffer )
  871. YY_BUFFER_STATE new_buffer;
  872. #endif
  873. %+
  874. void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  875. %*
  876. {
  877. if ( yy_current_buffer == new_buffer )
  878. return;
  879. if ( yy_current_buffer )
  880. {
  881. /* Flush out information for old buffer. */
  882. *yy_c_buf_p = yy_hold_char;
  883. yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  884. yy_current_buffer->yy_n_chars = yy_n_chars;
  885. }
  886. yy_current_buffer = new_buffer;
  887. yy_load_buffer_state();
  888. /* We don't actually know whether we did this switch during
  889. * EOF (yywrap()) processing, but the only time this flag
  890. * is looked at is after yywrap() is called, so it's safe
  891. * to go ahead and always set it.
  892. */
  893. yy_did_buffer_switch_on_eof = 1;
  894. }
  895. %-
  896. #ifdef YY_USE_PROTOS
  897. void yy_load_buffer_state( void )
  898. #else
  899. void yy_load_buffer_state()
  900. #endif
  901. %+
  902. void yyFlexLexer::yy_load_buffer_state()
  903. %*
  904. {
  905. yy_n_chars = yy_current_buffer->yy_n_chars;
  906. yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  907. yyin = yy_current_buffer->yy_input_file;
  908. yy_hold_char = *yy_c_buf_p;
  909. }
  910. %-
  911. #ifdef YY_USE_PROTOS
  912. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  913. #else
  914. YY_BUFFER_STATE yy_create_buffer( file, size )
  915. FILE *file;
  916. int size;
  917. #endif
  918. %+
  919. YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
  920. %*
  921. {
  922. YY_BUFFER_STATE b;
  923. b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  924. if ( ! b )
  925. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  926. b->yy_buf_size = size;
  927. /* yy_ch_buf has to be 2 characters longer than the size given because
  928. * we need to put in 2 end-of-buffer characters.
  929. */
  930. b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  931. if ( ! b->yy_ch_buf )
  932. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  933. b->yy_is_our_buffer = 1;
  934. yy_init_buffer( b, file );
  935. return b;
  936. }
  937. %-
  938. #ifdef YY_USE_PROTOS
  939. void yy_delete_buffer( YY_BUFFER_STATE b )
  940. #else
  941. void yy_delete_buffer( b )
  942. YY_BUFFER_STATE b;
  943. #endif
  944. %+
  945. void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
  946. %*
  947. {
  948. if ( ! b )
  949. return;
  950. if ( b == yy_current_buffer )
  951. yy_current_buffer = (YY_BUFFER_STATE) 0;
  952. if ( b->yy_is_our_buffer )
  953. yy_flex_free( (void *) b->yy_ch_buf );
  954. yy_flex_free( (void *) b );
  955. }
  956. %-
  957. #ifndef _WIN32
  958. #include <unistd.h>
  959. #else
  960. #ifndef YY_ALWAYS_INTERACTIVE
  961. #ifndef YY_NEVER_INTERACTIVE
  962. extern int isatty YY_PROTO(( int ));
  963. #endif
  964. #endif
  965. #endif
  966. #ifdef YY_USE_PROTOS
  967. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  968. #else
  969. void yy_init_buffer( b, file )
  970. YY_BUFFER_STATE b;
  971. FILE *file;
  972. #endif
  973. %+
  974. void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
  975. %*
  976. {
  977. yy_flush_buffer( b );
  978. b->yy_input_file = file;
  979. b->yy_fill_buffer = 1;
  980. %-
  981. #if YY_ALWAYS_INTERACTIVE
  982. b->yy_is_interactive = 1;
  983. #else
  984. #if YY_NEVER_INTERACTIVE
  985. b->yy_is_interactive = 0;
  986. #else
  987. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  988. #endif
  989. #endif
  990. %+
  991. b->yy_is_interactive = 0;
  992. %*
  993. }
  994. %-
  995. #ifdef YY_USE_PROTOS
  996. void yy_flush_buffer( YY_BUFFER_STATE b )
  997. #else
  998. void yy_flush_buffer( b )
  999. YY_BUFFER_STATE b;
  1000. #endif
  1001. %+
  1002. void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
  1003. %*
  1004. {
  1005. if ( ! b )
  1006. return;
  1007. b->yy_n_chars = 0;
  1008. /* We always need two end-of-buffer characters. The first causes
  1009. * a transition to the end-of-buffer state. The second causes
  1010. * a jam in that state.
  1011. */
  1012. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1013. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1014. b->yy_buf_pos = &b->yy_ch_buf[0];
  1015. b->yy_at_bol = 1;
  1016. b->yy_buffer_status = YY_BUFFER_NEW;
  1017. if ( b == yy_current_buffer )
  1018. yy_load_buffer_state();
  1019. }
  1020. %*
  1021. #ifndef YY_NO_SCAN_BUFFER
  1022. %-
  1023. #ifdef YY_USE_PROTOS
  1024. YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
  1025. #else
  1026. YY_BUFFER_STATE yy_scan_buffer( base, size )
  1027. char *base;
  1028. yy_size_t size;
  1029. #endif
  1030. {
  1031. YY_BUFFER_STATE b;
  1032. if ( size < 2 ||
  1033. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1034. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1035. /* They forgot to leave room for the EOB's. */
  1036. return 0;
  1037. b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1038. if ( ! b )
  1039. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1040. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1041. b->yy_buf_pos = b->yy_ch_buf = base;
  1042. b->yy_is_our_buffer = 0;
  1043. b->yy_input_file = 0;
  1044. b->yy_n_chars = b->yy_buf_size;
  1045. b->yy_is_interactive = 0;
  1046. b->yy_at_bol = 1;
  1047. b->yy_fill_buffer = 0;
  1048. b->yy_buffer_status = YY_BUFFER_NEW;
  1049. yy_switch_to_buffer( b );
  1050. return b;
  1051. }
  1052. %*
  1053. #endif
  1054. #ifndef YY_NO_SCAN_STRING
  1055. %-
  1056. #ifdef YY_USE_PROTOS
  1057. YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
  1058. #else
  1059. YY_BUFFER_STATE yy_scan_string( yy_str )
  1060. yyconst char *yy_str;
  1061. #endif
  1062. {
  1063. int len;
  1064. for ( len = 0; yy_str[len]; ++len )
  1065. ;
  1066. return yy_scan_bytes( yy_str, len );
  1067. }
  1068. %*
  1069. #endif
  1070. #ifndef YY_NO_SCAN_BYTES
  1071. %-
  1072. #ifdef YY_USE_PROTOS
  1073. YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
  1074. #else
  1075. YY_BUFFER_STATE yy_scan_bytes( bytes, len )
  1076. yyconst char *bytes;
  1077. int len;
  1078. #endif
  1079. {
  1080. YY_BUFFER_STATE b;
  1081. char *buf;
  1082. yy_size_t n;
  1083. int i;
  1084. /* Get memory for full buffer, including space for trailing EOB's. */
  1085. n = len + 2;
  1086. buf = (char *) yy_flex_alloc( n );
  1087. if ( ! buf )
  1088. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1089. for ( i = 0; i < len; ++i )
  1090. buf[i] = bytes[i];
  1091. buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1092. b = yy_scan_buffer( buf, n );
  1093. if ( ! b )
  1094. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1095. /* It's okay to grow etc. this buffer, and we should throw it
  1096. * away when we're done.
  1097. */
  1098. b->yy_is_our_buffer = 1;
  1099. return b;
  1100. }
  1101. %*
  1102. #endif
  1103. #ifndef YY_NO_PUSH_STATE
  1104. %-
  1105. #ifdef YY_USE_PROTOS
  1106. static void yy_push_state( int new_state )
  1107. #else
  1108. static void yy_push_state( new_state )
  1109. int new_state;
  1110. #endif
  1111. %+
  1112. void yyFlexLexer::yy_push_state( int new_state )
  1113. %*
  1114. {
  1115. if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1116. {
  1117. yy_size_t new_size;
  1118. yy_start_stack_depth += YY_START_STACK_INCR;
  1119. new_size = yy_start_stack_depth * sizeof( int );
  1120. if ( ! yy_start_stack )
  1121. yy_start_stack = (int *) yy_flex_alloc( new_size );
  1122. else
  1123. yy_start_stack = (int *) yy_flex_realloc(
  1124. (void *) yy_start_stack, new_size );
  1125. if ( ! yy_start_stack )
  1126. YY_FATAL_ERROR(
  1127. "out of memory expanding start-condition stack" );
  1128. }
  1129. yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1130. BEGIN(new_state);
  1131. }
  1132. #endif
  1133. #ifndef YY_NO_POP_STATE
  1134. %-
  1135. static void yy_pop_state()
  1136. %+
  1137. void yyFlexLexer::yy_pop_state()
  1138. %*
  1139. {
  1140. if ( --yy_start_stack_ptr < 0 )
  1141. YY_FATAL_ERROR( "start-condition stack underflow" );
  1142. BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1143. }
  1144. #endif
  1145. #ifndef YY_NO_TOP_STATE
  1146. %-
  1147. static int yy_top_state()
  1148. %+
  1149. int yyFlexLexer::yy_top_state()
  1150. %*
  1151. {
  1152. return yy_start_stack[yy_start_stack_ptr - 1];
  1153. }
  1154. #endif
  1155. #ifndef YY_EXIT_FAILURE
  1156. #define YY_EXIT_FAILURE 2
  1157. #endif
  1158. %-
  1159. #ifdef YY_USE_PROTOS
  1160. static void yy_fatal_error( yyconst char msg[] )
  1161. #else
  1162. static void yy_fatal_error( msg )
  1163. char msg[];
  1164. #endif
  1165. {
  1166. (void) fprintf( stderr, "%s\n", msg );
  1167. exit( YY_EXIT_FAILURE );
  1168. }
  1169. %+
  1170. void yyFlexLexer::LexerError( yyconst char msg[] )
  1171. {
  1172. cerr << msg << '\n';
  1173. exit( YY_EXIT_FAILURE );
  1174. }
  1175. %*
  1176. /* Redefine yyless() so it works in section 3 code. */
  1177. #undef yyless
  1178. #define yyless(n) \
  1179. do \
  1180. { \
  1181. /* Undo effects of setting up yytext. */ \
  1182. yytext[yyleng] = yy_hold_char; \
  1183. yy_c_buf_p = yytext + n; \
  1184. yy_hold_char = *yy_c_buf_p; \
  1185. *yy_c_buf_p = '\0'; \
  1186. yyleng = n; \
  1187. } \
  1188. while ( 0 )
  1189. /* Internal utility routines. */
  1190. #ifndef yytext_ptr
  1191. #ifdef YY_USE_PROTOS
  1192. static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
  1193. #else
  1194. static void yy_flex_strncpy( s1, s2, n )
  1195. char *s1;
  1196. yyconst char *s2;
  1197. int n;
  1198. #endif
  1199. {
  1200. int i;
  1201. for ( i = 0; i < n; ++i )
  1202. s1[i] = s2[i];
  1203. }
  1204. #endif
  1205. #ifdef YY_NEED_STRLEN
  1206. #ifdef YY_USE_PROTOS
  1207. static int yy_flex_strlen( yyconst char *s )
  1208. #else
  1209. static int yy_flex_strlen( s )
  1210. yyconst char *s;
  1211. #endif
  1212. {
  1213. int n;
  1214. for ( n = 0; s[n]; ++n )
  1215. ;
  1216. return n;
  1217. }
  1218. #endif
  1219. #ifdef YY_USE_PROTOS
  1220. static void *yy_flex_alloc( yy_size_t size )
  1221. #else
  1222. static void *yy_flex_alloc( size )
  1223. yy_size_t size;
  1224. #endif
  1225. {
  1226. return (void *) malloc( size );
  1227. }
  1228. #ifdef YY_USE_PROTOS
  1229. static void *yy_flex_realloc( void *ptr, yy_size_t size )
  1230. #else
  1231. static void *yy_flex_realloc( ptr, size )
  1232. void *ptr;
  1233. yy_size_t size;
  1234. #endif
  1235. {
  1236. /* The cast to (char *) in the following accommodates both
  1237. * implementations that use char* generic pointers, and those
  1238. * that use void* generic pointers. It works with the latter
  1239. * because both ANSI C and C++ allow castless assignment from
  1240. * any pointer type to void*, and deal with argument conversions
  1241. * as though doing an assignment.
  1242. */
  1243. return (void *) realloc( (char *) ptr, size );
  1244. }
  1245. #ifdef YY_USE_PROTOS
  1246. static void yy_flex_free( void *ptr )
  1247. #else
  1248. static void yy_flex_free( ptr )
  1249. void *ptr;
  1250. #endif
  1251. {
  1252. free( ptr );
  1253. }
  1254. #if YY_MAIN
  1255. int main()
  1256. {
  1257. yylex();
  1258. return 0;
  1259. }
  1260. #endif