Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1578 lines
45 KiB

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