diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-02-08 09:41:55 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-02-08 09:41:55 -0500 |
commit | af38cbf2ebf9c009fcea81cc316be64176da620e (patch) | |
tree | 28d6975bf5f1c4b7b89a5c24d2e1d9f1a2ba633c /cpp/src/Slice/Scanner.cpp | |
parent | Added wide char overloads of Ice::createProperties & Ice::initialize (diff) | |
download | ice-af38cbf2ebf9c009fcea81cc316be64176da620e.tar.bz2 ice-af38cbf2ebf9c009fcea81cc316be64176da620e.tar.xz ice-af38cbf2ebf9c009fcea81cc316be64176da620e.zip |
Make Slice enums scoped
Add new cpp:scoped and objc:scoped metadata directives
Diffstat (limited to 'cpp/src/Slice/Scanner.cpp')
-rw-r--r-- | cpp/src/Slice/Scanner.cpp | 509 |
1 files changed, 295 insertions, 214 deletions
diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index b866d155494..8d14ff3cd30 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -1,7 +1,7 @@ #include <IceUtil/ScannerConfig.h> -#line 2 "lex.yy.c" +#line 1 "lex.yy.c" -#line 4 "lex.yy.c" +#line 3 "lex.yy.c" #define YY_INT_ALIGNED short int @@ -28,12 +28,90 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 3 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif + #define yy_create_buffer slice__create_buffer + + #define yy_delete_buffer slice__delete_buffer + + #define yy_scan_buffer slice__scan_buffer + + #define yy_scan_string slice__scan_string + + #define yy_scan_bytes slice__scan_bytes + + #define yy_init_buffer slice__init_buffer + + #define yy_flush_buffer slice__flush_buffer + + #define yy_load_buffer_state slice__load_buffer_state + + #define yy_switch_to_buffer slice__switch_to_buffer + + #define yypush_buffer_state slice_push_buffer_state + + #define yypop_buffer_state slice_pop_buffer_state + + #define yyensure_buffer_stack slice_ensure_buffer_stack + + #define yylex slice_lex + + #define yyrestart slice_restart + + #define yylex_init slice_lex_init + + #define yylex_init_extra slice_lex_init_extra + + #define yylex_destroy slice_lex_destroy + + #define yyget_debug slice_get_debug + + #define yyset_debug slice_set_debug + + #define yyget_extra slice_get_extra + + #define yyset_extra slice_set_extra + + #define yyget_in slice_get_in + + #define yyset_in slice_set_in + + #define yyget_out slice_get_out + + #define yyset_out slice_set_out + + #define yyget_leng slice_get_leng + + #define yyget_text slice_get_text + + #define yyget_lineno slice_get_lineno + + #define yyset_lineno slice_set_lineno + + #define yywrap slice_wrap + + #define yyalloc slice_alloc + + #define yyrealloc slice_realloc + + #define yyfree slice_free + + #define yytext slice_text + + #define yyleng slice_leng + + #define yyin slice_in + + #define yyout slice_out + + #define yy_flex_debug slice__flex_debug + + #define yylineno slice_lineno + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -67,7 +145,6 @@ 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; @@ -75,7 +152,6 @@ 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 @@ -106,63 +182,55 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST +#endif /* ! C99 */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +#endif /* ! FLEXINT_H */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE slice_restart(slice_in ) - #define YY_END_OF_BUFFER_CHAR 0 /* 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. @@ -179,15 +247,16 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern yy_size_t slice_leng; +extern int slice_leng; extern FILE *slice_in, *slice_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #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) \ @@ -202,7 +271,6 @@ extern FILE *slice_in, *slice_out; YY_DO_BEFORE_ACTION; /* set up slice_text again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -217,12 +285,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int 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 @@ -245,7 +313,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -273,7 +341,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -284,7 +352,6 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ @@ -292,11 +359,11 @@ 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 yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t slice_leng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int slice_leng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; +static char *yy_c_buf_p = NULL; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ @@ -305,30 +372,28 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void slice_restart (FILE *input_file ); -void slice__switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE slice__create_buffer (FILE *file,int size ); -void slice__delete_buffer (YY_BUFFER_STATE b ); -void slice__flush_buffer (YY_BUFFER_STATE b ); -void slice_push_buffer_state (YY_BUFFER_STATE new_buffer ); -void slice_pop_buffer_state (void ); - -static void slice_ensure_buffer_stack (void ); -static void slice__load_buffer_state (void ); -static void slice__init_buffer (YY_BUFFER_STATE b,FILE *file ); - +void slice_restart ( FILE *input_file ); +void slice__switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE slice__create_buffer ( FILE *file, int size ); +void slice__delete_buffer ( YY_BUFFER_STATE b ); +void slice__flush_buffer ( YY_BUFFER_STATE b ); +void slice_push_buffer_state ( YY_BUFFER_STATE new_buffer ); +void slice_pop_buffer_state ( void ); + +static void slice_ensure_buffer_stack ( void ); +static void slice__load_buffer_state ( void ); +static void slice__init_buffer ( YY_BUFFER_STATE b, FILE *file ); #define YY_FLUSH_BUFFER slice__flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE slice__scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE slice__scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE slice__scan_bytes (yyconst char *bytes,yy_size_t len ); +YY_BUFFER_STATE slice__scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE slice__scan_string ( const char *yy_str ); +YY_BUFFER_STATE slice__scan_bytes ( const char *bytes, int len ); -void *slice_alloc (yy_size_t ); -void *slice_realloc (void *,yy_size_t ); -void slice_free (void * ); +void *slice_alloc ( yy_size_t ); +void *slice_realloc ( void *, yy_size_t ); +void slice_free ( void * ); #define yy_new_buffer slice__create_buffer - #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ @@ -338,7 +403,6 @@ void slice_free (void * ); } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ @@ -348,42 +412,41 @@ void slice_free (void * ); } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define slice_wrap(n) 1 +#define slice_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *slice_in = (FILE *) 0, *slice_out = (FILE *) 0; +FILE *slice_in = NULL, *slice_out = NULL; typedef int yy_state_type; 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 ); -static void yy_fatal_error (yyconst char msg[] ); +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 ); +static void yynoreturn yy_fatal_error ( const char* msg ); /* Done after the current pattern has been matched and before the * corresponding action - sets up slice_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - slice_leng = (yy_size_t) (yy_cp - yy_bp); \ + slice_leng = (int) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; - #define YY_NUM_RULES 20 #define YY_END_OF_BUFFER 21 /* This struct is not used in this scanner, @@ -393,7 +456,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[73] = +static const flex_int16_t yy_accept[73] = { 0, 0, 0, 0, 0, 0, 0, 21, 19, 17, 17, 14, 19, 19, 19, 15, 15, 19, 13, 8, 19, @@ -405,7 +468,7 @@ static yyconst flex_int16_t yy_accept[73] = 4, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, @@ -437,7 +500,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[32] = +static const YY_CHAR yy_meta[32] = { 0, 1, 2, 3, 4, 1, 1, 4, 1, 5, 5, 1, 1, 6, 6, 6, 1, 7, 7, 7, 8, @@ -445,7 +508,7 @@ static yyconst flex_int32_t yy_meta[32] = 1 } ; -static yyconst flex_int16_t yy_base[85] = +static const 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, @@ -458,7 +521,7 @@ static yyconst flex_int16_t yy_base[85] = 156, 164, 170, 179 } ; -static yyconst flex_int16_t yy_def[85] = +static const flex_int16_t yy_def[85] = { 0, 72, 1, 1, 1, 1, 1, 72, 72, 72, 72, 72, 72, 72, 72, 72, 15, 72, 73, 72, 74, @@ -471,7 +534,7 @@ static yyconst flex_int16_t yy_def[85] = 72, 72, 72, 72 } ; -static yyconst flex_int16_t yy_nxt[224] = +static const 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, @@ -500,7 +563,7 @@ static yyconst flex_int16_t yy_nxt[224] = 72, 72, 72 } ; -static yyconst flex_int16_t yy_chk[224] = +static const flex_int16_t yy_chk[224] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -625,9 +688,9 @@ int checkKeyword(string&); #define YY_USER_INIT initScanner(); +#line 690 "lex.yy.c" - -#line 630 "lex.yy.c" +#line 692 "lex.yy.c" #define INITIAL 0 #define BOMSCAN 1 @@ -645,36 +708,36 @@ int checkKeyword(string&); #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void ); +static int yy_init_globals ( void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int slice_lex_destroy (void ); +int slice_lex_destroy ( void ); -int slice_get_debug (void ); +int slice_get_debug ( void ); -void slice_set_debug (int debug_flag ); +void slice_set_debug ( int debug_flag ); -YY_EXTRA_TYPE slice_get_extra (void ); +YY_EXTRA_TYPE slice_get_extra ( void ); -void slice_set_extra (YY_EXTRA_TYPE user_defined ); +void slice_set_extra ( YY_EXTRA_TYPE user_defined ); -FILE *slice_get_in (void ); +FILE *slice_get_in ( void ); -void slice_set_in (FILE * in_str ); +void slice_set_in ( FILE * _in_str ); -FILE *slice_get_out (void ); +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 ); + int slice_get_leng ( void ); -char *slice_get_text (void ); +char *slice_get_text ( void ); -int slice_get_lineno (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. @@ -682,35 +745,43 @@ void slice_set_lineno (int line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int slice_wrap (void ); +extern "C" int slice_wrap ( void ); #else -extern int slice_wrap (void ); +extern int slice_wrap ( void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); +#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 ); +static void yy_flex_strncpy ( char *, const char *, int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen ( const char * ); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (void ); +static int yyinput ( void ); #else -static int input (void ); +static int input ( void ); #endif #endif /* 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. */ @@ -718,7 +789,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 fwrite( slice_text, slice_leng, 1, slice_out ) +#define ECHO do { if (fwrite( slice_text, (size_t) slice_leng, 1, slice_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -729,7 +800,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( slice_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -742,7 +813,7 @@ static int input (void ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, slice_in))==0 && ferror(slice_in)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, slice_in)) == 0 && ferror(slice_in)) \ { \ if( errno != EINTR) \ { \ @@ -797,7 +868,7 @@ extern int slice_lex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -810,15 +881,10 @@ extern int slice_lex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 98 "src/Slice/Scanner.l" - - -#line 820 "lex.yy.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -845,7 +911,13 @@ YY_DECL slice__load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 98 "src/Slice/Scanner.l" + + +#line 917 "lex.yy.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); @@ -862,7 +934,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + 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; @@ -872,9 +944,9 @@ yy_match: { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 72 ); @@ -904,7 +976,7 @@ YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP #line 100 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -913,12 +985,13 @@ 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 #line 107 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -931,7 +1004,7 @@ YY_DO_BEFORE_ACTION; /* set up slice_text again */ YY_RULE_SETUP #line 114 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -940,12 +1013,13 @@ 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 #line 121 "src/Slice/Scanner.l" { - if(unit->scanPosition(slice_text)) + if(unit->scanPosition(yytext)) { BEGIN(BOMSCAN); } @@ -975,7 +1049,7 @@ YY_RULE_SETUP { // C-style comment BEGIN(MAINSCAN); - string comment = slice_text + 2; + string comment = yytext + 2; while(true) { int c = yyinput(); @@ -1060,10 +1134,10 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); StringTokPtr ident = new StringTok; - ident->v = *slice_text == '\\' ? slice_text + 1 : slice_text; + ident->v = *yytext == '\\' ? yytext + 1 : yytext; ident->v.erase(ident->v.find_first_of(" \t\v\n\r\f(")); *yylvalp = ident; - if(*slice_text == '\\') + if(*yytext == '\\') { return ICE_IDENT_OP; } @@ -1088,9 +1162,9 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); StringTokPtr ident = new StringTok; - ident->v = *slice_text == '\\' ? slice_text + 1 : slice_text; + ident->v = *yytext == '\\' ? yytext + 1 : yytext; *yylvalp = ident; - return *slice_text == '\\' ? ICE_IDENTIFIER : checkKeyword(ident->v); + return *yytext == '\\' ? ICE_IDENTIFIER : checkKeyword(ident->v); } YY_BREAK case 14: @@ -1305,13 +1379,13 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); IntegerTokPtr itp = new IntegerTok; - itp->literal = string(slice_text); + itp->literal = string(yytext); *yylvalp = itp; - if(!IceUtilInternal::stringToInt64(string(slice_text), itp->v)) + if(!IceUtilInternal::stringToInt64(string(yytext), itp->v)) { assert(itp->v != 0); string msg = "integer constant `"; - msg += slice_text; + msg += yytext; msg += "' out of range"; unit->error(msg); } @@ -1326,7 +1400,7 @@ YY_RULE_SETUP errno = 0; FloatingTokPtr ftp = new FloatingTok; *yylvalp = ftp; - string literal(slice_text); + string literal(yytext); ftp->literal = literal; char lastChar = literal[literal.size() - 1]; if(lastChar == 'f' || lastChar == 'F') @@ -1337,14 +1411,14 @@ YY_RULE_SETUP if((ftp->v == HUGE_VAL || ftp->v == -HUGE_VAL) && errno == ERANGE) { string msg = "floating-point constant `"; - msg += slice_text; + msg += yytext; msg += "' too large (overflow)"; unit->error(msg); } else if(ftp->v == 0 && errno == ERANGE) { string msg = "floating-point constant `"; - msg += slice_text; + msg += yytext; msg += "' too small (underflow)"; unit->error(msg); } @@ -1362,7 +1436,7 @@ YY_RULE_SETUP { BEGIN(MAINSCAN); } - if(slice_text[0] == '\n') + if(yytext[0] == '\n') { unit->nextLine(); } @@ -1382,18 +1456,18 @@ YY_RULE_SETUP #line 510 "src/Slice/Scanner.l" { BEGIN(MAINSCAN); - if(slice_text[0] < 32 || slice_text[0] > 126) + if(yytext[0] < 32 || yytext[0] > 126) { stringstream s; s << "illegal input character: '\\"; s.width(3); s.fill('0'); - s << oct << static_cast<int>(static_cast<unsigned char>(slice_text[0])); + s << oct << static_cast<int>(static_cast<unsigned char>(yytext[0])); s << "'"; unit->error(s.str()); return BAD_CHAR; } - return slice_text[0]; + return yytext[0]; } YY_BREAK case 20: @@ -1401,7 +1475,7 @@ YY_RULE_SETUP #line 526 "src/Slice/Scanner.l" ECHO; YY_BREAK -#line 1404 "lex.yy.c" +#line 1477 "lex.yy.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(BOMSCAN): case YY_STATE_EOF(MAINSCAN): @@ -1535,6 +1609,7 @@ 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 @@ -1546,9 +1621,9 @@ case YY_STATE_EOF(MAINSCAN): */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1577,7 +1652,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((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++); @@ -1590,21 +1665,21 @@ static int yy_get_next_buffer (void) else { - yy_size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - yy_size_t new_size = b->yy_buf_size * 2; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1613,11 +1688,11 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - slice_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + slice_realloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1659,10 +1734,10 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - 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 ); + int 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,(yy_size_t) new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } @@ -1680,15 +1755,15 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + 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 ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + 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; @@ -1698,9 +1773,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -1713,10 +1788,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1726,17 +1801,19 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 73 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + 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; } - static void yyunput (int c, register char * yy_bp ) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) { - register char *yy_cp; + char *yy_cp; yy_cp = (yy_c_buf_p); @@ -1746,10 +1823,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. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -1758,7 +1835,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -1771,6 +1848,8 @@ static int yy_get_next_buffer (void) (yy_c_buf_p) = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1795,7 +1874,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -1927,7 +2006,7 @@ static void slice__load_buffer_state (void) /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) slice_alloc(b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) slice_alloc((yy_size_t) (b->yy_buf_size + 2) ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in slice__create_buffer()" ); @@ -2077,15 +2156,15 @@ 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; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)slice_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in slice_ensure_buffer_stack()" ); - + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -2094,7 +2173,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. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)slice_realloc @@ -2114,7 +2193,7 @@ static void slice_ensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE slice__scan_buffer (char * base, yy_size_t size ) { @@ -2124,16 +2203,16 @@ YY_BUFFER_STATE slice__scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; b = (YY_BUFFER_STATE) slice_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in slice__scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -2153,27 +2232,28 @@ YY_BUFFER_STATE slice__scan_buffer (char * base, yy_size_t size ) * @note If you want to scan bytes that may contain NUL values, then use * slice__scan_bytes() instead. */ -YY_BUFFER_STATE slice__scan_string (yyconst char * yystr ) +YY_BUFFER_STATE slice__scan_string (const char * yystr ) { - return slice__scan_bytes(yystr,strlen(yystr) ); + return slice__scan_bytes(yystr,(int) strlen(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 bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) +YY_BUFFER_STATE slice__scan_bytes (const char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = (yy_size_t) (_yybytes_len + 2); buf = (char *) slice_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in slice__scan_bytes()" ); @@ -2199,9 +2279,9 @@ YY_BUFFER_STATE slice__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_ #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void yynoreturn yy_fatal_error (const char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2229,7 +2309,7 @@ static void yy_fatal_error (yyconst char* msg ) */ int slice_get_lineno (void) { - + return slice_lineno; } @@ -2252,7 +2332,7 @@ FILE *slice_get_out (void) /** Get the length of the current token. * */ -yy_size_t slice_get_leng (void) +int slice_get_leng (void) { return slice_leng; } @@ -2267,29 +2347,29 @@ char *slice_get_text (void) } /** Set the current line number. - * @param line_number + * @param _line_number 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) @@ -2297,9 +2377,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) @@ -2308,10 +2388,10 @@ static int yy_init_globals (void) * This function is called from slice_lex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = NULL; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; + (yy_c_buf_p) = NULL; (yy_init) = 0; (yy_start) = 0; @@ -2320,8 +2400,8 @@ static int yy_init_globals (void) slice_in = stdin; slice_out = stdout; #else - slice_in = (FILE *) 0; - slice_out = (FILE *) 0; + slice_in = NULL; + slice_out = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2357,18 +2437,19 @@ int slice_lex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +static void yy_flex_strncpy (char* s1, const char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int yy_flex_strlen (const char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2378,11 +2459,12 @@ static int yy_flex_strlen (yyconst char * s ) void *slice_alloc (yy_size_t size ) { - return (void *) malloc( size ); + return 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 @@ -2390,12 +2472,12 @@ void *slice_realloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, 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" @@ -2403,7 +2485,6 @@ void slice_free (void * ptr ) #line 526 "src/Slice/Scanner.l" - namespace Slice { // |