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.

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