flex.skel 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. /* A lexical scanner generated by flex */
  2. /* scanner skeleton version:
  3. * $Id$
  4. */
  5. #define FLEX_SCANNER
  6. #define ACK_MOD
  7. #include <stdio.h>
  8. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  9. #ifdef c_plusplus
  10. #ifndef __cplusplus
  11. #define __cplusplus
  12. #endif
  13. #endif
  14. #ifdef __cplusplus
  15. #include <stdlib.h>
  16. #include <osfcn.h>
  17. /* use prototypes in function declarations */
  18. #define YY_USE_PROTOS
  19. /* the "const" storage-class-modifier is valid */
  20. #define YY_USE_CONST
  21. #else /* ! __cplusplus */
  22. #ifdef __STDC__
  23. #ifdef __GNUC__
  24. #include <stddef.h>
  25. void *malloc( size_t );
  26. void free( void* );
  27. #else
  28. #include <stdlib.h>
  29. #endif /* __GNUC__ */
  30. #define YY_USE_PROTOS
  31. #define YY_USE_CONST
  32. #endif /* __STDC__ */
  33. #endif /* ! __cplusplus */
  34. #ifdef __TURBOC__
  35. #define YY_USE_CONST
  36. #endif
  37. #ifndef YY_USE_CONST
  38. #define const
  39. #endif
  40. #ifdef YY_USE_PROTOS
  41. #define YY_PROTO(proto) proto
  42. #else
  43. #define YY_PROTO(proto) ()
  44. /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
  45. * so it's got to be a K&R compiler, and therefore there's no standard
  46. * place from which to include these definitions
  47. */
  48. char *malloc();
  49. int free();
  50. int read();
  51. #endif
  52. /* amount of stuff to slurp up with each read */
  53. #ifndef YY_READ_BUF_SIZE
  54. #define YY_READ_BUF_SIZE 8192
  55. #endif
  56. /* returned upon end-of-file */
  57. #define YY_END_TOK 0
  58. /* copy whatever the last rule matched to the standard output */
  59. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  60. /* this used to be an fputs(), but since the string might contain NUL's,
  61. * we now use fwrite()
  62. */
  63. #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  64. /* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  65. * is returned in "result".
  66. */
  67. #define YY_INPUT(buf,result,max_size) \
  68. if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  69. YY_FATAL_ERROR( "read() in flex scanner failed" );
  70. #define YY_NULL 0
  71. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  72. * we don't want an extra ';' after the "return" because that will cause
  73. * some compilers to complain about unreachable statements.
  74. */
  75. #define yyterminate() return ( YY_NULL )
  76. /* report a fatal error */
  77. /* The funky do-while is used to turn this macro definition into
  78. * a single C statement (which needs a semi-colon terminator).
  79. * This avoids problems with code like:
  80. *
  81. * if ( something_happens )
  82. * YY_FATAL_ERROR( "oops, the something happened" );
  83. * else
  84. * everything_okay();
  85. *
  86. * Prior to using the do-while the compiler would get upset at the
  87. * "else" because it interpreted the "if" statement as being all
  88. * done when it reached the ';' after the YY_FATAL_ERROR() call.
  89. */
  90. #define YY_FATAL_ERROR(msg) \
  91. do \
  92. { \
  93. (void) fputs( msg, stderr ); \
  94. (void) putc( '\n', stderr ); \
  95. exit( 1 ); \
  96. } \
  97. while ( 0 )
  98. /* default yywrap function - always treat EOF as an EOF */
  99. #define yywrap() 1
  100. /* enter a start condition. This macro really ought to take a parameter,
  101. * but we do it the disgusting crufty way forced on us by the ()-less
  102. * definition of BEGIN
  103. */
  104. #define BEGIN yy_start = 1 + 2 *
  105. /* action number for EOF rule of a given start state */
  106. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  107. /* special action meaning "start processing a new file" */
  108. #define YY_NEW_FILE \
  109. do \
  110. { \
  111. yy_init_buffer( yy_current_buffer, yyin ); \
  112. yy_load_buffer_state(); \
  113. } \
  114. while ( 0 )
  115. /* default declaration of generated scanner - a define so the user can
  116. * easily add parameters
  117. */
  118. #define YY_DECL int yylex YY_PROTO(( void ))
  119. /* code executed at the end of each rule */
  120. #define YY_BREAK break;
  121. #define YY_END_OF_BUFFER_CHAR 0
  122. #ifndef YY_BUF_SIZE
  123. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  124. #endif
  125. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  126. %% section 1 definitions go here
  127. /* done after the current pattern has been matched and before the
  128. * corresponding action - sets up yytext
  129. */
  130. #define YY_DO_BEFORE_ACTION \
  131. yytext = yy_bp; \
  132. %% code to fiddle yytext and yyleng for yymore() goes here
  133. yy_hold_char = *yy_cp; \
  134. *yy_cp = '\0'; \
  135. yy_c_buf_p = yy_cp;
  136. #define EOB_ACT_CONTINUE_SCAN 0
  137. #define EOB_ACT_END_OF_FILE 1
  138. #define EOB_ACT_LAST_MATCH 2
  139. /* return all but the first 'n' matched characters back to the input stream */
  140. #define yyless(n) \
  141. do \
  142. { \
  143. /* undo effects of setting up yytext */ \
  144. *yy_cp = yy_hold_char; \
  145. yy_c_buf_p = yy_cp = yy_bp + n; \
  146. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  147. } \
  148. while ( 0 )
  149. #define unput(c) yyunput( c, yytext )
  150. struct yy_buffer_state
  151. {
  152. FILE *yy_input_file;
  153. YY_CHAR *yy_ch_buf; /* input buffer */
  154. YY_CHAR *yy_buf_pos; /* current position in input buffer */
  155. /* size of input buffer in bytes, not including room for EOB characters*/
  156. int yy_buf_size;
  157. /* number of characters read into yy_ch_buf, not including EOB characters */
  158. int yy_n_chars;
  159. int yy_eof_status; /* whether we've seen an EOF on this buffer */
  160. #define EOF_NOT_SEEN 0
  161. /* "pending" happens when the EOF has been seen but there's still
  162. * some text process
  163. */
  164. #define EOF_PENDING 1
  165. #define EOF_DONE 2
  166. };
  167. static YY_BUFFER_STATE yy_current_buffer;
  168. /* we provide macros for accessing buffer states in case in the
  169. * future we want to put the buffer states in a more general
  170. * "scanner state"
  171. */
  172. #define YY_CURRENT_BUFFER yy_current_buffer
  173. /* yy_hold_char holds the character lost when yytext is formed */
  174. static YY_CHAR yy_hold_char;
  175. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  176. #ifndef YY_USER_ACTION
  177. #define YY_USER_ACTION
  178. #endif
  179. #ifndef YY_USER_INIT
  180. #define YY_USER_INIT
  181. #endif
  182. extern YY_CHAR *yytext;
  183. extern int yyleng;
  184. extern FILE *yyin, *yyout;
  185. YY_CHAR *yytext;
  186. int yyleng;
  187. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  188. %% data tables for the DFA go here
  189. /* these variables are all declared out here so that section 3 code can
  190. * manipulate them
  191. */
  192. /* points to current character in buffer */
  193. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  194. static int yy_init = 1; /* whether we need to initialize */
  195. static int yy_start = 0; /* start state number */
  196. /* flag which is used to allow yywrap()'s to do buffer switches
  197. * instead of setting up a fresh yyin. A bit of a hack ...
  198. */
  199. static int yy_did_buffer_switch_on_eof;
  200. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  201. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  202. static int yy_get_next_buffer YY_PROTO(( void ));
  203. static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
  204. void yyrestart YY_PROTO(( FILE *input_file ));
  205. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  206. void yy_load_buffer_state YY_PROTO(( void ));
  207. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  208. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  209. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  210. #define yy_new_buffer yy_create_buffer
  211. #ifdef __cplusplus
  212. static int yyinput YY_PROTO(( void ));
  213. #else
  214. static int input YY_PROTO(( void ));
  215. #endif
  216. YY_DECL
  217. {
  218. register yy_state_type yy_current_state;
  219. register YY_CHAR *yy_cp, *yy_bp;
  220. register int yy_act;
  221. %% user's declarations go here
  222. if ( yy_init )
  223. {
  224. YY_USER_INIT;
  225. if ( ! yy_start )
  226. yy_start = 1; /* first start state */
  227. if ( ! yyin )
  228. yyin = stdin;
  229. if ( ! yyout )
  230. yyout = stdout;
  231. if ( yy_current_buffer )
  232. yy_init_buffer( yy_current_buffer, yyin );
  233. else
  234. yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  235. yy_load_buffer_state();
  236. yy_init = 0;
  237. }
  238. while ( 1 ) /* loops until end-of-file is reached */
  239. {
  240. %% yymore()-related code goes here
  241. yy_cp = yy_c_buf_p;
  242. /* support of yytext */
  243. *yy_cp = yy_hold_char;
  244. /* yy_bp points to the position in yy_ch_buf of the start of the
  245. * current run.
  246. */
  247. yy_bp = yy_cp;
  248. %% code to set up and find next match goes here
  249. yy_find_action:
  250. %% code to find the action number goes here
  251. YY_DO_BEFORE_ACTION;
  252. YY_USER_ACTION;
  253. do_action: /* this label is used only to access EOF actions */
  254. %% debug code goes here
  255. switch ( yy_act )
  256. {
  257. %% actions go here
  258. case YY_END_OF_BUFFER:
  259. {
  260. /* amount of text matched not including the EOB char */
  261. int yy_amount_of_matched_text = yy_cp - yytext - 1;
  262. /* undo the effects of YY_DO_BEFORE_ACTION */
  263. *yy_cp = yy_hold_char;
  264. /* note that here we test for yy_c_buf_p "<=" to the position
  265. * of the first EOB in the buffer, since yy_c_buf_p will
  266. * already have been incremented past the NUL character
  267. * (since all states make transitions on EOB to the end-
  268. * of-buffer state). Contrast this with the test in yyinput().
  269. */
  270. if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  271. /* this was really a NUL */
  272. {
  273. yy_state_type yy_next_state;
  274. yy_c_buf_p = yytext + yy_amount_of_matched_text;
  275. yy_current_state = yy_get_previous_state();
  276. /* okay, we're now positioned to make the
  277. * NUL transition. We couldn't have
  278. * yy_get_previous_state() go ahead and do it
  279. * for us because it doesn't know how to deal
  280. * with the possibility of jamming (and we
  281. * don't want to build jamming into it because
  282. * then it will run more slowly)
  283. */
  284. yy_next_state = yy_try_NUL_trans( yy_current_state );
  285. yy_bp = yytext + YY_MORE_ADJ;
  286. if ( yy_next_state )
  287. {
  288. /* consume the NUL */
  289. yy_cp = ++yy_c_buf_p;
  290. yy_current_state = yy_next_state;
  291. goto yy_match;
  292. }
  293. else
  294. {
  295. %% code to do backtracking for compressed tables and set up yy_cp goes here
  296. goto yy_find_action;
  297. }
  298. }
  299. else switch ( yy_get_next_buffer() )
  300. {
  301. case EOB_ACT_END_OF_FILE:
  302. {
  303. yy_did_buffer_switch_on_eof = 0;
  304. if ( yywrap() )
  305. {
  306. /* note: because we've taken care in
  307. * yy_get_next_buffer() to have set up yytext,
  308. * we can now set up yy_c_buf_p so that if some
  309. * total hoser (like flex itself) wants
  310. * to call the scanner after we return the
  311. * YY_NULL, it'll still work - another YY_NULL
  312. * will get returned.
  313. */
  314. yy_c_buf_p = yytext + YY_MORE_ADJ;
  315. yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  316. goto do_action;
  317. }
  318. else
  319. {
  320. if ( ! yy_did_buffer_switch_on_eof )
  321. YY_NEW_FILE;
  322. }
  323. }
  324. break;
  325. case EOB_ACT_CONTINUE_SCAN:
  326. yy_c_buf_p = yytext + yy_amount_of_matched_text;
  327. yy_current_state = yy_get_previous_state();
  328. yy_cp = yy_c_buf_p;
  329. yy_bp = yytext + YY_MORE_ADJ;
  330. goto yy_match;
  331. case EOB_ACT_LAST_MATCH:
  332. yy_c_buf_p =
  333. &yy_current_buffer->yy_ch_buf[yy_n_chars];
  334. yy_current_state = yy_get_previous_state();
  335. yy_cp = yy_c_buf_p;
  336. yy_bp = yytext + YY_MORE_ADJ;
  337. goto yy_find_action;
  338. }
  339. break;
  340. }
  341. default:
  342. #ifdef FLEX_DEBUG
  343. printf( "action # %d\n", yy_act );
  344. #endif
  345. YY_FATAL_ERROR(
  346. "fatal flex scanner internal error--no action found" );
  347. }
  348. }
  349. }
  350. /* yy_get_next_buffer - try to read in a new buffer
  351. *
  352. * synopsis
  353. * int yy_get_next_buffer();
  354. *
  355. * returns a code representing an action
  356. * EOB_ACT_LAST_MATCH -
  357. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  358. * EOB_ACT_END_OF_FILE - end of file
  359. */
  360. static int yy_get_next_buffer()
  361. {
  362. register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  363. register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  364. register int number_to_move, i;
  365. int ret_val;
  366. if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  367. YY_FATAL_ERROR(
  368. "fatal flex scanner internal error--end of buffer missed" );
  369. /* try to read more data */
  370. /* first move last chars to start of buffer */
  371. number_to_move = yy_c_buf_p - yytext;
  372. for ( i = 0; i < number_to_move; ++i )
  373. *(dest++) = *(source++);
  374. if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  375. /* don't do the read, it's not guaranteed to return an EOF,
  376. * just force an EOF
  377. */
  378. yy_n_chars = 0;
  379. else
  380. {
  381. int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  382. if ( num_to_read > YY_READ_BUF_SIZE )
  383. num_to_read = YY_READ_BUF_SIZE;
  384. else if ( num_to_read <= 0 )
  385. YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  386. /* read in more data */
  387. YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  388. yy_n_chars, num_to_read );
  389. }
  390. if ( yy_n_chars == 0 )
  391. {
  392. if ( number_to_move == 1 )
  393. {
  394. ret_val = EOB_ACT_END_OF_FILE;
  395. yy_current_buffer->yy_eof_status = EOF_DONE;
  396. }
  397. else
  398. {
  399. ret_val = EOB_ACT_LAST_MATCH;
  400. yy_current_buffer->yy_eof_status = EOF_PENDING;
  401. }
  402. }
  403. else
  404. ret_val = EOB_ACT_CONTINUE_SCAN;
  405. yy_n_chars += number_to_move;
  406. yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  407. yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  408. /* yytext begins at the second character in yy_ch_buf; the first
  409. * character is the one which preceded it before reading in the latest
  410. * buffer; it needs to be kept around in case it's a newline, so
  411. * yy_get_previous_state() will have with '^' rules active
  412. */
  413. yytext = &yy_current_buffer->yy_ch_buf[1];
  414. return ( ret_val );
  415. }
  416. /* yy_get_previous_state - get the state just before the EOB char was reached
  417. *
  418. * synopsis
  419. * yy_state_type yy_get_previous_state();
  420. */
  421. static yy_state_type yy_get_previous_state()
  422. {
  423. register yy_state_type yy_current_state;
  424. register YY_CHAR *yy_cp;
  425. %% code to get the start state into yy_current_state goes here
  426. for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  427. {
  428. %% code to find the next state goes here
  429. }
  430. return ( yy_current_state );
  431. }
  432. /* yy_try_NUL_trans - try to make a transition on the NUL character
  433. *
  434. * synopsis
  435. * next_state = yy_try_NUL_trans( current_state );
  436. */
  437. #ifdef YY_USE_PROTOS
  438. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  439. #else
  440. static yy_state_type yy_try_NUL_trans( yy_current_state )
  441. register yy_state_type yy_current_state;
  442. #endif
  443. {
  444. register int yy_is_jam;
  445. %% code to find the next state, and perhaps do backtracking, goes here
  446. return ( yy_is_jam ? 0 : yy_current_state );
  447. }
  448. #ifdef YY_USE_PROTOS
  449. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  450. #else
  451. static void yyunput( c, yy_bp )
  452. YY_CHAR c;
  453. register YY_CHAR *yy_bp;
  454. #endif
  455. {
  456. register YY_CHAR *yy_cp = yy_c_buf_p;
  457. /* undo effects of setting up yytext */
  458. *yy_cp = yy_hold_char;
  459. if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  460. { /* need to shift things up to make room */
  461. register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  462. register YY_CHAR *dest =
  463. &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  464. register YY_CHAR *source =
  465. &yy_current_buffer->yy_ch_buf[number_to_move];
  466. while ( source > yy_current_buffer->yy_ch_buf )
  467. *--dest = *--source;
  468. yy_cp += dest - source;
  469. yy_bp += dest - source;
  470. yy_n_chars = yy_current_buffer->yy_buf_size;
  471. if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  472. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  473. }
  474. if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  475. yy_cp[-2] = '\n';
  476. *--yy_cp = c;
  477. /* note: the formal parameter *must* be called "yy_bp" for this
  478. * macro to now work correctly
  479. */
  480. YY_DO_BEFORE_ACTION; /* set up yytext again */
  481. }
  482. #ifdef __cplusplus
  483. static int yyinput()
  484. #else
  485. static int input()
  486. #endif
  487. {
  488. int c;
  489. YY_CHAR *yy_cp = yy_c_buf_p;
  490. *yy_cp = yy_hold_char;
  491. if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  492. {
  493. /* yy_c_buf_p now points to the character we want to return.
  494. * If this occurs *before* the EOB characters, then it's a
  495. * valid NUL; if not, then we've hit the end of the buffer.
  496. */
  497. if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  498. /* this was really a NUL */
  499. *yy_c_buf_p = '\0';
  500. else
  501. { /* need more input */
  502. yytext = yy_c_buf_p;
  503. ++yy_c_buf_p;
  504. switch ( yy_get_next_buffer() )
  505. {
  506. case EOB_ACT_END_OF_FILE:
  507. {
  508. if ( yywrap() )
  509. {
  510. yy_c_buf_p = yytext + YY_MORE_ADJ;
  511. return ( EOF );
  512. }
  513. YY_NEW_FILE;
  514. #ifdef __cplusplus
  515. return ( yyinput() );
  516. #else
  517. return ( input() );
  518. #endif
  519. }
  520. break;
  521. case EOB_ACT_CONTINUE_SCAN:
  522. yy_c_buf_p = yytext + YY_MORE_ADJ;
  523. break;
  524. case EOB_ACT_LAST_MATCH:
  525. #ifdef __cplusplus
  526. YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  527. #else
  528. YY_FATAL_ERROR( "unexpected last match in input()" );
  529. #endif
  530. }
  531. }
  532. }
  533. c = *yy_c_buf_p;
  534. yy_hold_char = *++yy_c_buf_p;
  535. return ( c );
  536. }
  537. #ifdef YY_USE_PROTOS
  538. void yyrestart( FILE *input_file )
  539. #else
  540. void yyrestart( input_file )
  541. FILE *input_file;
  542. #endif
  543. {
  544. yy_init_buffer( yy_current_buffer, input_file );
  545. yy_load_buffer_state();
  546. }
  547. #ifdef YY_USE_PROTOS
  548. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  549. #else
  550. void yy_switch_to_buffer( new_buffer )
  551. YY_BUFFER_STATE new_buffer;
  552. #endif
  553. {
  554. if ( yy_current_buffer == new_buffer )
  555. return;
  556. if ( yy_current_buffer )
  557. {
  558. /* flush out information for old buffer */
  559. *yy_c_buf_p = yy_hold_char;
  560. yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  561. yy_current_buffer->yy_n_chars = yy_n_chars;
  562. }
  563. yy_current_buffer = new_buffer;
  564. yy_load_buffer_state();
  565. /* we don't actually know whether we did this switch during
  566. * EOF (yywrap()) processing, but the only time this flag
  567. * is looked at is after yywrap() is called, so it's safe
  568. * to go ahead and always set it.
  569. */
  570. yy_did_buffer_switch_on_eof = 1;
  571. }
  572. #ifdef YY_USE_PROTOS
  573. void yy_load_buffer_state( void )
  574. #else
  575. void yy_load_buffer_state()
  576. #endif
  577. {
  578. yy_n_chars = yy_current_buffer->yy_n_chars;
  579. yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  580. yyin = yy_current_buffer->yy_input_file;
  581. yy_hold_char = *yy_c_buf_p;
  582. }
  583. #ifdef YY_USE_PROTOS
  584. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  585. #else
  586. YY_BUFFER_STATE yy_create_buffer( file, size )
  587. FILE *file;
  588. int size;
  589. #endif
  590. {
  591. YY_BUFFER_STATE b;
  592. b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  593. if ( ! b )
  594. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  595. b->yy_buf_size = size;
  596. /* yy_ch_buf has to be 2 characters longer than the size given because
  597. * we need to put in 2 end-of-buffer characters.
  598. */
  599. b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  600. if ( ! b->yy_ch_buf )
  601. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  602. yy_init_buffer( b, file );
  603. return ( b );
  604. }
  605. #ifdef YY_USE_PROTOS
  606. void yy_delete_buffer( YY_BUFFER_STATE b )
  607. #else
  608. void yy_delete_buffer( b )
  609. YY_BUFFER_STATE b;
  610. #endif
  611. {
  612. if ( b == yy_current_buffer )
  613. yy_current_buffer = (YY_BUFFER_STATE) 0;
  614. free( (char *) b->yy_ch_buf );
  615. free( (char *) b );
  616. }
  617. #ifdef YY_USE_PROTOS
  618. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  619. #else
  620. void yy_init_buffer( b, file )
  621. YY_BUFFER_STATE b;
  622. FILE *file;
  623. #endif
  624. {
  625. b->yy_input_file = file;
  626. /* we put in the '\n' and start reading from [1] so that an
  627. * initial match-at-newline will be true.
  628. */
  629. b->yy_ch_buf[0] = '\n';
  630. b->yy_n_chars = 1;
  631. /* we always need two end-of-buffer characters. The first causes
  632. * a transition to the end-of-buffer state. The second causes
  633. * a jam in that state.
  634. */
  635. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  636. b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  637. b->yy_buf_pos = &b->yy_ch_buf[1];
  638. b->yy_eof_status = EOF_NOT_SEEN;
  639. }
  640. #ifdef ACK_MOD
  641. /* redefine yyless() so that it does not access local variables of YYDECL */
  642. #undef yyless
  643. /* return all but the first 'n' matched characters back to the input stream */
  644. #define yyless(n) \
  645. do \
  646. { \
  647. /* undo effects of setting up yytext */ \
  648. yytext[yyleng] = yy_hold_char; \
  649. yy_c_buf_p = yytext + n; \
  650. yy_hold_char = *yy_c_buf_p; \
  651. *yy_c_buf_p = '\0'; \
  652. yyleng = n; \
  653. } \
  654. while ( 0 )
  655. #endif /* ACK_MOD */