diff options
author | Eugene Sandulenko | 2016-07-03 00:20:08 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 3cf8510c418ae6fd9683691c8da01aba062c3367 (patch) | |
tree | 2720aa7e22b299c1f7e98f0f4a2f785ec548f385 /engines/director/lingo | |
parent | 48b9ae7d698c5f7a80d3687a67598b7935d4ad87 (diff) | |
download | scummvm-rg350-3cf8510c418ae6fd9683691c8da01aba062c3367.tar.gz scummvm-rg350-3cf8510c418ae6fd9683691c8da01aba062c3367.tar.bz2 scummvm-rg350-3cf8510c418ae6fd9683691c8da01aba062c3367.zip |
DIRECTOR: Lingo: Process D3-style cast references
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 20 | ||||
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 21 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 460 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.h | 160 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 2 |
5 files changed, 353 insertions, 310 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 36f284e71b..918dea1a56 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -121,7 +121,16 @@ void Lingo::c_varpush() { Datum d; d.u.sym = g_lingo->lookupVar(name); - d.type = VAR; + if (d.u.sym->type == CASTREF) { + d.type = INT; + int val = d.u.sym->u.val; + + delete d.u.sym; + + d.u.i = val; + } else { + d.type = VAR; + } g_lingo->_pc += g_lingo->calcStringAlignment(name); @@ -166,6 +175,11 @@ void Lingo::c_eval() { Datum d; d = g_lingo->pop(); + if (d.type != VAR) { // It could be cast ref + g_lingo->push(d); + return; + } + if (!g_lingo->verify(d.u.sym)) return; @@ -354,6 +368,10 @@ void Lingo::c_repeatwithcode(void) { Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]); Symbol *counter = g_lingo->lookupVar(countername.c_str()); + if (counter->type == CASTREF) { + error("Cast ref used as index: %s", countername.c_str()); + } + g_lingo->execute(init); /* condition */ d = g_lingo->pop(); d.toInt(); diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index b620677ba0..ad780316e1 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -67,6 +67,27 @@ void Lingo::execute(int pc) { Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) { Symbol *sym; + // Looking for the cast member constants + if (_vm->getVersion() < 4) { // TODO: There could be a flag 'Allow Outdated Lingo' in Movie Info in D4 + if (strlen(name) == 3) { + if (name[0] >= 'A' && name[0] <= 'H' && + name[1] >= '1' && name[1] <= '8' && + name[2] >= '1' && name[2] <= '8') { + + if (!create) + error("Cast reference used in wrong context: %s", name); + + int val = (name[0] - 'A') * 64 + (name[1] - '1') * 8 + (name[2] - '1') + 1; + sym = new Symbol; + + sym->type = CASTREF; + sym->u.val = val; + + return sym; + } + } + } + if (!_localvars->contains(name)) { // Create variable if it was not defined if (!create) return NULL; diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index b00d22c79e..f079879a08 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -66,87 +66,89 @@ /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - UNARY = 258, - VOID = 259, - VAR = 260, - INT = 261, - FLOAT = 262, - BLTIN = 263, - ID = 264, - STRING = 265, - HANDLER = 266, - tDOWN = 267, - tELSE = 268, - tEND = 269, - tEXIT = 270, - tFRAME = 271, - tGLOBAL = 272, - tGO = 273, - tIF = 274, - tINTO = 275, - tLOOP = 276, - tMACRO = 277, - tMCI = 278, - tMCIWAIT = 279, - tMOVIE = 280, - tNEXT = 281, - tOF = 282, - tPREVIOUS = 283, - tPUT = 284, - tREPEAT = 285, - tSET = 286, - tTHEN = 287, - tTO = 288, - tWITH = 289, - tWHILE = 290, - tGE = 291, - tLE = 292, - tGT = 293, - tLT = 294, - tEQ = 295, - tNEQ = 296 + CASTREF = 258, + UNARY = 259, + VOID = 260, + VAR = 261, + INT = 262, + FLOAT = 263, + BLTIN = 264, + ID = 265, + STRING = 266, + HANDLER = 267, + tDOWN = 268, + tELSE = 269, + tEND = 270, + tEXIT = 271, + tFRAME = 272, + tGLOBAL = 273, + tGO = 274, + tIF = 275, + tINTO = 276, + tLOOP = 277, + tMACRO = 278, + tMCI = 279, + tMCIWAIT = 280, + tMOVIE = 281, + tNEXT = 282, + tOF = 283, + tPREVIOUS = 284, + tPUT = 285, + tREPEAT = 286, + tSET = 287, + tTHEN = 288, + tTO = 289, + tWITH = 290, + tWHILE = 291, + tGE = 292, + tLE = 293, + tGT = 294, + tLT = 295, + tEQ = 296, + tNEQ = 297 }; #endif /* Tokens. */ -#define UNARY 258 -#define VOID 259 -#define VAR 260 -#define INT 261 -#define FLOAT 262 -#define BLTIN 263 -#define ID 264 -#define STRING 265 -#define HANDLER 266 -#define tDOWN 267 -#define tELSE 268 -#define tEND 269 -#define tEXIT 270 -#define tFRAME 271 -#define tGLOBAL 272 -#define tGO 273 -#define tIF 274 -#define tINTO 275 -#define tLOOP 276 -#define tMACRO 277 -#define tMCI 278 -#define tMCIWAIT 279 -#define tMOVIE 280 -#define tNEXT 281 -#define tOF 282 -#define tPREVIOUS 283 -#define tPUT 284 -#define tREPEAT 285 -#define tSET 286 -#define tTHEN 287 -#define tTO 288 -#define tWITH 289 -#define tWHILE 290 -#define tGE 291 -#define tLE 292 -#define tGT 293 -#define tLT 294 -#define tEQ 295 -#define tNEQ 296 +#define CASTREF 258 +#define UNARY 259 +#define VOID 260 +#define VAR 261 +#define INT 262 +#define FLOAT 263 +#define BLTIN 264 +#define ID 265 +#define STRING 266 +#define HANDLER 267 +#define tDOWN 268 +#define tELSE 269 +#define tEND 270 +#define tEXIT 271 +#define tFRAME 272 +#define tGLOBAL 273 +#define tGO 274 +#define tIF 275 +#define tINTO 276 +#define tLOOP 277 +#define tMACRO 278 +#define tMCI 279 +#define tMCIWAIT 280 +#define tMOVIE 281 +#define tNEXT 282 +#define tOF 283 +#define tPREVIOUS 284 +#define tPUT 285 +#define tREPEAT 286 +#define tSET 287 +#define tTHEN 288 +#define tTO 289 +#define tWITH 290 +#define tWHILE 291 +#define tGE 292 +#define tLE 293 +#define tGT 294 +#define tLT 295 +#define tEQ 296 +#define tNEQ 297 @@ -198,7 +200,7 @@ typedef union YYSTYPE int narg; /* number of arguments */ } /* Line 193 of yacc.c. */ -#line 202 "engines/director/lingo/lingo-gr.cpp" +#line 204 "engines/director/lingo/lingo-gr.cpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -211,7 +213,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 215 "engines/director/lingo/lingo-gr.cpp" +#line 217 "engines/director/lingo/lingo-gr.cpp" #ifdef short # undef short @@ -429,7 +431,7 @@ union yyalloc #define YYLAST 340 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 54 +#define YYNTOKENS 55 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 25 /* YYNRULES -- Number of rules. */ @@ -439,7 +441,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 296 +#define YYMAXUTOK 297 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -448,12 +450,12 @@ union yyalloc static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 48, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 47, 2, 2, - 49, 50, 45, 43, 53, 44, 2, 46, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 48, 2, 2, + 50, 51, 46, 44, 54, 45, 2, 47, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 52, 42, 51, 2, 2, 2, 2, 2, 2, 2, + 53, 43, 52, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -476,7 +478,7 @@ static const yytype_uint8 yytranslate[] = 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41 + 35, 36, 37, 38, 39, 40, 41, 42 }; #if YYDEBUG @@ -498,36 +500,36 @@ static const yytype_uint16 yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 55, 0, -1, 56, 48, 55, -1, 56, -1, -1, - 73, -1, 68, -1, 77, -1, 57, -1, 59, -1, - 58, -1, 1, -1, 29, 67, 20, 9, -1, 31, - 9, 42, 67, -1, 31, 9, 33, 67, -1, 67, - -1, 68, -1, 63, 60, 32, 66, 65, 14, 19, - -1, 63, 60, 32, 66, 65, 13, 66, 65, 14, - 19, -1, 61, 49, 60, 50, 66, 65, 14, 30, - -1, 62, 42, 67, 65, 33, 67, 65, 66, 65, - 14, 30, -1, 62, 42, 67, 65, 12, 33, 67, - 65, 66, 65, 14, 30, -1, 63, 60, 32, 64, - 58, 65, -1, 67, -1, 67, 42, 67, -1, 49, - 60, 50, -1, 30, 35, -1, 30, 34, 9, -1, - 19, -1, -1, -1, -1, 66, 48, -1, 66, 58, - -1, 6, -1, 7, -1, 8, 49, 78, 50, -1, - 9, 49, 78, 50, -1, 9, -1, 57, -1, 67, - 43, 67, -1, 67, 44, 67, -1, 67, 45, 67, - -1, 67, 46, 67, -1, 67, 51, 67, -1, 67, - 52, 67, -1, 67, 41, 67, -1, 67, 36, 67, - -1, 67, 37, 67, -1, 43, 67, -1, 44, 67, - -1, 49, 67, 50, -1, 23, 10, -1, 24, 9, - -1, 29, 67, -1, 70, -1, 15, -1, 17, 69, - -1, 9, -1, 69, 53, 9, -1, 18, 21, -1, - 18, 26, -1, 18, 28, -1, 18, 71, -1, 18, - 71, 72, -1, 18, 72, -1, 33, 16, 10, -1, - 16, 10, -1, 33, 10, -1, 10, -1, 27, 25, - 10, -1, 25, 10, -1, 33, 25, 10, -1, -1, - 22, 9, 74, 64, 75, 48, 76, 66, -1, -1, - 9, -1, 75, 53, 9, -1, 75, 48, 53, 9, - -1, -1, 9, 64, 78, -1, -1, 67, -1, 78, - 53, 67, -1 + 56, 0, -1, 57, 49, 56, -1, 57, -1, -1, + 74, -1, 69, -1, 78, -1, 58, -1, 60, -1, + 59, -1, 1, -1, 30, 68, 21, 10, -1, 32, + 10, 43, 68, -1, 32, 10, 34, 68, -1, 68, + -1, 69, -1, 64, 61, 33, 67, 66, 15, 20, + -1, 64, 61, 33, 67, 66, 14, 67, 66, 15, + 20, -1, 62, 50, 61, 51, 67, 66, 15, 31, + -1, 63, 43, 68, 66, 34, 68, 66, 67, 66, + 15, 31, -1, 63, 43, 68, 66, 13, 34, 68, + 66, 67, 66, 15, 31, -1, 64, 61, 33, 65, + 59, 66, -1, 68, -1, 68, 43, 68, -1, 50, + 61, 51, -1, 31, 36, -1, 31, 35, 10, -1, + 20, -1, -1, -1, -1, 67, 49, -1, 67, 59, + -1, 7, -1, 8, -1, 9, 50, 79, 51, -1, + 10, 50, 79, 51, -1, 10, -1, 58, -1, 68, + 44, 68, -1, 68, 45, 68, -1, 68, 46, 68, + -1, 68, 47, 68, -1, 68, 52, 68, -1, 68, + 53, 68, -1, 68, 42, 68, -1, 68, 37, 68, + -1, 68, 38, 68, -1, 44, 68, -1, 45, 68, + -1, 50, 68, 51, -1, 24, 11, -1, 25, 10, + -1, 30, 68, -1, 71, -1, 16, -1, 18, 70, + -1, 10, -1, 70, 54, 10, -1, 19, 22, -1, + 19, 27, -1, 19, 29, -1, 19, 72, -1, 19, + 72, 73, -1, 19, 73, -1, 34, 17, 11, -1, + 17, 11, -1, 34, 11, -1, 11, -1, 28, 26, + 11, -1, 26, 11, -1, 34, 26, 11, -1, -1, + 23, 10, 75, 65, 76, 49, 77, 67, -1, -1, + 10, -1, 76, 54, 10, -1, 76, 49, 54, 10, + -1, -1, 10, 65, 79, -1, -1, 68, -1, 79, + 54, 68, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -550,17 +552,17 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "UNARY", "VOID", "VAR", "INT", "FLOAT", - "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", - "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", - "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", - "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", - "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", - "')'", "'>'", "'<'", "','", "$accept", "program", "programline", "asgn", - "stmt", "stmtoneliner", "cond", "repeatwhile", "repeatwith", "if", - "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc", - "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro", - "arglist", 0 + "$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT", + "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", + "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", + "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", + "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", + "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", + "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program", + "programline", "asgn", "stmt", "stmtoneliner", "cond", "repeatwhile", + "repeatwith", "if", "begin", "end", "stmtlist", "expr", "func", + "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", + "argdef", "argstore", "macro", "arglist", 0 }; #endif @@ -573,23 +575,23 @@ static const yytype_uint16 yytoknum[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 61, 43, 45, 42, 47, 37, 10, 40, - 41, 62, 60, 44 + 295, 296, 297, 61, 43, 45, 42, 47, 37, 10, + 40, 41, 62, 60, 44 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 54, 55, 55, 56, 56, 56, 56, 56, 56, - 56, 56, 57, 57, 57, 58, 58, 58, 58, 58, - 58, 58, 59, 60, 60, 60, 61, 62, 63, 64, - 65, 66, 66, 66, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, - 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, - 72, 72, 72, 74, 73, 75, 75, 75, 75, 76, - 77, 78, 78, 78 + 0, 55, 56, 56, 57, 57, 57, 57, 57, 57, + 57, 57, 58, 58, 58, 59, 59, 59, 59, 59, + 59, 59, 60, 61, 61, 61, 62, 63, 64, 65, + 66, 67, 67, 67, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 69, 69, 69, 69, 69, 69, 70, 70, + 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, + 73, 73, 73, 75, 74, 76, 76, 76, 76, 77, + 78, 79, 79, 79 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -644,32 +646,32 @@ static const yytype_int16 yydefgoto[] = #define YYPACT_NINF -123 static const yytype_int16 yypact[] = { - 86, -123, -123, -123, -24, 288, -123, 22, 247, -123, - 26, 27, 32, 157, -17, 35, 157, 157, 157, 48, - 4, 16, -123, -123, 30, 42, 201, 276, -123, -123, - -123, -123, 157, 157, 157, -123, 12, -123, 73, -123, - 75, -123, 63, -123, 14, 20, -123, -123, -123, -123, - 47, 157, -123, 215, 81, -123, -19, -9, -9, 252, - -123, 86, 201, 157, 201, 59, 264, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 276, 19, 23, 46, - 102, -123, -123, 104, -123, 108, 109, 95, -123, -123, - 215, 113, -123, 157, 157, -123, -123, 74, 276, 76, - 240, -2, 157, 276, 276, 276, 61, 61, -9, -9, - 276, 276, -123, 157, -123, -123, -123, -123, -123, 116, - -123, 276, 276, -123, 3, -123, 174, 130, 276, 276, - -123, 18, 130, 94, 157, -123, 201, -123, -123, -123, - 64, 79, 124, 126, 157, 276, -123, 110, -123, 122, - 134, -123, -123, 114, 276, -123, -123, 130, -123, -123, - 130, -123, -123, 130, 132, 130, 136, 133, 137, 125, - -123, 127, -123, -123 + 85, -123, -123, -123, -33, 287, -123, 42, 246, -123, + 59, 65, 69, 156, -12, 73, 156, 156, 156, 90, + 47, 15, -123, -123, 34, 48, 200, 275, -123, -123, + -123, -123, 156, 156, 156, -123, 43, -123, 87, -123, + 88, -123, 76, -123, 5, 13, -123, -123, -123, -123, + 56, 156, -123, 214, 97, -123, -9, 35, 35, 251, + -123, 85, 200, 156, 200, 78, 263, 156, 156, 156, + 156, 156, 156, 156, 156, 156, 275, 20, 24, 58, + 103, -123, -123, 107, -123, 108, 109, 96, -123, -123, + 214, 104, -123, 156, 156, -123, -123, 74, 275, 75, + 239, -3, 156, 275, 275, 275, -10, -10, 35, 35, + 275, 275, -123, 156, -123, -123, -123, -123, -123, 114, + -123, 275, 275, -123, 1, -123, 173, 129, 275, 275, + -123, -1, 129, 93, 156, -123, 200, -123, -123, -123, + 30, 79, 122, 125, 156, 275, -123, 110, -123, 121, + 132, -123, -123, 113, 275, -123, -123, 129, -123, -123, + 129, -123, -123, 129, 131, 129, 135, 136, 137, 120, + -123, 124, -123, -123 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -123, 97, -123, 6, 2, -123, -54, -123, -123, 7, - -67, 84, -122, -13, 9, -123, -123, -123, 111, -123, - -123, -123, -123, -123, 41 + -123, 101, -123, 6, 2, -123, -54, -123, -123, 7, + -71, 84, -122, -13, 9, -123, -123, -123, 112, -123, + -123, -123, -123, -123, 32 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -680,22 +682,22 @@ static const yytype_int8 yypgoto[] = static const yytype_int16 yytable[] = { 53, 132, 22, 57, 58, 59, 21, 26, 97, 28, - 99, -31, -31, 66, 93, 133, -8, 54, 55, 76, - 76, 76, 119, 94, 84, 32, 157, 67, 68, 160, - 85, 35, 69, 163, 126, 47, 134, 48, 90, 86, - 165, 49, 74, 75, 56, 40, -31, 42, 60, 66, - 98, 100, 61, 87, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 22, -8, 80, 141, 21, 26, 112, - 28, 142, 113, 114, 78, 79, 113, 148, 149, 62, - 121, 122, 147, 81, 63, 82, -4, 1, 83, 128, - 92, 101, 2, 3, 4, 5, 33, 67, 68, 113, - 129, 6, 69, 7, 8, 9, 72, 73, 10, 11, - 12, 115, 74, 75, 116, 13, 14, 15, 117, 118, - 86, 145, 120, 66, 123, 130, 125, 144, 135, 16, - 17, 154, 150, 152, -4, 18, 2, 3, 4, 50, - 153, 158, 156, 159, 161, 6, 167, 7, 8, 9, - 169, 171, 170, 11, 12, 172, 88, 173, 96, 13, - 14, 15, 0, 2, 3, 4, 50, 0, 0, 0, + 99, -31, -31, 66, 133, -8, 84, 32, 119, 76, + 76, 76, 85, 54, 55, 93, 157, 67, 68, 160, + 126, 86, 69, 163, 94, 134, 72, 73, 90, 40, + 165, 42, 74, 75, 148, 149, -31, 87, 141, 66, + 98, 100, 35, 142, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 22, -8, 78, 79, 21, 26, 47, + 28, 112, 67, 68, 113, 114, 48, 69, 113, 49, + 121, 122, 147, 56, 62, -4, 1, 74, 75, 128, + 60, 63, 2, 3, 4, 5, 61, 80, 81, 82, + 129, 6, 83, 7, 8, 9, 33, 92, 10, 11, + 12, 101, 113, 115, 120, 13, 14, 15, 116, 117, + 118, 145, 86, 66, 130, 123, 125, 144, 135, 16, + 17, 154, 152, 150, -4, 18, 2, 3, 4, 50, + 153, 158, 159, 156, 161, 6, 167, 7, 8, 9, + 169, 172, 171, 11, 12, 173, 170, 88, 0, 13, + 14, 15, 96, 2, 3, 4, 50, 0, 0, 0, 0, 0, 0, 16, 17, 0, 0, 0, 138, 18, 2, 3, 4, 50, 0, 0, 51, 0, 15, 6, 0, 7, 8, 9, 0, 0, 0, 11, 12, 0, @@ -719,64 +721,64 @@ static const yytype_int16 yytable[] = static const yytype_int16 yycheck[] = { 13, 123, 0, 16, 17, 18, 0, 0, 62, 0, - 64, 13, 14, 26, 33, 12, 0, 34, 35, 32, - 33, 34, 89, 42, 10, 49, 148, 36, 37, 151, - 16, 9, 41, 155, 101, 9, 33, 10, 51, 25, - 162, 9, 51, 52, 9, 25, 48, 27, 0, 62, - 63, 64, 48, 33, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 61, 48, 53, 48, 61, 61, 50, - 61, 53, 53, 50, 33, 34, 53, 13, 14, 49, - 93, 94, 136, 10, 42, 10, 0, 1, 25, 102, - 9, 32, 6, 7, 8, 9, 49, 36, 37, 53, - 113, 15, 41, 17, 18, 19, 45, 46, 22, 23, - 24, 9, 51, 52, 10, 29, 30, 31, 10, 10, - 25, 134, 9, 136, 50, 9, 50, 33, 126, 43, - 44, 144, 53, 9, 48, 49, 6, 7, 8, 9, - 14, 19, 32, 9, 30, 15, 14, 17, 18, 19, - 14, 14, 19, 23, 24, 30, 45, 30, 61, 29, - 30, 31, -1, 6, 7, 8, 9, -1, -1, -1, - -1, -1, -1, 43, 44, -1, -1, -1, 48, 49, - 6, 7, 8, 9, -1, -1, 29, -1, 31, 15, - -1, 17, 18, 19, -1, -1, -1, 23, 24, -1, - 43, 44, -1, 29, 30, 31, 49, 6, 7, 8, - 9, 127, -1, -1, -1, -1, 132, 43, 44, 135, - -1, -1, -1, 49, -1, -1, -1, -1, -1, 145, - 29, -1, 31, -1, -1, 20, -1, -1, 154, -1, - -1, 157, -1, -1, 43, 44, -1, 163, -1, 165, - 49, 36, 37, -1, -1, -1, 41, 10, 43, 44, - 45, 46, -1, 16, -1, -1, 51, 52, 21, -1, - -1, -1, 25, 26, 27, 28, 36, 37, -1, -1, - 33, 41, 42, 43, 44, 45, 46, -1, 36, 37, - 50, 51, 52, 41, -1, 43, 44, 45, 46, -1, - 36, 37, 50, 51, 52, 41, 42, 43, 44, 45, - 46, -1, 36, 37, -1, 51, 52, 41, -1, 43, - 44, 45, 46, -1, 36, 37, -1, 51, 52, 41, - -1, -1, -1, 45, 46, -1, -1, 49, -1, 51, - 52 + 64, 14, 15, 26, 13, 0, 11, 50, 89, 32, + 33, 34, 17, 35, 36, 34, 148, 37, 38, 151, + 101, 26, 42, 155, 43, 34, 46, 47, 51, 26, + 162, 28, 52, 53, 14, 15, 49, 34, 49, 62, + 63, 64, 10, 54, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 61, 49, 33, 34, 61, 61, 10, + 61, 51, 37, 38, 54, 51, 11, 42, 54, 10, + 93, 94, 136, 10, 50, 0, 1, 52, 53, 102, + 0, 43, 7, 8, 9, 10, 49, 54, 11, 11, + 113, 16, 26, 18, 19, 20, 50, 10, 23, 24, + 25, 33, 54, 10, 10, 30, 31, 32, 11, 11, + 11, 134, 26, 136, 10, 51, 51, 34, 126, 44, + 45, 144, 10, 54, 49, 50, 7, 8, 9, 10, + 15, 20, 10, 33, 31, 16, 15, 18, 19, 20, + 15, 31, 15, 24, 25, 31, 20, 45, -1, 30, + 31, 32, 61, 7, 8, 9, 10, -1, -1, -1, + -1, -1, -1, 44, 45, -1, -1, -1, 49, 50, + 7, 8, 9, 10, -1, -1, 30, -1, 32, 16, + -1, 18, 19, 20, -1, -1, -1, 24, 25, -1, + 44, 45, -1, 30, 31, 32, 50, 7, 8, 9, + 10, 127, -1, -1, -1, -1, 132, 44, 45, 135, + -1, -1, -1, 50, -1, -1, -1, -1, -1, 145, + 30, -1, 32, -1, -1, 21, -1, -1, 154, -1, + -1, 157, -1, -1, 44, 45, -1, 163, -1, 165, + 50, 37, 38, -1, -1, -1, 42, 11, 44, 45, + 46, 47, -1, 17, -1, -1, 52, 53, 22, -1, + -1, -1, 26, 27, 28, 29, 37, 38, -1, -1, + 34, 42, 43, 44, 45, 46, 47, -1, 37, 38, + 51, 52, 53, 42, -1, 44, 45, 46, 47, -1, + 37, 38, 51, 52, 53, 42, 43, 44, 45, 46, + 47, -1, 37, 38, -1, 52, 53, 42, -1, 44, + 45, 46, 47, -1, 37, 38, -1, 52, 53, 42, + -1, -1, -1, 46, 47, -1, -1, 50, -1, 52, + 53 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 1, 6, 7, 8, 9, 15, 17, 18, 19, - 22, 23, 24, 29, 30, 31, 43, 44, 49, 55, - 56, 57, 58, 59, 61, 62, 63, 67, 68, 70, - 73, 77, 49, 49, 64, 9, 69, 10, 16, 21, - 25, 26, 27, 28, 33, 71, 72, 9, 10, 9, - 9, 29, 57, 67, 34, 35, 9, 67, 67, 67, - 0, 48, 49, 42, 49, 60, 67, 36, 37, 41, - 43, 44, 45, 46, 51, 52, 67, 78, 78, 78, - 53, 10, 10, 25, 10, 16, 25, 33, 72, 74, - 67, 20, 9, 33, 42, 50, 55, 60, 67, 60, - 67, 32, 42, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 50, 53, 50, 9, 10, 10, 10, 64, - 9, 67, 67, 50, 65, 50, 64, 66, 67, 67, - 9, 75, 66, 12, 33, 58, 63, 68, 48, 58, - 65, 48, 53, 65, 33, 67, 65, 60, 13, 14, - 53, 76, 9, 14, 67, 65, 32, 66, 19, 9, - 66, 30, 65, 66, 65, 66, 65, 14, 65, 14, - 19, 14, 30, 30 + 0, 1, 7, 8, 9, 10, 16, 18, 19, 20, + 23, 24, 25, 30, 31, 32, 44, 45, 50, 56, + 57, 58, 59, 60, 62, 63, 64, 68, 69, 71, + 74, 78, 50, 50, 65, 10, 70, 11, 17, 22, + 26, 27, 28, 29, 34, 72, 73, 10, 11, 10, + 10, 30, 58, 68, 35, 36, 10, 68, 68, 68, + 0, 49, 50, 43, 50, 61, 68, 37, 38, 42, + 44, 45, 46, 47, 52, 53, 68, 79, 79, 79, + 54, 11, 11, 26, 11, 17, 26, 34, 73, 75, + 68, 21, 10, 34, 43, 51, 56, 61, 68, 61, + 68, 33, 43, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 51, 54, 51, 10, 11, 11, 11, 65, + 10, 68, 68, 51, 66, 51, 65, 67, 68, 68, + 10, 76, 67, 13, 34, 59, 64, 69, 49, 59, + 66, 49, 54, 66, 34, 68, 66, 61, 14, 15, + 54, 77, 10, 15, 68, 66, 33, 67, 20, 10, + 67, 31, 66, 67, 66, 67, 66, 15, 66, 15, + 20, 15, 31, 31 }; #define yyerrok (yyerrstatus = 0) @@ -2033,7 +2035,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 2037 "engines/director/lingo/lingo-gr.cpp" +#line 2039 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h index e21948c62f..2aff182464 100644 --- a/engines/director/lingo/lingo-gr.h +++ b/engines/director/lingo/lingo-gr.h @@ -39,87 +39,89 @@ /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - UNARY = 258, - VOID = 259, - VAR = 260, - INT = 261, - FLOAT = 262, - BLTIN = 263, - ID = 264, - STRING = 265, - HANDLER = 266, - tDOWN = 267, - tELSE = 268, - tEND = 269, - tEXIT = 270, - tFRAME = 271, - tGLOBAL = 272, - tGO = 273, - tIF = 274, - tINTO = 275, - tLOOP = 276, - tMACRO = 277, - tMCI = 278, - tMCIWAIT = 279, - tMOVIE = 280, - tNEXT = 281, - tOF = 282, - tPREVIOUS = 283, - tPUT = 284, - tREPEAT = 285, - tSET = 286, - tTHEN = 287, - tTO = 288, - tWITH = 289, - tWHILE = 290, - tGE = 291, - tLE = 292, - tGT = 293, - tLT = 294, - tEQ = 295, - tNEQ = 296 + CASTREF = 258, + UNARY = 259, + VOID = 260, + VAR = 261, + INT = 262, + FLOAT = 263, + BLTIN = 264, + ID = 265, + STRING = 266, + HANDLER = 267, + tDOWN = 268, + tELSE = 269, + tEND = 270, + tEXIT = 271, + tFRAME = 272, + tGLOBAL = 273, + tGO = 274, + tIF = 275, + tINTO = 276, + tLOOP = 277, + tMACRO = 278, + tMCI = 279, + tMCIWAIT = 280, + tMOVIE = 281, + tNEXT = 282, + tOF = 283, + tPREVIOUS = 284, + tPUT = 285, + tREPEAT = 286, + tSET = 287, + tTHEN = 288, + tTO = 289, + tWITH = 290, + tWHILE = 291, + tGE = 292, + tLE = 293, + tGT = 294, + tLT = 295, + tEQ = 296, + tNEQ = 297 }; #endif /* Tokens. */ -#define UNARY 258 -#define VOID 259 -#define VAR 260 -#define INT 261 -#define FLOAT 262 -#define BLTIN 263 -#define ID 264 -#define STRING 265 -#define HANDLER 266 -#define tDOWN 267 -#define tELSE 268 -#define tEND 269 -#define tEXIT 270 -#define tFRAME 271 -#define tGLOBAL 272 -#define tGO 273 -#define tIF 274 -#define tINTO 275 -#define tLOOP 276 -#define tMACRO 277 -#define tMCI 278 -#define tMCIWAIT 279 -#define tMOVIE 280 -#define tNEXT 281 -#define tOF 282 -#define tPREVIOUS 283 -#define tPUT 284 -#define tREPEAT 285 -#define tSET 286 -#define tTHEN 287 -#define tTO 288 -#define tWITH 289 -#define tWHILE 290 -#define tGE 291 -#define tLE 292 -#define tGT 293 -#define tLT 294 -#define tEQ 295 -#define tNEQ 296 +#define CASTREF 258 +#define UNARY 259 +#define VOID 260 +#define VAR 261 +#define INT 262 +#define FLOAT 263 +#define BLTIN 264 +#define ID 265 +#define STRING 266 +#define HANDLER 267 +#define tDOWN 268 +#define tELSE 269 +#define tEND 270 +#define tEXIT 271 +#define tFRAME 272 +#define tGLOBAL 273 +#define tGO 274 +#define tIF 275 +#define tINTO 276 +#define tLOOP 277 +#define tMACRO 278 +#define tMCI 279 +#define tMCIWAIT 280 +#define tMOVIE 281 +#define tNEXT 282 +#define tOF 283 +#define tPREVIOUS 284 +#define tPUT 285 +#define tREPEAT 286 +#define tSET 287 +#define tTHEN 288 +#define tTO 289 +#define tWITH 290 +#define tWHILE 291 +#define tGE 292 +#define tLE 293 +#define tGT 294 +#define tLT 295 +#define tEQ 296 +#define tNEQ 297 @@ -135,7 +137,7 @@ typedef union YYSTYPE int narg; /* number of arguments */ } /* Line 1529 of yacc.c. */ -#line 139 "engines/director/lingo/lingo-gr.hpp" +#line 141 "engines/director/lingo/lingo-gr.hpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index df0f494acd..191bccfc0c 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -70,7 +70,7 @@ using namespace Director; int narg; /* number of arguments */ } -%token UNARY VOID VAR +%token CASTREF UNARY VOID VAR %token<i> INT %token<f> FLOAT %token<s> BLTIN ID STRING HANDLER |