From b2ec1544be4c13b8229757566c33511c934c1684 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Sun, 25 Sep 2022 12:46:47 -0700 Subject: [PATCH] [build] Regenerate lex and yacc files The source grammar files were also updated. This fixes compiler warnings for these files. Bug: #1003 --- CMakeLists.txt | 4 + src/gba/debugger-expr-lex.cpp | 2343 ++++++++++++++++-------------- src/gba/debugger-expr-yacc.cpp | 2451 +++++++++++++++----------------- src/gba/debugger-expr-yacc.hpp | 136 +- src/gba/debugger-expr.l | 5 +- src/gba/debugger-expr.y | 8 +- 6 files changed, 2511 insertions(+), 2436 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6ca6d3b..5d7b605d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -909,7 +909,11 @@ set( src/gba/bios.cpp src/gba/Cheats.cpp src/gba/CheatSearch.cpp + # Built with flex -o debugger-expr-lex.cpp -P dexp_ debugger-expr.l src/gba/debugger-expr-lex.cpp + # Built with bison -L c -o debugger-expr-yacc.cpp -H -p dexp_ debugger-expr.y + # The yyerrorlab label handler was manually commented out to silence a + # compiler warning. src/gba/debugger-expr-yacc.cpp src/gba/EEprom.cpp src/gba/ereader.cpp diff --git a/src/gba/debugger-expr-lex.cpp b/src/gba/debugger-expr-lex.cpp index ec548b76..8b0bbfe0 100644 --- a/src/gba/debugger-expr-lex.cpp +++ b/src/gba/debugger-expr-lex.cpp @@ -1,18 +1,24 @@ -#line 2 "debugger-expr-lex.cpp" +#line 1 "debugger-expr-lex.cpp" -#line 4 "debugger-expr-lex.cpp" +#line 3 "debugger-expr-lex.cpp" -#define YY_INT_ALIGNED short int +#define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer dexp__create_buffer #define yy_delete_buffer dexp__delete_buffer -#define yy_flex_debug dexp__flex_debug +#define yy_scan_buffer dexp__scan_buffer +#define yy_scan_string dexp__scan_string +#define yy_scan_bytes dexp__scan_bytes #define yy_init_buffer dexp__init_buffer #define yy_flush_buffer dexp__flush_buffer #define yy_load_buffer_state dexp__load_buffer_state #define yy_switch_to_buffer dexp__switch_to_buffer +#define yypush_buffer_state dexp_push_buffer_state +#define yypop_buffer_state dexp_pop_buffer_state +#define yyensure_buffer_stack dexp_ensure_buffer_stack +#define yy_flex_debug dexp__flex_debug #define yyin dexp_in #define yyleng dexp_leng #define yylex dexp_lex @@ -27,23 +33,253 @@ #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 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define dexp__create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer dexp__create_buffer +#endif + +#ifdef yy_delete_buffer +#define dexp__delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer dexp__delete_buffer +#endif + +#ifdef yy_scan_buffer +#define dexp__scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer dexp__scan_buffer +#endif + +#ifdef yy_scan_string +#define dexp__scan_string_ALREADY_DEFINED +#else +#define yy_scan_string dexp__scan_string +#endif + +#ifdef yy_scan_bytes +#define dexp__scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes dexp__scan_bytes +#endif + +#ifdef yy_init_buffer +#define dexp__init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer dexp__init_buffer +#endif + +#ifdef yy_flush_buffer +#define dexp__flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer dexp__flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define dexp__load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state dexp__load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define dexp__switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer dexp__switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define dexp_push_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state dexp_push_buffer_state +#endif + +#ifdef yypop_buffer_state +#define dexp_pop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state dexp_pop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define dexp_ensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack dexp_ensure_buffer_stack +#endif + +#ifdef yylex +#define dexp_lex_ALREADY_DEFINED +#else +#define yylex dexp_lex +#endif + +#ifdef yyrestart +#define dexp_restart_ALREADY_DEFINED +#else +#define yyrestart dexp_restart +#endif + +#ifdef yylex_init +#define dexp_lex_init_ALREADY_DEFINED +#else +#define yylex_init dexp_lex_init +#endif + +#ifdef yylex_init_extra +#define dexp_lex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra dexp_lex_init_extra +#endif + +#ifdef yylex_destroy +#define dexp_lex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy dexp_lex_destroy +#endif + +#ifdef yyget_debug +#define dexp_get_debug_ALREADY_DEFINED +#else +#define yyget_debug dexp_get_debug +#endif + +#ifdef yyset_debug +#define dexp_set_debug_ALREADY_DEFINED +#else +#define yyset_debug dexp_set_debug +#endif + +#ifdef yyget_extra +#define dexp_get_extra_ALREADY_DEFINED +#else +#define yyget_extra dexp_get_extra +#endif + +#ifdef yyset_extra +#define dexp_set_extra_ALREADY_DEFINED +#else +#define yyset_extra dexp_set_extra +#endif + +#ifdef yyget_in +#define dexp_get_in_ALREADY_DEFINED +#else +#define yyget_in dexp_get_in +#endif + +#ifdef yyset_in +#define dexp_set_in_ALREADY_DEFINED +#else +#define yyset_in dexp_set_in +#endif + +#ifdef yyget_out +#define dexp_get_out_ALREADY_DEFINED +#else +#define yyget_out dexp_get_out +#endif + +#ifdef yyset_out +#define dexp_set_out_ALREADY_DEFINED +#else +#define yyset_out dexp_set_out +#endif + +#ifdef yyget_leng +#define dexp_get_leng_ALREADY_DEFINED +#else +#define yyget_leng dexp_get_leng +#endif + +#ifdef yyget_text +#define dexp_get_text_ALREADY_DEFINED +#else +#define yyget_text dexp_get_text +#endif + +#ifdef yyget_lineno +#define dexp_get_lineno_ALREADY_DEFINED +#else +#define yyget_lineno dexp_get_lineno +#endif + +#ifdef yyset_lineno +#define dexp_set_lineno_ALREADY_DEFINED +#else +#define yyset_lineno dexp_set_lineno +#endif + +#ifdef yywrap +#define dexp_wrap_ALREADY_DEFINED +#else +#define yywrap dexp_wrap +#endif + +#ifdef yyalloc +#define dexp_alloc_ALREADY_DEFINED +#else +#define yyalloc dexp_alloc +#endif + +#ifdef yyrealloc +#define dexp_realloc_ALREADY_DEFINED +#else +#define yyrealloc dexp_realloc +#endif + +#ifdef yyfree +#define dexp_free_ALREADY_DEFINED +#else +#define yyfree dexp_free +#endif + +#ifdef yytext +#define dexp_text_ALREADY_DEFINED +#else +#define yytext dexp_text +#endif + +#ifdef yyleng +#define dexp_leng_ALREADY_DEFINED +#else +#define yyleng dexp_leng +#endif + +#ifdef yyin +#define dexp_in_ALREADY_DEFINED +#else +#define yyin dexp_in +#endif + +#ifdef yyout +#define dexp_out_ALREADY_DEFINED +#else +#define yyout dexp_out +#endif + +#ifdef yy_flex_debug +#define dexp__flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug dexp__flex_debug +#endif + +#ifdef yylineno +#define dexp_lineno_ALREADY_DEFINED +#else +#define yylineno dexp_lineno +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ -#include #include -#include #include - -#if (defined __WIN32__ || defined _WIN32) -#define fileno _fileno -#endif +#include +#include /* end standard C headers. */ @@ -54,7 +290,7 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. @@ -74,93 +310,81 @@ typedef uint32_t flex_uint32_t; typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN -#define INT8_MIN (-128) +#define INT8_MIN (-128) #endif #ifndef INT16_MIN -#define INT16_MIN (-32767 - 1) +#define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN -#define INT32_MIN (-2147483647 - 1) +#define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX -#define INT8_MAX (127) +#define INT8_MAX (127) #endif #ifndef INT16_MAX -#define INT16_MAX (32767) +#define INT16_MAX (32767) #endif #ifndef INT32_MAX -#define INT32_MAX (2147483647) +#define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX -#define UINT8_MAX (255U) +#define UINT8_MAX (255U) #endif #ifndef UINT16_MAX -#define UINT16_MAX (65535U) +#define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -#ifdef __cplusplus +/* begin standard C++ headers. */ -/* 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 /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#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 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 dexp_restart(dexp_in) - +#define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -178,108 +402,113 @@ typedef unsigned int flex_uint32_t; /* The state buf must be large enough to hold one state per character in the main buffer. */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state* YY_BUFFER_STATE; +typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif -extern int dexp_leng; - -extern FILE *dexp_in, *dexp_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) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do { \ - /* Undo effects of setting up dexp_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up dexp_text again */ \ - } while (0) - -#define unput(c) yyunput(c, (yytext_ptr)) - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif +extern int yyleng; + +extern FILE *yyin, *yyout; + +#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) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state { - FILE* yy_input_file; +struct yy_buffer_state + { + FILE *yy_input_file; - char* yy_ch_buf; /* input buffer */ - char* yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB + /* 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 + /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + int yy_n_chars; - /* Whether we "own" the buffer - i.e., we know we created it, + /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ - int yy_is_our_buffer; + int yy_is_our_buffer; - /* Whether this is an "interactive" input source; if so, and + /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ - int yy_is_interactive; + int yy_is_interactive; - /* Whether we're considered to be at the beginning of a line. + /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ - int yy_at_bol; + int yy_at_bol; 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 + /* Whether to try to fill the input buffer when we reach the * end of it. */ - int yy_fill_buffer; + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 -/* When an EOF's been seen but there's still some text to process + /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via dexp_restart()), so that the user can continue scanning by - * just pointing dexp_in at a new input file. + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 -}; + + }; #endif /* !YY_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 @@ -287,207 +516,219 @@ static YY_BUFFER_STATE* yy_buffer_stack = 0; /**< Stack as an array. */ * * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER ((yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - +#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. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when dexp_text is formed. */ +/* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int dexp_leng; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; /* Points to current character in buffer. */ -static char* yy_c_buf_p = (char*)0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +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 */ -/* Flag which is used to allow dexp_wrap()'s to do buffer switches - * instead of setting up a fresh dexp_in. A bit of a hack ... +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void dexp_restart(FILE* input_file); -void dexp__switch_to_buffer(YY_BUFFER_STATE new_buffer); -YY_BUFFER_STATE dexp__create_buffer(FILE* file, int size); -void dexp__delete_buffer(YY_BUFFER_STATE b); -void dexp__flush_buffer(YY_BUFFER_STATE b); -void dexp_push_buffer_state(YY_BUFFER_STATE new_buffer); -void dexp_pop_buffer_state(void); +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); -static void dexp_ensure_buffer_stack(void); -static void dexp__load_buffer_state(void); -static void dexp__init_buffer(YY_BUFFER_STATE b, FILE* file); +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) -#define YY_FLUSH_BUFFER dexp__flush_buffer(YY_CURRENT_BUFFER) +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); -YY_BUFFER_STATE dexp__scan_buffer(char* base, yy_size_t size); -YY_BUFFER_STATE dexp__scan_string(yyconst char* yy_str); -YY_BUFFER_STATE dexp__scan_bytes(yyconst char* bytes, int len); - -void* dexp_alloc(yy_size_t); -void* dexp_realloc(void*, yy_size_t); -void dexp_free(void*); - -#define yy_new_buffer dexp__create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if (!YY_CURRENT_BUFFER) { \ - dexp_ensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = dexp__create_buffer(dexp_in, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if (!YY_CURRENT_BUFFER) { \ - dexp_ensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = dexp__create_buffer(dexp_in, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define dexp_wrap(n) 1 +#define dexp_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; -typedef unsigned char YY_CHAR; - -FILE *dexp_in = (FILE *)0, *dexp_out = (FILE *)0; +FILE *yyin = NULL, *yyout = NULL; typedef int yy_state_type; -extern int dexp_lineno; +extern int yylineno; +int yylineno = 1; -int dexp_lineno = 1; +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext -extern char* dexp_text; -#define yytext_ptr dexp_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 dexp_text. + * corresponding action - sets up yytext. */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - dexp_leng = (size_t)(yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 30 #define YY_END_OF_BUFFER 31 /* This struct is not used in this scanner, but its presence is necessary. */ -struct yy_trans_info { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; -}; -static yyconst flex_int16_t yy_accept[51] = { 0, - 0, 0, 31, 28, 30, 27, 25, 28, 23, 20, - 21, 17, 14, 15, 16, 11, 10, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 9, 8, 24, 28, - 22, 26, 13, 11, 0, 10, 18, 19, 29, 5, - 6, 3, 4, 2, 7, 1, 1, 1, 12, 0 }; +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[51] = + { 0, + 0, 0, 31, 28, 30, 27, 25, 28, 23, 20, + 21, 17, 14, 15, 16, 11, 10, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 9, 8, 24, 28, + 22, 26, 13, 11, 0, 10, 18, 19, 29, 5, + 6, 3, 4, 2, 7, 1, 1, 1, 12, 0 + } ; -static yyconst flex_int32_t yy_ec[256] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 4, 1, 1, 5, 1, 6, 1, 7, - 8, 9, 10, 1, 11, 1, 12, 13, 14, 15, - 15, 15, 15, 16, 16, 16, 16, 1, 1, 17, - 1, 18, 1, 1, 19, 20, 21, 19, 19, 19, - 22, 23, 22, 22, 22, 24, 22, 22, 22, 25, - 22, 26, 27, 22, 22, 22, 28, 29, 22, 22, - 30, 1, 31, 32, 22, 1, 19, 20, 21, 19, +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 4, 1, 1, 5, 1, 6, 1, 7, + 8, 9, 10, 1, 11, 1, 12, 13, 14, 15, + 15, 15, 15, 16, 16, 16, 16, 1, 1, 17, + 1, 18, 1, 1, 19, 20, 21, 19, 19, 19, + 22, 23, 22, 22, 22, 24, 22, 22, 22, 25, + 22, 26, 27, 22, 22, 22, 28, 29, 22, 22, + 30, 1, 31, 32, 22, 1, 19, 20, 21, 19, - 19, 19, 22, 23, 22, 22, 22, 24, 22, 22, - 22, 25, 22, 33, 27, 22, 22, 22, 28, 29, - 22, 22, 1, 34, 1, 35, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 19, 19, 22, 23, 22, 22, 22, 24, 22, 22, + 22, 25, 22, 33, 27, 22, 22, 22, 28, 29, + 22, 22, 1, 34, 1, 35, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 }; + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; -static yyconst flex_int32_t yy_meta[36] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, - 2, 3, 3, 3, 3, 3, 3, 3, 4, 1, - 1, 1, 3, 1, 1 }; +static const YY_CHAR yy_meta[36] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 4, 1, + 1, 1, 3, 1, 1 + } ; -static yyconst flex_int16_t yy_base[55] = { 0, - 0, 0, 71, 72, 72, 72, 72, 0, 72, 72, - 72, 72, 72, 72, 72, 41, 23, 52, 50, 0, - 37, 36, 14, 44, 39, 33, 72, 72, 72, 28, - 72, 72, 0, 33, 0, 35, 72, 72, 0, 72, - 72, 0, 0, 0, 72, 32, 39, 0, 0, 72, - 55, 54, 57, 52 }; +static const flex_int16_t yy_base[55] = + { 0, + 0, 0, 71, 72, 72, 72, 72, 0, 72, 72, + 72, 72, 72, 72, 72, 41, 23, 52, 50, 0, + 37, 36, 14, 44, 39, 33, 72, 72, 72, 28, + 72, 72, 0, 33, 0, 35, 72, 72, 0, 72, + 72, 0, 0, 0, 72, 32, 39, 0, 0, 72, + 55, 54, 57, 52 + } ; -static yyconst flex_int16_t yy_def[55] = { 0, - 50, 1, 50, 50, 50, 50, 50, 51, 50, 50, - 50, 50, 50, 50, 50, 52, 50, 50, 50, 53, - 53, 53, 53, 53, 53, 53, 50, 50, 50, 53, - 50, 50, 51, 52, 54, 50, 50, 50, 53, 50, - 50, 53, 53, 53, 50, 30, 30, 53, 54, 0, - 50, 50, 50, 50 }; +static const flex_int16_t yy_def[55] = + { 0, + 50, 1, 50, 50, 50, 50, 50, 51, 50, 50, + 50, 50, 50, 50, 50, 52, 50, 50, 50, 53, + 53, 53, 53, 53, 53, 53, 50, 50, 50, 53, + 50, 50, 51, 52, 54, 50, 50, 50, 53, 50, + 50, 53, 53, 53, 50, 30, 30, 53, 54, 0, + 50, 50, 50, 50 + } ; -static yyconst flex_int16_t yy_nxt[108] = { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 17, 17, 18, 19, 20, 21, - 20, 20, 22, 23, 24, 20, 25, 26, 20, 27, - 28, 29, 30, 31, 32, 36, 36, 36, 36, 42, - 46, 47, 48, 48, 48, 48, 42, 36, 36, 36, - 36, 48, 48, 49, 39, 34, 33, 34, 39, 39, - 39, 50, 45, 44, 43, 41, 40, 38, 37, 35, - 50, 3, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, +static const flex_int16_t yy_nxt[108] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 17, 17, 18, 19, 20, 21, + 20, 20, 22, 23, 24, 20, 25, 26, 20, 27, + 28, 29, 30, 31, 32, 36, 36, 36, 36, 42, + 46, 47, 48, 48, 48, 48, 42, 36, 36, 36, + 36, 48, 48, 49, 39, 34, 33, 34, 39, 39, + 39, 50, 45, 44, 43, 41, 40, 38, 37, 35, + 50, 3, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50 }; + 50, 50, 50, 50, 50, 50, 50 + } ; -static yyconst flex_int16_t yy_chk[108] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 17, 17, 17, 17, 23, - 30, 30, 30, 30, 46, 46, 23, 36, 36, 36, - 36, 47, 47, 54, 47, 52, 51, 52, 53, 53, - 53, 34, 26, 25, 24, 22, 21, 19, 18, 16, - 3, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, +static const flex_int16_t yy_chk[108] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 17, 17, 17, 17, 23, + 30, 30, 30, 30, 46, 46, 23, 36, 36, 36, + 36, 47, 47, 54, 47, 52, 51, 52, 53, 53, + 53, 34, 26, 25, 24, 22, 21, 19, 18, 16, + 3, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50 }; + 50, 50, 50, 50, 50, 50, 50 + } ; static yy_state_type yy_last_accepting_state; -static char* yy_last_accepting_cpos; +static char *yy_last_accepting_cpos; -extern int dexp__flex_debug; -int dexp__flex_debug = 0; +extern int yy_flex_debug; +int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -496,32 +737,35 @@ int dexp__flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char* dexp_text; +char *yytext; #line 1 "debugger-expr.l" #line 2 "debugger-expr.l" -#include "debugger-expr-yacc.hpp" #include #include +#include "debugger-expr-yacc.hpp" #ifdef _MSC_VER #define YY_NO_UNISTD_H #include #define isatty _isatty +#define fileno _fileno #endif extern YYSTYPE dexp_lval; -char* dexprString; +char *dexprString; int dexprCol; -#define YY_INPUT(buf, result, max_size) \ - { \ - int c = *dexprString++; \ - dexprCol++; \ - result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ +#define YY_INPUT(buf,result,max_size) \ + { \ + char c = *dexprString++; \ + dexprCol++;\ + result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ } -#line 543 "debugger-expr-lex.cpp" +#line 766 "debugger-expr-lex.cpp" +#define YY_NO_INPUT 1 +#line 768 "debugger-expr-lex.cpp" #define INITIAL 0 @@ -534,39 +778,39 @@ int dexprCol; #endif #ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void* +#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 dexp_lex_destroy(void); +int yylex_destroy ( void ); -int dexp_get_debug(void); +int yyget_debug ( void ); -void dexp_set_debug(int debug_flag); +void yyset_debug ( int debug_flag ); -YY_EXTRA_TYPE dexp_get_extra(void); +YY_EXTRA_TYPE yyget_extra ( void ); -void dexp_set_extra(YY_EXTRA_TYPE user_defined); +void yyset_extra ( YY_EXTRA_TYPE user_defined ); -FILE* dexp_get_in(void); +FILE *yyget_in ( void ); -void dexp_set_in(FILE* in_str); +void yyset_in ( FILE * _in_str ); -FILE* dexp_get_out(void); +FILE *yyget_out ( void ); -void dexp_set_out(FILE* out_str); +void yyset_out ( FILE * _out_str ); -int dexp_get_leng(void); + int yyget_leng ( void ); -char* dexp_get_text(void); +char *yyget_text ( void ); -int dexp_get_lineno(void); +int yyget_lineno ( void ); -void dexp_set_lineno(int line_number); +void yyset_lineno ( int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -574,28 +818,29 @@ void dexp_set_lineno(int line_number); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int dexp_wrap(void); +extern "C" int yywrap ( void ); #else -extern int dexp_wrap(void); +extern int yywrap ( void ); #endif #endif -static void yyunput(int c, char* buf_ptr); +#ifndef YY_NO_UNPUT + +#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 @@ -615,39 +860,42 @@ 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(dexp_text, dexp_leng, 1, dexp_out)) { \ - } \ - } while (0) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT -#define YY_INPUT(buf, result, max_size) \ - if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) { \ - int c = '*'; \ - size_t n; \ - for (n = 0; n < max_size && (c = getc(dexp_in)) != EOF && c != '\n'; ++n) \ - buf[n] = (char)c; \ - if (c == '\n') \ - buf[n++] = (char)c; \ - if (c == EOF && ferror(dexp_in)) \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - result = n; \ - } else { \ - errno = 0; \ - while ((result = fread(buf, 1, max_size, dexp_in)) == 0 && ferror(dexp_in)) { \ - if (errno != EINTR) { \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - break; \ - } \ - errno = 0; \ - clearerr(dexp_in); \ - } \ - } +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ #endif @@ -666,7 +914,7 @@ static int input(void); /* Report a fatal error. */ #ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error(msg) +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ @@ -677,12 +925,12 @@ static int input(void); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int dexp_lex(void); +extern int yylex (void); -#define YY_DECL int dexp_lex(void) +#define YY_DECL int yylex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after dexp_text and dexp_leng +/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION @@ -691,298 +939,301 @@ extern int dexp_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 \ - YY_USER_ACTION + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - -#line 31 "debugger-expr.l" - -#line 732 "debugger-expr-lex.cpp" - - if (!(yy_init)) { - (yy_init) = 1; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if (!(yy_start)) - (yy_start) = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if (!dexp_in) - dexp_in = stdin; + if ( ! yyin ) + yyin = stdin; - if (!dexp_out) - dexp_out = stdout; + if ( ! yyout ) + yyout = stdout; - if (!YY_CURRENT_BUFFER) { - dexp_ensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = dexp__create_buffer(dexp_in, YY_BUF_SIZE); - } + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } - dexp__load_buffer_state(); - } + yy_load_buffer_state( ); + } - while (1) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); + { +#line 34 "debugger-expr.l" - /* Support of dexp_text. */ - *yy_cp = (yy_hold_char); +#line 985 "debugger-expr-lex.cpp" - /* yy_bp points to the position in yy_ch_buf of the start of + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ - yy_bp = yy_cp; + yy_bp = yy_cp; - yy_current_state = (yy_start); - yy_match: - do { - 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; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 51) - yy_c = yy_meta[(unsigned int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; - ++yy_cp; - } while (yy_base[yy_current_state] != 72); + yy_current_state = (yy_start); +yy_match: + do + { + 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; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 51 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 72 ); - yy_find_action: - yy_act = yy_accept[yy_current_state]; - if (yy_act == 0) { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ +do_action: /* This label is used only to access EOF actions. */ - switch (yy_act) { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; - case 1: - YY_RULE_SETUP -#line 32 "debugger-expr.l" - dexp_lval.number = atoi((char*)(dexp_text + 1)); - return TOK_REGISTER; - YY_BREAK - case 2: - YY_RULE_SETUP -#line 33 "debugger-expr.l" - dexp_lval.number = 13; - return TOK_REGISTER; - YY_BREAK - case 3: - YY_RULE_SETUP -#line 34 "debugger-expr.l" - dexp_lval.number = 14; - return TOK_REGISTER; - YY_BREAK - case 4: - YY_RULE_SETUP +case 1: +YY_RULE_SETUP #line 35 "debugger-expr.l" - dexp_lval.number = 15; - return TOK_REGISTER; - YY_BREAK - case 5: - YY_RULE_SETUP +dexp_lval.number=atoi((char *)(dexp_text+1)); return TOK_REGISTER; + YY_BREAK +case 2: +YY_RULE_SETUP #line 36 "debugger-expr.l" - return TOK_BBRACKET; - YY_BREAK - case 6: - YY_RULE_SETUP +dexp_lval.number = 13; return TOK_REGISTER; + YY_BREAK +case 3: +YY_RULE_SETUP #line 37 "debugger-expr.l" - return TOK_HBRACKET; - YY_BREAK - case 7: - YY_RULE_SETUP +dexp_lval.number = 14; return TOK_REGISTER; + YY_BREAK +case 4: +YY_RULE_SETUP #line 38 "debugger-expr.l" - return TOK_WBRACKET; - YY_BREAK - case 8: - YY_RULE_SETUP +dexp_lval.number = 15; return TOK_REGISTER; + YY_BREAK +case 5: +YY_RULE_SETUP #line 39 "debugger-expr.l" - return TOK_RBRACKET; - YY_BREAK - case 9: - YY_RULE_SETUP +return TOK_BBRACKET; + YY_BREAK +case 6: +YY_RULE_SETUP #line 40 "debugger-expr.l" - return TOK_LBRACKET; - YY_BREAK - case 10: - YY_RULE_SETUP +return TOK_HBRACKET; + YY_BREAK +case 7: +YY_RULE_SETUP #line 41 "debugger-expr.l" - dexp_lval.number = atoi(dexp_text); - return TOK_NUMBER; - YY_BREAK - case 11: - YY_RULE_SETUP +return TOK_WBRACKET; + YY_BREAK +case 8: +YY_RULE_SETUP #line 42 "debugger-expr.l" - sscanf(dexp_text, "%x", &dexp_lval.number); - return TOK_NUMBER; - YY_BREAK - case 12: - YY_RULE_SETUP +return TOK_RBRACKET; + YY_BREAK +case 9: +YY_RULE_SETUP #line 43 "debugger-expr.l" - sscanf((char*)(dexp_text + 2), "%x", &dexp_lval.number); - return TOK_NUMBER; - YY_BREAK - case 13: - YY_RULE_SETUP +return TOK_LBRACKET; + YY_BREAK +case 10: +YY_RULE_SETUP #line 44 "debugger-expr.l" - sscanf((char*)(dexp_text + 1), "%x", &dexp_lval.number); - return TOK_NUMBER; - YY_BREAK - case 14: - YY_RULE_SETUP +dexp_lval.number=atoi(dexp_text); return TOK_NUMBER; + YY_BREAK +case 11: +YY_RULE_SETUP #line 45 "debugger-expr.l" - return TOK_PLUS; - YY_BREAK - case 15: - YY_RULE_SETUP +sscanf(dexp_text, "%x", &dexp_lval.number); return TOK_NUMBER; + YY_BREAK +case 12: +YY_RULE_SETUP #line 46 "debugger-expr.l" - return TOK_MINUS; - YY_BREAK - case 16: - YY_RULE_SETUP +sscanf((char *)(dexp_text + 2), "%x", &dexp_lval.number); return TOK_NUMBER; + YY_BREAK +case 13: +YY_RULE_SETUP #line 47 "debugger-expr.l" - return TOK_DIVIDE; - YY_BREAK - case 17: - YY_RULE_SETUP +sscanf((char *)(dexp_text + 1), "%x", &dexp_lval.number); return TOK_NUMBER; + YY_BREAK +case 14: +YY_RULE_SETUP #line 48 "debugger-expr.l" - return TOK_MULTIPLY; - YY_BREAK - case 18: - YY_RULE_SETUP +return TOK_PLUS; + YY_BREAK +case 15: +YY_RULE_SETUP #line 49 "debugger-expr.l" - return TOK_LSHIFT; - YY_BREAK - case 19: - YY_RULE_SETUP +return TOK_MINUS; + YY_BREAK +case 16: +YY_RULE_SETUP #line 50 "debugger-expr.l" - return TOK_RSHIFT; - YY_BREAK - case 20: - YY_RULE_SETUP +return TOK_DIVIDE; + YY_BREAK +case 17: +YY_RULE_SETUP #line 51 "debugger-expr.l" - return TOK_LPAREN; - YY_BREAK - case 21: - YY_RULE_SETUP +return TOK_MULTIPLY; + YY_BREAK +case 18: +YY_RULE_SETUP #line 52 "debugger-expr.l" - return TOK_RPAREN; - YY_BREAK - case 22: - YY_RULE_SETUP +return TOK_LSHIFT; + YY_BREAK +case 19: +YY_RULE_SETUP #line 53 "debugger-expr.l" - return TOK_OR; - YY_BREAK - case 23: - YY_RULE_SETUP +return TOK_RSHIFT; + YY_BREAK +case 20: +YY_RULE_SETUP #line 54 "debugger-expr.l" - return TOK_AND; - YY_BREAK - case 24: - YY_RULE_SETUP +return TOK_LPAREN; + YY_BREAK +case 21: +YY_RULE_SETUP #line 55 "debugger-expr.l" - return TOK_XOR; - YY_BREAK - case 25: - YY_RULE_SETUP +return TOK_RPAREN; + YY_BREAK +case 22: +YY_RULE_SETUP #line 56 "debugger-expr.l" - return TOK_NEGATE; - YY_BREAK - case 26: - YY_RULE_SETUP +return TOK_OR; + YY_BREAK +case 23: +YY_RULE_SETUP #line 57 "debugger-expr.l" - return TOK_NEGATE; - YY_BREAK - case 27: - YY_RULE_SETUP +return TOK_AND; + YY_BREAK +case 24: +YY_RULE_SETUP #line 58 "debugger-expr.l" - ; - YY_BREAK - case 28: - YY_RULE_SETUP +return TOK_XOR; + YY_BREAK +case 25: +YY_RULE_SETUP #line 59 "debugger-expr.l" - printf("Unrecognised token: %s\n", dexp_text); - YY_BREAK - case 29: - YY_RULE_SETUP +return TOK_NEGATE; + YY_BREAK +case 26: +YY_RULE_SETUP #line 60 "debugger-expr.l" - dexp_lval.string = dexp_text; - return TOK_ID; - YY_BREAK - case 30: - YY_RULE_SETUP +return TOK_NEGATE; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 61 "debugger-expr.l" +; + YY_BREAK +case 28: +YY_RULE_SETUP #line 62 "debugger-expr.l" - ECHO; - YY_BREAK -#line 965 "debugger-expr-lex.cpp" - case YY_STATE_EOF(INITIAL): - yyterminate(); +printf("Unrecognised token: %s\n", dexp_text); + YY_BREAK +case 29: +YY_RULE_SETUP +#line 63 "debugger-expr.l" +dexp_lval.string=dexp_text; return TOK_ID; + YY_BREAK +case 30: +YY_RULE_SETUP +#line 65 "debugger-expr.l" +ECHO; + YY_BREAK +#line 1192 "debugger-expr-lex.cpp" +case YY_STATE_EOF(INITIAL): + yyterminate(); - case YY_END_OF_BUFFER: { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1; + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) { - /* We're scanning a new file or input source. It's + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed dexp_in at a new source and called - * dexp_lex(). If so, then we have to assure + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = dexp_in; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* Note that here we test for yy_c_buf_p "<=" to the position + /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ - if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) { /* This was really a NUL. */ - yy_state_type yy_next_state; + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - /* Okay, we're now positioned to make the NUL + /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal @@ -991,78 +1242,86 @@ YY_DECL * will run more slowly). */ - yy_next_state = yy_try_NUL_trans(yy_current_state); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; - if (yy_next_state) { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } - else { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } - else - switch (yy_get_next_buffer()) { - case EOB_ACT_END_OF_FILE: { - (yy_did_buffer_switch_on_eof) = 0; + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; - if (dexp_wrap()) { - /* Note: because we've taken care in + if ( yywrap( ) ) + { + /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * dexp_text, we can now set up + * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } - else { - if (!(yy_did_buffer_switch_on_eof)) - YY_NEW_FILE; - } - break; - } + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found"); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of dexp_lex */ + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1071,147 +1330,169 @@ YY_DECL * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ -static int yy_get_next_buffer(void) +static int yy_get_next_buffer (void) { - char* dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char* source = (yytext_ptr); - int number_to_move, i; - int ret_val; + 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]) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed"); + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); - if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */ - if ((yy_c_buf_p) - (yytext_ptr)-YY_MORE_ADJ == 1) { - /* We matched a single character, the EOB, so + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so * treat this as a final EOF. */ - return EOB_ACT_END_OF_FILE; - } + return EOB_ACT_END_OF_FILE; + } - else { - /* We matched some text prior to the EOB, first + else + { + /* We matched some text prior to the EOB, first * process it. */ - return EOB_ACT_LAST_MATCH; - } - } + return EOB_ACT_LAST_MATCH; + } + } - /* Try to read more data. */ + /* Try to read more data. */ - /* First move last chars to start of buffer. */ - number_to_move = (int)((yy_c_buf_p) - (yytext_ptr)) - 1; + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); - for (i = 0; i < number_to_move; ++i) - *(dest++) = *(source++); + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) - /* don't do the read, it's not guaranteed to return an EOF, + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - else { - int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + else + { + 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. */ + 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; + /* just a shorter name for the 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); + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); - if (b->yy_is_our_buffer) { - int new_size = b->yy_buf_size * 2; + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; - if (new_size <= 0) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; - b->yy_ch_buf = (char*) - /* Include room in for 2 EOB chars. */ - dexp_realloc((void*)b->yy_ch_buf, b->yy_buf_size + 2); - } else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (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 = NULL; - if (!b->yy_ch_buf) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow"); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - } + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; - if (num_to_read > YY_READ_BUF_SIZE) - num_to_read = YY_READ_BUF_SIZE; + } - /* Read in more data. */ - YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t)num_to_read); + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - if ((yy_n_chars) == 0) { - if (number_to_move == YY_MORE_ADJ) { - ret_val = EOB_ACT_END_OF_FILE; - dexp_restart(dexp_in); - } + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } - else { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } - } + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } - 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. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char*)dexp_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()"); - } + else + ret_val = EOB_ACT_CONTINUE_SCAN; - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + 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. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (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()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - return ret_val; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state(void) + static yy_state_type yy_get_previous_state (void) { - yy_state_type yy_current_state; - char* yy_cp; + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); - yy_current_state = (yy_start); + 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); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 51 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } - 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); - if (yy_accept[yy_current_state]) { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 51) - yy_c = yy_meta[(unsigned int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; - } - - return yy_current_state; + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character @@ -1219,88 +1500,64 @@ static yy_state_type yy_get_previous_state(void) * synopsis * next_state = yy_try_NUL_trans( current_state ); */ -static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state) + 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); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - YY_CHAR yy_c = 1; - if (yy_accept[yy_current_state]) { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 51) - yy_c = yy_meta[(unsigned int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; - yy_is_jam = (yy_current_state == 50); + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 51 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 50); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } -static void yyunput(int c, char* yy_bp) -{ - char* yy_cp; +#ifndef YY_NO_UNPUT - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up dexp_text */ - *yy_cp = (yy_hold_char); - - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - 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]; - char* source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - *--dest = *--source; - - 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; - - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) - YY_FATAL_ERROR("flex scanner push-back overflow"); - } - - *--yy_cp = (char)c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} +#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 { - int c; + int c; + + *(yy_c_buf_p) = (yy_hold_char); - *(yy_c_buf_p) = (yy_hold_char); - - if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) { - /* yy_c_buf_p now points to the character we want to return. + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; - else { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); - switch (yy_get_next_buffer()) { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before @@ -1310,96 +1567,99 @@ static int input(void) * to EOB_ACT_END_OF_FILE. */ - /* Reset buffer status. */ - dexp_restart(dexp_in); + /* Reset buffer status. */ + yyrestart( yyin ); - /*FALLTHROUGH*/ + /*FALLTHROUGH*/ - case EOB_ACT_END_OF_FILE: { - if (dexp_wrap()) - return EOF; + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; - if (!(yy_did_buffer_switch_on_eof)) - YY_NEW_FILE; + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char*)(yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve dexp_text */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ -void dexp_restart(FILE* input_file) + void yyrestart (FILE * input_file ) { + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } - if (!YY_CURRENT_BUFFER) { - dexp_ensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = dexp__create_buffer(dexp_in, YY_BUF_SIZE); - } - - dexp__init_buffer(YY_CURRENT_BUFFER, input_file); - dexp__load_buffer_state(); + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ -void dexp__switch_to_buffer(YY_BUFFER_STATE new_buffer) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - - /* TODO. We should be able to replace this entire function body + + /* TODO. We should be able to replace this entire function body * with - * dexp_pop_buffer_state(); - * dexp_push_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - dexp_ensure_buffer_stack(); - if (YY_CURRENT_BUFFER == new_buffer) - return; + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; - if (YY_CURRENT_BUFFER) { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } - YY_CURRENT_BUFFER_LVALUE = new_buffer; - dexp__load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); - /* We don't actually know whether we did this switch during - * EOF (dexp_wrap()) processing, but the only time this flag - * is looked at is after dexp_wrap() is called, so it's safe + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - (yy_did_buffer_switch_on_eof) = 1; + (yy_did_buffer_switch_on_eof) = 1; } -static void dexp__load_buffer_state(void) +static void yy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - dexp_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. @@ -1408,106 +1668,102 @@ static void dexp__load_buffer_state(void) * * @return the allocated buffer state. */ -YY_BUFFER_STATE dexp__create_buffer(FILE* file, int size) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b = (YY_BUFFER_STATE)dexp_alloc(sizeof(struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR("out of dynamic memory in dexp__create_buffer()"); + b->yy_buf_size = size; - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because + /* 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*)dexp_alloc(b->yy_buf_size + 2); - if (!b->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in dexp__create_buffer()"); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - dexp__init_buffer(b, file); + yy_init_buffer( b, file ); - return b; + return b; } /** Destroy the buffer. - * @param b a buffer created with dexp__create_buffer() + * @param b a buffer created with yy_create_buffer() * */ -void dexp__delete_buffer(YY_BUFFER_STATE b) + void yy_delete_buffer (YY_BUFFER_STATE b ) { + + if ( ! b ) + return; - if (!b) - return; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0; + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); - if (b->yy_is_our_buffer) - dexp_free((void*)b->yy_ch_buf); - - dexp_free((void*)b); + yyfree( (void *) b ); } -#ifndef __cplusplus -extern int isatty(int); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a dexp_restart() or at EOF. + * such as during a yyrestart() or at EOF. */ -static void dexp__init_buffer(YY_BUFFER_STATE b, FILE* file) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { - int oerrno = errno; + int oerrno = errno; + + yy_flush_buffer( b ); - dexp__flush_buffer(b); + b->yy_input_file = file; + b->yy_fill_buffer = 1; - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then dexp__init_buffer was _probably_ - * called from dexp_restart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ - if (b != YY_CURRENT_BUFFER) { + if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } - b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; - - errno = oerrno; + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ -void dexp__flush_buffer(YY_BUFFER_STATE b) + void yy_flush_buffer (YY_BUFFER_STATE b ) { - if (!b) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes + /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if (b == YY_CURRENT_BUFFER) - dexp__load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -1516,328 +1772,337 @@ void dexp__flush_buffer(YY_BUFFER_STATE b) * @param new_buffer The new state. * */ -void dexp_push_buffer_state(YY_BUFFER_STATE new_buffer) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) - return; + if (new_buffer == NULL) + return; - dexp_ensure_buffer_stack(); + yyensure_buffer_stack(); - /* This block is copied from dexp__switch_to_buffer. */ - if (YY_CURRENT_BUFFER) { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from dexp__switch_to_buffer. */ - dexp__load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ -void dexp_pop_buffer_state(void) +void yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; + if (!YY_CURRENT_BUFFER) + return; - dexp__delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); - if (YY_CURRENT_BUFFER) { - dexp__load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; - } + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void dexp_ensure_buffer_stack(void) +static void yyensure_buffer_stack (void) { - int num_to_alloc; + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this + /* First allocation is just for 2 elements, since we don't know if this * 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; - (yy_buffer_stack) = (struct yy_buffer_state**)dexp_alloc(num_to_alloc * sizeof(struct yy_buffer_state*)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in dexp_ensure_buffer_stack()"); + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + 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; - } + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) { + 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 */; + /* Increase the buffer to prepare for a possible push. */ + 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**)dexp_realloc((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in dexp_ensure_buffer_stack()"); + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @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 dexp__scan_buffer(char* base, yy_size_t size) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; + + if ( size < 2 || + 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 NULL; - if (size < 2 || 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; + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b = (YY_BUFFER_STATE)dexp_alloc(sizeof(struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR("out of dynamic memory in dexp__scan_buffer()"); + 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 = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; - b->yy_buf_size = 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_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; + yy_switch_to_buffer( b ); - dexp__switch_to_buffer(b); - - return b; + return b; } -/** Setup the input buffer state to scan a string. The next call to dexp_lex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * dexp__scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE dexp__scan_string(yyconst char* yystr) +YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - - return dexp__scan_bytes(yystr, strlen(yystr)); + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to dexp_lex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() 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. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE dexp__scan_bytes(yyconst char* yybytes, int _yybytes_len) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) { - YY_BUFFER_STATE b; - char* buf; - yy_size_t n; - int i; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char*)dexp_alloc(n); - if (!buf) - YY_FATAL_ERROR("out of dynamic memory in dexp__scan_bytes()"); + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - for (i = 0; i < _yybytes_len; ++i) - buf[i] = yybytes[i]; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - b = dexp__scan_buffer(buf, n); - if (!b) - YY_FATAL_ERROR("bad buffer in dexp__scan_bytes()"); - - /* It's okay to grow etc. this buffer, and we should throw it + /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - return b; + return b; } #ifndef YY_EXIT_FAILURE #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); - exit(YY_EXIT_FAILURE); + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless -#define yyless(n) \ - do { \ - /* Undo effects of setting up dexp_text. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - dexp_text[dexp_leng] = (yy_hold_char); \ - (yy_c_buf_p) = dexp_text + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - dexp_leng = yyless_macro_arg; \ - } while (0) +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ -int dexp_get_lineno(void) +int yyget_lineno (void) { - - return dexp_lineno; + + return yylineno; } /** Get the input stream. * */ -FILE* dexp_get_in(void) +FILE *yyget_in (void) { - return dexp_in; + return yyin; } /** Get the output stream. * */ -FILE* dexp_get_out(void) +FILE *yyget_out (void) { - return dexp_out; + return yyout; } /** Get the length of the current token. * */ -int dexp_get_leng(void) +int yyget_leng (void) { - return dexp_leng; + return yyleng; } /** Get the current token. * */ -char* dexp_get_text(void) +char *yyget_text (void) { - return dexp_text; + return yytext; } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void dexp_set_lineno(int line_number) +void yyset_lineno (int _line_number ) { - - dexp_lineno = line_number; + + yylineno = _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 dexp__switch_to_buffer + * @see yy_switch_to_buffer */ -void dexp_set_in(FILE* in_str) +void yyset_in (FILE * _in_str ) { - dexp_in = in_str; + yyin = _in_str ; } -void dexp_set_out(FILE* out_str) +void yyset_out (FILE * _out_str ) { - dexp_out = out_str; + yyout = _out_str ; } -int dexp_get_debug(void) +int yyget_debug (void) { - return dexp__flex_debug; + return yy_flex_debug; } -void dexp_set_debug(int bdebug) +void yyset_debug (int _bdebug ) { - dexp__flex_debug = bdebug; + yy_flex_debug = _bdebug ; } -static int yy_init_globals(void) +static int yy_init_globals (void) { - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from dexp_lex_destroy(), so don't allocate here. + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_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; /* Defined in main.c */ #ifdef YY_STDINIT - dexp_in = stdin; - dexp_out = stdout; + yyin = stdin; + yyout = stdout; #else - dexp_in = (FILE*)0; - dexp_out = (FILE*)0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by - * dexp_lex_init() + * yylex_init() */ return 0; } -/* dexp_lex_destroy is for both reentrant and non-reentrant scanners. */ -int dexp_lex_destroy(void) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) { - + /* Pop the buffer stack, destroying each element. */ - while (YY_CURRENT_BUFFER) { - dexp__delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - dexp_pop_buffer_state(); - } + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } - /* Destroy the stack itself. */ - dexp_free((yy_buffer_stack)); - (yy_buffer_stack) = NULL; + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * dexp_lex() is called, initialization will occur. */ - yy_init_globals(); + * yylex() is called, initialization will occur. */ + yy_init_globals( ); return 0; } @@ -1847,52 +2112,56 @@ int dexp_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 ) { - int i; - for (i = 0; i < n; ++i) - s1[i] = s2[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 ) { - int n; - for (n = 0; s[n]; ++n) - ; + int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif -void* dexp_alloc(yy_size_t size) +void *yyalloc (yy_size_t size ) { - return (void*)malloc(size); + return malloc(size); } -void* dexp_realloc(void* ptr, yy_size_t size) +void *yyrealloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both + + /* 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 * because both ANSI C and C++ allow castless assignment from * 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 dexp_free(void* ptr) +void yyfree (void * ptr ) { - free((char*)ptr); /* see dexp_realloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 62 "debugger-expr.l" +#line 65 "debugger-expr.l" + void dexp_flush() { - dexp__flush_buffer(YY_CURRENT_BUFFER); + dexp__flush_buffer(YY_CURRENT_BUFFER); } + diff --git a/src/gba/debugger-expr-yacc.cpp b/src/gba/debugger-expr-yacc.cpp index 3f57b14e..3e4c7bab 100644 --- a/src/gba/debugger-expr-yacc.cpp +++ b/src/gba/debugger-expr-yacc.cpp @@ -1,14 +1,14 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -36,6 +34,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -43,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 1 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30802 -/* Bison version. */ -#define YYBISON_VERSION "2.3" +/* Bison version string. */ +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,706 +57,734 @@ /* Pure parsers. */ #define YYPURE 0 -/* Using locations. */ -#define YYLSP_NEEDED 0 +/* Push parsers. */ +#define YYPUSH 0 -#define yyparse dexp_parse -#define yylex dexp_lex -#define yyerror dexp_error -#define yylval dexp_lval -#define yychar dexp_char -#define yydebug dexp_debug -#define yynerrs dexp_nerrs +/* Pull parsers. */ +#define YYPULL 1 -/* Tokens. */ -#ifndef YYTOKENTYPE -#define YYTOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ -enum yytokentype { - TOK_PLUS = 258, - TOK_MINUS = 259, - TOK_DIVIDE = 260, - TOK_MULTIPLY = 261, - TOK_LSHIFT = 262, - TOK_RSHIFT = 263, - TOK_LPAREN = 264, - TOK_RPAREN = 265, - TOK_OR = 266, - TOK_AND = 267, - TOK_XOR = 268, - TOK_NEGATE = 269, - TOK_BBRACKET = 270, - TOK_HBRACKET = 271, - TOK_WBRACKET = 272, - TOK_LBRACKET = 273, - TOK_RBRACKET = 274, - TOK_REGISTER = 275, - TOK_NUMBER = 276, - TOK_ID = 277 -}; -#endif -/* Tokens. */ -#define TOK_PLUS 258 -#define TOK_MINUS 259 -#define TOK_DIVIDE 260 -#define TOK_MULTIPLY 261 -#define TOK_LSHIFT 262 -#define TOK_RSHIFT 263 -#define TOK_LPAREN 264 -#define TOK_RPAREN 265 -#define TOK_OR 266 -#define TOK_AND 267 -#define TOK_XOR 268 -#define TOK_NEGATE 269 -#define TOK_BBRACKET 270 -#define TOK_HBRACKET 271 -#define TOK_WBRACKET 272 -#define TOK_LBRACKET 273 -#define TOK_RBRACKET 274 -#define TOK_REGISTER 275 -#define TOK_NUMBER 276 -#define TOK_ID 277 -/* Copy the first part of user declarations. */ -#line 1 "src/sdl/debugger-expr.y" +/* Substitute the variable and function names. */ +#define yyparse dexp_parse +#define yylex dexp_lex +#define yyerror dexp_error +#define yydebug dexp_debug +#define yynerrs dexp_nerrs +#define yylval dexp_lval +#define yychar dexp_char + +/* First part of user prologue. */ +#line 1 "debugger-expr.y" #include - + #include "../System.h" -#include "../common/Port.h" #include "GBA.h" +#include "../common/Port.h" -#include -#include #include +#include +#include unsigned int dexp_result = 0; -extern int dexp_error(char*); +extern int dexp_error(const char *); extern int dexp_lex(); -extern char* dexp_text; +extern char *dexp_text; std::map dexp_vars; #define readWord(addr) \ - READ32LE((&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask])) + READ32LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) #define readHalfWord(addr) \ - READ16LE((&map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask])) + READ16LE((&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) #define readByte(addr) \ - map[(addr) >> 24].address[(addr)&map[(addr) >> 24].mask] + map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] -/* Enabling traces. */ -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -#undef YYERROR_VERBOSE -#define YYERROR_VERBOSE 1 -#else -#define YYERROR_VERBOSE 0 -#endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -#define YYTOKEN_TABLE 0 -#endif +#line 108 "debugger-expr-yacc.cpp" -#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 44 "src/sdl/debugger-expr.y" +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +#include "debugger-expr-yacc.hpp" +/* Symbol kind. */ +enum yysymbol_kind_t { - unsigned int number; - char* string; -} -/* Line 187 of yacc.c. */ -#line 175 "src/sdl/debugger-expr-yacc.cpp" -YYSTYPE; -#define yystype YYSTYPE /* obsolescent; will be withdrawn */ -#define YYSTYPE_IS_DECLARED 1 -#define YYSTYPE_IS_TRIVIAL 1 -#endif + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_TOK_PLUS = 3, /* TOK_PLUS */ + YYSYMBOL_TOK_MINUS = 4, /* TOK_MINUS */ + YYSYMBOL_TOK_DIVIDE = 5, /* TOK_DIVIDE */ + YYSYMBOL_TOK_MULTIPLY = 6, /* TOK_MULTIPLY */ + YYSYMBOL_TOK_LSHIFT = 7, /* TOK_LSHIFT */ + YYSYMBOL_TOK_RSHIFT = 8, /* TOK_RSHIFT */ + YYSYMBOL_TOK_LPAREN = 9, /* TOK_LPAREN */ + YYSYMBOL_TOK_RPAREN = 10, /* TOK_RPAREN */ + YYSYMBOL_TOK_OR = 11, /* TOK_OR */ + YYSYMBOL_TOK_AND = 12, /* TOK_AND */ + YYSYMBOL_TOK_XOR = 13, /* TOK_XOR */ + YYSYMBOL_TOK_NEGATE = 14, /* TOK_NEGATE */ + YYSYMBOL_TOK_BBRACKET = 15, /* TOK_BBRACKET */ + YYSYMBOL_TOK_HBRACKET = 16, /* TOK_HBRACKET */ + YYSYMBOL_TOK_WBRACKET = 17, /* TOK_WBRACKET */ + YYSYMBOL_TOK_LBRACKET = 18, /* TOK_LBRACKET */ + YYSYMBOL_TOK_RBRACKET = 19, /* TOK_RBRACKET */ + YYSYMBOL_TOK_REGISTER = 20, /* TOK_REGISTER */ + YYSYMBOL_TOK_NUMBER = 21, /* TOK_NUMBER */ + YYSYMBOL_TOK_ID = 22, /* TOK_ID */ + YYSYMBOL_YYACCEPT = 23, /* $accept */ + YYSYMBOL_final = 24, /* final */ + YYSYMBOL_exp = 25 /* exp */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; + -/* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 188 "src/sdl/debugger-expr-yacc.cpp" #ifdef short -#undef short +# undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif + +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; -#else -typedef short int yytype_int8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned short int yytype_uint16; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short int yytype_int16; +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T -#ifdef __SIZE_TYPE__ -#define YYSIZE_T __SIZE_TYPE__ -#elif defined size_t -#define YYSIZE_T size_t -#elif !defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -#include /* INFRINGES ON USER NAME SPACE */ -#define YYSIZE_T size_t -#else -#define YYSIZE_T unsigned int -#endif +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T)-1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_int8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ -#if YYENABLE_NLS -#if ENABLE_NLS -#include /* INFRINGES ON USER NAME SPACE */ -#define YY_(msgid) dgettext("bison-runtime", msgid) +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif #endif + + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif #endif -#ifndef YY_ -#define YY_(msgid) msgid -#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif #endif /* Suppress unused-variable warnings by "using" E. */ -#if !defined lint || defined __GNUC__ -#define YYUSE(e) ((void)(e)) +#if ! defined lint || defined __GNUC__ +# define YY_USE(E) ((void) (E)) #else -#define YYUSE(e) /* empty */ +# define YY_USE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -#define YYID(n) (n) +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID(int i) -#else -static int - YYID(i) int i; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return i; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif -#if !defined yyoverflow || YYERROR_VERBOSE +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if !defined yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ -#ifdef YYSTACK_USE_ALLOCA -#if YYSTACK_USE_ALLOCA -#ifdef __GNUC__ -#define YYSTACK_ALLOC __builtin_alloca -#elif defined __BUILTIN_VA_ARG_INCR -#include /* INFRINGES ON USER NAME SPACE */ -#elif defined _AIX -#define YYSTACK_ALLOC __alloca -#elif defined _MSC_VER -#include /* INFRINGES ON USER NAME SPACE */ -#define alloca _alloca -#else -#define YYSTACK_ALLOC alloca -#if !defined _ALLOCA_H && !defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -#include /* INFRINGES ON USER NAME SPACE */ -#ifndef _STDLIB_H -#define _STDLIB_H 1 -#endif -#endif -#endif -#endif -#endif +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif -#ifdef YYSTACK_ALLOC -/* Pacify GCC's `empty if-body' warning. */ -#define YYSTACK_FREE(Ptr) \ - do { /* empty */ \ - ; \ - } while (YYID(0)) -#ifndef YYSTACK_ALLOC_MAXIMUM -/* The OS might guarantee only one guard page at the bottom of the stack, +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -#define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -#endif -#else -#define YYSTACK_ALLOC YYMALLOC -#define YYSTACK_FREE YYFREE -#ifndef YYSTACK_ALLOC_MAXIMUM -#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -#endif -#if (defined __cplusplus && !defined _STDLIB_H \ - && !((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -#include /* INFRINGES ON USER NAME SPACE */ -#ifndef _STDLIB_H -#define _STDLIB_H 1 -#endif -#endif -#ifndef YYMALLOC -#define YYMALLOC malloc -#if !defined malloc && !defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void* malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -#endif -#endif -#ifndef YYFREE -#define YYFREE free -#if !defined free && !defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free(void*); /* INFRINGES ON USER NAME SPACE */ -#endif -#endif -#endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* !defined yyoverflow */ -#if (!defined yyoverflow \ - && (!defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ -union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; +union yyalloc +{ + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -#define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ -#define YYSTACK_BYTES(N) \ - ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) +# define YYSTACK_BYTES(N) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -#ifndef YYCOPY -#if defined __GNUC__ && 1 < __GNUC__ -#define YYCOPY(To, From, Count) \ - __builtin_memcpy(To, From, (Count) * sizeof(*(From))) -#else -#define YYCOPY(To, From, Count) \ - do { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } while (YYID(0)) -#endif -#endif +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -#define YYSTACK_RELOCATE(Stack) \ - do { \ - YYSIZE_T yynewbytes; \ - YYCOPY(&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof(*yyptr); \ - } while (YYID(0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + } \ + while (0) #endif +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 20 +#define YYFINAL 20 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 135 +#define YYLAST 135 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 23 +#define YYNTOKENS 23 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 3 +#define YYNNTS 3 /* YYNRULES -- Number of rules. */ -#define YYNRULES 21 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 44 +#define YYNRULES 21 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 44 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 277 +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK 277 -#define YYTRANSLATE(YYX) \ - ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = { - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22 +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_int8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22 }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = { - 0, 0, 3, 5, 7, 9, 13, 17, 20, 23, - 27, 31, 35, 39, 43, 47, 51, 55, 57, 61, - 65, 69 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = { - 24, 0, -1, 25, -1, 21, -1, 22, -1, 25, - 3, 25, -1, 25, 4, 25, -1, 4, 25, -1, - 14, 25, -1, 25, 5, 25, -1, 25, 6, 25, - -1, 25, 7, 25, -1, 25, 8, 25, -1, 9, - 25, 10, -1, 25, 12, 25, -1, 25, 11, 25, - -1, 25, 13, 25, -1, 20, -1, 15, 25, 19, - -1, 16, 25, 19, -1, 17, 25, 19, -1, 18, - 25, 19, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint8 yyrline[] = { - 0, 56, 56, 59, 60, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84 +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int8 yyrline[] = +{ + 0, 56, 56, 59, 60, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char* const yytname[] = { - "$end", "error", "$undefined", "TOK_PLUS", "TOK_MINUS", "TOK_DIVIDE", - "TOK_MULTIPLY", "TOK_LSHIFT", "TOK_RSHIFT", "TOK_LPAREN", "TOK_RPAREN", - "TOK_OR", "TOK_AND", "TOK_XOR", "TOK_NEGATE", "TOK_BBRACKET", - "TOK_HBRACKET", "TOK_WBRACKET", "TOK_LBRACKET", "TOK_RBRACKET", - "TOK_REGISTER", "TOK_NUMBER", "TOK_ID", "$accept", "final", "exp", 0 +static const char *const yytname[] = +{ + "\"end of file\"", "error", "\"invalid token\"", "TOK_PLUS", + "TOK_MINUS", "TOK_DIVIDE", "TOK_MULTIPLY", "TOK_LSHIFT", "TOK_RSHIFT", + "TOK_LPAREN", "TOK_RPAREN", "TOK_OR", "TOK_AND", "TOK_XOR", "TOK_NEGATE", + "TOK_BBRACKET", "TOK_HBRACKET", "TOK_WBRACKET", "TOK_LBRACKET", + "TOK_RBRACKET", "TOK_REGISTER", "TOK_NUMBER", "TOK_ID", "$accept", + "final", "exp", YY_NULLPTR }; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} #endif -#ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277 -}; -#endif +#define YYPACT_NINF (-2) -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = { - 0, 23, 24, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25 -}; +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = { - 0, 2, 1, 1, 1, 3, 3, 2, 2, 3, - 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, - 3, 3 -}; +#define YYTABLE_NINF (-1) -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 17, 3, - 4, 0, 2, 7, 0, 8, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 13, 18, 19, 20, 21, 5, 6, 9, 10, 11, - 12, 15, 14, 16 -}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = { - -1, 11, 12 -}; +#define yytable_value_is_error(Yyn) \ + 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -2 -static const yytype_int8 yypact[] = { - 25, 25, 25, 25, 25, 25, 25, 25, -2, -2, - -2, 13, 113, 122, 4, 122, 45, 62, 79, 96, - -2, 25, 25, 25, 25, 25, 25, 25, 25, 25, - -2, -2, -2, -2, -2, 122, 122, 24, 24, 48, - 48, 6, 17, -2 +static const yytype_int8 yypact[] = +{ + 25, 25, 25, 25, 25, 25, 25, 25, -2, -2, + -2, 13, 113, 122, 4, 122, 45, 62, 79, 96, + -2, 25, 25, 25, 25, 25, 25, 25, 25, 25, + -2, -2, -2, -2, -2, 122, 122, 24, 24, 48, + 48, 6, 17, -2 +}; + +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int8 yydefact[] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 17, 3, + 4, 0, 2, 7, 0, 8, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 13, 18, 19, 20, 21, 5, 6, 9, 10, 11, + 12, 15, 14, 16 }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = { - -2, -2, -1 +static const yytype_int8 yypgoto[] = +{ + -2, -2, -1 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = { - 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, - 24, 25, 26, 20, 30, 27, 28, 29, 28, 29, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 1, - 29, 25, 26, 0, 2, 27, 28, 29, 0, 3, - 4, 5, 6, 7, 0, 8, 9, 10, 21, 22, - 23, 24, 25, 26, 0, 0, 27, 28, 29, 27, - 28, 29, 0, 0, 31, 21, 22, 23, 24, 25, - 26, 0, 0, 27, 28, 29, 0, 0, 0, 0, - 0, 32, 21, 22, 23, 24, 25, 26, 0, 0, - 27, 28, 29, 0, 0, 0, 0, 0, 33, 21, - 22, 23, 24, 25, 26, 0, 0, 27, 28, 29, - 0, 0, 0, 0, 0, 34, 21, 22, 23, 24, - 25, 26, 0, 0, 27, 28, 29, 23, 24, 25, - 26, 0, 0, 27, 28, 29 +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + 0, 11, 12 }; -static const yytype_int8 yycheck[] = { - 1, 2, 3, 4, 5, 6, 7, 3, 4, 5, - 6, 7, 8, 0, 10, 11, 12, 13, 12, 13, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 4, - 13, 7, 8, -1, 9, 11, 12, 13, -1, 14, - 15, 16, 17, 18, -1, 20, 21, 22, 3, 4, - 5, 6, 7, 8, -1, -1, 11, 12, 13, 11, - 12, 13, -1, -1, 19, 3, 4, 5, 6, 7, - 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, - -1, 19, 3, 4, 5, 6, 7, 8, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, 19, 3, - 4, 5, 6, 7, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, 19, 3, 4, 5, 6, - 7, 8, -1, -1, 11, 12, 13, 5, 6, 7, - 8, -1, -1, 11, 12, 13 +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int8 yytable[] = +{ + 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, + 24, 25, 26, 20, 30, 27, 28, 29, 28, 29, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 1, + 29, 25, 26, 0, 2, 27, 28, 29, 0, 3, + 4, 5, 6, 7, 0, 8, 9, 10, 21, 22, + 23, 24, 25, 26, 0, 0, 27, 28, 29, 27, + 28, 29, 0, 0, 31, 21, 22, 23, 24, 25, + 26, 0, 0, 27, 28, 29, 0, 0, 0, 0, + 0, 32, 21, 22, 23, 24, 25, 26, 0, 0, + 27, 28, 29, 0, 0, 0, 0, 0, 33, 21, + 22, 23, 24, 25, 26, 0, 0, 27, 28, 29, + 0, 0, 0, 0, 0, 34, 21, 22, 23, 24, + 25, 26, 0, 0, 27, 28, 29, 23, 24, 25, + 26, 0, 0, 27, 28, 29 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = { - 0, 4, 9, 14, 15, 16, 17, 18, 20, 21, - 22, 24, 25, 25, 25, 25, 25, 25, 25, 25, - 0, 3, 4, 5, 6, 7, 8, 11, 12, 13, - 10, 19, 19, 19, 19, 25, 25, 25, 25, 25, - 25, 25, 25, 25 +static const yytype_int8 yycheck[] = +{ + 1, 2, 3, 4, 5, 6, 7, 3, 4, 5, + 6, 7, 8, 0, 10, 11, 12, 13, 12, 13, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 4, + 13, 7, 8, -1, 9, 11, 12, 13, -1, 14, + 15, 16, 17, 18, -1, 20, 21, 22, 3, 4, + 5, 6, 7, 8, -1, -1, 11, 12, 13, 11, + 12, 13, -1, -1, 19, 3, 4, 5, 6, 7, + 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, 19, 3, 4, 5, 6, 7, 8, -1, -1, + 11, 12, 13, -1, -1, -1, -1, -1, 19, 3, + 4, 5, 6, 7, 8, -1, -1, 11, 12, 13, + -1, -1, -1, -1, -1, 19, 3, 4, 5, 6, + 7, 8, -1, -1, 11, 12, 13, 5, 6, 7, + 8, -1, -1, 11, 12, 13 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ +static const yytype_int8 yystos[] = +{ + 0, 4, 9, 14, 15, 16, 17, 18, 20, 21, + 22, 24, 25, 25, 25, 25, 25, 25, 25, 25, + 0, 3, 4, 5, 6, 7, 8, 11, 12, 13, + 10, 19, 19, 19, 19, 25, 25, 25, 25, 25, + 25, 25, 25, 25 +}; -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr1[] = +{ + 0, 23, 24, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25 +}; -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr2[] = +{ + 0, 2, 1, 1, 1, 3, 3, 2, 2, 3, + 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, + 3, 3 +}; -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) +enum { YYENOMEM = -2 }; -#define YYBACKUP(Token, Value) \ - \ -do if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE(yychar); \ - YYPOPSTACK(1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror(YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - \ -while(YYID(0)) +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -#define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID(N)) { \ - (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ - } else { \ - (Current).first_line = (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = YYRHSLOC(Rhs, 0).last_column; \ - } \ - while (YYID(0)) -#endif +#define YYRECOVERING() (!!yyerrstatus) -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) -#ifndef YY_LOCATION_PRINT -#if YYLTYPE_IS_TRIVIAL -#define YY_LOCATION_PRINT(File, Loc) \ - fprintf(File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -#else -#define YY_LOCATION_PRINT(File, Loc) ((void)0) -#endif -#endif +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF -/* YYLEX -- calling `yylex' with the right arguments. */ - -#ifdef YYLEX_PARAM -#define YYLEX yylex(YYLEX_PARAM) -#else -#define YYLEX yylex() -#endif /* Enable debugging if requested. */ #if YYDEBUG -#ifndef YYFPRINTF -#include /* INFRINGES ON USER NAME SPACE */ -#define YYFPRINTF fprintf -#endif +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif -#define YYDPRINTF(Args) \ - \ -do \ - { \ - if (yydebug) \ - YYFPRINTF Args; \ - \ -} \ - while (YYID(0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -#define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ - \ -do \ - { \ - if (yydebug) { \ - YYFPRINTF(stderr, "%s ", Title); \ - yy_symbol_print(stderr, \ - Type, Value); \ - YYFPRINTF(stderr, "\n"); \ - } \ - \ -} \ - while (YYID(0)) -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Kind, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ + static void -yy_symbol_value_print(FILE* yyoutput, int yytype, YYSTYPE const* const yyvaluep) -#else -static void - yy_symbol_value_print(yyoutput, yytype, yyvaluep) - FILE* yyoutput; -int yytype; -YYSTYPE const* const yyvaluep; -#endif +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - if (!yyvaluep) - return; -#ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep); -#else - YYUSE(yyoutput); -#endif - switch (yytype) { - default: - break; - } + FILE *yyoutput = yyo; + YY_USE (yyoutput); + if (!yyvaluep) + return; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ + static void -yy_symbol_print(FILE* yyoutput, int yytype, YYSTYPE const* const yyvaluep) -#else -static void - yy_symbol_print(yyoutput, yytype, yyvaluep) - FILE* yyoutput; -int yytype; -YYSTYPE const* const yyvaluep; -#endif +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - if (yytype < YYNTOKENS) - YYFPRINTF(yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF(yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print(yyoutput, yytype, yyvaluep); - YYFPRINTF(yyoutput, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -762,85 +792,69 @@ YYSTYPE const* const yyvaluep; | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print(yytype_int16* bottom, yytype_int16* top) -#else -static void - yy_stack_print(bottom, top) - yytype_int16* bottom; -yytype_int16* top; -#endif +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { - YYFPRINTF(stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF(stderr, " %d", *bottom); - YYFPRINTF(stderr, "\n"); + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); } -#define YY_STACK_PRINT(Bottom, Top) \ - \ -do \ - { \ - if (yydebug) \ - yy_stack_print((Bottom), (Top)); \ - \ -} \ - while (YYID(0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print(YYSTYPE* yyvsp, int yyrule) -#else -static void - yy_reduce_print(yyvsp, yyrule) - YYSTYPE* yyvsp; -int yyrule; -#endif +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule) { - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf(stderr, " $%d = ", yyi + 1); - yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)])); - fprintf(stderr, "\n"); + int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); + YYFPRINTF (stderr, "\n"); } } -#define YY_REDUCE_PRINT(Rule) \ - \ -do \ - { \ - if (yydebug) \ - yy_reduce_print(yyvsp, Rule); \ - \ -} \ - while (YYID(0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -#define YYDPRINTF(Args) -#define YY_SYMBOL_PRINT(Title, Type, Value, Location) -#define YY_STACK_PRINT(Bottom, Top) -#define YY_REDUCE_PRINT(Rule) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ + /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only @@ -851,903 +865,688 @@ int yydebug; evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif -#if YYERROR_VERBOSE -#ifndef yystrlen -#if defined __GLIBC__ && defined _STRING_H -#define yystrlen strlen -#else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen(const char* yystr) -#else -static YYSIZE_T - yystrlen(yystr) - const char* yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -#endif -#endif -#ifndef yystpcpy -#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -#define yystpcpy stpcpy -#else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char* -yystpcpy(char* yydest, const char* yysrc) -#else -static char* - yystpcpy(yydest, yysrc) char* yydest; -const char* yysrc; -#endif -{ - char* yyd = yydest; - const char* yys = yysrc; - while ((*yyd++ = *yys++) != '\0') - continue; - return yyd - 1; -} -#endif -#endif - -#ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr(char* yyres, const char* yystr) -{ - if (*yystr == '"') { - YYSIZE_T yyn = 0; - char const* yyp = yystr; - - for (;;) - switch (*++yyp) { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes:; - } - - if (!yyres) - return yystrlen(yystr); - - return yystpcpy(yyres, yystr) - yyres; -} -#endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error(char* yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; - - if (!(YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else { - int yytype = YYTRANSLATE(yychar); - YYSIZE_T yysize0 = yytnamerr(0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const* yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char* yyfmt; - char const* yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const* yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy(yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr(0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy(yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen(yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char* yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { - yyp += yytnamerr(yyp, yyarg[yyi++]); - yyf += 2; - } else { - yyp++; - yyf++; - } - } - } - return yysize; - } -} -#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yydestruct(const char* yymsg, int yytype, YYSTYPE* yyvaluep) -#else -static void - yydestruct(yymsg, yytype, yyvaluep) - const char* yymsg; -int yytype; -YYSTYPE* yyvaluep; -#endif +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { - YYUSE(yyvaluep); + YY_USE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) { - - default: - break; - } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse(void* YYPARSE_PARAM); -#else -int yyparse(); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse(void); -#else -int yyparse(); -#endif -#endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* Lookahead token kind. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; - /* Number of syntax errors so far. */ int yynerrs; + + + /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int yyparse(void* YYPARSE_PARAM) -#else int - yyparse(YYPARSE_PARAM) void* YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int yyparse(void) -#else -int yyparse() - -#endif -#endif +yyparse (void) { - - int yystate; - int yyn; - int yyresult; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char* yymsg = (char *)yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + int yyerrstatus = 0; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + /* Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16* yyss = yyssa; - yytype_int16* yyssp; + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - /* The semantic value stack. */ + /* The semantic value stack: array, bottom, top. */ YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE* yyvs = yyvsa; - YYSTYPE* yyvsp; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the + int yyn; + /* The return value of yyparse. */ + int yyresult; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; + /* The variables used to return semantic value and location from the action routines. */ - YYSTYPE yyval; + YYSTYPE yyval; - /* The number of symbols on the RHS of the reduced rule. + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ - int yylen = 0; + int yylen = 0; - YYDPRINTF((stderr, "Starting parse\n")); + YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ + goto yysetstate; - yyssp = yyss; - yyvsp = yyvs; - - goto yysetstate; /*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | +| yynewstate -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: - /* In all cases, when you get here, the value and location stacks + /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; + yyssp++; + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ yysetstate: - *yyssp = yystate; + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); - if (yyss + yystacksize - 1 <= yyssp) { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE* yyvs1 = yyvs; - yytype_int16* yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow(YY_("memory exhausted"), - &yyss1, yysize * sizeof(*yyssp), - &yyvs1, yysize * sizeof(*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -#ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + YYNOMEM; #else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + { + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; - { - yytype_int16* yyss1 = yyss; - union yyalloc* yyptr = (union yyalloc*)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize)); - if (!yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE(yyss); - YYSTACK_RELOCATE(yyvs); +# if defined yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; -#undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE(yyss1); - } -#endif -#endif /* no yyoverflow */ + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + } +# else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + YYNOMEM; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + if (! yyptr) + YYNOMEM; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif - YYDPRINTF((stderr, "Stack size increased to %lu\n", - (unsigned long int)yystacksize)); + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF((stderr, "Entering state %d\n", yystate)); - goto yybackup; + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + /*-----------. | yybackup. | `-----------*/ yybackup: + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; - /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) - goto yydefault; + /* Not known => get a lookahead token if don't already have one. */ - /* Not known => get a look-ahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) { - YYDPRINTF((stderr, "Reading a token: ")); - yychar = YYLEX; + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token\n")); + yychar = yylex (); } - if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; - YYDPRINTF((stderr, "Now at end of input.\n")); - } else { - yytoken = YYTRANSLATE(yychar); - YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); + if (yychar <= YYEOF) + { + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } - /* If the proper action on seeing token YYTOKEN is to reduce or to + /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - - /* Count tokens shifted since error; after three, turn off error + /* Count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) - yyerrstatus--; + if (yyerrstatus) + yyerrstatus--; - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; + goto yynewstate; - yystate = yyn; - *++yyvsp = yylval; - - goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1 - yylen]; + yyval = yyvsp[1-yylen]; - YY_REDUCE_PRINT(yyn); - switch (yyn) { - case 2: -#line 56 "src/sdl/debugger-expr.y" + + YY_REDUCE_PRINT (yyn); + switch (yyn) { - dexp_result = (yyvsp[(1) - (1)].number); - } break; + case 2: /* final: exp */ +#line 56 "debugger-expr.y" + {dexp_result = (yyvsp[0].number);} +#line 1156 "debugger-expr-yacc.cpp" + break; - case 3: -#line 59 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (1)].number); - } break; + case 3: /* exp: TOK_NUMBER */ +#line 59 "debugger-expr.y" + { (yyval.number) = (yyvsp[0].number); } +#line 1162 "debugger-expr-yacc.cpp" + break; - case 4: -#line 60 "src/sdl/debugger-expr.y" - { - std::string v((yyvsp[(1) - (1)].string)); - if (dexp_vars.count(v) == 0) { - printf("Variable %s not defined.\n", (yyvsp[(1) - (1)].string)); - YYABORT; - } - (yyval.number) = dexp_vars[v]; - } break; + case 4: /* exp: TOK_ID */ +#line 60 "debugger-expr.y" + { + std::string v((yyvsp[0].string)); + if (dexp_vars.count(v) == 0) { + printf("Variable %s not defined.\n", (yyvsp[0].string)); + YYABORT; + } + (yyval.number) = dexp_vars[v]; +} +#line 1175 "debugger-expr-yacc.cpp" + break; - case 5: -#line 68 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) + (yyvsp[(3) - (3)].number); - } break; + case 5: /* exp: exp TOK_PLUS exp */ +#line 68 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) + (yyvsp[0].number); } +#line 1181 "debugger-expr-yacc.cpp" + break; - case 6: -#line 69 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) - (yyvsp[(3) - (3)].number); - } break; + case 6: /* exp: exp TOK_MINUS exp */ +#line 69 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) - (yyvsp[0].number);} +#line 1187 "debugger-expr-yacc.cpp" + break; - case 7: -#line 70 "src/sdl/debugger-expr.y" - { - (yyval.number) = -(yyvsp[(2) - (2)].number); - } break; + case 7: /* exp: TOK_MINUS exp */ +#line 70 "debugger-expr.y" + { (yyval.number) = 0 - (yyvsp[0].number);} +#line 1193 "debugger-expr-yacc.cpp" + break; - case 8: -#line 71 "src/sdl/debugger-expr.y" - { - (yyval.number) = ~(yyvsp[(2) - (2)].number); - } break; + case 8: /* exp: TOK_NEGATE exp */ +#line 71 "debugger-expr.y" + { (yyval.number) = ~(yyvsp[0].number);} +#line 1199 "debugger-expr-yacc.cpp" + break; - case 9: -#line 72 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) / (yyvsp[(3) - (3)].number); - } break; + case 9: /* exp: exp TOK_DIVIDE exp */ +#line 72 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) / (yyvsp[0].number);} +#line 1205 "debugger-expr-yacc.cpp" + break; - case 10: -#line 73 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) * (yyvsp[(3) - (3)].number); - } break; + case 10: /* exp: exp TOK_MULTIPLY exp */ +#line 73 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) * (yyvsp[0].number);} +#line 1211 "debugger-expr-yacc.cpp" + break; - case 11: -#line 74 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) << (yyvsp[(3) - (3)].number); - } break; + case 11: /* exp: exp TOK_LSHIFT exp */ +#line 74 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) << (yyvsp[0].number);} +#line 1217 "debugger-expr-yacc.cpp" + break; - case 12: -#line 75 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) >> (yyvsp[(3) - (3)].number); - } break; + case 12: /* exp: exp TOK_RSHIFT exp */ +#line 75 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) >> (yyvsp[0].number);} +#line 1223 "debugger-expr-yacc.cpp" + break; - case 13: -#line 76 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(2) - (3)].number); - } break; + case 13: /* exp: TOK_LPAREN exp TOK_RPAREN */ +#line 76 "debugger-expr.y" + { (yyval.number)=(yyvsp[-1].number);} +#line 1229 "debugger-expr-yacc.cpp" + break; - case 14: -#line 77 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) & (yyvsp[(3) - (3)].number); - } break; + case 14: /* exp: exp TOK_AND exp */ +#line 77 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) & (yyvsp[0].number);} +#line 1235 "debugger-expr-yacc.cpp" + break; - case 15: -#line 78 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) | (yyvsp[(3) - (3)].number); - } break; + case 15: /* exp: exp TOK_OR exp */ +#line 78 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) | (yyvsp[0].number);} +#line 1241 "debugger-expr-yacc.cpp" + break; - case 16: -#line 79 "src/sdl/debugger-expr.y" - { - (yyval.number) = (yyvsp[(1) - (3)].number) ^ (yyvsp[(3) - (3)].number); - } break; + case 16: /* exp: exp TOK_XOR exp */ +#line 79 "debugger-expr.y" + { (yyval.number) = (yyvsp[-2].number) ^ (yyvsp[0].number); } +#line 1247 "debugger-expr-yacc.cpp" + break; - case 17: -#line 80 "src/sdl/debugger-expr.y" - { - (yyval.number) = reg[(yyvsp[(1) - (1)].number)].I; - } break; + case 17: /* exp: TOK_REGISTER */ +#line 80 "debugger-expr.y" + { (yyval.number) = reg[(yyvsp[0].number)].I; } +#line 1253 "debugger-expr-yacc.cpp" + break; - case 18: -#line 81 "src/sdl/debugger-expr.y" - { - (yyval.number) = readByte((yyvsp[(2) - (3)].number)); - } break; + case 18: /* exp: TOK_BBRACKET exp TOK_RBRACKET */ +#line 81 "debugger-expr.y" + { (yyval.number) = readByte((yyvsp[-1].number)); } +#line 1259 "debugger-expr-yacc.cpp" + break; - case 19: -#line 82 "src/sdl/debugger-expr.y" - { - (yyval.number) = readHalfWord((yyvsp[(2) - (3)].number)); - } break; + case 19: /* exp: TOK_HBRACKET exp TOK_RBRACKET */ +#line 82 "debugger-expr.y" + { (yyval.number) = readHalfWord((yyvsp[-1].number)); } +#line 1265 "debugger-expr-yacc.cpp" + break; - case 20: -#line 83 "src/sdl/debugger-expr.y" - { - (yyval.number) = readWord((yyvsp[(2) - (3)].number)); - } break; + case 20: /* exp: TOK_WBRACKET exp TOK_RBRACKET */ +#line 83 "debugger-expr.y" + { (yyval.number) = readWord((yyvsp[-1].number)); } +#line 1271 "debugger-expr-yacc.cpp" + break; - case 21: -#line 84 "src/sdl/debugger-expr.y" - { - (yyval.number) = readWord((yyvsp[(2) - (3)].number)); - } break; + case 21: /* exp: TOK_LBRACKET exp TOK_RBRACKET */ +#line 84 "debugger-expr.y" + { (yyval.number) = readWord((yyvsp[-1].number)); } +#line 1277 "debugger-expr-yacc.cpp" + break; -/* Line 1267 of yacc.c. */ -#line 1534 "src/sdl/debugger-expr-yacc.cpp" - default: - break; + +#line 1281 "debugger-expr-yacc.cpp" + + default: break; } - YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc); + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); - YYPOPSTACK(yylen); - yylen = 0; - YY_STACK_PRINT(yyss, yyssp); + YYPOPSTACK (yylen); + yylen = 0; - *++yyvsp = yyval; + *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } - yyn = yyr1[yyn]; + goto yynewstate; - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - goto yynewstate; - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) { - ++yynerrs; -#if !YYERROR_VERBOSE - yyerror((char *)YY_("syntax error")); -#else + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + yyerror (YY_("syntax error")); + } + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) { - YYSIZE_T yysize = yysyntax_error(0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { - YYSIZE_T yyalloc = 2 * yysize; - if (!(yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE(yymsg); - yymsg = (char*)YYSTACK_ALLOC(yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) { - (void)yysyntax_error(yymsg, yystate, yychar); - yyerror(yymsg); - } else { - yyerror((char *)YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; } -#endif - } - - if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } else { - yydestruct("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ - goto yyerrlab1; + goto yyerrlab1; -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; +// /*---------------------------------------------------. +// | yyerrorlab -- error raised explicitly by YYERROR. | +// `---------------------------------------------------*/ +// yyerrorlab: +// /* Pacify compilers when the user code never invokes YYERROR and the +// label yyerrorlab therefore never appears in user code. */ +// if (0) +// YYERROR; +// ++yynerrs; + +// /* Do not reclaim the symbols of the rule whose action triggered +// this YYERROR. */ +// YYPOPSTACK (yylen); +// yylen = 0; +// YY_STACK_PRINT (yyss, yyssp); +// yystate = *yyssp; +// goto yyerrlab1; - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK(yylen); - yylen = 0; - YY_STACK_PRINT(yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ - for (;;) { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { - yyn = yytable[yyn]; - if (0 < yyn) - break; + /* Pop stack until we find a state that shifts the error token. */ + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; } } - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yydestruct("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK(1); - yystate = *yyssp; - YY_STACK_PRINT(yyss, yyssp); + + yydestruct ("Error: popping", + YY_ACCESSING_SYMBOL (yystate), yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END - *++yyvsp = yylval; - /* Shift the error token. */ - YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp); + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; - yystate = yyn; - goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: - yyresult = 0; - goto yyreturn; + yyresult = 0; + goto yyreturnlab; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - yyresult = 1; - goto yyreturn; + yyresult = 1; + goto yyreturnlab; -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ + +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: - yyerror((char *)YY_("memory exhausted")); - yyresult = 2; -/* Fall through. */ -#endif + yyerror (YY_("memory exhausted")); + yyresult = 2; + goto yyreturnlab; -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered + +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ - YYPOPSTACK(yylen); - YY_STACK_PRINT(yyss, yyssp); - while (yyssp != yyss) { - yydestruct("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK(1); + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); + YYPOPSTACK (1); } #ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE(yyss); + if (yyss != yyssa) + YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE(yymsg); -#endif - /* Make sure YYID is used. */ - return YYID(yyresult); + + return yyresult; } -#line 86 "src/sdl/debugger-expr.y" +#line 86 "debugger-expr.y" -bool dexp_eval(char* expr, uint32_t* result) + +bool dexp_eval(char *expr, uint32_t *result) { - extern void dexp_flush(); - extern char* dexprString; - extern int dexprCol; + extern void dexp_flush(); + extern char *dexprString; + extern int dexprCol; - dexp_flush(); - - dexprString = expr; - dexprCol = 0; - - if (!dexp_parse()) { - *result = dexp_result; - return true; - } else { - return false; - } + dexp_flush(); + + + dexprString = expr; + dexprCol = 0; + + if(!dexp_parse()) { + *result = dexp_result; + return true; + } else { + return false; + } } -int dexp_error(char* s) +int dexp_error(const char *) { - return 0; + return 0; } -void dexp_setVar(char* name, uint32_t value) +void dexp_setVar(char *name, uint32_t value) { - std::string a(name); - dexp_vars[a] = value; + std::string a(name); + dexp_vars[a] = value; } void dexp_listVars() { - std::map::iterator iter; + std::map::iterator iter; - for (iter = dexp_vars.begin(); iter != dexp_vars.end(); iter++) { - printf("%s = %08X\n", iter->first.c_str(), iter->second); - } + for (iter = dexp_vars.begin(); iter != dexp_vars.end(); iter++) { + printf("%s = %08X\n", iter->first.c_str(), iter->second); + } } -void dexp_saveVars(char* file) +void dexp_saveVars(char *file) { - std::map::iterator iter; + std::map::iterator iter; - FILE* f = fopen(file, "w"); - if (!f) { - printf("Could not open file %s\n", file); - return; - } + FILE *f = fopen(file, "w"); + if (!f) { + printf("Could not open file %s\n", file); + return; + } - for (iter = dexp_vars.begin(); iter != dexp_vars.end(); iter++) { - fprintf(f, "%s = %08X\n", iter->first.c_str(), iter->second); - } - fclose(f); + for (iter = dexp_vars.begin(); iter != dexp_vars.end(); iter++) { + fprintf(f, "%s = %08X\n", iter->first.c_str(), iter->second); + } + fclose(f); } -void dexp_loadVars(char* file) +void dexp_loadVars(char *file) { - std::map::iterator iter; - char buffer[500]; - char name[500]; - uint32_t val; + std::map::iterator iter; + char buffer[500]; + char name[500]; + uint32_t val; - FILE* f = fopen(file, "r"); - if (!f) { - printf("Could not open file %s\n", file); - return; - } + FILE *f = fopen(file, "r"); + if (!f) { + printf("Could not open file %s\n", file); + return; + } - while (fgets(buffer, 500, f) != NULL) { - if (sscanf(buffer, "%s = %x", name, &val) == 2) { - dexp_setVar(name, val); - } + while (fgets(buffer, 500, f) != NULL) { + if (sscanf(buffer, "%s = %x",name,&val) == 2) { + dexp_setVar(name, val); } + } } + + diff --git a/src/gba/debugger-expr-yacc.hpp b/src/gba/debugger-expr-yacc.hpp index c77534e8..c66bd2db 100644 --- a/src/gba/debugger-expr-yacc.hpp +++ b/src/gba/debugger-expr-yacc.hpp @@ -1,14 +1,14 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -16,9 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -33,73 +31,75 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ -/* Tokens. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + +#ifndef YY_DEXP_DEBUGGER_EXPR_YACC_HPP_INCLUDED +# define YY_DEXP_DEBUGGER_EXPR_YACC_HPP_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int dexp_debug; +#endif + +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_PLUS = 258, - TOK_MINUS = 259, - TOK_DIVIDE = 260, - TOK_MULTIPLY = 261, - TOK_LSHIFT = 262, - TOK_RSHIFT = 263, - TOK_LPAREN = 264, - TOK_RPAREN = 265, - TOK_OR = 266, - TOK_AND = 267, - TOK_XOR = 268, - TOK_NEGATE = 269, - TOK_BBRACKET = 270, - TOK_HBRACKET = 271, - TOK_WBRACKET = 272, - TOK_LBRACKET = 273, - TOK_RBRACKET = 274, - TOK_REGISTER = 275, - TOK_NUMBER = 276, - TOK_ID = 277 - }; + enum yytokentype + { + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + TOK_PLUS = 258, /* TOK_PLUS */ + TOK_MINUS = 259, /* TOK_MINUS */ + TOK_DIVIDE = 260, /* TOK_DIVIDE */ + TOK_MULTIPLY = 261, /* TOK_MULTIPLY */ + TOK_LSHIFT = 262, /* TOK_LSHIFT */ + TOK_RSHIFT = 263, /* TOK_RSHIFT */ + TOK_LPAREN = 264, /* TOK_LPAREN */ + TOK_RPAREN = 265, /* TOK_RPAREN */ + TOK_OR = 266, /* TOK_OR */ + TOK_AND = 267, /* TOK_AND */ + TOK_XOR = 268, /* TOK_XOR */ + TOK_NEGATE = 269, /* TOK_NEGATE */ + TOK_BBRACKET = 270, /* TOK_BBRACKET */ + TOK_HBRACKET = 271, /* TOK_HBRACKET */ + TOK_WBRACKET = 272, /* TOK_WBRACKET */ + TOK_LBRACKET = 273, /* TOK_LBRACKET */ + TOK_RBRACKET = 274, /* TOK_RBRACKET */ + TOK_REGISTER = 275, /* TOK_REGISTER */ + TOK_NUMBER = 276, /* TOK_NUMBER */ + TOK_ID = 277 /* TOK_ID */ + }; + typedef enum yytokentype yytoken_kind_t; #endif -/* Tokens. */ -#define TOK_PLUS 258 -#define TOK_MINUS 259 -#define TOK_DIVIDE 260 -#define TOK_MULTIPLY 261 -#define TOK_LSHIFT 262 -#define TOK_RSHIFT 263 -#define TOK_LPAREN 264 -#define TOK_RPAREN 265 -#define TOK_OR 266 -#define TOK_AND 267 -#define TOK_XOR 268 -#define TOK_NEGATE 269 -#define TOK_BBRACKET 270 -#define TOK_HBRACKET 271 -#define TOK_WBRACKET 272 -#define TOK_LBRACKET 273 -#define TOK_RBRACKET 274 -#define TOK_REGISTER 275 -#define TOK_NUMBER 276 -#define TOK_ID 277 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 44 "src/sdl/debugger-expr.y" +union YYSTYPE { +#line 44 "debugger-expr.y" + unsigned int number; char *string; -} -/* Line 1489 of yacc.c. */ -#line 98 "src/sdl/debugger-expr-yacc.hpp" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 + +#line 91 "debugger-expr-yacc.hpp" + +}; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif -extern YYSTYPE yylval; +extern YYSTYPE dexp_lval; + + +int dexp_parse (void); + + +#endif /* !YY_DEXP_DEBUGGER_EXPR_YACC_HPP_INCLUDED */ diff --git a/src/gba/debugger-expr.l b/src/gba/debugger-expr.l index 18247ec9..56f43adc 100644 --- a/src/gba/debugger-expr.l +++ b/src/gba/debugger-expr.l @@ -7,6 +7,7 @@ #define YY_NO_UNISTD_H #include #define isatty _isatty +#define fileno _fileno #endif extern YYSTYPE dexp_lval; @@ -16,7 +17,7 @@ int dexprCol; #define YY_INPUT(buf,result,max_size) \ { \ - int c = *dexprString++; \ + char c = *dexprString++; \ dexprCol++;\ result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ } @@ -25,6 +26,8 @@ int dexprCol; %option nomain %option noyywrap +%option noinput +%option nounput HEX [0-9a-fA-F] diff --git a/src/gba/debugger-expr.y b/src/gba/debugger-expr.y index 7725f065..27c1d806 100644 --- a/src/gba/debugger-expr.y +++ b/src/gba/debugger-expr.y @@ -3,14 +3,14 @@ #include "../System.h" #include "GBA.h" -#include "../Port.h" +#include "../common/Port.h" #include #include #include unsigned int dexp_result = 0; -extern int dexp_error(char *); +extern int dexp_error(const char *); extern int dexp_lex(); extern char *dexp_text; @@ -67,7 +67,7 @@ exp: TOK_NUMBER { $$ = $1; } } | exp TOK_PLUS exp { $$ = $1 + $3; } | exp TOK_MINUS exp { $$ = $1 - $3;} -| TOK_MINUS exp { $$ = -$2;} +| TOK_MINUS exp { $$ = 0 - $2;} | TOK_NEGATE exp { $$ = ~$2;} | exp TOK_DIVIDE exp { $$ = $1 / $3;} | exp TOK_MULTIPLY exp { $$ = $1 * $3;} @@ -105,7 +105,7 @@ bool dexp_eval(char *expr, uint32_t *result) } } -int dexp_error(char *s) +int dexp_error(const char *) { return 0; }