home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / gnu / flex-2.4.6-src.lha / src / amiga / flex-2.4.6 / flex.skl < prev    next >
Text File  |  1994-01-04  |  27KB  |  1,217 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* Scanner skeleton version:
  4.  * $Header: flex.skl,v 1.2 94/01/04 14:33:15 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. %-
  10. #include <stdio.h>
  11. %*
  12.  
  13.  
  14. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  15. #ifdef c_plusplus
  16. #ifndef __cplusplus
  17. #define __cplusplus
  18. #endif
  19. #endif
  20.  
  21.  
  22. #ifdef __cplusplus
  23.  
  24. #include <stdlib.h>
  25. %+
  26. class istream;
  27. %*
  28. #include <unistd.h>
  29.  
  30. /* Use prototypes in function declarations. */
  31. #define YY_USE_PROTOS
  32.  
  33. /* The "const" storage-class-modifier is valid. */
  34. #define YY_USE_CONST
  35.  
  36. #else    /* ! __cplusplus */
  37.  
  38. #ifdef __STDC__
  39.  
  40. #define YY_USE_PROTOS
  41. #define YY_USE_CONST
  42.  
  43. #endif    /* __STDC__ */
  44. #endif    /* ! __cplusplus */
  45.  
  46.  
  47. #ifdef __TURBOC__
  48. #define YY_USE_CONST
  49. #endif
  50.  
  51.  
  52. #ifndef YY_USE_CONST
  53. #ifndef const
  54. #define const
  55. #endif
  56. #endif
  57.  
  58.  
  59. #ifdef YY_USE_PROTOS
  60. #define YY_PROTO(proto) proto
  61. #else
  62. #define YY_PROTO(proto) ()
  63. #endif
  64.  
  65. /* Returned upon end-of-file. */
  66. #define YY_NULL 0
  67.  
  68. /* Promotes a possibly negative, possibly signed char to an unsigned
  69.  * integer for use as an array index.  If the signed char is negative,
  70.  * we want to instead treat it as an 8-bit unsigned char, hence the
  71.  * double cast.
  72.  */
  73. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  74.  
  75. /* Enter a start condition.  This macro really ought to take a parameter,
  76.  * but we do it the disgusting crufty way forced on us by the ()-less
  77.  * definition of BEGIN.
  78.  */
  79. #define BEGIN yy_start = 1 + 2 *
  80.  
  81. /* Translate the current start state into a value that can be later handed
  82.  * to BEGIN to return to the state.
  83.  */
  84. #define YY_START ((yy_start - 1) / 2)
  85.  
  86. /* Action number for EOF rule of a given start state. */
  87. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  88.  
  89. /* Special action meaning "start processing a new file".  Now included
  90.  * only for backward compatibility with previous versions of flex.
  91.  */
  92. #define YY_NEW_FILE yyrestart( yyin )
  93.  
  94. #define YY_END_OF_BUFFER_CHAR 0
  95.  
  96. /* Size of default input buffer. */
  97. #define YY_BUF_SIZE 16384
  98.  
  99. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  100.  
  101. extern int yyleng;
  102. %-
  103. extern FILE *yyin, *yyout;
  104. %*
  105.  
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109.     extern int yywrap YY_PROTO(( void ));
  110. #ifdef __cplusplus
  111.     }
  112. #endif
  113.  
  114. #define EOB_ACT_CONTINUE_SCAN 0
  115. #define EOB_ACT_END_OF_FILE 1
  116. #define EOB_ACT_LAST_MATCH 2
  117.  
  118. /* The funky do-while in the following #define is used to turn the definition
  119.  * int a single C statement (which needs a semi-colon terminator).  This
  120.  * avoids problems with code like:
  121.  *
  122.  *     if ( condition_holds )
  123.  *        yyless( 5 );
  124.  *    else
  125.  *        do_something_else();
  126.  *
  127.  * Prior to using the do-while the compiler would get upset at the
  128.  * "else" because it interpreted the "if" statement as being all
  129.  * done when it reached the ';' after the yyless() call.
  130.  */
  131.  
  132. /* Return all but the first 'n' matched characters back to the input stream. */
  133.  
  134. #define yyless(n) \
  135.     do \
  136.         { \
  137.         /* Undo effects of setting up yytext. */ \
  138.         *yy_cp = yy_hold_char; \
  139.         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  140.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  141.         } \
  142.     while ( 0 )
  143.  
  144. #define unput(c) yyunput( c, yytext_ptr )
  145.  
  146.  
  147. struct yy_buffer_state
  148.     {
  149. %-
  150.     FILE *yy_input_file;
  151. %+
  152.     istream* yy_input_file;
  153. %*
  154.  
  155.     char *yy_ch_buf;        /* input buffer */
  156.     char *yy_buf_pos;        /* current position in input buffer */
  157.  
  158.     /* Size of input buffer in bytes, not including room for EOB
  159.      * characters.
  160.      */
  161.     int yy_buf_size;
  162.  
  163.     /* Number of characters read into yy_ch_buf, not including EOB
  164.      * characters.
  165.      */
  166.     int yy_n_chars;
  167.  
  168.     /* Whether this is an "interactive" input source; if so, and
  169.      * if we're using stdio for input, then we want to use getc()
  170.      * instead of fread(), to make sure we stop fetching input after
  171.      * each newline.
  172.      */
  173.     int yy_is_interactive;
  174.  
  175.     /* Whether to try to fill the input buffer when we reach the
  176.      * end of it.
  177.      */
  178.     int yy_fill_buffer;
  179.  
  180.     /* Whether we've seen an EOF on this buffer. */
  181.     int yy_eof_status;
  182. #define EOF_NOT_SEEN 0
  183.     /* "Pending" happens when the EOF has been seen but there's still
  184.      * some text to process.  Note that when we actually see the EOF,
  185.      * we switch the status back to "not seen" (via yyrestart()), so
  186.      * that the user can continue scanning by just pointing yyin at
  187.      * a new input file.
  188.      */
  189. #define EOF_PENDING 1
  190.     };
  191.  
  192. %- Standard (non-C++) definition
  193. static YY_BUFFER_STATE yy_current_buffer = 0;
  194. %*
  195.  
  196. /* We provide macros for accessing buffer states in case in the
  197.  * future we want to put the buffer states in a more general
  198.  * "scanner state".
  199.  */
  200. #define YY_CURRENT_BUFFER yy_current_buffer
  201.  
  202.  
  203. %- Standard (non-C++) definition
  204. /* yy_hold_char holds the character lost when yytext is formed. */
  205. static char yy_hold_char;
  206.  
  207. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  208.  
  209.  
  210. int yyleng;
  211.  
  212. /* Points to current character in buffer. */
  213. static char *yy_c_buf_p = (char *) 0;
  214. static int yy_init = 1;        /* whether we need to initialize */
  215. static int yy_start = 0;    /* start state number */
  216.  
  217. /* Flag which is used to allow yywrap()'s to do buffer switches
  218.  * instead of setting up a fresh yyin.  A bit of a hack ...
  219.  */
  220. static int yy_did_buffer_switch_on_eof;
  221.  
  222. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  223. void yyrestart YY_PROTO(( FILE *input_file ));
  224. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  225. void yy_load_buffer_state YY_PROTO(( void ));
  226. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  227. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  228. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  229.  
  230. static int yy_start_stack_ptr = 0;
  231. static int yy_start_stack_depth = 0;
  232. static int *yy_start_stack = 0;
  233. static void yy_push_state YY_PROTO(( int new_state ));
  234. static void yy_pop_state YY_PROTO(( void ));
  235. static int yy_top_state YY_PROTO(( void ));
  236. %*
  237.  
  238. #ifndef yytext_ptr
  239. static void yy_flex_strcpy YY_PROTO(( char *, const char * ));
  240. #endif
  241.  
  242. static void *yy_flex_alloc YY_PROTO(( unsigned int ));
  243. static void *yy_flex_realloc YY_PROTO(( void *ptr, unsigned int ));
  244. static void yy_flex_free YY_PROTO(( void * ));
  245.  
  246. #define yy_new_buffer yy_create_buffer
  247.  
  248. %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
  249.  
  250. %- Standard (non-C++) definition
  251. #ifdef __cplusplus
  252. static int yyinput YY_PROTO(( void ));
  253. #else
  254. static int input YY_PROTO(( void ));
  255. #endif
  256. %*
  257.  
  258. %- Standard (non-C++) definition
  259. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  260. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  261. static int yy_get_next_buffer YY_PROTO(( void ));
  262. static void yy_fatal_error YY_PROTO(( const char msg[] ));
  263. %*
  264.  
  265. /* Done after the current pattern has been matched and before the
  266.  * corresponding action - sets up yytext.
  267.  */
  268. #define YY_DO_BEFORE_ACTION \
  269.     yytext_ptr = yy_bp; \
  270. %% code to fiddle yytext and yyleng for yymore() goes here
  271.     yy_hold_char = *yy_cp; \
  272.     *yy_cp = '\0'; \
  273. %% code to copy yytext_ptr to yytext[] goes here, if %array
  274.     yy_c_buf_p = yy_cp;
  275.  
  276. %% data tables for the DFA and the user's section 1 definitions go here
  277.  
  278. /* Macros after this point can all be overridden by user definitions in
  279.  * section 1.
  280.  */
  281.  
  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.  
  297. /* Amount of stuff to slurp up with each read. */
  298. #ifndef YY_READ_BUF_SIZE
  299. #define YY_READ_BUF_SIZE 8192
  300. #endif
  301.  
  302. /* Copy whatever the last rule matched to the standard output. */
  303.  
  304. #ifndef ECHO
  305. %- Standard (non-C++) definition
  306. /* This used to be an fputs(), but since the string might contain NUL's,
  307.  * we now use fwrite().
  308.  */
  309. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  310. %+ C++ definition
  311. #define ECHO LexerOutput( yytext, yyleng )
  312. %*
  313. #endif
  314.  
  315. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  316.  * is returned in "result".
  317.  */
  318. #ifndef YY_INPUT
  319. #define YY_INPUT(buf,result,max_size) \
  320. %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
  321. %+ C++ definition
  322.     if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
  323.         YY_FATAL_ERROR( "input in flex scan