rlm@1: #line 2 "expr-lex.cpp" rlm@1: /* A lexical scanner generated by flex */ rlm@1: rlm@1: /* Scanner skeleton version: rlm@1: * $Header: /cvsroot/vba/VisualBoyAdvance/src/expr-lex.cpp,v 1.2 2003/06/06 14:17:21 forgotten Exp $ rlm@1: */ rlm@1: rlm@1: #define FLEX_SCANNER rlm@1: #define YY_FLEX_MAJOR_VERSION 2 rlm@1: #define YY_FLEX_MINOR_VERSION 5 rlm@1: rlm@1: #include rlm@1: #ifdef __GNUC__ rlm@1: #include rlm@1: #endif rlm@1: rlm@1: rlm@1: /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ rlm@1: #ifdef c_plusplus rlm@1: #ifndef __cplusplus rlm@1: #define __cplusplus rlm@1: #endif rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifdef __cplusplus rlm@1: rlm@1: #include rlm@1: rlm@1: /* Use prototypes in function declarations. */ rlm@1: #define YY_USE_PROTOS rlm@1: rlm@1: /* The "const" storage-class-modifier is valid. */ rlm@1: #define YY_USE_CONST rlm@1: rlm@1: #else /* ! __cplusplus */ rlm@1: rlm@1: #if __STDC__ rlm@1: rlm@1: #define YY_USE_PROTOS rlm@1: #define YY_USE_CONST rlm@1: rlm@1: #endif /* __STDC__ */ rlm@1: #endif /* ! __cplusplus */ rlm@1: rlm@1: #ifdef __TURBOC__ rlm@1: #pragma warn -rch rlm@1: #pragma warn -use rlm@1: #include rlm@1: #include rlm@1: #define YY_USE_CONST rlm@1: #define YY_USE_PROTOS rlm@1: #endif rlm@1: rlm@1: #ifdef YY_USE_CONST rlm@1: #define yyconst const rlm@1: #else rlm@1: #define yyconst rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: #define YY_PROTO(proto) proto rlm@1: #else rlm@1: #define YY_PROTO(proto) () rlm@1: #endif rlm@1: rlm@1: /* Returned upon end-of-file. */ rlm@1: #define YY_NULL 0 rlm@1: rlm@1: /* Promotes a possibly negative, possibly signed char to an unsigned rlm@1: * integer for use as an array index. If the signed char is negative, rlm@1: * we want to instead treat it as an 8-bit unsigned char, hence the rlm@1: * double cast. rlm@1: */ rlm@1: #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) rlm@1: rlm@1: /* Enter a start condition. This macro really ought to take a parameter, rlm@1: * but we do it the disgusting crufty way forced on us by the ()-less rlm@1: * definition of BEGIN. rlm@1: */ rlm@1: #define BEGIN yy_start = 1 + 2 * rlm@1: rlm@1: /* Translate the current start state into a value that can be later handed rlm@1: * to BEGIN to return to the state. The YYSTATE alias is for lex rlm@1: * compatibility. rlm@1: */ rlm@1: #define YY_START ((yy_start - 1) / 2) rlm@1: #define YYSTATE YY_START rlm@1: rlm@1: /* Action number for EOF rule of a given start state. */ rlm@1: #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) rlm@1: rlm@1: /* Special action meaning "start processing a new file". */ rlm@1: #define YY_NEW_FILE yyrestart( yyin ) rlm@1: rlm@1: #define YY_END_OF_BUFFER_CHAR 0 rlm@1: rlm@1: /* Size of default input buffer. */ rlm@1: #define YY_BUF_SIZE 16384 rlm@1: rlm@1: typedef struct yy_buffer_state *YY_BUFFER_STATE; rlm@1: rlm@1: extern int yyleng; rlm@1: extern FILE *yyin, *yyout; rlm@1: rlm@1: #define EOB_ACT_CONTINUE_SCAN 0 rlm@1: #define EOB_ACT_END_OF_FILE 1 rlm@1: #define EOB_ACT_LAST_MATCH 2 rlm@1: rlm@1: /* The funky do-while in the following #define is used to turn the definition rlm@1: * int a single C statement (which needs a semi-colon terminator). This rlm@1: * avoids problems with code like: rlm@1: * rlm@1: * if ( condition_holds ) rlm@1: * yyless( 5 ); rlm@1: * else rlm@1: * do_something_else(); rlm@1: * rlm@1: * Prior to using the do-while the compiler would get upset at the rlm@1: * "else" because it interpreted the "if" statement as being all rlm@1: * done when it reached the ';' after the yyless() call. rlm@1: */ rlm@1: rlm@1: /* Return all but the first 'n' matched characters back to the input stream. */ rlm@1: rlm@1: #define yyless(n) \ rlm@1: do \ rlm@1: { \ rlm@1: /* Undo effects of setting up yytext. */ \ rlm@1: *yy_cp = yy_hold_char; \ rlm@1: YY_RESTORE_YY_MORE_OFFSET \ rlm@1: yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ rlm@1: YY_DO_BEFORE_ACTION; /* set up yytext again */ \ rlm@1: } \ rlm@1: while ( 0 ) rlm@1: rlm@1: #define unput(c) yyunput( c, yytext_ptr ) rlm@1: rlm@1: /* The following is because we cannot portably get our hands on size_t rlm@1: * (without autoconf's help, which isn't available because we want rlm@1: * flex-generated scanners to compile on their own). rlm@1: */ rlm@1: typedef unsigned int yy_size_t; rlm@1: rlm@1: rlm@1: struct yy_buffer_state rlm@1: { rlm@1: FILE *yy_input_file; rlm@1: rlm@1: char *yy_ch_buf; /* input buffer */ rlm@1: char *yy_buf_pos; /* current position in input buffer */ rlm@1: rlm@1: /* Size of input buffer in bytes, not including room for EOB rlm@1: * characters. rlm@1: */ rlm@1: yy_size_t yy_buf_size; rlm@1: rlm@1: /* Number of characters read into yy_ch_buf, not including EOB rlm@1: * characters. rlm@1: */ rlm@1: int yy_n_chars; rlm@1: rlm@1: /* Whether we "own" the buffer - i.e., we know we created it, rlm@1: * and can realloc() it to grow it, and should free() it to rlm@1: * delete it. rlm@1: */ rlm@1: int yy_is_our_buffer; rlm@1: rlm@1: /* Whether this is an "interactive" input source; if so, and rlm@1: * if we're using stdio for input, then we want to use getc() rlm@1: * instead of fread(), to make sure we stop fetching input after rlm@1: * each newline. rlm@1: */ rlm@1: int yy_is_interactive; rlm@1: rlm@1: /* Whether we're considered to be at the beginning of a line. rlm@1: * If so, '^' rules will be active on the next match, otherwise rlm@1: * not. rlm@1: */ rlm@1: int yy_at_bol; rlm@1: rlm@1: /* Whether to try to fill the input buffer when we reach the rlm@1: * end of it. rlm@1: */ rlm@1: int yy_fill_buffer; rlm@1: rlm@1: int yy_buffer_status; rlm@1: #define YY_BUFFER_NEW 0 rlm@1: #define YY_BUFFER_NORMAL 1 rlm@1: /* When an EOF's been seen but there's still some text to process rlm@1: * then we mark the buffer as YY_EOF_PENDING, to indicate that we rlm@1: * shouldn't try reading from the input source any more. We might rlm@1: * still have a bunch of tokens to match, though, because of rlm@1: * possible backing-up. rlm@1: * rlm@1: * When we actually see the EOF, we change the status to "new" rlm@1: * (via yyrestart()), so that the user can continue scanning by rlm@1: * just pointing yyin at a new input file. rlm@1: */ rlm@1: #define YY_BUFFER_EOF_PENDING 2 rlm@1: }; rlm@1: rlm@1: static YY_BUFFER_STATE yy_current_buffer = 0; rlm@1: rlm@1: /* We provide macros for accessing buffer states in case in the rlm@1: * future we want to put the buffer states in a more general rlm@1: * "scanner state". rlm@1: */ rlm@1: #define YY_CURRENT_BUFFER yy_current_buffer rlm@1: rlm@1: rlm@1: /* yy_hold_char holds the character lost when yytext is formed. */ rlm@1: static char yy_hold_char; rlm@1: rlm@1: static int yy_n_chars; /* number of characters read into yy_ch_buf */ rlm@1: rlm@1: rlm@1: int yyleng; rlm@1: rlm@1: /* Points to current character in buffer. */ rlm@1: static char *yy_c_buf_p = (char *) 0; rlm@1: static int yy_init = 1; /* whether we need to initialize */ rlm@1: static int yy_start = 0; /* start state number */ rlm@1: rlm@1: /* Flag which is used to allow yywrap()'s to do buffer switches rlm@1: * instead of setting up a fresh yyin. A bit of a hack ... rlm@1: */ rlm@1: static int yy_did_buffer_switch_on_eof; rlm@1: rlm@1: void yyrestart YY_PROTO(( FILE *input_file )); rlm@1: rlm@1: void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); rlm@1: void yy_load_buffer_state YY_PROTO(( void )); rlm@1: YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); rlm@1: void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); rlm@1: void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); rlm@1: void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); rlm@1: #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) rlm@1: rlm@1: YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); rlm@1: YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); rlm@1: YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); rlm@1: rlm@1: static void *yy_flex_alloc YY_PROTO(( yy_size_t )); rlm@1: static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); rlm@1: static void yy_flex_free YY_PROTO(( void * )); rlm@1: rlm@1: #define yy_new_buffer yy_create_buffer rlm@1: rlm@1: #define yy_set_interactive(is_interactive) \ rlm@1: { \ rlm@1: if ( ! yy_current_buffer ) \ rlm@1: yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ rlm@1: yy_current_buffer->yy_is_interactive = is_interactive; \ rlm@1: } rlm@1: rlm@1: #define yy_set_bol(at_bol) \ rlm@1: { \ rlm@1: if ( ! yy_current_buffer ) \ rlm@1: yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ rlm@1: yy_current_buffer->yy_at_bol = at_bol; \ rlm@1: } rlm@1: rlm@1: #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) rlm@1: rlm@1: rlm@1: #define yywrap() 1 rlm@1: #define YY_SKIP_YYWRAP rlm@1: typedef unsigned char YY_CHAR; rlm@1: FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; rlm@1: typedef int yy_state_type; rlm@1: extern char *yytext; rlm@1: #define yytext_ptr yytext rlm@1: rlm@1: static yy_state_type yy_get_previous_state YY_PROTO(( void )); rlm@1: static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); rlm@1: static int yy_get_next_buffer YY_PROTO(( void )); rlm@1: static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); rlm@1: rlm@1: /* Done after the current pattern has been matched and before the rlm@1: * corresponding action - sets up yytext. rlm@1: */ rlm@1: #define YY_DO_BEFORE_ACTION \ rlm@1: yytext_ptr = yy_bp; \ rlm@1: yyleng = (int) (yy_cp - yy_bp); \ rlm@1: yy_hold_char = *yy_cp; \ rlm@1: *yy_cp = '\0'; \ rlm@1: yy_c_buf_p = yy_cp; rlm@1: rlm@1: #define YY_NUM_RULES 10 rlm@1: #define YY_END_OF_BUFFER 11 rlm@1: static yyconst short int yy_accept[24] = rlm@1: { 0, rlm@1: 0, 0, 11, 9, 8, 8, 6, 7, 9, 4, rlm@1: 3, 2, 2, 8, 5, 3, 2, 2, 2, 2, rlm@1: 2, 1, 0 rlm@1: } ; rlm@1: rlm@1: static yyconst int yy_ec[256] = rlm@1: { 0, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 2, 1, 1, 1, 1, 1, 4, 1, 1, rlm@1: 1, 5, 1, 1, 6, 7, 1, 8, 8, 8, rlm@1: 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, rlm@1: 1, 9, 1, 1, 10, 10, 10, 10, 10, 10, rlm@1: 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, rlm@1: 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, rlm@1: 1, 1, 1, 1, 10, 1, 10, 10, 10, 10, rlm@1: rlm@1: 11, 12, 10, 10, 13, 10, 10, 10, 10, 10, rlm@1: 14, 10, 10, 10, 15, 10, 10, 10, 10, 10, rlm@1: 10, 16, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1 rlm@1: } ; rlm@1: rlm@1: static yyconst int yy_meta[17] = rlm@1: { 0, rlm@1: 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, rlm@1: 2, 2, 2, 2, 2, 2 rlm@1: } ; rlm@1: rlm@1: static yyconst short int yy_base[25] = rlm@1: { 0, rlm@1: 0, 0, 32, 33, 15, 17, 33, 33, 22, 33, rlm@1: 22, 0, 16, 19, 33, 20, 0, 11, 15, 11, rlm@1: 12, 0, 33, 21 rlm@1: } ; rlm@1: rlm@1: static yyconst short int yy_def[25] = rlm@1: { 0, rlm@1: 23, 1, 23, 23, 23, 23, 23, 23, 23, 23, rlm@1: 23, 24, 24, 23, 23, 23, 24, 24, 24, 24, rlm@1: 24, 24, 0, 23 rlm@1: } ; rlm@1: rlm@1: static yyconst short int yy_nxt[50] = rlm@1: { 0, rlm@1: 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, rlm@1: 12, 12, 12, 12, 13, 12, 14, 14, 14, 14, rlm@1: 14, 14, 17, 22, 21, 20, 19, 16, 18, 16, rlm@1: 15, 23, 3, 23, 23, 23, 23, 23, 23, 23, rlm@1: 23, 23, 23, 23, 23, 23, 23, 23, 23 rlm@1: } ; rlm@1: rlm@1: static yyconst short int yy_chk[50] = rlm@1: { 0, rlm@1: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, rlm@1: 1, 1, 1, 1, 1, 1, 5, 5, 6, 6, rlm@1: 14, 14, 24, 21, 20, 19, 18, 16, 13, 11, rlm@1: 9, 3, 23, 23, 23, 23, 23, 23, 23, 23, rlm@1: 23, 23, 23, 23, 23, 23, 23, 23, 23 rlm@1: } ; rlm@1: rlm@1: static yy_state_type yy_last_accepting_state; rlm@1: static char *yy_last_accepting_cpos; rlm@1: rlm@1: /* The intent behind this definition is that it'll catch rlm@1: * any uses of REJECT which flex missed. rlm@1: */ rlm@1: #define REJECT reject_used_but_not_detected rlm@1: #define yymore() yymore_used_but_not_detected rlm@1: #define YY_MORE_ADJ 0 rlm@1: #define YY_RESTORE_YY_MORE_OFFSET rlm@1: char *yytext; rlm@1: #line 1 "expr.l" rlm@1: #define INITIAL 0 rlm@1: #line 2 "expr.l" rlm@1: #include "expr.cpp.h" rlm@1: rlm@1: #ifndef __GNUC__ rlm@1: #include rlm@1: #define isatty _isatty rlm@1: #endif rlm@1: rlm@1: char *exprString; rlm@1: int exprCol; rlm@1: rlm@1: #define YY_INPUT(buf,result,max_size) \ rlm@1: { \ rlm@1: int c = *exprString++; \ rlm@1: exprCol++;\ rlm@1: result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ rlm@1: } rlm@1: #define YY_MAIN 0 rlm@1: #line 400 "expr-lex.cpp" rlm@1: rlm@1: /* Macros after this point can all be overridden by user definitions in rlm@1: * section 1. rlm@1: */ rlm@1: rlm@1: #ifndef YY_SKIP_YYWRAP rlm@1: #ifdef __cplusplus rlm@1: extern "C" int yywrap YY_PROTO(( void )); rlm@1: #else rlm@1: extern int yywrap YY_PROTO(( void )); rlm@1: #endif rlm@1: #endif rlm@1: rlm@1: #ifndef YY_NO_UNPUT rlm@1: static void yyunput YY_PROTO(( int c, char *buf_ptr )); rlm@1: #endif rlm@1: rlm@1: #ifndef yytext_ptr rlm@1: static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); rlm@1: #endif rlm@1: rlm@1: #ifdef YY_NEED_STRLEN rlm@1: static int yy_flex_strlen YY_PROTO(( yyconst char * )); rlm@1: #endif rlm@1: rlm@1: #ifndef YY_NO_INPUT rlm@1: #ifdef __cplusplus rlm@1: static int yyinput YY_PROTO(( void )); rlm@1: #else rlm@1: static int input YY_PROTO(( void )); rlm@1: #endif rlm@1: #endif rlm@1: rlm@1: #if YY_STACK_USED rlm@1: static int yy_start_stack_ptr = 0; rlm@1: static int yy_start_stack_depth = 0; rlm@1: static int *yy_start_stack = 0; rlm@1: #ifndef YY_NO_PUSH_STATE rlm@1: static void yy_push_state YY_PROTO(( int new_state )); rlm@1: #endif rlm@1: #ifndef YY_NO_POP_STATE rlm@1: static void yy_pop_state YY_PROTO(( void )); rlm@1: #endif rlm@1: #ifndef YY_NO_TOP_STATE rlm@1: static int yy_top_state YY_PROTO(( void )); rlm@1: #endif rlm@1: rlm@1: #else rlm@1: #define YY_NO_PUSH_STATE 1 rlm@1: #define YY_NO_POP_STATE 1 rlm@1: #define YY_NO_TOP_STATE 1 rlm@1: #endif rlm@1: rlm@1: #ifdef YY_MALLOC_DECL rlm@1: YY_MALLOC_DECL rlm@1: #else rlm@1: #if __STDC__ rlm@1: #ifndef __cplusplus rlm@1: #include rlm@1: #endif rlm@1: #else rlm@1: /* Just try to get by without declaring the routines. This will fail rlm@1: * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) rlm@1: * or sizeof(void*) != sizeof(int). rlm@1: */ rlm@1: #endif rlm@1: #endif rlm@1: rlm@1: /* Amount of stuff to slurp up with each read. */ rlm@1: #ifndef YY_READ_BUF_SIZE rlm@1: #define YY_READ_BUF_SIZE 8192 rlm@1: #endif rlm@1: rlm@1: /* Copy whatever the last rule matched to the standard output. */ rlm@1: rlm@1: #ifndef ECHO rlm@1: /* This used to be an fputs(), but since the string might contain NUL's, rlm@1: * we now use fwrite(). rlm@1: */ rlm@1: #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) rlm@1: #endif rlm@1: rlm@1: /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, rlm@1: * is returned in "result". rlm@1: */ rlm@1: #ifndef YY_INPUT rlm@1: #define YY_INPUT(buf,result,max_size) \ rlm@1: if ( yy_current_buffer->yy_is_interactive ) \ rlm@1: { \ rlm@1: int c = '*', n; \ rlm@1: for ( n = 0; n < max_size && \ rlm@1: (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ rlm@1: buf[n] = (char) c; \ rlm@1: if ( c == '\n' ) \ rlm@1: buf[n++] = (char) c; \ rlm@1: if ( c == EOF && ferror( yyin ) ) \ rlm@1: YY_FATAL_ERROR( "input in flex scanner failed" ); \ rlm@1: result = n; \ rlm@1: } \ rlm@1: else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ rlm@1: && ferror( yyin ) ) \ rlm@1: YY_FATAL_ERROR( "input in flex scanner failed" ); rlm@1: #endif rlm@1: rlm@1: /* No semi-colon after return; correct usage is to write "yyterminate();" - rlm@1: * we don't want an extra ';' after the "return" because that will cause rlm@1: * some compilers to complain about unreachable statements. rlm@1: */ rlm@1: #ifndef yyterminate rlm@1: #define yyterminate() return YY_NULL rlm@1: #endif rlm@1: rlm@1: /* Number of entries by which start-condition stack grows. */ rlm@1: #ifndef YY_START_STACK_INCR rlm@1: #define YY_START_STACK_INCR 25 rlm@1: #endif rlm@1: rlm@1: /* Report a fatal error. */ rlm@1: #ifndef YY_FATAL_ERROR rlm@1: #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) rlm@1: #endif rlm@1: rlm@1: /* Default declaration of generated scanner - a define so the user can rlm@1: * easily add parameters. rlm@1: */ rlm@1: #ifndef YY_DECL rlm@1: #define YY_DECL int yylex YY_PROTO(( void )) rlm@1: #endif rlm@1: rlm@1: /* Code executed at the beginning of each rule, after yytext and yyleng rlm@1: * have been set up. rlm@1: */ rlm@1: #ifndef YY_USER_ACTION rlm@1: #define YY_USER_ACTION rlm@1: #endif rlm@1: rlm@1: /* Code executed at the end of each rule. */ rlm@1: #ifndef YY_BREAK rlm@1: #define YY_BREAK break; rlm@1: #endif rlm@1: rlm@1: #define YY_RULE_SETUP \ rlm@1: YY_USER_ACTION rlm@1: rlm@1: YY_DECL rlm@1: { rlm@1: register yy_state_type yy_current_state; rlm@1: register char *yy_cp = NULL, *yy_bp = NULL; rlm@1: register int yy_act; rlm@1: rlm@1: #line 31 "expr.l" rlm@1: rlm@1: rlm@1: #line 554 "expr-lex.cpp" rlm@1: rlm@1: if ( yy_init ) rlm@1: { rlm@1: yy_init = 0; rlm@1: rlm@1: #ifdef YY_USER_INIT rlm@1: YY_USER_INIT; rlm@1: #endif rlm@1: rlm@1: if ( ! yy_start ) rlm@1: yy_start = 1; /* first start state */ rlm@1: rlm@1: if ( ! yyin ) rlm@1: yyin = stdin; rlm@1: rlm@1: if ( ! yyout ) rlm@1: yyout = stdout; rlm@1: rlm@1: if ( ! yy_current_buffer ) rlm@1: yy_current_buffer = rlm@1: yy_create_buffer( yyin, YY_BUF_SIZE ); rlm@1: rlm@1: yy_load_buffer_state(); rlm@1: } rlm@1: rlm@1: while ( 1 ) /* loops until end-of-file is reached */ rlm@1: { rlm@1: yy_cp = yy_c_buf_p; rlm@1: rlm@1: /* Support of yytext. */ rlm@1: *yy_cp = yy_hold_char; rlm@1: rlm@1: /* yy_bp points to the position in yy_ch_buf of the start of rlm@1: * the current run. rlm@1: */ rlm@1: yy_bp = yy_cp; rlm@1: rlm@1: yy_current_state = yy_start; rlm@1: yy_match: rlm@1: do rlm@1: { rlm@1: register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; rlm@1: if ( yy_accept[yy_current_state] ) rlm@1: { rlm@1: yy_last_accepting_state = yy_current_state; rlm@1: yy_last_accepting_cpos = yy_cp; rlm@1: } rlm@1: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) rlm@1: { rlm@1: yy_current_state = (int) yy_def[yy_current_state]; rlm@1: if ( yy_current_state >= 24 ) rlm@1: yy_c = yy_meta[(unsigned int) yy_c]; rlm@1: } rlm@1: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; rlm@1: ++yy_cp; rlm@1: } rlm@1: while ( yy_base[yy_current_state] != 33 ); rlm@1: rlm@1: yy_find_action: rlm@1: yy_act = yy_accept[yy_current_state]; rlm@1: if ( yy_act == 0 ) rlm@1: { /* have to back up */ rlm@1: yy_cp = yy_last_accepting_cpos; rlm@1: yy_current_state = yy_last_accepting_state; rlm@1: yy_act = yy_accept[yy_current_state]; rlm@1: } rlm@1: rlm@1: YY_DO_BEFORE_ACTION; rlm@1: rlm@1: rlm@1: do_action: /* This label is used only to access EOF actions. */ rlm@1: rlm@1: rlm@1: switch ( yy_act ) rlm@1: { /* beginning of action switch */ rlm@1: case 0: /* must back up */ rlm@1: /* undo the effects of YY_DO_BEFORE_ACTION */ rlm@1: *yy_cp = yy_hold_char; rlm@1: yy_cp = yy_last_accepting_cpos; rlm@1: yy_current_state = yy_last_accepting_state; rlm@1: goto yy_find_action; rlm@1: rlm@1: case 1: rlm@1: YY_RULE_SETUP rlm@1: #line 33 "expr.l" rlm@1: { rlm@1: return TOKEN_SIZEOF; rlm@1: } rlm@1: YY_BREAK rlm@1: case 2: rlm@1: YY_RULE_SETUP rlm@1: #line 37 "expr.l" rlm@1: { rlm@1: return TOKEN_IDENTIFIER; rlm@1: } rlm@1: YY_BREAK rlm@1: case 3: rlm@1: YY_RULE_SETUP rlm@1: #line 41 "expr.l" rlm@1: { rlm@1: return TOKEN_NUMBER; rlm@1: } rlm@1: YY_BREAK rlm@1: case 4: rlm@1: YY_RULE_SETUP rlm@1: #line 45 "expr.l" rlm@1: { rlm@1: return TOKEN_DOT; rlm@1: } rlm@1: YY_BREAK rlm@1: case 5: rlm@1: YY_RULE_SETUP rlm@1: #line 49 "expr.l" rlm@1: { rlm@1: return TOKEN_ARROW; rlm@1: } rlm@1: YY_BREAK rlm@1: case 6: rlm@1: YY_RULE_SETUP rlm@1: #line 53 "expr.l" rlm@1: { rlm@1: return TOKEN_ADDR; rlm@1: } rlm@1: YY_BREAK rlm@1: case 7: rlm@1: YY_RULE_SETUP rlm@1: #line 57 "expr.l" rlm@1: { rlm@1: return TOKEN_STAR; rlm@1: } rlm@1: YY_BREAK rlm@1: case 8: rlm@1: YY_RULE_SETUP rlm@1: #line 61 "expr.l" rlm@1: rlm@1: YY_BREAK rlm@1: case 9: rlm@1: YY_RULE_SETUP rlm@1: #line 63 "expr.l" rlm@1: return *yytext; rlm@1: YY_BREAK rlm@1: case 10: rlm@1: YY_RULE_SETUP rlm@1: #line 65 "expr.l" rlm@1: ECHO; rlm@1: YY_BREAK rlm@1: #line 701 "expr-lex.cpp" rlm@1: case YY_STATE_EOF(INITIAL): rlm@1: yyterminate(); rlm@1: rlm@1: case YY_END_OF_BUFFER: rlm@1: { rlm@1: /* Amount of text matched not including the EOB char. */ rlm@1: int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; rlm@1: rlm@1: /* Undo the effects of YY_DO_BEFORE_ACTION. */ rlm@1: *yy_cp = yy_hold_char; rlm@1: YY_RESTORE_YY_MORE_OFFSET rlm@1: rlm@1: if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) rlm@1: { rlm@1: /* We're scanning a new file or input source. It's rlm@1: * possible that this happened because the user rlm@1: * just pointed yyin at a new source and called rlm@1: * yylex(). If so, then we have to assure rlm@1: * consistency between yy_current_buffer and our rlm@1: * globals. Here is the right place to do so, because rlm@1: * this is the first action (other than possibly a rlm@1: * back-up) that will match for the new input source. rlm@1: */ rlm@1: yy_n_chars = yy_current_buffer->yy_n_chars; rlm@1: yy_current_buffer->yy_input_file = yyin; rlm@1: yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; rlm@1: } rlm@1: rlm@1: /* Note that here we test for yy_c_buf_p "<=" to the position rlm@1: * of the first EOB in the buffer, since yy_c_buf_p will rlm@1: * already have been incremented past the NUL character rlm@1: * (since all states make transitions on EOB to the rlm@1: * end-of-buffer state). Contrast this with the test rlm@1: * in input(). rlm@1: */ rlm@1: if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) rlm@1: { /* This was really a NUL. */ rlm@1: yy_state_type yy_next_state; rlm@1: rlm@1: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; rlm@1: rlm@1: yy_current_state = yy_get_previous_state(); rlm@1: rlm@1: /* Okay, we're now positioned to make the NUL rlm@1: * transition. We couldn't have rlm@1: * yy_get_previous_state() go ahead and do it rlm@1: * for us because it doesn't know how to deal rlm@1: * with the possibility of jamming (and we don't rlm@1: * want to build jamming into it because then it rlm@1: * will run more slowly). rlm@1: */ rlm@1: rlm@1: yy_next_state = yy_try_NUL_trans( yy_current_state ); rlm@1: rlm@1: yy_bp = yytext_ptr + YY_MORE_ADJ; rlm@1: rlm@1: if ( yy_next_state ) rlm@1: { rlm@1: /* Consume the NUL. */ rlm@1: yy_cp = ++yy_c_buf_p; rlm@1: yy_current_state = yy_next_state; rlm@1: goto yy_match; rlm@1: } rlm@1: rlm@1: else rlm@1: { rlm@1: yy_cp = yy_c_buf_p; rlm@1: goto yy_find_action; rlm@1: } rlm@1: } rlm@1: rlm@1: else switch ( yy_get_next_buffer() ) rlm@1: { rlm@1: case EOB_ACT_END_OF_FILE: rlm@1: { rlm@1: yy_did_buffer_switch_on_eof = 0; rlm@1: rlm@1: if ( yywrap() ) rlm@1: { rlm@1: /* Note: because we've taken care in rlm@1: * yy_get_next_buffer() to have set up rlm@1: * yytext, we can now set up rlm@1: * yy_c_buf_p so that if some total rlm@1: * hoser (like flex itself) wants to rlm@1: * call the scanner after we return the rlm@1: * YY_NULL, it'll still work - another rlm@1: * YY_NULL will get returned. rlm@1: */ rlm@1: yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; rlm@1: rlm@1: yy_act = YY_STATE_EOF(YY_START); rlm@1: goto do_action; rlm@1: } rlm@1: rlm@1: else rlm@1: { rlm@1: if ( ! yy_did_buffer_switch_on_eof ) rlm@1: YY_NEW_FILE; rlm@1: } rlm@1: break; rlm@1: } rlm@1: rlm@1: case EOB_ACT_CONTINUE_SCAN: rlm@1: yy_c_buf_p = rlm@1: yytext_ptr + yy_amount_of_matched_text; rlm@1: rlm@1: yy_current_state = yy_get_previous_state(); rlm@1: rlm@1: yy_cp = yy_c_buf_p; rlm@1: yy_bp = yytext_ptr + YY_MORE_ADJ; rlm@1: goto yy_match; rlm@1: rlm@1: case EOB_ACT_LAST_MATCH: rlm@1: yy_c_buf_p = rlm@1: &yy_current_buffer->yy_ch_buf[yy_n_chars]; rlm@1: rlm@1: yy_current_state = yy_get_previous_state(); rlm@1: rlm@1: yy_cp = yy_c_buf_p; rlm@1: yy_bp = yytext_ptr + YY_MORE_ADJ; rlm@1: goto yy_find_action; rlm@1: } rlm@1: break; rlm@1: } rlm@1: rlm@1: default: rlm@1: YY_FATAL_ERROR( rlm@1: "fatal flex scanner internal error--no action found" ); rlm@1: } /* end of action switch */ rlm@1: } /* end of scanning one token */ rlm@1: } /* end of yylex */ rlm@1: rlm@1: rlm@1: /* yy_get_next_buffer - try to read in a new buffer rlm@1: * rlm@1: * Returns a code representing an action: rlm@1: * EOB_ACT_LAST_MATCH - rlm@1: * EOB_ACT_CONTINUE_SCAN - continue scanning from current position rlm@1: * EOB_ACT_END_OF_FILE - end of file rlm@1: */ rlm@1: rlm@1: static int yy_get_next_buffer() rlm@1: { rlm@1: register char *dest = yy_current_buffer->yy_ch_buf; rlm@1: register char *source = yytext_ptr; rlm@1: register int number_to_move, i; rlm@1: int ret_val; rlm@1: rlm@1: if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) rlm@1: YY_FATAL_ERROR( rlm@1: "fatal flex scanner internal error--end of buffer missed" ); rlm@1: rlm@1: if ( yy_current_buffer->yy_fill_buffer == 0 ) rlm@1: { /* Don't try to fill the buffer, so this is an EOF. */ rlm@1: if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) rlm@1: { rlm@1: /* We matched a single character, the EOB, so rlm@1: * treat this as a final EOF. rlm@1: */ rlm@1: return EOB_ACT_END_OF_FILE; rlm@1: } rlm@1: rlm@1: else rlm@1: { rlm@1: /* We matched some text prior to the EOB, first rlm@1: * process it. rlm@1: */ rlm@1: return EOB_ACT_LAST_MATCH; rlm@1: } rlm@1: } rlm@1: rlm@1: /* Try to read more data. */ rlm@1: rlm@1: /* First move last chars to start of buffer. */ rlm@1: number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; rlm@1: rlm@1: for ( i = 0; i < number_to_move; ++i ) rlm@1: *(dest++) = *(source++); rlm@1: rlm@1: if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) rlm@1: /* don't do the read, it's not guaranteed to return an EOF, rlm@1: * just force an EOF rlm@1: */ rlm@1: yy_current_buffer->yy_n_chars = yy_n_chars = 0; rlm@1: rlm@1: else rlm@1: { rlm@1: int num_to_read = rlm@1: yy_current_buffer->yy_buf_size - number_to_move - 1; rlm@1: rlm@1: while ( num_to_read <= 0 ) rlm@1: { /* Not enough room in the buffer - grow it. */ rlm@1: #ifdef YY_USES_REJECT rlm@1: YY_FATAL_ERROR( rlm@1: "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); rlm@1: #else rlm@1: rlm@1: /* just a shorter name for the current buffer */ rlm@1: YY_BUFFER_STATE b = yy_current_buffer; rlm@1: rlm@1: int yy_c_buf_p_offset = rlm@1: (int) (yy_c_buf_p - b->yy_ch_buf); rlm@1: rlm@1: if ( b->yy_is_our_buffer ) rlm@1: { rlm@1: int new_size = b->yy_buf_size * 2; rlm@1: rlm@1: if ( new_size <= 0 ) rlm@1: b->yy_buf_size += b->yy_buf_size / 8; rlm@1: else rlm@1: b->yy_buf_size *= 2; rlm@1: rlm@1: b->yy_ch_buf = (char *) rlm@1: /* Include room in for 2 EOB chars. */ rlm@1: yy_flex_realloc( (void *) b->yy_ch_buf, rlm@1: b->yy_buf_size + 2 ); rlm@1: } rlm@1: else rlm@1: /* Can't grow it, we don't own it. */ rlm@1: b->yy_ch_buf = 0; rlm@1: rlm@1: if ( ! b->yy_ch_buf ) rlm@1: YY_FATAL_ERROR( rlm@1: "fatal error - scanner input buffer overflow" ); rlm@1: rlm@1: yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; rlm@1: rlm@1: num_to_read = yy_current_buffer->yy_buf_size - rlm@1: number_to_move - 1; rlm@1: #endif rlm@1: } rlm@1: rlm@1: if ( num_to_read > YY_READ_BUF_SIZE ) rlm@1: num_to_read = YY_READ_BUF_SIZE; rlm@1: rlm@1: /* Read in more data. */ rlm@1: YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), rlm@1: yy_n_chars, num_to_read ); rlm@1: rlm@1: yy_current_buffer->yy_n_chars = yy_n_chars; rlm@1: } rlm@1: rlm@1: if ( yy_n_chars == 0 ) rlm@1: { rlm@1: if ( number_to_move == YY_MORE_ADJ ) rlm@1: { rlm@1: ret_val = EOB_ACT_END_OF_FILE; rlm@1: yyrestart( yyin ); rlm@1: } rlm@1: rlm@1: else rlm@1: { rlm@1: ret_val = EOB_ACT_LAST_MATCH; rlm@1: yy_current_buffer->yy_buffer_status = rlm@1: YY_BUFFER_EOF_PENDING; rlm@1: } rlm@1: } rlm@1: rlm@1: else rlm@1: ret_val = EOB_ACT_CONTINUE_SCAN; rlm@1: rlm@1: yy_n_chars += number_to_move; rlm@1: yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; rlm@1: yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; rlm@1: rlm@1: yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; rlm@1: rlm@1: return ret_val; rlm@1: } rlm@1: rlm@1: rlm@1: /* yy_get_previous_state - get the state just before the EOB char was reached */ rlm@1: rlm@1: static yy_state_type yy_get_previous_state() rlm@1: { rlm@1: register yy_state_type yy_current_state; rlm@1: register char *yy_cp; rlm@1: rlm@1: yy_current_state = yy_start; rlm@1: rlm@1: for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) rlm@1: { rlm@1: register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); rlm@1: if ( yy_accept[yy_current_state] ) rlm@1: { rlm@1: yy_last_accepting_state = yy_current_state; rlm@1: yy_last_accepting_cpos = yy_cp; rlm@1: } rlm@1: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) rlm@1: { rlm@1: yy_current_state = (int) yy_def[yy_current_state]; rlm@1: if ( yy_current_state >= 24 ) rlm@1: yy_c = yy_meta[(unsigned int) yy_c]; rlm@1: } rlm@1: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; rlm@1: } rlm@1: rlm@1: return yy_current_state; rlm@1: } rlm@1: rlm@1: rlm@1: /* yy_try_NUL_trans - try to make a transition on the NUL character rlm@1: * rlm@1: * synopsis rlm@1: * next_state = yy_try_NUL_trans( current_state ); rlm@1: */ rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) rlm@1: #else rlm@1: static yy_state_type yy_try_NUL_trans( yy_current_state ) rlm@1: yy_state_type yy_current_state; rlm@1: #endif rlm@1: { rlm@1: register int yy_is_jam; rlm@1: register char *yy_cp = yy_c_buf_p; rlm@1: rlm@1: register YY_CHAR yy_c = 1; rlm@1: if ( yy_accept[yy_current_state] ) rlm@1: { rlm@1: yy_last_accepting_state = yy_current_state; rlm@1: yy_last_accepting_cpos = yy_cp; rlm@1: } rlm@1: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) rlm@1: { rlm@1: yy_current_state = (int) yy_def[yy_current_state]; rlm@1: if ( yy_current_state >= 24 ) rlm@1: yy_c = yy_meta[(unsigned int) yy_c]; rlm@1: } rlm@1: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; rlm@1: yy_is_jam = (yy_current_state == 23); rlm@1: rlm@1: return yy_is_jam ? 0 : yy_current_state; rlm@1: } rlm@1: rlm@1: rlm@1: #ifndef YY_NO_UNPUT rlm@1: #ifdef YY_USE_PROTOS rlm@1: static void yyunput( int c, register char *yy_bp ) rlm@1: #else rlm@1: static void yyunput( c, yy_bp ) rlm@1: int c; rlm@1: register char *yy_bp; rlm@1: #endif rlm@1: { rlm@1: register char *yy_cp = yy_c_buf_p; rlm@1: rlm@1: /* undo effects of setting up yytext */ rlm@1: *yy_cp = yy_hold_char; rlm@1: rlm@1: if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) rlm@1: { /* need to shift things up to make room */ rlm@1: /* +2 for EOB chars. */ rlm@1: register int number_to_move = yy_n_chars + 2; rlm@1: register char *dest = &yy_current_buffer->yy_ch_buf[ rlm@1: yy_current_buffer->yy_buf_size + 2]; rlm@1: register char *source = rlm@1: &yy_current_buffer->yy_ch_buf[number_to_move]; rlm@1: rlm@1: while ( source > yy_current_buffer->yy_ch_buf ) rlm@1: *--dest = *--source; rlm@1: rlm@1: yy_cp += (int) (dest - source); rlm@1: yy_bp += (int) (dest - source); rlm@1: yy_current_buffer->yy_n_chars = rlm@1: yy_n_chars = yy_current_buffer->yy_buf_size; rlm@1: rlm@1: if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) rlm@1: YY_FATAL_ERROR( "flex scanner push-back overflow" ); rlm@1: } rlm@1: rlm@1: *--yy_cp = (char) c; rlm@1: rlm@1: rlm@1: yytext_ptr = yy_bp; rlm@1: yy_hold_char = *yy_cp; rlm@1: yy_c_buf_p = yy_cp; rlm@1: } rlm@1: #endif /* ifndef YY_NO_UNPUT */ rlm@1: rlm@1: rlm@1: #ifdef __cplusplus rlm@1: static int yyinput() rlm@1: #else rlm@1: static int input() rlm@1: #endif rlm@1: { rlm@1: int c; rlm@1: rlm@1: *yy_c_buf_p = yy_hold_char; rlm@1: rlm@1: if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) rlm@1: { rlm@1: /* yy_c_buf_p now points to the character we want to return. rlm@1: * If this occurs *before* the EOB characters, then it's a rlm@1: * valid NUL; if not, then we've hit the end of the buffer. rlm@1: */ rlm@1: if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) rlm@1: /* This was really a NUL. */ rlm@1: *yy_c_buf_p = '\0'; rlm@1: rlm@1: else rlm@1: { /* need more input */ rlm@1: int offset = yy_c_buf_p - yytext_ptr; rlm@1: ++yy_c_buf_p; rlm@1: rlm@1: switch ( yy_get_next_buffer() ) rlm@1: { rlm@1: case EOB_ACT_LAST_MATCH: rlm@1: /* This happens because yy_g_n_b() rlm@1: * sees that we've accumulated a rlm@1: * token and flags that we need to rlm@1: * try matching the token before rlm@1: * proceeding. But for input(), rlm@1: * there's no matching to consider. rlm@1: * So convert the EOB_ACT_LAST_MATCH rlm@1: * to EOB_ACT_END_OF_FILE. rlm@1: */ rlm@1: rlm@1: /* Reset buffer status. */ rlm@1: yyrestart( yyin ); rlm@1: rlm@1: /* fall through */ rlm@1: rlm@1: case EOB_ACT_END_OF_FILE: rlm@1: { rlm@1: if ( yywrap() ) rlm@1: return EOF; rlm@1: rlm@1: if ( ! yy_did_buffer_switch_on_eof ) rlm@1: YY_NEW_FILE; rlm@1: #ifdef __cplusplus rlm@1: return yyinput(); rlm@1: #else rlm@1: return input(); rlm@1: #endif rlm@1: } rlm@1: rlm@1: case EOB_ACT_CONTINUE_SCAN: rlm@1: yy_c_buf_p = yytext_ptr + offset; rlm@1: break; rlm@1: } rlm@1: } rlm@1: } rlm@1: rlm@1: c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ rlm@1: *yy_c_buf_p = '\0'; /* preserve yytext */ rlm@1: yy_hold_char = *++yy_c_buf_p; rlm@1: rlm@1: rlm@1: return c; rlm@1: } rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: void yyrestart( FILE *input_file ) rlm@1: #else rlm@1: void yyrestart( input_file ) rlm@1: FILE *input_file; rlm@1: #endif rlm@1: { rlm@1: if ( ! yy_current_buffer ) rlm@1: yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); rlm@1: rlm@1: yy_init_buffer( yy_current_buffer, input_file ); rlm@1: yy_load_buffer_state(); rlm@1: } rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) rlm@1: #else rlm@1: void yy_switch_to_buffer( new_buffer ) rlm@1: YY_BUFFER_STATE new_buffer; rlm@1: #endif rlm@1: { rlm@1: if ( yy_current_buffer == new_buffer ) rlm@1: return; rlm@1: rlm@1: if ( yy_current_buffer ) rlm@1: { rlm@1: /* Flush out information for old buffer. */ rlm@1: *yy_c_buf_p = yy_hold_char; rlm@1: yy_current_buffer->yy_buf_pos = yy_c_buf_p; rlm@1: yy_current_buffer->yy_n_chars = yy_n_chars; rlm@1: } rlm@1: rlm@1: yy_current_buffer = new_buffer; rlm@1: yy_load_buffer_state(); rlm@1: rlm@1: /* We don't actually know whether we did this switch during rlm@1: * EOF (yywrap()) processing, but the only time this flag rlm@1: * is looked at is after yywrap() is called, so it's safe rlm@1: * to go ahead and always set it. rlm@1: */ rlm@1: yy_did_buffer_switch_on_eof = 1; rlm@1: } rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: void yy_load_buffer_state( void ) rlm@1: #else rlm@1: void yy_load_buffer_state() rlm@1: #endif rlm@1: { rlm@1: yy_n_chars = yy_current_buffer->yy_n_chars; rlm@1: yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; rlm@1: yyin = yy_current_buffer->yy_input_file; rlm@1: yy_hold_char = *yy_c_buf_p; rlm@1: } rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) rlm@1: #else rlm@1: YY_BUFFER_STATE yy_create_buffer( file, size ) rlm@1: FILE *file; rlm@1: int size; rlm@1: #endif rlm@1: { rlm@1: YY_BUFFER_STATE b; rlm@1: rlm@1: b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); rlm@1: if ( ! b ) rlm@1: YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); rlm@1: rlm@1: b->yy_buf_size = size; rlm@1: rlm@1: /* yy_ch_buf has to be 2 characters longer than the size given because rlm@1: * we need to put in 2 end-of-buffer characters. rlm@1: */ rlm@1: b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); rlm@1: if ( ! b->yy_ch_buf ) rlm@1: YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); rlm@1: rlm@1: b->yy_is_our_buffer = 1; rlm@1: rlm@1: yy_init_buffer( b, file ); rlm@1: rlm@1: return b; rlm@1: } rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: void yy_delete_buffer( YY_BUFFER_STATE b ) rlm@1: #else rlm@1: void yy_delete_buffer( b ) rlm@1: YY_BUFFER_STATE b; rlm@1: #endif rlm@1: { rlm@1: if ( ! b ) rlm@1: return; rlm@1: rlm@1: if ( b == yy_current_buffer ) rlm@1: yy_current_buffer = (YY_BUFFER_STATE) 0; rlm@1: rlm@1: if ( b->yy_is_our_buffer ) rlm@1: yy_flex_free( (void *) b->yy_ch_buf ); rlm@1: rlm@1: yy_flex_free( (void *) b ); rlm@1: } rlm@1: rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) rlm@1: #else rlm@1: void yy_init_buffer( b, file ) rlm@1: YY_BUFFER_STATE b; rlm@1: FILE *file; rlm@1: #endif rlm@1: rlm@1: rlm@1: { rlm@1: yy_flush_buffer( b ); rlm@1: rlm@1: b->yy_input_file = file; rlm@1: b->yy_fill_buffer = 1; rlm@1: rlm@1: #if YY_ALWAYS_INTERACTIVE rlm@1: b->yy_is_interactive = 1; rlm@1: #else rlm@1: #if YY_NEVER_INTERACTIVE rlm@1: b->yy_is_interactive = 0; rlm@1: #else rlm@1: b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; rlm@1: #endif rlm@1: #endif rlm@1: } rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: void yy_flush_buffer( YY_BUFFER_STATE b ) rlm@1: #else rlm@1: void yy_flush_buffer( b ) rlm@1: YY_BUFFER_STATE b; rlm@1: #endif rlm@1: rlm@1: { rlm@1: if ( ! b ) rlm@1: return; rlm@1: rlm@1: b->yy_n_chars = 0; rlm@1: rlm@1: /* We always need two end-of-buffer characters. The first causes rlm@1: * a transition to the end-of-buffer state. The second causes rlm@1: * a jam in that state. rlm@1: */ rlm@1: b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; rlm@1: b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; rlm@1: rlm@1: b->yy_buf_pos = &b->yy_ch_buf[0]; rlm@1: rlm@1: b->yy_at_bol = 1; rlm@1: b->yy_buffer_status = YY_BUFFER_NEW; rlm@1: rlm@1: if ( b == yy_current_buffer ) rlm@1: yy_load_buffer_state(); rlm@1: } rlm@1: rlm@1: rlm@1: #ifndef YY_NO_SCAN_BUFFER rlm@1: #ifdef YY_USE_PROTOS rlm@1: YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) rlm@1: #else rlm@1: YY_BUFFER_STATE yy_scan_buffer( base, size ) rlm@1: char *base; rlm@1: yy_size_t size; rlm@1: #endif rlm@1: { rlm@1: YY_BUFFER_STATE b; rlm@1: rlm@1: if ( size < 2 || rlm@1: base[size-2] != YY_END_OF_BUFFER_CHAR || rlm@1: base[size-1] != YY_END_OF_BUFFER_CHAR ) rlm@1: /* They forgot to leave room for the EOB's. */ rlm@1: return 0; rlm@1: rlm@1: b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); rlm@1: if ( ! b ) rlm@1: YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); rlm@1: rlm@1: b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ rlm@1: b->yy_buf_pos = b->yy_ch_buf = base; rlm@1: b->yy_is_our_buffer = 0; rlm@1: b->yy_input_file = 0; rlm@1: b->yy_n_chars = b->yy_buf_size; rlm@1: b->yy_is_interactive = 0; rlm@1: b->yy_at_bol = 1; rlm@1: b->yy_fill_buffer = 0; rlm@1: b->yy_buffer_status = YY_BUFFER_NEW; rlm@1: rlm@1: yy_switch_to_buffer( b ); rlm@1: rlm@1: return b; rlm@1: } rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifndef YY_NO_SCAN_STRING rlm@1: #ifdef YY_USE_PROTOS rlm@1: YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) rlm@1: #else rlm@1: YY_BUFFER_STATE yy_scan_string( yy_str ) rlm@1: yyconst char *yy_str; rlm@1: #endif rlm@1: { rlm@1: int len; rlm@1: for ( len = 0; yy_str[len]; ++len ) rlm@1: ; rlm@1: rlm@1: return yy_scan_bytes( yy_str, len ); rlm@1: } rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifndef YY_NO_SCAN_BYTES rlm@1: #ifdef YY_USE_PROTOS rlm@1: YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) rlm@1: #else rlm@1: YY_BUFFER_STATE yy_scan_bytes( bytes, len ) rlm@1: yyconst char *bytes; rlm@1: int len; rlm@1: #endif rlm@1: { rlm@1: YY_BUFFER_STATE b; rlm@1: char *buf; rlm@1: yy_size_t n; rlm@1: int i; rlm@1: rlm@1: /* Get memory for full buffer, including space for trailing EOB's. */ rlm@1: n = len + 2; rlm@1: buf = (char *) yy_flex_alloc( n ); rlm@1: if ( ! buf ) rlm@1: YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); rlm@1: rlm@1: for ( i = 0; i < len; ++i ) rlm@1: buf[i] = bytes[i]; rlm@1: rlm@1: buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; rlm@1: rlm@1: b = yy_scan_buffer( buf, n ); rlm@1: if ( ! b ) rlm@1: YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); rlm@1: rlm@1: /* It's okay to grow etc. this buffer, and we should throw it rlm@1: * away when we're done. rlm@1: */ rlm@1: b->yy_is_our_buffer = 1; rlm@1: rlm@1: return b; rlm@1: } rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifndef YY_NO_PUSH_STATE rlm@1: #ifdef YY_USE_PROTOS rlm@1: static void yy_push_state( int new_state ) rlm@1: #else rlm@1: static void yy_push_state( new_state ) rlm@1: int new_state; rlm@1: #endif rlm@1: { rlm@1: if ( yy_start_stack_ptr >= yy_start_stack_depth ) rlm@1: { rlm@1: yy_size_t new_size; rlm@1: rlm@1: yy_start_stack_depth += YY_START_STACK_INCR; rlm@1: new_size = yy_start_stack_depth * sizeof( int ); rlm@1: rlm@1: if ( ! yy_start_stack ) rlm@1: yy_start_stack = (int *) yy_flex_alloc( new_size ); rlm@1: rlm@1: else rlm@1: yy_start_stack = (int *) yy_flex_realloc( rlm@1: (void *) yy_start_stack, new_size ); rlm@1: rlm@1: if ( ! yy_start_stack ) rlm@1: YY_FATAL_ERROR( rlm@1: "out of memory expanding start-condition stack" ); rlm@1: } rlm@1: rlm@1: yy_start_stack[yy_start_stack_ptr++] = YY_START; rlm@1: rlm@1: BEGIN(new_state); rlm@1: } rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifndef YY_NO_POP_STATE rlm@1: static void yy_pop_state() rlm@1: { rlm@1: if ( --yy_start_stack_ptr < 0 ) rlm@1: YY_FATAL_ERROR( "start-condition stack underflow" ); rlm@1: rlm@1: BEGIN(yy_start_stack[yy_start_stack_ptr]); rlm@1: } rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifndef YY_NO_TOP_STATE rlm@1: static int yy_top_state() rlm@1: { rlm@1: return yy_start_stack[yy_start_stack_ptr - 1]; rlm@1: } rlm@1: #endif rlm@1: rlm@1: #ifndef YY_EXIT_FAILURE rlm@1: #define YY_EXIT_FAILURE 2 rlm@1: #endif rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: static void yy_fatal_error( yyconst char msg[] ) rlm@1: #else rlm@1: static void yy_fatal_error( msg ) rlm@1: char msg[]; rlm@1: #endif rlm@1: { rlm@1: (void) fprintf( stderr, "%s\n", msg ); rlm@1: exit( YY_EXIT_FAILURE ); rlm@1: } rlm@1: rlm@1: rlm@1: rlm@1: /* Redefine yyless() so it works in section 3 code. */ rlm@1: rlm@1: #undef yyless rlm@1: #define yyless(n) \ rlm@1: do \ rlm@1: { \ rlm@1: /* Undo effects of setting up yytext. */ \ rlm@1: yytext[yyleng] = yy_hold_char; \ rlm@1: yy_c_buf_p = yytext + n; \ rlm@1: yy_hold_char = *yy_c_buf_p; \ rlm@1: *yy_c_buf_p = '\0'; \ rlm@1: yyleng = n; \ rlm@1: } \ rlm@1: while ( 0 ) rlm@1: rlm@1: rlm@1: /* Internal utility routines. */ rlm@1: rlm@1: #ifndef yytext_ptr rlm@1: #ifdef YY_USE_PROTOS rlm@1: static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) rlm@1: #else rlm@1: static void yy_flex_strncpy( s1, s2, n ) rlm@1: char *s1; rlm@1: yyconst char *s2; rlm@1: int n; rlm@1: #endif rlm@1: { rlm@1: register int i; rlm@1: for ( i = 0; i < n; ++i ) rlm@1: s1[i] = s2[i]; rlm@1: } rlm@1: #endif rlm@1: rlm@1: #ifdef YY_NEED_STRLEN rlm@1: #ifdef YY_USE_PROTOS rlm@1: static int yy_flex_strlen( yyconst char *s ) rlm@1: #else rlm@1: static int yy_flex_strlen( s ) rlm@1: yyconst char *s; rlm@1: #endif rlm@1: { rlm@1: register int n; rlm@1: for ( n = 0; s[n]; ++n ) rlm@1: ; rlm@1: rlm@1: return n; rlm@1: } rlm@1: #endif rlm@1: rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: static void *yy_flex_alloc( yy_size_t size ) rlm@1: #else rlm@1: static void *yy_flex_alloc( size ) rlm@1: yy_size_t size; rlm@1: #endif rlm@1: { rlm@1: return (void *) malloc( size ); rlm@1: } rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: static void *yy_flex_realloc( void *ptr, yy_size_t size ) rlm@1: #else rlm@1: static void *yy_flex_realloc( ptr, size ) rlm@1: void *ptr; rlm@1: yy_size_t size; rlm@1: #endif rlm@1: { rlm@1: /* The cast to (char *) in the following accommodates both rlm@1: * implementations that use char* generic pointers, and those rlm@1: * that use void* generic pointers. It works with the latter rlm@1: * because both ANSI C and C++ allow castless assignment from rlm@1: * any pointer type to void*, and deal with argument conversions rlm@1: * as though doing an assignment. rlm@1: */ rlm@1: return (void *) realloc( (char *) ptr, size ); rlm@1: } rlm@1: rlm@1: #ifdef YY_USE_PROTOS rlm@1: static void yy_flex_free( void *ptr ) rlm@1: #else rlm@1: static void yy_flex_free( ptr ) rlm@1: void *ptr; rlm@1: #endif rlm@1: { rlm@1: free( ptr ); rlm@1: } rlm@1: rlm@1: #if YY_MAIN rlm@1: int main() rlm@1: { rlm@1: yylex(); rlm@1: return 0; rlm@1: } rlm@1: #endif rlm@1: #line 65 "expr.l" rlm@1: rlm@1: rlm@1: void exprCleanBuffer() rlm@1: { rlm@1: yy_delete_buffer(yy_current_buffer); rlm@1: yy_init = 1; rlm@1: }