diff --git a/engines/private/code.cpp b/engines/private/code.cpp index 47ca6462d88..0fe5966c5bd 100644 --- a/engines/private/code.cpp +++ b/engines/private/code.cpp @@ -8,8 +8,8 @@ namespace Private { -Setting *psetting; -SettingMap settingcode; +Setting *setting; +SettingMap settingMap; Datum *stack = NULL; /* the stack */ Datum *stackp = NULL; /* next free spot on stack */ @@ -47,11 +47,11 @@ void initInsts() { void initSetting() /* initialize for code generation */ { - psetting = (Setting*) malloc(sizeof(Setting)); - memset((void *) psetting, 0, sizeof(Setting)); + setting = (Setting*) malloc(sizeof(Setting)); + memset((void *) setting, 0, sizeof(Setting)); - prog = (Inst *) &psetting->prog; - stack = (Datum *) &psetting->stack; + prog = (Inst *) &setting->prog; + stack = (Datum *) &setting->stack; stackp = stack; progp = prog; @@ -60,19 +60,19 @@ void initSetting() /* initialize for code generation */ void saveSetting(char *name) { Common::String s(name); - settingcode.setVal(s, psetting); + settingMap.setVal(s, setting); //debug("setting %s", name); } void loadSetting(Common::String *name) { - assert(settingcode.contains(*name)); - psetting = settingcode.getVal(*name); + assert(settingMap.contains(*name)); + setting = settingMap.getVal(*name); debug("loading setting %s", name->c_str()); - prog = (Inst *) &psetting->prog; - stack = (Datum *) &psetting->stack; + prog = (Inst *) &setting->prog; + stack = (Datum *) &setting->stack; stackp = stack; progp = prog; diff --git a/engines/private/grammar.h b/engines/private/grammar.h index 793a9fdd9d5..3810559f3b9 100644 --- a/engines/private/grammar.h +++ b/engines/private/grammar.h @@ -5,6 +5,7 @@ #include "common/list.h" #include "common/array.h" #include "common/rect.h" +#include "private/symbol.h" #ifndef PRIVATE_GRAMMAR_H #define PRIVATE_GRAMMAR_H @@ -12,20 +13,8 @@ #define NSTACK 256 #define NPROG 10000 -typedef struct Arg { - int n; - int (**inst)(); -} Arg; -typedef struct Symbol { /* symbol table entry */ - Common::String *name; - short type; /* NAME, NUM, STRING or RECT */ - union { - int val; /* NAME or NUM */ - char *str; /* STRING */ - Common::Rect *rect; /* RECT */ - } u; -} Symbol; +namespace Private { typedef struct Datum { /* interpreter stack type */ short type; @@ -37,7 +26,11 @@ typedef struct Datum { /* interpreter stack type */ } u; } Datum; -namespace Private { + +typedef struct Arg { + int n; + int (**inst)(); +} Arg; typedef int (*Inst)(); /* machine instruction */ #define STOP (Inst) 0 @@ -68,28 +61,6 @@ typedef Common::HashMap SettingMap; typedef Common::Queue StringQueue; typedef Common::Queue RectQueue; - -extern StringQueue todefine; -extern SettingMap settingcode; - -// Symbols - -extern void showSymbol(Symbol *); -extern void setSymbol(Symbol *, int); - -typedef Common::HashMap SymbolMap; -typedef Common::List ConstantList; - -extern SymbolMap settings, variables, cursors, locations, rects; -extern ConstantList constants; - -extern void define(char *, Common::Rect *); -extern Symbol *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*); -extern Symbol *lookupName(char *); -extern Symbol *addconstant(int, int, char *); -extern void installall(char *); -extern Symbol *lookup(Common::String, SymbolMap); - // Funtions typedef Common::Array ArgArray; diff --git a/engines/private/grammar.l b/engines/private/grammar.l index 462d9d50817..be6f411c9f0 100644 --- a/engines/private/grammar.l +++ b/engines/private/grammar.l @@ -32,8 +32,8 @@ TRUE return TRUETOK; NULL return NULLTOK; Random return RANDOMTOK; [A-Za-z_][A-Za-z_0-9]* yylval.s = strdup(yytext); return NAME; -[\-]?[0-9]+ yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); return NUM; -\"[^\"\r\n]*\" yylval.sym = Private::addconstant(STRING, 0, strdup(yytext)); return STRING; +[\-]?[0-9]+ yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM; +\"[^\"\r\n]*\" yylval.sym = Private::constant(STRING, 0, strdup(yytext)); return STRING; [\r|\n]+ /* ignore return */; [ \t]+ /* ignore whitespace */; . return *yytext; @@ -46,21 +46,15 @@ namespace Private { int parse(char *code) { initSetting(); - //_lines[0] = _lines[1] = _lines[2] = code; YY_BUFFER_STATE bp; - //if (debugChannelSet(-1, kDebugParse)) yydebug = 1; - //else - // yydebug = 0; - yy_delete_buffer(YY_CURRENT_BUFFER); bp = yy_scan_string(code); yy_switch_to_buffer(bp); yyparse(); - //execute(prog); yy_delete_buffer(bp); return 0; diff --git a/engines/private/grammar.tab.cpp b/engines/private/grammar.tab.cpp index d93bf3b2402..1fcf2987da6 100644 --- a/engines/private/grammar.tab.cpp +++ b/engines/private/grammar.tab.cpp @@ -91,12 +91,12 @@ extern int yyparse(); void yyerror(const char *str) { - //fprintf(stderr,"error: %s\n",str); + //fprintf(stderr,"error: %s\n",str); } int yywrap() { - return 1; + return 1; } @@ -127,55 +127,55 @@ int yywrap() /* Symbol kind. */ enum yysymbol_kind_t { - YYSYMBOL_YYEMPTY = -2, - YYSYMBOL_YYEOF = 0, /* "end of file" */ - YYSYMBOL_YYerror = 1, /* error */ - YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ - YYSYMBOL_NAME = 3, /* NAME */ - YYSYMBOL_STRING = 4, /* STRING */ - YYSYMBOL_NUM = 5, /* NUM */ - YYSYMBOL_LTE = 6, /* LTE */ - YYSYMBOL_GTE = 7, /* GTE */ - YYSYMBOL_NEQ = 8, /* NEQ */ - YYSYMBOL_EQ = 9, /* EQ */ - YYSYMBOL_FALSETOK = 10, /* FALSETOK */ - YYSYMBOL_TRUETOK = 11, /* TRUETOK */ - YYSYMBOL_NULLTOK = 12, /* NULLTOK */ - YYSYMBOL_IFTOK = 13, /* IFTOK */ - YYSYMBOL_ELSETOK = 14, /* ELSETOK */ - YYSYMBOL_RECT = 15, /* RECT */ - YYSYMBOL_GOTOTOK = 16, /* GOTOTOK */ - YYSYMBOL_DEBUGTOK = 17, /* DEBUGTOK */ - YYSYMBOL_DEFINETOK = 18, /* DEFINETOK */ - YYSYMBOL_SETTINGTOK = 19, /* SETTINGTOK */ - YYSYMBOL_RANDOMTOK = 20, /* RANDOMTOK */ - YYSYMBOL_21_ = 21, /* '{' */ - YYSYMBOL_22_ = 22, /* '}' */ - YYSYMBOL_23_ = 23, /* ',' */ - YYSYMBOL_24_ = 24, /* ';' */ - YYSYMBOL_25_ = 25, /* '(' */ - YYSYMBOL_26_ = 26, /* ')' */ - YYSYMBOL_27_ = 27, /* '!' */ - YYSYMBOL_28_ = 28, /* '+' */ - YYSYMBOL_29_ = 29, /* '<' */ - YYSYMBOL_30_ = 30, /* '>' */ - YYSYMBOL_31_ = 31, /* '%' */ - YYSYMBOL_YYACCEPT = 32, /* $accept */ - YYSYMBOL_lines = 33, /* lines */ - YYSYMBOL_line = 34, /* line */ - YYSYMBOL_debug = 35, /* debug */ - YYSYMBOL_statements = 36, /* statements */ - YYSYMBOL_statement = 37, /* statement */ - YYSYMBOL_body = 38, /* body */ - YYSYMBOL_end = 39, /* end */ - YYSYMBOL_if = 40, /* if */ - YYSYMBOL_cond = 41, /* cond */ - YYSYMBOL_define = 42, /* define */ - YYSYMBOL_fcall = 43, /* fcall */ - YYSYMBOL_startp = 44, /* startp */ - YYSYMBOL_params = 45, /* params */ - YYSYMBOL_value = 46, /* value */ - YYSYMBOL_expr = 47 /* expr */ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_NAME = 3, /* NAME */ + YYSYMBOL_STRING = 4, /* STRING */ + YYSYMBOL_NUM = 5, /* NUM */ + YYSYMBOL_LTE = 6, /* LTE */ + YYSYMBOL_GTE = 7, /* GTE */ + YYSYMBOL_NEQ = 8, /* NEQ */ + YYSYMBOL_EQ = 9, /* EQ */ + YYSYMBOL_FALSETOK = 10, /* FALSETOK */ + YYSYMBOL_TRUETOK = 11, /* TRUETOK */ + YYSYMBOL_NULLTOK = 12, /* NULLTOK */ + YYSYMBOL_IFTOK = 13, /* IFTOK */ + YYSYMBOL_ELSETOK = 14, /* ELSETOK */ + YYSYMBOL_RECT = 15, /* RECT */ + YYSYMBOL_GOTOTOK = 16, /* GOTOTOK */ + YYSYMBOL_DEBUGTOK = 17, /* DEBUGTOK */ + YYSYMBOL_DEFINETOK = 18, /* DEFINETOK */ + YYSYMBOL_SETTINGTOK = 19, /* SETTINGTOK */ + YYSYMBOL_RANDOMTOK = 20, /* RANDOMTOK */ + YYSYMBOL_21_ = 21, /* '{' */ + YYSYMBOL_22_ = 22, /* '}' */ + YYSYMBOL_23_ = 23, /* ',' */ + YYSYMBOL_24_ = 24, /* ';' */ + YYSYMBOL_25_ = 25, /* '(' */ + YYSYMBOL_26_ = 26, /* ')' */ + YYSYMBOL_27_ = 27, /* '!' */ + YYSYMBOL_28_ = 28, /* '+' */ + YYSYMBOL_29_ = 29, /* '<' */ + YYSYMBOL_30_ = 30, /* '>' */ + YYSYMBOL_31_ = 31, /* '%' */ + YYSYMBOL_YYACCEPT = 32, /* $accept */ + YYSYMBOL_lines = 33, /* lines */ + YYSYMBOL_line = 34, /* line */ + YYSYMBOL_debug = 35, /* debug */ + YYSYMBOL_statements = 36, /* statements */ + YYSYMBOL_statement = 37, /* statement */ + YYSYMBOL_body = 38, /* body */ + YYSYMBOL_end = 39, /* end */ + YYSYMBOL_if = 40, /* if */ + YYSYMBOL_cond = 41, /* cond */ + YYSYMBOL_define = 42, /* define */ + YYSYMBOL_fcall = 43, /* fcall */ + YYSYMBOL_startp = 44, /* startp */ + YYSYMBOL_params = 45, /* params */ + YYSYMBOL_value = 46, /* value */ + YYSYMBOL_expr = 47 /* expr */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -374,7 +374,7 @@ typedef int yy_state_fast_t; # 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. */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -384,13 +384,13 @@ typedef int yy_state_fast_t; # endif # ifdef YYSTACK_ALLOC -/* Pacify GCC's 'empty if-body' warning. */ + /* 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. */ + /* 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 @@ -429,8 +429,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yy_state_t yyss_alloc; - YYSTYPE yyvs_alloc; + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -511,46 +511,46 @@ union yyalloc 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, 27, 2, 2, 2, 31, 2, 2, - 25, 26, 2, 28, 23, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 24, - 29, 2, 30, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 21, 2, 22, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 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 + 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, 27, 2, 2, 2, 31, 2, 2, + 25, 26, 2, 28, 23, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 24, + 29, 2, 30, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 21, 2, 22, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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 }; #if YYDEBUG -/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 54, 54, 55, 58, 59, 60, 63, 64, 67, - 68, 71, 77, 78, 83, 91, 92, 95, 98, 101, - 104, 105, 110, 114, 115, 118, 126, 127, 135, 138, - 139, 140, 141, 142, 145, 146, 147, 148, 149, 150, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163 + 0, 54, 54, 55, 58, 59, 60, 63, 64, 67, + 68, 71, 77, 78, 83, 91, 92, 95, 98, 101, + 104, 105, 110, 114, 115, 118, 126, 127, 135, 138, + 139, 140, 141, 142, 145, 146, 147, 148, 149, 150, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163 }; #endif @@ -566,19 +566,19 @@ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING", - "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK", - "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK", - "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'", - "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug", - "statements", "statement", "body", "end", "if", "cond", "define", - "fcall", "startp", "params", "value", "expr", YY_NULLPTR + "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING", + "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK", + "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK", + "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'", + "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug", + "statements", "statement", "body", "end", "if", "cond", "define", + "fcall", "startp", "params", "value", "expr", YY_NULLPTR }; static const char * yysymbol_name (yysymbol_kind_t yysymbol) { - return yytname[yysymbol]; + return yytname[yysymbol]; } #endif @@ -587,10 +587,10 @@ yysymbol_name (yysymbol_kind_t yysymbol) (internal) symbol number NUM (which must be that of a token). */ static const yytype_int16 yytoknum[] = { - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 123, 125, 44, 59, 40, 41, 33, 43, 60, - 62, 37 + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 123, 125, 44, 59, 40, 41, 33, 43, 60, + 62, 37 }; #endif @@ -604,132 +604,132 @@ static const yytype_int16 yytoknum[] = #define yytable_value_is_error(Yyn) \ 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int8 yypact[] = { - 8, -11, 11, 12, 18, 8, 30, 22, 23, -73, - -73, 24, 38, 42, 59, 30, -73, 40, 39, 41, - -73, 54, 16, 58, 59, 56, 60, -73, 5, -73, - -73, 77, 61, 83, -73, -73, 19, 52, -73, 62, - -73, 1, 65, -73, 63, -73, -73, -73, -73, -73, - -73, 67, 66, 29, 64, 59, -73, -73, 86, 41, - 68, 71, 69, 73, 92, -73, 93, -73, 66, 66, - 66, 66, 66, 66, 66, -73, 78, 50, 76, 1, - -73, 1, 79, 70, -73, -73, -73, -73, -73, -73, - -73, -73, 52, 98, -73, -73, 99, 80, -73, 82, - 84, -73, -73, 103, 104, 87, 85, 107, -73, 88, - 90, 42, -73 + 8, -11, 11, 12, 18, 8, 30, 22, 23, -73, + -73, 24, 38, 42, 59, 30, -73, 40, 39, 41, + -73, 54, 16, 58, 59, 56, 60, -73, 5, -73, + -73, 77, 61, 83, -73, -73, 19, 52, -73, 62, + -73, 1, 65, -73, 63, -73, -73, -73, -73, -73, + -73, 67, 66, 29, 64, 59, -73, -73, 86, 41, + 68, 71, 69, 73, 92, -73, 93, -73, 66, 66, + 66, 66, 66, 66, 66, -73, 78, 50, 76, 1, + -73, 1, 79, 70, -73, -73, -73, -73, -73, -73, + -73, -73, 52, 98, -73, -73, 99, 80, -73, 82, + 84, -73, -73, 103, 104, 87, 85, 107, -73, 88, + 90, 42, -73 }; -/* 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. */ + /* 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, 3, 7, 0, 0, 1, - 2, 0, 0, 20, 9, 7, 4, 24, 0, 0, - 18, 0, 0, 0, 9, 0, 0, 8, 20, 5, - 28, 0, 0, 0, 6, 10, 0, 0, 12, 0, - 23, 29, 0, 11, 0, 39, 38, 37, 35, 36, - 34, 0, 0, 40, 0, 9, 15, 17, 0, 39, - 0, 33, 0, 32, 0, 25, 0, 41, 0, 0, - 0, 0, 49, 0, 0, 19, 0, 13, 0, 29, - 27, 29, 0, 0, 47, 48, 43, 42, 44, 45, - 46, 16, 0, 0, 30, 31, 0, 0, 17, 0, - 0, 50, 14, 0, 0, 0, 0, 0, 26, 0, - 22, 20, 21 + 0, 0, 0, 0, 0, 3, 7, 0, 0, 1, + 2, 0, 0, 20, 9, 7, 4, 24, 0, 0, + 18, 0, 0, 0, 9, 0, 0, 8, 20, 5, + 28, 0, 0, 0, 6, 10, 0, 0, 12, 0, + 23, 29, 0, 11, 0, 39, 38, 37, 35, 36, + 34, 0, 0, 40, 0, 9, 15, 17, 0, 39, + 0, 33, 0, 32, 0, 25, 0, 41, 0, 0, + 0, 0, 49, 0, 0, 19, 0, 13, 0, 29, + 27, 29, 0, 0, 47, 48, 43, 42, 44, 45, + 46, 16, 0, 0, 30, 31, 0, 0, 17, 0, + 0, 50, 14, 0, 0, 0, 0, 0, 26, 0, + 22, 20, 21 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -73, 110, -73, 101, -21, -36, 25, 20, -73, -73, - -28, -39, -73, -72, -20, 89 - }; + -73, 110, -73, 101, -21, -36, 25, 20, -73, -73, + -28, -39, -73, -72, -20, 89 +}; -/* YYDEFGOTO[NTERM-NUM]. */ + /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 4, 5, 12, 23, 24, 57, 77, 25, 37, - 18, 26, 41, 62, 53, 63 - }; + -1, 4, 5, 12, 23, 24, 57, 77, 25, 37, + 18, 26, 41, 62, 53, 63 +}; -/* 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. */ + /* 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[] = { - 40, 56, 61, 35, 59, 46, 47, 94, 17, 95, - 6, 48, 49, 50, 7, 8, 21, 60, 9, 32, - 39, 51, 45, 46, 47, 1, 2, 3, 52, 48, - 49, 50, 67, 11, 76, 68, 69, 70, 71, 51, - 61, 33, 61, 13, 14, 17, 52, 15, 84, 85, - 86, 87, 88, 89, 90, 19, 56, 72, 73, 74, - 16, 29, 19, 28, 92, 20, 30, 21, 22, 45, - 46, 47, 20, 55, 21, 22, 48, 49, 50, 31, - 34, 36, 42, 112, 38, 43, 44, 58, 64, 65, - 75, 78, 66, 33, 79, 80, 81, 82, 83, 93, - 91, 97, 96, 99, 100, 103, 101, 104, 105, 106, - 107, 108, 109, 111, 110, 10, 27, 98, 102, 0, - 0, 0, 0, 0, 0, 54 + 40, 56, 61, 35, 59, 46, 47, 94, 17, 95, + 6, 48, 49, 50, 7, 8, 21, 60, 9, 32, + 39, 51, 45, 46, 47, 1, 2, 3, 52, 48, + 49, 50, 67, 11, 76, 68, 69, 70, 71, 51, + 61, 33, 61, 13, 14, 17, 52, 15, 84, 85, + 86, 87, 88, 89, 90, 19, 56, 72, 73, 74, + 16, 29, 19, 28, 92, 20, 30, 21, 22, 45, + 46, 47, 20, 55, 21, 22, 48, 49, 50, 31, + 34, 36, 42, 112, 38, 43, 44, 58, 64, 65, + 75, 78, 66, 33, 79, 80, 81, 82, 83, 93, + 91, 97, 96, 99, 100, 103, 101, 104, 105, 106, + 107, 108, 109, 111, 110, 10, 27, 98, 102, 0, + 0, 0, 0, 0, 0, 54 }; static const yytype_int8 yycheck[] = { - 28, 37, 41, 24, 3, 4, 5, 79, 3, 81, - 21, 10, 11, 12, 3, 3, 15, 16, 0, 3, - 15, 20, 3, 4, 5, 17, 18, 19, 27, 10, - 11, 12, 52, 3, 55, 6, 7, 8, 9, 20, - 79, 25, 81, 21, 21, 3, 27, 23, 68, 69, - 70, 71, 72, 73, 74, 3, 92, 28, 29, 30, - 22, 22, 3, 23, 14, 13, 25, 15, 16, 3, - 4, 5, 13, 21, 15, 16, 10, 11, 12, 25, - 22, 25, 5, 111, 24, 24, 3, 25, 23, 26, - 26, 5, 25, 25, 23, 26, 23, 5, 5, 23, - 22, 31, 23, 5, 5, 23, 26, 23, 5, 5, - 23, 26, 5, 23, 26, 5, 15, 92, 98, -1, - -1, -1, -1, -1, -1, 36 + 28, 37, 41, 24, 3, 4, 5, 79, 3, 81, + 21, 10, 11, 12, 3, 3, 15, 16, 0, 3, + 15, 20, 3, 4, 5, 17, 18, 19, 27, 10, + 11, 12, 52, 3, 55, 6, 7, 8, 9, 20, + 79, 25, 81, 21, 21, 3, 27, 23, 68, 69, + 70, 71, 72, 73, 74, 3, 92, 28, 29, 30, + 22, 22, 3, 23, 14, 13, 25, 15, 16, 3, + 4, 5, 13, 21, 15, 16, 10, 11, 12, 25, + 22, 25, 5, 111, 24, 24, 3, 25, 23, 26, + 26, 5, 25, 25, 23, 26, 23, 5, 5, 23, + 22, 31, 23, 5, 5, 23, 26, 23, 5, 5, + 23, 26, 5, 23, 26, 5, 15, 92, 98, -1, + -1, -1, -1, -1, -1, 36 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_int8 yystos[] = { - 0, 17, 18, 19, 33, 34, 21, 3, 3, 0, - 33, 3, 35, 21, 21, 23, 22, 3, 42, 3, - 13, 15, 16, 36, 37, 40, 43, 35, 23, 22, - 25, 25, 3, 25, 22, 36, 25, 41, 24, 15, - 42, 44, 5, 24, 3, 3, 4, 5, 10, 11, - 12, 20, 27, 46, 47, 21, 37, 38, 25, 3, - 16, 43, 45, 47, 23, 26, 25, 46, 6, 7, - 8, 9, 28, 29, 30, 26, 36, 39, 5, 23, - 26, 23, 5, 5, 46, 46, 46, 46, 46, 46, - 46, 22, 14, 23, 45, 45, 23, 31, 38, 5, - 5, 26, 39, 23, 23, 5, 5, 23, 26, 5, - 26, 23, 42 + 0, 17, 18, 19, 33, 34, 21, 3, 3, 0, + 33, 3, 35, 21, 21, 23, 22, 3, 42, 3, + 13, 15, 16, 36, 37, 40, 43, 35, 23, 22, + 25, 25, 3, 25, 22, 36, 25, 41, 24, 15, + 42, 44, 5, 24, 3, 3, 4, 5, 10, 11, + 12, 20, 27, 46, 47, 21, 37, 38, 25, 3, + 16, 43, 45, 47, 23, 26, 25, 46, 6, 7, + 8, 9, 28, 29, 30, 26, 36, 39, 5, 23, + 26, 23, 5, 5, 46, 46, 46, 46, 46, 46, + 46, 22, 14, 23, 45, 45, 23, 31, 38, 5, + 5, 26, 39, 23, 23, 5, 5, 23, 26, 5, + 26, 23, 42 }; -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_int8 yyr1[] = { - 0, 32, 33, 33, 34, 34, 34, 35, 35, 36, - 36, 37, 37, 37, 37, 38, 38, 39, 40, 41, - 42, 42, 42, 42, 42, 43, 43, 43, 44, 45, - 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47 + 0, 32, 33, 33, 34, 34, 34, 35, 35, 36, + 36, 37, 37, 37, 37, 38, 38, 39, 40, 41, + 42, 42, 42, 42, 42, 43, 43, 43, 44, 45, + 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47 }; -/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_int8 yyr2[] = { - 0, 2, 2, 1, 4, 5, 5, 0, 3, 0, - 2, 3, 2, 4, 7, 1, 3, 0, 1, 3, - 0, 14, 12, 3, 1, 4, 10, 5, 0, 0, - 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, - 5 + 0, 2, 2, 1, 4, 5, 5, 0, 3, 0, + 2, 3, 2, 4, 7, 1, 3, 0, 1, 3, + 0, 14, 12, 3, 1, 4, 10, 5, 0, 0, + 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, + 5 }; @@ -807,17 +807,17 @@ static void yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - FILE *yyoutput = yyo; - YYUSE (yyoutput); - if (!yyvaluep) - return; + FILE *yyoutput = yyo; + YYUSE (yyoutput); + if (!yyvaluep) + return; # ifdef YYPRINT - if (yykind < YYNTOKENS) - YYPRINT (yyo, yytoknum[yykind], *yyvaluep); + if (yykind < YYNTOKENS) + YYPRINT (yyo, yytoknum[yykind], *yyvaluep); # endif - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yykind); - YY_IGNORE_MAYBE_UNINITIALIZED_END + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -829,11 +829,11 @@ static void yy_symbol_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyo, "%s %s (", - yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print (yyo, yykind, yyvaluep); - YYFPRINTF (yyo, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -844,13 +844,13 @@ yy_symbol_print (FILE *yyo, static void yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); } - YYFPRINTF (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ @@ -868,19 +868,19 @@ static void yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule) { - 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++) + 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"); + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); + YYFPRINTF (stderr, "\n"); } } @@ -930,14 +930,14 @@ static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { - YYUSE (yyvaluep); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yykind); - YY_IGNORE_MAYBE_UNINITIALIZED_END + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } @@ -979,781 +979,705 @@ yyparse (void) YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp = yyvs; - 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; + 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; #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; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; - YYDPRINTF ((stderr, "Starting parse\n")); + YYDPRINTF ((stderr, "Starting parse\n")); - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; + yychar = YYEMPTY; /* Cause a token to be read. */ + 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 - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; + /* 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++; - /*--------------------------------------------------------------------. - | yysetstate -- set current state (the top of the stack) to yystate. | - `--------------------------------------------------------------------*/ +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ yysetstate: - 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); + 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) + if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; + goto yyexhaustedlab; #else { - /* Get the current used size of the three stacks, in elements. */ - YYPTRDIFF_T yysize = yyssp - yyss + 1; + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; # 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; + { + /* 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; - /* 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; - } + /* 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) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; - { - yy_state_t *yyss1 = yyss; - union yyalloc *yyptr = - YY_CAST (union yyalloc *, - YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } # endif - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; - YY_IGNORE_USELESS_CAST_BEGIN - YYDPRINTF ((stderr, "Stack size increased to %ld\n", - YY_CAST (long, yystacksize))); - YY_IGNORE_USELESS_CAST_END + 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; + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - if (yystate == YYFINAL) - YYACCEPT; + if (yystate == YYFINAL) + YYACCEPT; - goto yybackup; + goto yybackup; - /*-----------. - | 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 + lookahead 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 lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ - if (yychar == YYEMPTY) + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token\n")); - yychar = yylex (); + YYDPRINTF ((stderr, "Reading a token\n")); + yychar = yylex (); } - if (yychar <= YYEOF) + if (yychar <= YYEOF) { - yychar = YYEOF; - yytoken = YYSYMBOL_YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } - else if (yychar == YYerror) + 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; + /* 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 + else { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + 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 - 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 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 (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* 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. */ - yychar = YYEMPTY; - goto yynewstate; - - - /*-----------------------------------------------------------. - | yydefault -- do the default action for the current state. | - `-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) + if (yytable_value_is_error (yyn)) goto yyerrlab; - goto yyreduce; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* 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. */ + yychar = YYEMPTY; + goto yynewstate; - /*-----------------------------. - | yyreduce -- do a reduction. | - `-----------------------------*/ +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| 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]; + 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]; - YY_REDUCE_PRINT (yyn); - switch (yyn) + YY_REDUCE_PRINT (yyn); + switch (yyn) { - case 4: /* line: DEBUGTOK '{' debug '}' */ + case 4: /* line: DEBUGTOK '{' debug '}' */ #line 58 "engines/private/grammar.y" - { /* Not used in the game */ } + { /* Not used in the game */ } #line 1203 "engines/private/grammar.tab.cpp" - break; + break; - case 5: /* line: DEFINETOK NAME '{' define '}' */ + case 5: /* line: DEFINETOK NAME '{' define '}' */ #line 59 "engines/private/grammar.y" - { - installall((yyvsp[-3].s)); - } + { installAll((yyvsp[-3].s)); } #line 1209 "engines/private/grammar.tab.cpp" - break; + break; - case 6: /* line: SETTINGTOK NAME '{' statements '}' */ + case 6: /* line: SETTINGTOK NAME '{' statements '}' */ #line 60 "engines/private/grammar.y" - { - saveSetting((yyvsp[-3].s)); - initSetting(); - } + { saveSetting((yyvsp[-3].s)); initSetting(); } #line 1215 "engines/private/grammar.tab.cpp" - break; + break; - case 9: /* statements: %empty */ + case 9: /* statements: %empty */ #line 67 "engines/private/grammar.y" - { - (yyval.inst) = progp; - } + { (yyval.inst) = progp; } #line 1221 "engines/private/grammar.tab.cpp" - break; + break; - case 11: /* statement: GOTOTOK NAME ';' */ + case 11: /* statement: GOTOTOK NAME ';' */ #line 71 "engines/private/grammar.y" - { - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s))); - code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); - code1(funcpush); + { + code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s))); + code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); + code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); + code1(funcpush); } #line 1232 "engines/private/grammar.tab.cpp" - break; + break; - case 12: /* statement: fcall ';' */ + case 12: /* statement: fcall ';' */ #line 77 "engines/private/grammar.y" - { } + { } #line 1238 "engines/private/grammar.tab.cpp" - break; + break; - case 13: /* statement: if cond body end */ + case 13: /* statement: if cond body end */ #line 78 "engines/private/grammar.y" - { - /* else-less if */ - ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst); /* thenpart */ - ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); - } + { + /* else-less if */ + ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst); /* thenpart */ + ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); + } #line 1248 "engines/private/grammar.tab.cpp" - break; + break; - case 14: /* statement: if cond body end ELSETOK body end */ + case 14: /* statement: if cond body end ELSETOK body end */ #line 83 "engines/private/grammar.y" - { - /* if with else */ - ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst); /* thenpart */ - ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst); /* elsepart */ - ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); - } + { + /* if with else */ + ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst); /* thenpart */ + ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst); /* elsepart */ + ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); + } #line 1259 "engines/private/grammar.tab.cpp" - break; + break; - case 15: /* body: statement */ + case 15: /* body: statement */ #line 91 "engines/private/grammar.y" - { - (yyval.inst) = (yyvsp[0].inst); - } + { (yyval.inst) = (yyvsp[0].inst); } #line 1265 "engines/private/grammar.tab.cpp" - break; + break; - case 16: /* body: '{' statements '}' */ + case 16: /* body: '{' statements '}' */ #line 92 "engines/private/grammar.y" - { - (yyval.inst) = (yyvsp[-1].inst); - } + { (yyval.inst) = (yyvsp[-1].inst); } #line 1271 "engines/private/grammar.tab.cpp" - break; + break; - case 17: /* end: %empty */ + case 17: /* end: %empty */ #line 95 "engines/private/grammar.y" - { - code(STOP); - (yyval.inst) = progp; - } + { code(STOP); (yyval.inst) = progp; } #line 1277 "engines/private/grammar.tab.cpp" - break; + break; - case 18: /* if: IFTOK */ + case 18: /* if: IFTOK */ #line 98 "engines/private/grammar.y" - { - (yyval.inst) = code(ifcode); - code3(STOP, STOP, STOP); - } + { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); } #line 1283 "engines/private/grammar.tab.cpp" - break; + break; - case 19: /* cond: '(' expr ')' */ + case 19: /* cond: '(' expr ')' */ #line 101 "engines/private/grammar.y" - { - code(STOP); - (yyval.inst) = (yyvsp[-1].inst); - } + { code(STOP); (yyval.inst) = (yyvsp[-1].inst); } #line 1289 "engines/private/grammar.tab.cpp" - break; + break; - case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define */ + case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define */ #line 105 "engines/private/grammar.y" - { - Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val); - assert(r->isValidRect()); - define((yyvsp[-13].s), r); - } + { + Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val); + assert(r->isValidRect()); + defineSymbol((yyvsp[-13].s), r); + } #line 1299 "engines/private/grammar.tab.cpp" - break; + break; - case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' */ + case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' */ #line 110 "engines/private/grammar.y" - { - Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val); - define((yyvsp[-11].s), r); - } + { + Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val); + defineSymbol((yyvsp[-11].s), r); + } #line 1308 "engines/private/grammar.tab.cpp" - break; + break; - case 23: /* define: NAME ',' define */ + case 23: /* define: NAME ',' define */ #line 114 "engines/private/grammar.y" - { - define((yyvsp[-2].s), NULL); - } + { defineSymbol((yyvsp[-2].s), NULL); } #line 1314 "engines/private/grammar.tab.cpp" - break; + break; - case 24: /* define: NAME */ + case 24: /* define: NAME */ #line 115 "engines/private/grammar.y" - { - define((yyvsp[0].s), NULL); - } + { defineSymbol((yyvsp[0].s), NULL); } #line 1320 "engines/private/grammar.tab.cpp" - break; + break; - case 25: /* fcall: GOTOTOK '(' NAME ')' */ + case 25: /* fcall: GOTOTOK '(' NAME ')' */ #line 118 "engines/private/grammar.y" - { - (yyval.inst) = progp; - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s))); - code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); - code1(funcpush); - } + { + (yyval.inst) = progp; + code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s))); + code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); + code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); + code1(funcpush); + } #line 1332 "engines/private/grammar.tab.cpp" - break; + break; - case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' */ + case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' */ #line 126 "engines/private/grammar.y" - { - (yyval.inst) = progp; - } + { (yyval.inst) = progp; } #line 1338 "engines/private/grammar.tab.cpp" - break; + break; - case 27: /* fcall: NAME '(' startp params ')' */ + case 27: /* fcall: NAME '(' startp params ')' */ #line 127 "engines/private/grammar.y" - { - (yyval.inst) = (yyvsp[-2].inst); - code2(constpush, (Private::Inst) addconstant(NUM, (yyvsp[-1].narg), NULL)); - code2(strpush, (Private::Inst) addconstant(STRING, 0, (yyvsp[-4].s))); - code1(funcpush); - } + { + (yyval.inst) = (yyvsp[-2].inst); + code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL)); + code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s))); + code1(funcpush); + } #line 1349 "engines/private/grammar.tab.cpp" - break; + break; - case 28: /* startp: %empty */ + case 28: /* startp: %empty */ #line 135 "engines/private/grammar.y" - { - (yyval.inst) = progp; - } + { (yyval.inst) = progp; } #line 1355 "engines/private/grammar.tab.cpp" - break; + break; - case 29: /* params: %empty */ + case 29: /* params: %empty */ #line 138 "engines/private/grammar.y" - { - (yyval.narg) = 0; - } + { (yyval.narg) = 0; } #line 1361 "engines/private/grammar.tab.cpp" - break; + break; - case 30: /* params: fcall ',' params */ + case 30: /* params: fcall ',' params */ #line 139 "engines/private/grammar.y" - { - (yyval.narg) = (yyvsp[0].narg) + 1; - } + { (yyval.narg) = (yyvsp[0].narg) + 1; } #line 1367 "engines/private/grammar.tab.cpp" - break; + break; - case 31: /* params: expr ',' params */ + case 31: /* params: expr ',' params */ #line 140 "engines/private/grammar.y" - { - (yyval.narg) = (yyvsp[0].narg) + 1; - } + { (yyval.narg) = (yyvsp[0].narg) + 1; } #line 1373 "engines/private/grammar.tab.cpp" - break; + break; - case 32: /* params: expr */ + case 32: /* params: expr */ #line 141 "engines/private/grammar.y" - { - (yyval.narg) = 1; - } + { (yyval.narg) = 1; } #line 1379 "engines/private/grammar.tab.cpp" - break; + break; - case 33: /* params: fcall */ + case 33: /* params: fcall */ #line 142 "engines/private/grammar.y" - { - (yyval.narg) = 1; - } + { (yyval.narg) = 1; } #line 1385 "engines/private/grammar.tab.cpp" - break; + break; - case 34: /* value: NULLTOK */ + case 34: /* value: NULLTOK */ #line 145 "engines/private/grammar.y" - { - code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); - } + { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); } #line 1391 "engines/private/grammar.tab.cpp" - break; + break; - case 35: /* value: FALSETOK */ + case 35: /* value: FALSETOK */ #line 146 "engines/private/grammar.y" - { - code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); - } + { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); } #line 1397 "engines/private/grammar.tab.cpp" - break; + break; - case 36: /* value: TRUETOK */ + case 36: /* value: TRUETOK */ #line 147 "engines/private/grammar.y" - { - code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); - } + { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); } #line 1403 "engines/private/grammar.tab.cpp" - break; + break; - case 37: /* value: NUM */ + case 37: /* value: NUM */ #line 148 "engines/private/grammar.y" - { - code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); - } + { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); } #line 1409 "engines/private/grammar.tab.cpp" - break; + break; - case 38: /* value: STRING */ + case 38: /* value: STRING */ #line 149 "engines/private/grammar.y" - { - code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); - } + { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); } #line 1415 "engines/private/grammar.tab.cpp" - break; + break; - case 39: /* value: NAME */ + case 39: /* value: NAME */ #line 150 "engines/private/grammar.y" - { - code1(Private::varpush); - code1((Private::Inst) lookupName((yyvsp[0].s))); - code1(Private::eval); - } + { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); } #line 1421 "engines/private/grammar.tab.cpp" - break; + break; - case 40: /* expr: value */ + case 40: /* expr: value */ #line 153 "engines/private/grammar.y" - { - (yyval.inst) = (yyvsp[0].inst); - } + { (yyval.inst) = (yyvsp[0].inst); } #line 1427 "engines/private/grammar.tab.cpp" - break; + break; - case 41: /* expr: '!' value */ + case 41: /* expr: '!' value */ #line 154 "engines/private/grammar.y" - { - code1(Private::negate); - (yyval.inst) = (yyvsp[0].inst); - } + { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); } #line 1433 "engines/private/grammar.tab.cpp" - break; + break; - case 42: /* expr: value EQ value */ + case 42: /* expr: value EQ value */ #line 155 "engines/private/grammar.y" - { - code1(Private::eq); - } + { code1(Private::eq); } #line 1439 "engines/private/grammar.tab.cpp" - break; + break; - case 43: /* expr: value NEQ value */ + case 43: /* expr: value NEQ value */ #line 156 "engines/private/grammar.y" - { - code1(Private::ne); - } + { code1(Private::ne); } #line 1445 "engines/private/grammar.tab.cpp" - break; + break; - case 44: /* expr: value '+' value */ + case 44: /* expr: value '+' value */ #line 157 "engines/private/grammar.y" - { - code1(Private::add); - } + { code1(Private::add); } #line 1451 "engines/private/grammar.tab.cpp" - break; + break; - case 45: /* expr: value '<' value */ + case 45: /* expr: value '<' value */ #line 158 "engines/private/grammar.y" - { - code1(Private::lt); - } + { code1(Private::lt); } #line 1457 "engines/private/grammar.tab.cpp" - break; + break; - case 46: /* expr: value '>' value */ + case 46: /* expr: value '>' value */ #line 159 "engines/private/grammar.y" - { - code1(Private::gt); - } + { code1(Private::gt); } #line 1463 "engines/private/grammar.tab.cpp" - break; + break; - case 47: /* expr: value LTE value */ + case 47: /* expr: value LTE value */ #line 160 "engines/private/grammar.y" - { - code1(Private::le); - } + { code1(Private::le); } #line 1469 "engines/private/grammar.tab.cpp" - break; + break; - case 48: /* expr: value GTE value */ + case 48: /* expr: value GTE value */ #line 161 "engines/private/grammar.y" - { - code1(Private::ge); - } + { code1(Private::ge); } #line 1475 "engines/private/grammar.tab.cpp" - break; + break; - case 49: /* expr: value '+' */ + case 49: /* expr: value '+' */ #line 162 "engines/private/grammar.y" - { - (yyval.inst) = (yyvsp[-1].inst); - } + { (yyval.inst) = (yyvsp[-1].inst); } #line 1481 "engines/private/grammar.tab.cpp" - break; + break; - case 50: /* expr: RANDOMTOK '(' NUM '%' ')' */ + case 50: /* expr: RANDOMTOK '(' NUM '%' ')' */ #line 163 "engines/private/grammar.y" - { - code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); - } + { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); } #line 1487 "engines/private/grammar.tab.cpp" - break; + break; #line 1491 "engines/private/grammar.tab.cpp" - default: - break; + default: break; } - /* 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); + /* 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; + YYPOPSTACK (yylen); + yylen = 0; - *++yyvsp = yyval; + *++yyvsp = yyval; - /* 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]); - } + /* 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]); + } - goto yynewstate; + goto yynewstate; - /*--------------------------------------. - | yyerrlab -- here on detecting error. | - `--------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: - /* 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) + /* 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")); + ++yynerrs; + yyerror (YY_("syntax error")); } - if (yyerrstatus == 3) + if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ - if (yychar <= YYEOF) + if (yychar <= YYEOF) { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; } - else + else { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; } } - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; - /*---------------------------------------------------. - | yyerrorlab -- error raised explicitly by YYERROR. | - `---------------------------------------------------*/ +/*---------------------------------------------------. +| 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; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; - /* 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 whose 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 -- 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. */ - /* Pop stack until we find a state that shifts the error token. */ - for (;;) + /* Pop stack until we find a state that shifts the error token. */ + for (;;) { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) { - yyn += YYSYMBOL_YYerror; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { - yyn = yytable[yyn]; - if (0 < yyn) - break; + 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", - YY_ACCESSING_SYMBOL (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); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (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 -- YYACCEPT comes here. | +`-------------------------------------*/ yyacceptlab: - yyresult = 0; - goto yyreturn; + yyresult = 0; + goto yyreturn; - /*-----------------------------------. - | yyabortlab -- YYABORT comes here. | - `-----------------------------------*/ +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ yyabortlab: - yyresult = 1; - goto yyreturn; + yyresult = 1; + goto yyreturn; #if !defined yyoverflow - /*-------------------------------------------------. - | yyexhaustedlab -- memory exhaustion comes here. | - `-------------------------------------------------*/ +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - goto yyreturn; + yyerror (YY_("memory exhausted")); + yyresult = 2; + goto yyreturn; #endif - /*-------------------------------------------------------. - | yyreturn -- parsing is finished, clean up and return. | - `-------------------------------------------------------*/ +/*-------------------------------------------------------. +| yyreturn -- parsing is finished, clean up and return. | +`-------------------------------------------------------*/ yyreturn: - if (yychar != YYEMPTY) + 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); + /* 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) + /* 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", - YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); - YYPOPSTACK (1); + 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 - return yyresult; + return yyresult; } diff --git a/engines/private/grammar.tab.h b/engines/private/grammar.tab.h index 6e82ff9616f..35e067aca61 100644 --- a/engines/private/grammar.tab.h +++ b/engines/private/grammar.tab.h @@ -82,7 +82,7 @@ union YYSTYPE { #line 38 "engines/private/grammar.y" - struct Symbol *sym; /* symbol table pointer */ + Private::Symbol *sym; /* symbol table pointer */ int (**inst)(); /* machine instruction */ char *s; int *i; diff --git a/engines/private/grammar.y b/engines/private/grammar.y index ff3663ee6ad..1df0cb0ef55 100644 --- a/engines/private/grammar.y +++ b/engines/private/grammar.y @@ -36,7 +36,7 @@ int yywrap() %} %union { - struct Symbol *sym; /* symbol table pointer */ + Private::Symbol *sym; /* symbol table pointer */ int (**inst)(); /* machine instruction */ char *s; int *i; @@ -56,7 +56,7 @@ lines: line lines ; line: DEBUGTOK '{' debug '}' { /* Not used in the game */ } - | DEFINETOK NAME '{' define '}' { installall($NAME); } + | DEFINETOK NAME '{' define '}' { installAll($NAME); } | SETTINGTOK NAME '{' statements '}' { saveSetting($NAME); initSetting(); } ; @@ -69,9 +69,9 @@ statements: /* nothing */ { $$ = progp; } statement: GOTOTOK NAME ';' { - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME)); - code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); + code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME)); + code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); + code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); code1(funcpush); } | fcall ';' { } @@ -105,29 +105,29 @@ define: /* nothing */ | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define { Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val); assert(r->isValidRect()); - define($NAME, r); + defineSymbol($NAME, r); } | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' { Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val); - define($NAME, r); + defineSymbol($NAME, r); } - | NAME ',' define { define($NAME, NULL); } - | NAME { define($NAME, NULL); } + | NAME ',' define { defineSymbol($NAME, NULL); } + | NAME { defineSymbol($NAME, NULL); } ; fcall: GOTOTOK '(' NAME ')' { $$ = progp; - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME)); - code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); - code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); + code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME)); + code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); + code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); code1(funcpush); } | RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; } | NAME '(' startp params ')' { $$ = $startp; - code2(constpush, (Private::Inst) addconstant(NUM, $params, NULL)); - code2(strpush, (Private::Inst) addconstant(STRING, 0, $NAME)); + code2(constpush, (Private::Inst) constant(NUM, $params, NULL)); + code2(strpush, (Private::Inst) constant(STRING, 0, $NAME)); code1(funcpush); } ; @@ -142,9 +142,9 @@ params: /* nothing */ { $$ = 0; } | fcall { $$ = 1; } ; -value: NULLTOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); } - | FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); } - | TRUETOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); } +value: NULLTOK { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); } + | FALSETOK { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); } + | TRUETOK { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); } | NUM { code2(Private::constpush, (Private::Inst)$NUM); } | STRING { code2(Private::strpush, (Private::Inst)$STRING); } | NAME { code1(Private::varpush); code1((Private::Inst) lookupName($NAME)); code1(Private::eval); } diff --git a/engines/private/lex.yy.cpp b/engines/private/lex.yy.cpp index 98e2191c010..72ccf708502 100644 --- a/engines/private/lex.yy.cpp +++ b/engines/private/lex.yy.cpp @@ -34,7 +34,7 @@ #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. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 @@ -51,7 +51,7 @@ 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; @@ -162,10 +162,10 @@ 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) - + + #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 \ @@ -184,66 +184,66 @@ extern FILE *yyin, *yyout; #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state -{ - FILE *yy_input_file; + { + 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 - * characters. - */ - int yy_buf_size; + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; + /* 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; - /* 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; + /* 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; - /* 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; + /* 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_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + 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 - * 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 yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* 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 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. */ @@ -360,125 +360,125 @@ static void yynoreturn yy_fatal_error ( const char* msg ); /* 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; -}; + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; static const flex_int16_t yy_accept[78] = -{ 0, - 0, 0, 24, 22, 21, 20, 20, 22, 22, 22, - 22, 18, 22, 22, 22, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 21, 20, 4, 0, 19, - 18, 1, 2, 5, 3, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 9, 17, 1, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 15, 12, - 17, 14, 17, 17, 10, 11, 17, 13, 17, 6, - 17, 17, 16, 7, 17, 8, 0 -} ; + { 0, + 0, 0, 24, 22, 21, 20, 20, 22, 22, 22, + 22, 18, 22, 22, 22, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 21, 20, 4, 0, 19, + 18, 1, 2, 5, 3, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 9, 17, 1, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 15, 12, + 17, 14, 17, 17, 10, 11, 17, 13, 17, 6, + 17, 17, 16, 7, 17, 8, 0 + } ; static const YY_CHAR yy_ec[256] = -{ 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 5, 6, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 7, 1, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 1, 1, 10, - 11, 12, 1, 1, 13, 14, 15, 14, 16, 17, - 14, 14, 14, 14, 14, 18, 14, 19, 14, 14, - 14, 20, 21, 22, 23, 14, 14, 14, 14, 14, - 1, 1, 1, 1, 14, 1, 24, 25, 14, 26, + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 7, 1, 8, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 1, 1, 10, + 11, 12, 1, 1, 13, 14, 15, 14, 16, 17, + 14, 14, 14, 14, 14, 18, 14, 19, 14, 14, + 14, 20, 21, 22, 23, 14, 14, 14, 14, 14, + 1, 1, 1, 1, 14, 1, 24, 25, 14, 26, - 27, 28, 29, 14, 30, 14, 14, 31, 32, 33, - 34, 14, 14, 14, 35, 36, 37, 14, 14, 14, - 14, 14, 1, 38, 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, + 27, 28, 29, 14, 30, 14, 14, 31, 32, 33, + 34, 14, 14, 14, 35, 36, 37, 14, 14, 14, + 14, 14, 1, 38, 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, 1, 1 + } ; static const YY_CHAR yy_meta[39] = -{ 0, - 1, 1, 2, 3, 1, 1, 1, 1, 4, 1, - 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 1 -} ; + { 0, + 1, 1, 2, 3, 1, 1, 1, 1, 4, 1, + 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 1 + } ; static const flex_int16_t yy_base[81] = -{ 0, - 0, 0, 105, 106, 102, 36, 38, 92, 96, 92, - 92, 90, 87, 86, 85, 0, 82, 71, 27, 73, - 65, 60, 56, 61, 61, 83, 41, 106, 76, 106, - 72, 0, 106, 106, 106, 0, 60, 59, 60, 40, - 49, 21, 36, 34, 0, 33, 0, 47, 49, 44, - 39, 48, 26, 32, 34, 26, 23, 42, 0, 0, - 23, 0, 27, 22, 0, 0, 24, 0, 21, 0, - 25, 17, 0, 0, 19, 0, 106, 79, 43, 83 -} ; + { 0, + 0, 0, 105, 106, 102, 36, 38, 92, 96, 92, + 92, 90, 87, 86, 85, 0, 82, 71, 27, 73, + 65, 60, 56, 61, 61, 83, 41, 106, 76, 106, + 72, 0, 106, 106, 106, 0, 60, 59, 60, 40, + 49, 21, 36, 34, 0, 33, 0, 47, 49, 44, + 39, 48, 26, 32, 34, 26, 23, 42, 0, 0, + 23, 0, 27, 22, 0, 0, 24, 0, 21, 0, + 25, 17, 0, 0, 19, 0, 106, 79, 43, 83 + } ; static const flex_int16_t yy_def[81] = -{ 0, - 77, 1, 77, 77, 77, 77, 77, 77, 78, 77, - 77, 77, 77, 77, 77, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 77, 77, 77, 78, 77, - 77, 80, 77, 77, 77, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 80, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 0, 77, 77, 77 -} ; + { 0, + 77, 1, 77, 77, 77, 77, 77, 77, 78, 77, + 77, 77, 77, 77, 77, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 77, 77, 77, 78, 77, + 77, 80, 77, 77, 77, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 80, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 0, 77, 77, 77 + } ; static const flex_int16_t yy_nxt[145] = -{ 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 16, 16, 16, 17, 16, 18, 19, - 16, 20, 16, 16, 16, 21, 22, 16, 23, 24, - 16, 16, 16, 16, 25, 16, 16, 7, 27, 27, - 27, 27, 39, 27, 27, 53, 36, 76, 54, 75, - 40, 74, 73, 72, 71, 70, 69, 68, 67, 66, - 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, - 55, 52, 51, 27, 50, 27, 49, 48, 27, 29, - 31, 30, 29, 47, 26, 47, 47, 46, 45, 44, - 43, 42, 41, 38, 37, 35, 34, 33, 31, 32, + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 16, 16, 16, 17, 16, 18, 19, + 16, 20, 16, 16, 16, 21, 22, 16, 23, 24, + 16, 16, 16, 16, 25, 16, 16, 7, 27, 27, + 27, 27, 39, 27, 27, 53, 36, 76, 54, 75, + 40, 74, 73, 72, 71, 70, 69, 68, 67, 66, + 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, + 55, 52, 51, 27, 50, 27, 49, 48, 27, 29, + 31, 30, 29, 47, 26, 47, 47, 46, 45, 44, + 43, 42, 41, 38, 37, 35, 34, 33, 31, 32, - 31, 30, 28, 26, 77, 3, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77 -} ; + 31, 30, 28, 26, 77, 3, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77 + } ; static const flex_int16_t yy_chk[145] = -{ 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, 1, 1, 1, 6, 6, - 7, 7, 19, 27, 27, 42, 79, 75, 42, 72, - 19, 71, 69, 67, 64, 63, 61, 58, 57, 56, - 55, 54, 53, 52, 51, 50, 49, 48, 46, 44, - 43, 41, 40, 6, 39, 7, 38, 37, 27, 78, - 31, 29, 78, 80, 26, 80, 80, 25, 24, 23, - 22, 21, 20, 18, 17, 15, 14, 13, 12, 11, + { 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, 1, 1, 1, 6, 6, + 7, 7, 19, 27, 27, 42, 79, 75, 42, 72, + 19, 71, 69, 67, 64, 63, 61, 58, 57, 56, + 55, 54, 53, 52, 51, 50, 49, 48, 46, 44, + 43, 41, 40, 6, 39, 7, 38, 37, 27, 78, + 31, 29, 78, 80, 26, 80, 80, 25, 24, 23, + 22, 21, 20, 18, 17, 15, 14, 13, 12, 11, - 10, 9, 8, 5, 3, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77 -} ; + 10, 9, 8, 5, 3, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77 + } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; @@ -544,7 +544,7 @@ FILE *yyget_out ( void ); void yyset_out ( FILE * _out_str ); -int yyget_leng ( void ); + int yyget_leng ( void ); char *yyget_text ( void ); @@ -565,9 +565,9 @@ extern int yywrap ( void ); #endif #ifndef YY_NO_UNPUT - -static void yyunput ( int c, char *buf_ptr ); - + + static void yyunput ( int c, char *buf_ptr ); + #endif #ifndef yytext_ptr @@ -691,344 +691,341 @@ extern int yylex (void); */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - 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 ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); - } + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } - yy_load_buffer_state( ); - } + yy_load_buffer_state( ); + } - { + { #line 17 "engines/private/grammar.l" #line 727 "engines/private/lex.yy.cpp" - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = (yy_hold_char); + /* 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 points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = (yy_start); + 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 >= 78 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_current_state != 77 ); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); + 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 >= 78 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_current_state != 77 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: - yy_act = yy_accept[yy_current_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. */ - 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 +case 1: +YY_RULE_SETUP #line 18 "engines/private/grammar.l" - /* ignoring the comment */ - YY_BREAK - case 2: - YY_RULE_SETUP +/* ignoring the comment */ + YY_BREAK +case 2: +YY_RULE_SETUP #line 19 "engines/private/grammar.l" - return LTE; - YY_BREAK - case 3: - YY_RULE_SETUP +return LTE; + YY_BREAK +case 3: +YY_RULE_SETUP #line 20 "engines/private/grammar.l" - return GTE; - YY_BREAK - case 4: - YY_RULE_SETUP +return GTE; + YY_BREAK +case 4: +YY_RULE_SETUP #line 21 "engines/private/grammar.l" - return NEQ; - YY_BREAK - case 5: - YY_RULE_SETUP +return NEQ; + YY_BREAK +case 5: +YY_RULE_SETUP #line 22 "engines/private/grammar.l" - return EQ; - YY_BREAK - case 6: - YY_RULE_SETUP +return EQ; + YY_BREAK +case 6: +YY_RULE_SETUP #line 23 "engines/private/grammar.l" - return DEBUGTOK; - YY_BREAK - case 7: - YY_RULE_SETUP +return DEBUGTOK; + YY_BREAK +case 7: +YY_RULE_SETUP #line 24 "engines/private/grammar.l" - return DEFINETOK; - YY_BREAK - case 8: - YY_RULE_SETUP +return DEFINETOK; + YY_BREAK +case 8: +YY_RULE_SETUP #line 25 "engines/private/grammar.l" - return SETTINGTOK; - YY_BREAK - case 9: - YY_RULE_SETUP +return SETTINGTOK; + YY_BREAK +case 9: +YY_RULE_SETUP #line 26 "engines/private/grammar.l" - return IFTOK; - YY_BREAK - case 10: - YY_RULE_SETUP +return IFTOK; + YY_BREAK +case 10: +YY_RULE_SETUP #line 27 "engines/private/grammar.l" - return ELSETOK; - YY_BREAK - case 11: - YY_RULE_SETUP +return ELSETOK; + YY_BREAK +case 11: +YY_RULE_SETUP #line 28 "engines/private/grammar.l" - return GOTOTOK; - YY_BREAK - case 12: - YY_RULE_SETUP +return GOTOTOK; + YY_BREAK +case 12: +YY_RULE_SETUP #line 29 "engines/private/grammar.l" - return RECT; - YY_BREAK - case 13: - YY_RULE_SETUP +return RECT; + YY_BREAK +case 13: +YY_RULE_SETUP #line 30 "engines/private/grammar.l" - return FALSETOK; - YY_BREAK - case 14: - YY_RULE_SETUP +return FALSETOK; + YY_BREAK +case 14: +YY_RULE_SETUP #line 31 "engines/private/grammar.l" - return TRUETOK; - YY_BREAK - case 15: - YY_RULE_SETUP +return TRUETOK; + YY_BREAK +case 15: +YY_RULE_SETUP #line 32 "engines/private/grammar.l" - return NULLTOK; - YY_BREAK - case 16: - YY_RULE_SETUP +return NULLTOK; + YY_BREAK +case 16: +YY_RULE_SETUP #line 33 "engines/private/grammar.l" - return RANDOMTOK; - YY_BREAK - case 17: - YY_RULE_SETUP +return RANDOMTOK; + YY_BREAK +case 17: +YY_RULE_SETUP #line 34 "engines/private/grammar.l" - yylval.s = strdup(yytext); - return NAME; - YY_BREAK - case 18: - YY_RULE_SETUP +yylval.s = strdup(yytext); return NAME; + YY_BREAK +case 18: +YY_RULE_SETUP #line 35 "engines/private/grammar.l" - yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); - return NUM; - YY_BREAK - case 19: - YY_RULE_SETUP +yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM; + YY_BREAK +case 19: +YY_RULE_SETUP #line 36 "engines/private/grammar.l" - yylval.sym = Private::addconstant(STRING, 0, strdup(yytext)); - return STRING; - YY_BREAK - case 20: - /* rule 20 can match eol */ - YY_RULE_SETUP +yylval.sym = Private::constant(STRING, 0, strdup(yytext)); return STRING; + YY_BREAK +case 20: +/* rule 20 can match eol */ +YY_RULE_SETUP #line 37 "engines/private/grammar.l" - /* ignore return */; - YY_BREAK - case 21: - YY_RULE_SETUP +/* ignore return */; + YY_BREAK +case 21: +YY_RULE_SETUP #line 38 "engines/private/grammar.l" - /* ignore whitespace */; - YY_BREAK - case 22: - YY_RULE_SETUP +/* ignore whitespace */; + YY_BREAK +case 22: +YY_RULE_SETUP #line 39 "engines/private/grammar.l" - return *yytext; - YY_BREAK - case 23: - YY_RULE_SETUP +return *yytext; + YY_BREAK +case 23: +YY_RULE_SETUP #line 40 "engines/private/grammar.l" - ECHO; - YY_BREAK +ECHO; + YY_BREAK #line 896 "engines/private/lex.yy.cpp" - case YY_STATE_EOF(INITIAL): - yyterminate(); +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 - * possible that this happened because the user - * 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 = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } + 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 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 = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* 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; + /* 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; - (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 - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* 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 + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * 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_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - } - } + else + { + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + 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 ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have 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; + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have 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_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 user's declarations */ + 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 @@ -1040,167 +1037,167 @@ do_action: /* This label is used only to access EOF actions. */ */ 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 - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } + 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; + } - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + 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, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + 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; - 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_LVALUE; + /* 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. */ - 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; + 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; + 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), num_to_read ); + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } + 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_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - 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); - } + 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); + } - (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; + (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; - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - return ret_val; + 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 >= 78 ) + 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 >= 78 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - } - - return yy_current_state; + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character @@ -1208,359 +1205,359 @@ 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 >= 78 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 77); + 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 >= 78 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 77); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT -static void yyunput (int c, char * yy_bp ) + static void yyunput (int c, char * yy_bp ) { - char *yy_cp; - + char *yy_cp; + yy_cp = (yy_c_buf_p); - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); + /* undo effects of setting up yytext */ + *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]; + 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; + 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) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + (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 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_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'; + else + { /* need more input */ + int offset = (int) ((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() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ - 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 - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ + /* Reset buffer status. */ + yyrestart( yyin ); - /* Reset buffer status. */ - yyrestart( yyin ); + /*FALLTHROUGH*/ - /*FALLTHROUGH*/ + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; - 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 yytext */ - (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 */ /** 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 yyrestart (FILE * input_file ) + void yyrestart (FILE * input_file ) { - - if ( ! YY_CURRENT_BUFFER ) { + + if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer( yyin, YY_BUF_SIZE ); - } + } - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_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 yy_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 - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - yyensure_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; - yy_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 (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; + /* 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; } 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; - yyin = 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. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * + * * @return the allocated buffer state. */ -YY_BUFFER_STATE yy_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) yyalloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_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 + * we need to put in 2 end-of-buffer characters. + */ + 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()" ); - /* 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 *) 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; + yy_init_buffer( b, file ); - yy_init_buffer( b, file ); - - return b; + return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() - * + * */ -void yy_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 ) - yyfree( (void *) b->yy_ch_buf ); - - yyfree( (void *) b ); + yyfree( (void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ -static void yy_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 ); - yy_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 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 = 0; - - errno = oerrno; + b->yy_is_interactive = 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 yy_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 - * 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; + /* 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_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 ) - yy_load_buffer_state( ); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. - * + * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) - return; + if (new_buffer == NULL) + return; - yyensure_buffer_stack(); + yyensure_buffer_stack(); - /* 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); - } + /* 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 yy_switch_to_buffer. */ - yy_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 yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; + if (!YY_CURRENT_BUFFER) + return; - yy_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) { - yy_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. @@ -1568,131 +1565,131 @@ void yypop_buffer_state (void) */ static void yyensure_buffer_stack (void) { - yy_size_t 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 - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* 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; /* 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()" ); + 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. */ - yy_size_t 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**)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()" ); + 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. */ 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 NULL; + 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) yyalloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_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 = (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; + yy_switch_to_buffer( b ); - yy_switch_to_buffer( b ); - - return b; + return b; } /** 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 * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (const char * yystr ) { - - return yy_scan_bytes( yystr, (int) strlen(yystr) ); + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); } /** 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 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 = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_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 = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; + return b; } #ifndef YY_EXIT_FAILURE @@ -1701,8 +1698,8 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) static void yynoreturn yy_fatal_error (const char* msg ) { - 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. */ @@ -1725,88 +1722,88 @@ static void yynoreturn yy_fatal_error (const char* msg ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. - * + * */ int yyget_lineno (void) { - + return yylineno; } /** Get the input stream. - * + * */ FILE *yyget_in (void) { - return yyin; + return yyin; } /** Get the output stream. - * + * */ FILE *yyget_out (void) { - return yyout; + return yyout; } /** Get the length of the current token. - * + * */ int yyget_leng (void) { - return yyleng; + return yyleng; } /** Get the current token. - * + * */ char *yyget_text (void) { - return yytext; + return yytext; } /** Set the current line number. * @param _line_number line number - * + * */ void yyset_lineno (int _line_number ) { - + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. - * + * * @see yy_switch_to_buffer */ void yyset_in (FILE * _in_str ) { - yyin = _in_str ; + yyin = _in_str ; } void yyset_out (FILE * _out_str ) { - yyout = _out_str ; + yyout = _out_str ; } int yyget_debug (void) { - return yy_flex_debug; + return yy_flex_debug; } void yyset_debug (int _bdebug ) { - yy_flex_debug = _bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) { - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_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) = NULL; (yy_buffer_stack_top) = 0; @@ -1815,7 +1812,7 @@ static int yy_init_globals (void) (yy_init) = 0; (yy_start) = 0; - /* Defined in main.c */ +/* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; @@ -1833,17 +1830,17 @@ static int yy_init_globals (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) { - yy_delete_buffer( YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } - /* Destroy the stack itself. */ - yyfree((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 * yylex() is called, initialization will occur. */ @@ -1859,45 +1856,45 @@ int yylex_destroy (void) #ifndef yytext_ptr 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 (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 *yyalloc (yy_size_t size ) { - return malloc(size); + return malloc(size); } void *yyrealloc (void * ptr, yy_size_t size ) { - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * 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 realloc(ptr, size); + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * 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 realloc(ptr, size); } void yyfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" @@ -1910,26 +1907,20 @@ extern int yydebug; namespace Private { int parse(char *code) { + + initSetting(); - initSetting(); - //_lines[0] = _lines[1] = _lines[2] = code; + YY_BUFFER_STATE bp; - YY_BUFFER_STATE bp; + yydebug = 1; + yy_delete_buffer(YY_CURRENT_BUFFER); - //if (debugChannelSet(-1, kDebugParse)) - yydebug = 1; - //else - // yydebug = 0; + bp = yy_scan_string(code); + yy_switch_to_buffer(bp); + yyparse(); + yy_delete_buffer(bp); - yy_delete_buffer(YY_CURRENT_BUFFER); - - bp = yy_scan_string(code); - yy_switch_to_buffer(bp); - yyparse(); - //execute(prog); - yy_delete_buffer(bp); - - return 0; + return 0; } } // End of namespace Private diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp index 71069f956f5..ffc90d91249 100644 --- a/engines/private/symbol.cpp +++ b/engines/private/symbol.cpp @@ -9,14 +9,13 @@ ConstantList constants; StringQueue stringToDefine; RectQueue rectToDefine; -void define(char *n, Common::Rect *r) { +void defineSymbol(char *n, Common::Rect *r) { Common::String *s = new Common::String(n); stringToDefine.push(*s); rectToDefine.push(r); } -char *emalloc(unsigned n) /* check return from malloc */ -{ +char *emalloc(unsigned n) { char *p; p = (char*) malloc(n); @@ -24,8 +23,7 @@ char *emalloc(unsigned n) /* check return from malloc */ return p; } -void showSymbol(Symbol *s) -{ +void showSymbol(Symbol *s) { if (s->type == NUM) debug("%s %d",s->name->c_str(), s->u.val); else if (s->type == STRING) @@ -41,8 +39,8 @@ void setSymbol(Symbol *s, int v) { s->u.val = v; } -Symbol *lookup(Common::String s, SymbolMap symlist) /* find s in symbol table symlist */ -{ +/* find s in symbol table symlist */ +Symbol *lookup(Common::String s, SymbolMap symlist) { //debug("looking up %s", s.c_str()); Symbol *r = symlist.getVal(s); /*if (strcmp(s.c_str(), "m_640x480") == 0) { @@ -53,8 +51,8 @@ Symbol *lookup(Common::String s, SymbolMap symlist) /* find s in symbol table sy return r; } -Symbol *lookupName(char *n) /* install s in some symbol table */ -{ +/* lookup some name in some symbol table */ +Symbol *lookupName(char *n) { //debug("looking up %s", n); Common::String *s = new Common::String(n); @@ -75,15 +73,13 @@ Symbol *lookupName(char *n) /* install s in some symbol table */ else { debug("WARNING: %s not defined", n); - return addconstant(NAME, 0, n); + return constant(NAME, 0, n); } } - - -void installall(char *n) { +void installAll(char *n) { Common::String *s; Common::Rect *r; @@ -125,8 +121,7 @@ void installall(char *n) { } -Symbol *addconstant(int t, int d, char *s) -{ +Symbol *constant(int t, int d, char *s) { Symbol *sp; Common::String *n = new Common::String(""); @@ -144,9 +139,8 @@ Symbol *addconstant(int t, int d, char *s) return sp; } - -Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist) /* install s in symbol table */ -{ +/* install some symbol s in a symbol table */ +Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist) { Common::String *name = new Common::String(*n); Symbol *sp; diff --git a/engines/private/symbol.h b/engines/private/symbol.h new file mode 100644 index 00000000000..acac1c40fc7 --- /dev/null +++ b/engines/private/symbol.h @@ -0,0 +1,44 @@ +#include "common/str.h" +#include "common/hash-str.h" +#include "common/hash-ptr.h" +#include "common/queue.h" +#include "common/list.h" +#include "common/array.h" +#include "common/rect.h" + +#ifndef PRIVATE_SYMBOL_H +#define PRIVATE_SYMBOL_H + +namespace Private { + +typedef struct Symbol { /* symbol table entry */ + Common::String *name; + short type; /* NAME, NUM, STRING or RECT */ + union { + int val; /* NAME or NUM */ + char *str; /* STRING */ + Common::Rect *rect; /* RECT */ + } u; +} Symbol; + +// Symbols + +extern void showSymbol(Symbol *); +extern void setSymbol(Symbol *, int); + +typedef Common::HashMap SymbolMap; +typedef Common::List ConstantList; + +extern SymbolMap settings, variables, cursors, locations, rects; +extern ConstantList constants; + +extern void defineSymbol(char *, Common::Rect *); +extern Symbol *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*); +extern Symbol *lookupName(char *); +extern Symbol *constant(int, int, char *); +extern void installAll(char *); +extern Symbol *lookup(Common::String, SymbolMap); + +} + +#endif \ No newline at end of file