diff options
Diffstat (limited to 'cpp/src/Slice/Scanner.cpp')
-rw-r--r-- | cpp/src/Slice/Scanner.cpp | 181 |
1 files changed, 73 insertions, 108 deletions
diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index e43e15c66fd..b866d155494 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -28,8 +28,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -67,6 +67,7 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -74,6 +75,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -104,8 +106,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -162,15 +162,7 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -196,7 +188,6 @@ extern FILE *slice_in, *slice_out; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -231,7 +222,7 @@ struct yy_buffer_state /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -301,7 +292,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* yy_hold_char holds the character lost when slice_text is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t slice_leng; /* Points to current character in buffer. */ @@ -362,7 +353,7 @@ void slice_free (void * ); /* Begin user sect3 */ -#define slice_wrap() (/*CONSTCOND*/1) +#define slice_wrap(n) 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -376,17 +367,11 @@ extern int slice_lineno; int slice_lineno = 1; extern char *slice_text; -#ifdef yytext_ptr -#undef yytext_ptr -#endif #define yytext_ptr slice_text static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); -#if defined(__GNUC__) && __GNUC__ >= 3 -__attribute__((__noreturn__)) -#endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the @@ -394,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ); */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - slice_leng = (size_t) (yy_cp - yy_bp); \ + slice_leng = (yy_size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -420,7 +405,7 @@ static yyconst flex_int16_t yy_accept[73] = 4, 0 } ; -static yyconst YY_CHAR yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, @@ -452,7 +437,7 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[32] = +static yyconst flex_int32_t yy_meta[32] = { 0, 1, 2, 3, 4, 1, 1, 4, 1, 5, 5, 1, 1, 6, 6, 6, 1, 7, 7, 7, 8, @@ -460,7 +445,7 @@ static yyconst YY_CHAR yy_meta[32] = 1 } ; -static yyconst flex_uint16_t yy_base[85] = +static yyconst flex_int16_t yy_base[85] = { 0, 0, 185, 0, 26, 0, 184, 189, 192, 192, 192, 192, 22, 25, 33, 47, 35, 153, 40, 147, 0, @@ -486,7 +471,7 @@ static yyconst flex_int16_t yy_def[85] = 72, 72, 72, 72 } ; -static yyconst flex_uint16_t yy_nxt[224] = +static yyconst flex_int16_t yy_nxt[224] = { 0, 8, 9, 10, 9, 11, 8, 8, 8, 12, 12, 13, 14, 15, 16, 16, 17, 18, 18, 18, 18, @@ -642,7 +627,7 @@ int checkKeyword(string&); -#line 645 "lex.yy.c" +#line 630 "lex.yy.c" #define INITIAL 0 #define BOMSCAN 1 @@ -677,11 +662,11 @@ void slice_set_extra (YY_EXTRA_TYPE user_defined ); FILE *slice_get_in (void ); -void slice_set_in (FILE * _in_str ); +void slice_set_in (FILE * in_str ); FILE *slice_get_out (void ); -void slice_set_out (FILE * _out_str ); +void slice_set_out (FILE * out_str ); yy_size_t slice_get_leng (void ); @@ -689,7 +674,7 @@ char *slice_get_text (void ); int slice_get_lineno (void ); -void slice_set_lineno (int _line_number ); +void slice_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -703,12 +688,8 @@ extern int slice_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT - static void yyunput (int c,char *buf_ptr ); -#endif - #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -729,12 +710,7 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -742,7 +718,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( slice_text, slice_leng, 1, slice_out )) {} } while (0) +#define ECHO fwrite( slice_text, slice_leng, 1, slice_out ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -753,7 +729,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( slice_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -821,7 +797,7 @@ extern int slice_lex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; +#define YY_BREAK break; #endif #define YY_RULE_SETUP \ @@ -834,10 +810,15 @@ extern int slice_lex (void); */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; +#line 98 "src/Slice/Scanner.l" + + +#line 820 "lex.yy.c" + if ( !(yy_init) ) { (yy_init) = 1; @@ -864,13 +845,7 @@ YY_DECL slice__load_buffer_state( ); } - { -#line 98 "src/Slice/Scanner.l" - - -#line 871 "lex.yy.c" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -887,7 +862,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -938,7 +913,6 @@ YY_RULE_SETUP case 2: /* rule 2 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up slice_text */ -YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP @@ -966,7 +940,6 @@ YY_RULE_SETUP case 4: /* rule 4 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up slice_text */ -YY_LINENO_REWIND_TO(yy_cp - 1); (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP @@ -1026,7 +999,7 @@ YY_RULE_SETUP } else if(c == EOF) { - unit->warning("EOF in comment"); + unit->warning(All, "EOF in comment"); break; } else @@ -1308,7 +1281,7 @@ YY_RULE_SETUP { ostringstream os; os << "unknown escape sequence `\\" << next << "'"; - unit->warning(os.str()); + unit->warning(All, os.str()); // Escape the \ in this unknown escape sequence str->v += '\\'; @@ -1428,7 +1401,7 @@ YY_RULE_SETUP #line 526 "src/Slice/Scanner.l" ECHO; YY_BREAK -#line 1431 "lex.yy.c" +#line 1404 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(BOMSCAN): case YY_STATE_EOF(MAINSCAN): @@ -1562,7 +1535,6 @@ case YY_STATE_EOF(MAINSCAN): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of user's declarations */ } /* end of slice_lex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1574,9 +1546,9 @@ case YY_STATE_EOF(MAINSCAN): */ static int yy_get_next_buffer (void) { - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - yy_size_t number_to_move, i; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1605,7 +1577,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1625,7 +1597,7 @@ static int yy_get_next_buffer (void) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); @@ -1687,9 +1659,9 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) slice_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -1708,15 +1680,15 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - yy_state_type yy_current_state; - char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1741,10 +1713,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); - YY_CHAR yy_c = 1; + register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1759,14 +1731,12 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 72); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) + static void yyunput (int c, register char * yy_bp ) { - char *yy_cp; + register char *yy_cp; yy_cp = (yy_c_buf_p); @@ -1776,10 +1746,10 @@ static int yy_get_next_buffer (void) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - yy_size_t number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = + register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1801,8 +1771,6 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } -#endif - #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1851,7 +1819,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( slice_wrap( ) ) - return EOF; + return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1954,7 +1922,7 @@ static void slice__load_buffer_state (void) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in slice__create_buffer()" ); - b->yy_buf_size = (yy_size_t)size; + b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -2109,7 +2077,7 @@ static void slice_ensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)slice_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); @@ -2126,7 +2094,7 @@ static void slice_ensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; + int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)slice_realloc @@ -2193,8 +2161,8 @@ YY_BUFFER_STATE slice__scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to slice_lex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -2202,8 +2170,7 @@ YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - yy_size_t i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2234,7 +2201,7 @@ YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2300,29 +2267,29 @@ char *slice_get_text (void) } /** Set the current line number. - * @param _line_number line number + * @param line_number * */ -void slice_set_lineno (int _line_number ) +void slice_set_lineno (int line_number ) { - slice_lineno = _line_number; + slice_lineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param _in_str A readable stream. + * @param in_str A readable stream. * * @see slice__switch_to_buffer */ -void slice_set_in (FILE * _in_str ) +void slice_set_in (FILE * in_str ) { - slice_in = _in_str ; + slice_in = in_str ; } -void slice_set_out (FILE * _out_str ) +void slice_set_out (FILE * out_str ) { - slice_out = _out_str ; + slice_out = out_str ; } int slice_get_debug (void) @@ -2330,9 +2297,9 @@ int slice_get_debug (void) return slice__flex_debug; } -void slice_set_debug (int _bdebug ) +void slice_set_debug (int bdebug ) { - slice__flex_debug = _bdebug ; + slice__flex_debug = bdebug ; } static int yy_init_globals (void) @@ -2392,8 +2359,7 @@ int slice_lex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - - int i; + register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2402,7 +2368,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - int n; + register int n; for ( n = 0; s[n]; ++n ) ; @@ -2412,12 +2378,11 @@ static int yy_flex_strlen (yyconst char * s ) void *slice_alloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( size ); } void *slice_realloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2430,7 +2395,7 @@ void *slice_realloc (void * ptr, yy_size_t size ) void slice_free (void * ptr ) { - free( (char *) ptr ); /* see slice_realloc() for (char *) cast */ + free( (char *) ptr ); /* see slice_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" |