home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 329_01 / skeleton.h < prev    next >
Text File  |  1989-10-03  |  2KB  |  44 lines

  1. /* macro definitions for compressed-table C/FTL programs generated by flex */
  2. #include <stdlib.h>     /* exit() prototype */
  3. #include <io.h>         /* read(), write() prototypes */
  4. #include "skelcom.h"
  5.  
  6. /* reinitializes everything except the current start condition.  The last
  7.  * input character is set to a newline so an initial beginning-of-line
  8.  * rule will match
  9.  */
  10. #define YY_INIT \
  11.     { \
  12.     yyleng = yy_c_buf_p = yy_e_buf_p = 0; \
  13.     yy_hold_char = yy_ch_buf[yy_c_buf_p] = '\n'; \
  14.     yytext = &yy_ch_buf[yy_c_buf_p]; \
  15.     yy_saw_eof = 0; \
  16.     }
  17.  
  18. /* returns the length of the matched text */
  19. #define YY_LENG (yy_c_buf_p - yy_b_buf_p + 1)
  20.  
  21. /* done before the next pattern has been matched action */
  22. #define YY_DO_BEFORE_SCAN \
  23.     yytext[yyleng] = yy_hold_char;
  24.  
  25. /* done after the current pattern has been matched and before the corresponding action */
  26. #define YY_DO_BEFORE_ACTION \
  27.     yytext = &yy_ch_buf[yy_b_buf_p]; \
  28.     yyleng = YY_LENG; \
  29.     yy_hold_char = yytext[yyleng]; \
  30.     yytext[yyleng] = '\0';
  31.  
  32. /* find the next rule matched */
  33. #ifdef FLEX_REJECT_ENABLED
  34. #define REJECT \
  35.         { \
  36.     YY_DO_BEFORE_SCAN; /* undo effects of setting up yytext */ \
  37.     yy_c_buf_p = yy_full_match; /* restore possibly backed-over text */ \
  38.         ++yy_lp; \
  39.         goto find_rule; \
  40.         }
  41. #else
  42. #define REJECT YY_FATAL_ERROR( "REJECT used and scanner was not generated using -r" )
  43. #endif
  44.