diff options
author | Eugene Sandulenko | 2016-07-09 11:35:10 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | cca71376b7ffdc539548e9daa72963ebac990a07 (patch) | |
tree | a932561bf2e1e32a2e8ef8dbdf4b7e4466d9945d | |
parent | 598be95ab4379fac72af28c35a087ed681a8731a (diff) | |
download | scummvm-rg350-cca71376b7ffdc539548e9daa72963ebac990a07.tar.gz scummvm-rg350-cca71376b7ffdc539548e9daa72963ebac990a07.tar.bz2 scummvm-rg350-cca71376b7ffdc539548e9daa72963ebac990a07.zip |
DIRECTOR: Lingo: Implemented '&' string operator
-rw-r--r-- | engines/director/director.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 31 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 547 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 1 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 11 |
7 files changed, 325 insertions, 271 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index d18dcc5c88..040eaac7c1 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -128,7 +128,9 @@ Common::Error DirectorEngine::run() { else put 5\n\ end repeat\n\ set z = \"foo bar baz\"\n\ + set z1 = z & \" meow\"\n\ put z\n\ + put z1\n\ ", kMovieScript, 2); _lingo->executeScript(kMovieScript, 2); diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 67345e181d..2c797194c7 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -160,15 +160,25 @@ void Lingo::c_assign() { return; } - if (d1.u.sym->type != INT && d1.u.sym->type != VOID) { + if (d1.u.sym->type != INT && d1.u.sym->type != VOID && + d1.u.sym->type != FLOAT && d1.u.sym->type != STRING) { warning("assignment to non-variable '%s'", d1.u.sym->name); return; } - d1.u.sym->u.val = d2.u.i; + if (d1.u.sym->type == STRING) // Free memory if needed + delete d1.u.sym->u.str; + + if (d2.type == INT) + d1.u.sym->u.val = d2.u.i; + else if (d2.type == FLOAT) + d1.u.sym->u.fval = d2.u.f; + else if (d2.type == STRING) + d1.u.sym->u.str = new Common::String(*d2.u.s); + d1.u.sym->type = d2.type; - g_lingo->push(d2); + g_lingo->push(d1); } bool Lingo::verify(Symbol *s) { @@ -266,6 +276,21 @@ void Lingo::c_negate() { g_lingo->push(d); } +void Lingo::c_ampersand() { + Datum d2 = g_lingo->pop(); + Datum d1 = g_lingo->pop(); + + if (d1.type != STRING || d2.type != STRING) { + error("Wrong operands for & operation: %d %d", d1.type, d2.type); + } + + *d1.u.s += *d2.u.s; + + delete d2.u.s; + + g_lingo->push(d1); +} + void Lingo::c_eq() { Datum d2 = g_lingo->pop(); Datum d1 = g_lingo->pop(); diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index ed7a3c421f..da427d3e39 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -432,16 +432,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 62 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 380 +#define YYLAST 439 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 57 +#define YYNTOKENS 58 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 33 /* YYNRULES -- Number of rules. */ -#define YYNRULES 99 +#define YYNRULES 100 /* YYNRULES -- Number of states. */ -#define YYNSTATES 209 +#define YYNSTATES 211 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -456,8 +456,8 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 51, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 50, 2, 2, - 52, 53, 48, 46, 56, 47, 2, 49, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 50, 56, 2, + 52, 53, 48, 46, 57, 47, 2, 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 55, 45, 54, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -496,52 +496,54 @@ static const yytype_uint16 yyprhs[] = 149, 152, 154, 157, 159, 166, 168, 174, 176, 180, 184, 187, 191, 193, 195, 196, 197, 198, 201, 204, 206, 208, 210, 215, 220, 222, 224, 228, 232, 236, - 240, 244, 248, 252, 256, 260, 263, 266, 270, 273, - 276, 279, 281, 283, 286, 288, 292, 295, 298, 301, - 304, 308, 311, 315, 318, 321, 323, 327, 330, 334, - 335, 344, 345, 347, 351, 356, 357, 361, 362, 364 + 240, 244, 248, 252, 256, 260, 264, 267, 270, 274, + 277, 280, 283, 285, 287, 290, 292, 296, 299, 302, + 305, 308, 312, 315, 319, 322, 325, 327, 331, 334, + 338, 339, 348, 349, 351, 355, 360, 361, 365, 366, + 368 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 58, 0, -1, 58, 59, 60, -1, 60, -1, 51, - -1, -1, 84, -1, 79, -1, 88, -1, 61, -1, - 63, -1, 1, -1, 31, 78, 22, 10, -1, 33, - 10, 45, 78, -1, 33, 10, 35, 78, -1, 78, - -1, 79, -1, 62, -1, 64, -1, 71, 52, 70, - 53, 77, 76, 16, 32, -1, 72, 45, 78, 76, - 35, 78, 76, 77, 76, 16, 32, -1, 72, 45, - 78, 76, 13, 35, 78, 76, 77, 76, 16, 32, - -1, 73, 70, 34, 59, 77, 76, 16, 21, -1, - 73, 70, 34, 59, 77, 76, 14, 77, 76, 16, - 21, -1, 73, 70, 34, 59, 77, 76, 75, 66, - 76, 59, 16, 21, -1, 73, 70, 34, 75, 62, - 76, -1, 73, 70, 34, 75, 62, 76, 38, 75, - 62, 76, -1, 73, 70, 34, 75, 62, 76, 67, - 76, 65, 76, -1, -1, 38, 75, 62, -1, 66, - 69, -1, 69, -1, 67, 68, -1, 68, -1, 74, - 70, 34, 75, 63, 76, -1, 67, -1, 74, 70, - 34, 77, 76, -1, 78, -1, 78, 45, 78, -1, - 52, 70, 53, -1, 32, 37, -1, 32, 36, 10, - -1, 21, -1, 15, -1, -1, -1, -1, 77, 59, - -1, 77, 63, -1, 7, -1, 8, -1, 11, -1, - 9, 52, 89, 53, -1, 10, 52, 89, 53, -1, - 10, -1, 61, -1, 78, 46, 78, -1, 78, 47, - 78, -1, 78, 48, 78, -1, 78, 49, 78, -1, - 78, 54, 78, -1, 78, 55, 78, -1, 78, 44, - 78, -1, 78, 39, 78, -1, 78, 40, 78, -1, - 46, 78, -1, 47, 78, -1, 52, 78, 53, -1, - 25, 11, -1, 26, 10, -1, 31, 78, -1, 81, - -1, 17, -1, 19, 80, -1, 10, -1, 80, 56, - 10, -1, 20, 23, -1, 20, 28, -1, 20, 30, - -1, 20, 82, -1, 20, 82, 83, -1, 20, 83, - -1, 35, 18, 11, -1, 18, 11, -1, 35, 11, - -1, 11, -1, 29, 27, 11, -1, 27, 11, -1, - 35, 27, 11, -1, -1, 24, 10, 85, 75, 86, - 59, 87, 77, -1, -1, 10, -1, 86, 56, 10, - -1, 86, 59, 56, 10, -1, -1, 10, 75, 89, - -1, -1, 78, -1, 89, 56, 78, -1 + 59, 0, -1, 59, 60, 61, -1, 61, -1, 51, + -1, -1, 85, -1, 80, -1, 89, -1, 62, -1, + 64, -1, 1, -1, 31, 79, 22, 10, -1, 33, + 10, 45, 79, -1, 33, 10, 35, 79, -1, 79, + -1, 80, -1, 63, -1, 65, -1, 72, 52, 71, + 53, 78, 77, 16, 32, -1, 73, 45, 79, 77, + 35, 79, 77, 78, 77, 16, 32, -1, 73, 45, + 79, 77, 13, 35, 79, 77, 78, 77, 16, 32, + -1, 74, 71, 34, 60, 78, 77, 16, 21, -1, + 74, 71, 34, 60, 78, 77, 14, 78, 77, 16, + 21, -1, 74, 71, 34, 60, 78, 77, 76, 67, + 77, 60, 16, 21, -1, 74, 71, 34, 76, 63, + 77, -1, 74, 71, 34, 76, 63, 77, 38, 76, + 63, 77, -1, 74, 71, 34, 76, 63, 77, 68, + 77, 66, 77, -1, -1, 38, 76, 63, -1, 67, + 70, -1, 70, -1, 68, 69, -1, 69, -1, 75, + 71, 34, 76, 64, 77, -1, 68, -1, 75, 71, + 34, 78, 77, -1, 79, -1, 79, 45, 79, -1, + 52, 71, 53, -1, 32, 37, -1, 32, 36, 10, + -1, 21, -1, 15, -1, -1, -1, -1, 78, 60, + -1, 78, 64, -1, 7, -1, 8, -1, 11, -1, + 9, 52, 90, 53, -1, 10, 52, 90, 53, -1, + 10, -1, 62, -1, 79, 46, 79, -1, 79, 47, + 79, -1, 79, 48, 79, -1, 79, 49, 79, -1, + 79, 54, 79, -1, 79, 55, 79, -1, 79, 44, + 79, -1, 79, 39, 79, -1, 79, 40, 79, -1, + 79, 56, 79, -1, 46, 79, -1, 47, 79, -1, + 52, 79, 53, -1, 25, 11, -1, 26, 10, -1, + 31, 79, -1, 82, -1, 17, -1, 19, 81, -1, + 10, -1, 81, 57, 10, -1, 20, 23, -1, 20, + 28, -1, 20, 30, -1, 20, 83, -1, 20, 83, + 84, -1, 20, 84, -1, 35, 18, 11, -1, 18, + 11, -1, 35, 11, -1, 11, -1, 29, 27, 11, + -1, 27, 11, -1, 35, 27, 11, -1, -1, 24, + 10, 86, 76, 87, 60, 88, 78, -1, -1, 10, + -1, 87, 57, 10, -1, 87, 60, 57, 10, -1, + -1, 10, 76, 90, -1, -1, 79, -1, 90, 57, + 79, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -553,10 +555,11 @@ static const yytype_uint16 yyrline[] = 240, 241, 244, 245, 248, 256, 257, 265, 266, 267, 269, 271, 277, 283, 290, 292, 294, 295, 296, 299, 304, 307, 310, 316, 324, 327, 328, 329, 330, 331, - 332, 333, 334, 335, 336, 337, 338, 339, 342, 343, - 344, 345, 346, 348, 351, 352, 363, 364, 365, 366, - 371, 377, 384, 385, 386, 387, 390, 391, 392, 420, - 420, 427, 428, 429, 430, 432, 435, 443, 444, 445 + 332, 333, 334, 335, 336, 337, 338, 339, 340, 343, + 344, 345, 346, 347, 349, 352, 353, 364, 365, 366, + 367, 372, 378, 385, 386, 387, 388, 391, 392, 393, + 421, 421, 428, 429, 430, 431, 433, 436, 444, 445, + 446 }; #endif @@ -572,12 +575,12 @@ static const char *const yytname[] = "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", - "','", "$accept", "program", "nl", "programline", "asgn", "stmtoneliner", - "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner", - "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile", - "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func", - "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", - "argdef", "argstore", "macro", "arglist", 0 + "'&'", "','", "$accept", "program", "nl", "programline", "asgn", + "stmtoneliner", "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", + "elseifstmtoneliner", "elseifstmtoneliner1", "elseifstmt1", "cond", + "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist", + "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie", + "defn", "@1", "argdef", "argstore", "macro", "arglist", 0 }; #endif @@ -591,23 +594,24 @@ static const yytype_uint16 yytoknum[] = 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 61, 43, 45, 42, 47, - 37, 10, 40, 41, 62, 60, 44 + 37, 10, 40, 41, 62, 60, 38, 44 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 57, 58, 58, 59, 60, 60, 60, 60, 60, - 60, 60, 61, 61, 61, 62, 62, 63, 63, 63, - 63, 63, 64, 64, 64, 64, 64, 64, 65, 65, - 66, 66, 67, 67, 68, 69, 69, 70, 70, 70, - 71, 72, 73, 74, 75, 76, 77, 77, 77, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, - 79, 79, 79, 79, 80, 80, 81, 81, 81, 81, - 81, 81, 82, 82, 82, 82, 83, 83, 83, 85, - 84, 86, 86, 86, 86, 87, 88, 89, 89, 89 + 0, 58, 59, 59, 60, 61, 61, 61, 61, 61, + 61, 61, 62, 62, 62, 63, 63, 64, 64, 64, + 64, 64, 65, 65, 65, 65, 65, 65, 66, 66, + 67, 67, 68, 68, 69, 70, 70, 71, 71, 71, + 72, 73, 74, 75, 76, 77, 78, 78, 78, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, + 80, 80, 80, 80, 80, 81, 81, 82, 82, 82, + 82, 82, 82, 83, 83, 83, 83, 84, 84, 84, + 86, 85, 87, 87, 87, 87, 88, 89, 90, 90, + 90 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -619,10 +623,11 @@ static const yytype_uint8 yyr2[] = 2, 1, 2, 1, 6, 1, 5, 1, 3, 3, 2, 3, 1, 1, 0, 0, 0, 2, 2, 1, 1, 1, 4, 4, 1, 1, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 2, 2, 3, 2, 2, - 2, 1, 1, 2, 1, 3, 2, 2, 2, 2, - 3, 2, 3, 2, 2, 1, 3, 2, 3, 0, - 8, 0, 1, 3, 4, 0, 3, 0, 1, 3 + 3, 3, 3, 3, 3, 3, 2, 2, 3, 2, + 2, 2, 1, 1, 2, 1, 3, 2, 2, 2, + 2, 3, 2, 3, 2, 2, 1, 3, 2, 3, + 0, 8, 0, 1, 3, 4, 0, 3, 0, 1, + 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -630,36 +635,37 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 11, 49, 50, 0, 44, 51, 72, 0, 0, + 0, 11, 49, 50, 0, 44, 51, 73, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 55, 17, 10, 18, 0, 0, 0, 15, - 7, 71, 6, 8, 97, 97, 97, 74, 73, 85, - 0, 76, 0, 77, 0, 78, 0, 79, 81, 89, - 68, 69, 54, 0, 55, 70, 0, 40, 0, 65, - 66, 0, 1, 4, 0, 0, 0, 0, 0, 37, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, - 0, 0, 96, 0, 83, 87, 0, 84, 0, 0, - 0, 80, 44, 0, 0, 41, 0, 0, 67, 2, - 0, 45, 0, 0, 44, 0, 63, 64, 62, 56, - 57, 58, 59, 60, 61, 52, 0, 53, 75, 86, - 82, 88, 91, 12, 14, 13, 46, 0, 39, 46, - 0, 38, 99, 92, 0, 45, 0, 0, 45, 45, - 16, 0, 95, 47, 48, 0, 0, 45, 44, 25, - 93, 0, 46, 0, 45, 46, 46, 0, 0, 43, - 44, 45, 33, 0, 94, 90, 19, 46, 45, 45, - 22, 45, 35, 31, 0, 0, 32, 28, 0, 45, - 0, 0, 30, 0, 0, 45, 44, 45, 44, 0, - 0, 0, 0, 44, 26, 0, 27, 0, 0, 20, - 23, 0, 45, 29, 45, 21, 24, 36, 34 + 7, 72, 6, 8, 98, 98, 98, 75, 74, 86, + 0, 77, 0, 78, 0, 79, 0, 80, 82, 90, + 69, 70, 54, 0, 55, 71, 0, 40, 0, 66, + 67, 0, 1, 4, 0, 0, 0, 0, 0, 37, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 99, 0, 0, 97, 0, 84, 88, 0, 85, 0, + 0, 0, 81, 44, 0, 0, 41, 0, 0, 68, + 2, 0, 45, 0, 0, 44, 0, 63, 64, 62, + 56, 57, 58, 59, 60, 61, 65, 52, 0, 53, + 76, 87, 83, 89, 92, 12, 14, 13, 46, 0, + 39, 46, 0, 38, 100, 93, 0, 45, 0, 0, + 45, 45, 16, 0, 96, 47, 48, 0, 0, 45, + 44, 25, 94, 0, 46, 0, 45, 46, 46, 0, + 0, 43, 44, 45, 33, 0, 95, 91, 19, 46, + 45, 45, 22, 45, 35, 31, 0, 0, 32, 28, + 0, 45, 0, 0, 30, 0, 0, 45, 44, 45, + 44, 0, 0, 0, 0, 44, 26, 0, 27, 0, + 0, 20, 23, 0, 45, 29, 45, 21, 24, 36, + 34 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 20, 143, 21, 54, 23, 144, 25, 187, 171, - 172, 162, 173, 68, 26, 27, 28, 163, 197, 127, - 135, 29, 140, 38, 31, 47, 48, 32, 92, 134, - 152, 33, 80 + -1, 20, 145, 21, 54, 23, 146, 25, 189, 173, + 174, 164, 175, 68, 26, 27, 28, 165, 199, 129, + 137, 29, 142, 38, 31, 47, 48, 32, 93, 136, + 154, 33, 81 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -667,36 +673,37 @@ static const yytype_int16 yydefgoto[] = #define YYPACT_NINF -150 static const yytype_int16 yypact[] = { - 152, -150, -150, -150, -41, 55, -150, -150, 51, 296, - -150, 73, 81, 95, 180, 16, 105, 180, 180, 180, - 4, -150, 8, -150, -150, -150, 39, 76, 226, 325, - -150, -150, -150, -150, 180, 180, 180, -150, 62, -150, - 112, -150, 114, -150, 103, -150, 3, 21, -150, -150, - -150, -150, 79, 180, -150, 80, 122, -150, -7, -13, - -13, 301, -150, -150, 152, 226, 180, 226, 99, 313, - 180, 180, 180, 180, 180, 180, 180, 180, 180, 325, - 37, 58, 83, 126, -150, -150, 129, -150, 130, 131, - 110, -150, -150, 80, 133, -150, 180, 180, -150, -150, - 92, 325, 93, 289, 97, 180, 325, 325, 325, 249, - 249, -13, -13, 325, 325, -150, 180, -150, -150, -150, - -150, -150, 139, -150, 325, 325, -150, -1, -150, -150, - 275, 325, 325, -150, 57, 198, 115, 180, 198, -150, - -150, 141, 98, -150, -150, 142, 180, 325, 46, -5, - -150, 145, -150, 125, 325, -150, -150, 146, 151, -150, - -150, 151, -150, 226, -150, 198, -150, -150, 198, 198, - -150, 151, 151, -150, 226, 275, -150, 132, 134, 198, - 158, 163, -150, 97, 147, -150, -150, -150, -150, 164, - 154, 171, 177, -8, -150, 275, -150, 244, 162, -150, - -150, 174, 198, -150, -150, -150, -150, -150, -150 + 162, -150, -150, -150, -21, 383, -150, -150, 15, 329, + -150, 32, 42, 50, 84, -23, 52, 84, 84, 84, + 7, -150, 8, -150, -150, -150, 13, 18, 236, 370, + -150, -150, -150, -150, 84, 84, 84, -150, 25, -150, + 72, -150, 73, -150, 59, -150, 5, 12, -150, -150, + -150, -150, 36, 84, -150, 295, 80, -150, 11, 83, + 83, 339, -150, -150, 162, 236, 84, 236, 62, 357, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 370, -27, 4, 40, 90, -150, -150, 91, -150, 93, + 94, 79, -150, -150, 295, 98, -150, 84, 84, -150, + -150, 57, 370, 58, 321, 65, 84, 370, 370, 370, + 182, 182, 83, 83, 370, 370, 370, -150, 84, -150, + -150, -150, -150, -150, 110, -150, 370, 370, -150, -1, + -150, -150, 285, 370, 370, -150, -29, 208, 89, 84, + 208, -150, -150, 115, 69, -150, -150, 113, 84, 370, + 34, -5, -150, 122, -150, 101, 370, -150, -150, 120, + 119, -150, -150, 119, -150, 236, -150, 208, -150, -150, + 208, 208, -150, 119, 119, -150, 236, 285, -150, 106, + 114, 208, 131, 134, -150, 65, 117, -150, -150, -150, + -150, 136, 123, 133, 140, -6, -150, 285, -150, 254, + 125, -150, -150, 139, 208, -150, -150, -150, -150, -150, + -150 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -150, -150, -18, 136, 6, -106, 0, -150, -150, -150, - 47, -121, 30, -62, -150, -150, -150, -149, -4, -122, - -71, 1, 23, -150, -150, -150, 155, -150, -150, -150, - -150, -150, 9 + -150, -150, -18, 100, 6, -128, 0, -150, -150, -150, + 14, -136, 2, -62, -150, -150, -150, -149, -4, -28, + -114, 1, 21, -150, -150, -150, 121, -150, -150, -150, + -150, -150, 16 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -706,88 +713,98 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -55 static const yytype_int16 yytable[] = { - 24, 36, 64, 100, 62, 102, 22, -46, -9, 174, - 159, 34, 136, 145, 87, 55, 148, 149, 59, 60, - 61, 88, 174, 30, 139, 155, 70, 71, 96, 69, - 89, 72, 167, 160, 137, 79, 79, 79, 97, 177, - 176, 77, 78, -46, 81, 82, 180, 181, 42, 183, - 44, 176, 56, 57, 93, 63, 90, 189, 138, -9, - 156, 37, 157, 194, 24, 196, 69, 101, 103, 185, - 22, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 207, 165, 208, 49, 168, 169, 129, 30, 122, 203, - 115, 65, 50, 116, -54, -54, 179, 124, 125, -54, - 130, 178, 94, -54, -54, 51, 131, 35, 63, -54, - -54, 117, 184, 141, 116, 58, 142, 132, 83, 70, - 71, 66, 202, 84, 72, 85, 73, 74, 75, 76, - 86, 35, 95, 104, 77, 78, 118, 89, 147, 116, - 119, 120, 121, 123, 158, 126, 128, 154, 63, 133, - 146, 150, -5, 1, 151, 164, 175, 166, 153, 2, - 3, 4, 5, 6, 69, 192, 159, 170, 188, 7, - 186, 8, 9, 10, 190, 69, 11, 12, 13, 191, - 198, 193, 195, 14, 15, 16, 199, 2, 3, 4, - 52, 6, 200, 201, 205, 206, 161, 204, 17, 18, - 99, 182, 91, -5, 19, 2, 3, 4, 52, 6, - 0, 53, 0, 16, 0, 7, 0, 8, 9, 10, - 0, 0, 0, 12, 13, 0, 17, 18, 0, 14, - 15, 16, 19, 2, 3, 4, 52, 6, 0, 0, + 24, 36, 64, 101, 141, 103, 22, 62, -9, -46, + 161, 176, 138, 56, 57, 55, 88, 140, 59, 60, + 61, 30, 63, 89, 176, 37, 117, 178, 143, 69, + 118, 34, 90, 162, 139, 80, 80, 80, 178, 42, + 167, 44, 49, 170, 171, -46, 97, 91, 158, 187, + 159, 82, 83, 50, 94, 181, 98, 119, 63, -9, + 51, 118, 58, 66, 24, 65, 69, 102, 104, 205, + 22, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 204, 84, 85, 86, 30, 87, 131, 35, 124, + 96, 2, 3, 4, 52, 6, 105, 118, 126, 127, + 120, 132, 121, 180, 122, 123, 90, 133, 125, 147, + 128, 130, 150, 151, 186, 53, 63, 16, 144, 134, + 135, 157, 70, 71, 148, 152, 153, 72, 169, 155, + 17, 18, 166, 168, 161, 179, 19, 77, 78, 79, + 149, 172, 182, 183, 188, 185, 160, 192, 190, 156, + 193, 195, 200, 191, 202, 201, 203, 207, 177, 196, + 208, 198, -5, 1, 100, 163, 69, 194, 92, 2, + 3, 4, 5, 6, 0, 184, 209, 69, 210, 7, + 0, 8, 9, 10, 197, 0, 11, 12, 13, 0, + 0, 0, 0, 14, 15, 16, 0, 0, 0, 206, + 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, + 0, 0, 0, -5, 19, 2, 3, 4, 52, 6, + 0, 70, 71, 0, 0, 7, 72, 8, 9, 10, + 75, 76, 0, 12, 13, 0, 77, 78, 79, 14, + 15, 16, 0, 2, 3, 4, 52, 6, 0, 0, 0, 0, 0, 0, 17, 18, 0, 0, 0, 63, 19, 2, 3, 4, 52, 6, 0, 53, 0, 16, 0, 7, 0, 8, 9, 10, 0, 0, 0, 12, 13, 0, 17, 18, 0, 14, 15, 16, 67, 0, - 0, 0, 2, 3, 4, 52, 6, 0, 70, 71, - 17, 18, 7, 72, 8, 9, 19, 75, 76, 0, - 12, 13, 0, 77, 78, 0, 14, 39, 16, 0, - 0, 0, 0, 0, 40, 0, 0, 0, 0, 41, - 0, 17, 18, 42, 43, 44, 45, 19, 70, 71, - 0, 46, 0, 72, 105, 73, 74, 75, 76, 0, - 70, 71, 98, 77, 78, 72, 0, 73, 74, 75, - 76, 0, 70, 71, 98, 77, 78, 72, 105, 73, - 74, 75, 76, 0, 70, 71, 0, 77, 78, 72, - 0, 73, 74, 75, 76, 0, 0, 0, 0, 77, - 78 + 0, 0, 2, 3, 4, 52, 6, 0, 0, 0, + 17, 18, 7, 0, 8, 9, 19, 0, 0, 0, + 12, 13, 0, 0, 0, 0, 14, 95, 16, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 17, 18, 0, 70, 71, 0, 19, 0, 72, + 39, 73, 74, 75, 76, 0, 0, 40, 0, 77, + 78, 79, 41, 0, 0, 0, 42, 43, 44, 45, + 70, 71, 0, 0, 46, 72, 106, 73, 74, 75, + 76, 0, 0, 0, 99, 77, 78, 79, 70, 71, + 0, 0, 0, 72, 0, 73, 74, 75, 76, 0, + 0, 0, 99, 77, 78, 79, 70, 71, 0, 0, + 0, 72, 106, 73, 74, 75, 76, 0, 0, 70, + 71, 77, 78, 79, 72, 0, 73, 74, 75, 76, + 0, 0, -54, -54, 77, 78, 79, -54, 0, 0, + 0, -54, -54, 0, 0, 35, 0, -54, -54, -54 }; static const yytype_int16 yycheck[] = { - 0, 5, 20, 65, 0, 67, 0, 15, 0, 158, - 15, 52, 13, 135, 11, 14, 138, 139, 17, 18, - 19, 18, 171, 0, 130, 147, 39, 40, 35, 28, - 27, 44, 154, 38, 35, 34, 35, 36, 45, 161, - 161, 54, 55, 51, 35, 36, 168, 169, 27, 171, - 29, 172, 36, 37, 53, 51, 35, 179, 129, 51, - 14, 10, 16, 185, 64, 187, 65, 66, 67, 175, + 0, 5, 20, 65, 132, 67, 0, 0, 0, 15, + 15, 160, 13, 36, 37, 14, 11, 131, 17, 18, + 19, 0, 51, 18, 173, 10, 53, 163, 57, 28, + 57, 52, 27, 38, 35, 34, 35, 36, 174, 27, + 154, 29, 10, 157, 158, 51, 35, 35, 14, 177, + 16, 35, 36, 11, 53, 169, 45, 53, 51, 51, + 10, 57, 10, 45, 64, 52, 65, 66, 67, 197, 64, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 202, 152, 204, 10, 155, 156, 104, 64, 92, 195, - 53, 52, 11, 56, 39, 40, 167, 96, 97, 44, - 104, 163, 22, 48, 49, 10, 105, 52, 51, 54, - 55, 53, 174, 56, 56, 10, 134, 116, 56, 39, - 40, 45, 193, 11, 44, 11, 46, 47, 48, 49, - 27, 52, 10, 34, 54, 55, 10, 27, 137, 56, - 11, 11, 11, 10, 148, 53, 53, 146, 51, 10, - 35, 10, 0, 1, 56, 10, 160, 32, 16, 7, - 8, 9, 10, 11, 163, 183, 15, 21, 34, 17, - 38, 19, 20, 21, 16, 174, 24, 25, 26, 16, - 16, 34, 186, 31, 32, 33, 32, 7, 8, 9, - 10, 11, 21, 16, 32, 21, 149, 197, 46, 47, - 64, 171, 47, 51, 52, 7, 8, 9, 10, 11, - -1, 31, -1, 33, -1, 17, -1, 19, 20, 21, - -1, -1, -1, 25, 26, -1, 46, 47, -1, 31, - 32, 33, 52, 7, 8, 9, 10, 11, -1, -1, + 79, 195, 57, 11, 11, 64, 27, 105, 52, 93, + 10, 7, 8, 9, 10, 11, 34, 57, 97, 98, + 10, 105, 11, 165, 11, 11, 27, 106, 10, 137, + 53, 53, 140, 141, 176, 31, 51, 33, 136, 118, + 10, 149, 39, 40, 35, 10, 57, 44, 156, 16, + 46, 47, 10, 32, 15, 163, 52, 54, 55, 56, + 139, 21, 170, 171, 38, 173, 150, 16, 34, 148, + 16, 34, 16, 181, 21, 32, 16, 32, 162, 187, + 21, 189, 0, 1, 64, 151, 165, 185, 47, 7, + 8, 9, 10, 11, -1, 173, 204, 176, 206, 17, + -1, 19, 20, 21, 188, -1, 24, 25, 26, -1, + -1, -1, -1, 31, 32, 33, -1, -1, -1, 199, + -1, -1, -1, -1, -1, -1, -1, -1, 46, 47, + -1, -1, -1, 51, 52, 7, 8, 9, 10, 11, + -1, 39, 40, -1, -1, 17, 44, 19, 20, 21, + 48, 49, -1, 25, 26, -1, 54, 55, 56, 31, + 32, 33, -1, 7, 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, 46, 47, -1, -1, -1, 51, 52, 7, 8, 9, 10, 11, -1, 31, -1, 33, -1, 17, -1, 19, 20, 21, -1, -1, -1, 25, 26, -1, 46, 47, -1, 31, 32, 33, 52, -1, - -1, -1, 7, 8, 9, 10, 11, -1, 39, 40, - 46, 47, 17, 44, 19, 20, 52, 48, 49, -1, - 25, 26, -1, 54, 55, -1, 31, 11, 33, -1, - -1, -1, -1, -1, 18, -1, -1, -1, -1, 23, - -1, 46, 47, 27, 28, 29, 30, 52, 39, 40, - -1, 35, -1, 44, 45, 46, 47, 48, 49, -1, - 39, 40, 53, 54, 55, 44, -1, 46, 47, 48, - 49, -1, 39, 40, 53, 54, 55, 44, 45, 46, - 47, 48, 49, -1, 39, 40, -1, 54, 55, 44, - -1, 46, 47, 48, 49, -1, -1, -1, -1, 54, - 55 + -1, -1, 7, 8, 9, 10, 11, -1, -1, -1, + 46, 47, 17, -1, 19, 20, 52, -1, -1, -1, + 25, 26, -1, -1, -1, -1, 31, 22, 33, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 46, 47, -1, 39, 40, -1, 52, -1, 44, + 11, 46, 47, 48, 49, -1, -1, 18, -1, 54, + 55, 56, 23, -1, -1, -1, 27, 28, 29, 30, + 39, 40, -1, -1, 35, 44, 45, 46, 47, 48, + 49, -1, -1, -1, 53, 54, 55, 56, 39, 40, + -1, -1, -1, 44, -1, 46, 47, 48, 49, -1, + -1, -1, 53, 54, 55, 56, 39, 40, -1, -1, + -1, 44, 45, 46, 47, 48, 49, -1, -1, 39, + 40, 54, 55, 56, 44, -1, 46, 47, 48, 49, + -1, -1, 39, 40, 54, 55, 56, 44, -1, -1, + -1, 48, 49, -1, -1, 52, -1, 54, 55, 56 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -796,25 +813,26 @@ static const yytype_uint8 yystos[] = { 0, 1, 7, 8, 9, 10, 11, 17, 19, 20, 21, 24, 25, 26, 31, 32, 33, 46, 47, 52, - 58, 60, 61, 62, 63, 64, 71, 72, 73, 78, - 79, 81, 84, 88, 52, 52, 75, 10, 80, 11, - 18, 23, 27, 28, 29, 30, 35, 82, 83, 10, - 11, 10, 10, 31, 61, 78, 36, 37, 10, 78, - 78, 78, 0, 51, 59, 52, 45, 52, 70, 78, - 39, 40, 44, 46, 47, 48, 49, 54, 55, 78, - 89, 89, 89, 56, 11, 11, 27, 11, 18, 27, - 35, 83, 85, 78, 22, 10, 35, 45, 53, 60, - 70, 78, 70, 78, 34, 45, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 53, 56, 53, 10, 11, - 11, 11, 75, 10, 78, 78, 53, 76, 53, 59, - 75, 78, 78, 10, 86, 77, 13, 35, 77, 62, - 79, 56, 59, 59, 63, 76, 35, 78, 76, 76, - 10, 56, 87, 16, 78, 76, 14, 16, 75, 15, - 38, 67, 68, 74, 10, 77, 32, 76, 77, 77, - 21, 66, 67, 69, 74, 75, 68, 76, 70, 77, - 76, 76, 69, 76, 70, 62, 38, 65, 34, 76, - 16, 16, 59, 34, 76, 75, 76, 75, 16, 32, - 21, 16, 77, 62, 63, 32, 21, 76, 76 + 59, 61, 62, 63, 64, 65, 72, 73, 74, 79, + 80, 82, 85, 89, 52, 52, 76, 10, 81, 11, + 18, 23, 27, 28, 29, 30, 35, 83, 84, 10, + 11, 10, 10, 31, 62, 79, 36, 37, 10, 79, + 79, 79, 0, 51, 60, 52, 45, 52, 71, 79, + 39, 40, 44, 46, 47, 48, 49, 54, 55, 56, + 79, 90, 90, 90, 57, 11, 11, 27, 11, 18, + 27, 35, 84, 86, 79, 22, 10, 35, 45, 53, + 61, 71, 79, 71, 79, 34, 45, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 53, 57, 53, + 10, 11, 11, 11, 76, 10, 79, 79, 53, 77, + 53, 60, 76, 79, 79, 10, 87, 78, 13, 35, + 78, 63, 80, 57, 60, 60, 64, 77, 35, 79, + 77, 77, 10, 57, 88, 16, 79, 77, 14, 16, + 76, 15, 38, 68, 69, 75, 10, 78, 32, 77, + 78, 78, 21, 67, 68, 70, 75, 76, 69, 77, + 71, 78, 77, 77, 70, 77, 71, 63, 38, 66, + 34, 77, 16, 16, 60, 34, 77, 76, 77, 76, + 16, 32, 21, 16, 78, 63, 64, 32, 21, 77, + 77 }; #define yyerrok (yyerrstatus = 0) @@ -1989,67 +2007,72 @@ yyreduce: case 65: #line 337 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = (yyvsp[(2) - (2)].code); ;} + { g_lingo->code1(g_lingo->c_ampersand); ;} break; case 66: #line 338 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} + { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; case 67: #line 339 "engines/director/lingo/lingo-gr.y" - { (yyval.code) = (yyvsp[(2) - (3)].code); ;} + { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; case 68: -#line 342 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} +#line 340 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; case 69: #line 343 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} + { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} break; case 70: #line 344 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} + break; + + case 71: +#line 345 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; - case 72: -#line 346 "engines/director/lingo/lingo-gr.y" + case 73: +#line 347 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); ;} break; - case 74: -#line 351 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} - break; - case 75: #line 352 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} + { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; case 76: -#line 363 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_gotoloop); ;} +#line 353 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} break; case 77: #line 364 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_gotonext); ;} + { g_lingo->code1(g_lingo->c_gotoloop); ;} break; case 78: #line 365 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_gotoprevious); ;} + { g_lingo->code1(g_lingo->c_gotonext); ;} break; case 79: #line 366 "engines/director/lingo/lingo-gr.y" + { g_lingo->code1(g_lingo->c_gotoprevious); ;} + break; + + case 80: +#line 367 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -2057,8 +2080,8 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 80: -#line 371 "engines/director/lingo/lingo-gr.y" + case 81: +#line 372 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -2067,8 +2090,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 81: -#line 377 "engines/director/lingo/lingo-gr.y" + case 82: +#line 378 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -2076,14 +2099,9 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 82: -#line 384 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(3) - (3)].s); ;} - break; - case 83: #line 385 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(2) - (2)].s); ;} + { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 84: @@ -2093,31 +2111,36 @@ yyreduce: case 85: #line 387 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(1) - (1)].s); ;} + { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 86: -#line 390 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(3) - (3)].s); ;} +#line 388 "engines/director/lingo/lingo-gr.y" + { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; case 87: #line 391 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(2) - (2)].s); ;} + { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 88: #line 392 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(3) - (3)].s); ;} + { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 89: -#line 420 "engines/director/lingo/lingo-gr.y" - { g_lingo->_indef = true; ;} +#line 393 "engines/director/lingo/lingo-gr.y" + { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 90: #line 421 "engines/director/lingo/lingo-gr.y" + { g_lingo->_indef = true; ;} + break; + + case 91: +#line 422 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); @@ -2125,33 +2148,33 @@ yyreduce: g_lingo->_indef = false; ;} break; - case 91: -#line 427 "engines/director/lingo/lingo-gr.y" - { (yyval.narg) = 0; ;} - break; - case 92: #line 428 "engines/director/lingo/lingo-gr.y" - { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} + { (yyval.narg) = 0; ;} break; case 93: #line 429 "engines/director/lingo/lingo-gr.y" - { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} + { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; case 94: #line 430 "engines/director/lingo/lingo-gr.y" - { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} + { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; case 95: -#line 432 "engines/director/lingo/lingo-gr.y" - { g_lingo->codeArgStore(); ;} +#line 431 "engines/director/lingo/lingo-gr.y" + { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; case 96: -#line 435 "engines/director/lingo/lingo-gr.y" +#line 433 "engines/director/lingo/lingo-gr.y" + { g_lingo->codeArgStore(); ;} + break; + + case 97: +#line 436 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2160,24 +2183,24 @@ yyreduce: g_lingo->code1(numpar); ;} break; - case 97: -#line 443 "engines/director/lingo/lingo-gr.y" - { (yyval.narg) = 0; ;} - break; - case 98: #line 444 "engines/director/lingo/lingo-gr.y" - { (yyval.narg) = 1; ;} + { (yyval.narg) = 0; ;} break; case 99: #line 445 "engines/director/lingo/lingo-gr.y" + { (yyval.narg) = 1; ;} + break; + + case 100: +#line 446 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2181 "engines/director/lingo/lingo-gr.cpp" +#line 2204 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2391,6 +2414,6 @@ yyreturn: } -#line 448 "engines/director/lingo/lingo-gr.y" +#line 449 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index b76000af32..002b4546f6 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -334,6 +334,7 @@ expr: INT { | expr tNEQ expr { g_lingo->code1(g_lingo->c_neq); } | expr tGE expr { g_lingo->code1(g_lingo->c_ge); } | expr tLE expr { g_lingo->code1(g_lingo->c_le); } + | expr '&' expr { g_lingo->code1(g_lingo->c_ampersand); } | '+' expr %prec UNARY { $$ = $2; } | '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->c_negate); } | '(' expr ')' { $$ = $2; } diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 60ae1231f1..76a11bea56 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -397,7 +397,7 @@ static yyconst flex_int32_t yy_ec[256] = 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, 5, 6, 7, 1, 1, 8, 1, 1, 8, + 1, 5, 6, 7, 1, 1, 8, 8, 1, 8, 8, 8, 8, 8, 9, 10, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 1, 12, 13, 14, 1, 1, 15, 16, 17, 18, 19, 20, diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index c3ae83ceef..7b04c6b472 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -51,7 +51,7 @@ identifier [_[:alpha:]][_[:alnum:]]* constfloat [[:digit:]]+\.[[:digit:]]* constinteger [[:digit:]]+ conststring \"[^\"\n]*\" -operator [-+*/%=^:,()><] +operator [-+*/%=^:,()><&] newline [ \t]*[\n\r]+ whitespace [\t ] diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index cc9f0acdf7..f6aa565327 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -81,10 +81,10 @@ struct Symbol { /* symbol table entry */ char *name; int type; union { - int val; /* VAR */ - float fval; /* FLOAT */ - ScriptData *defn; /* FUNCTION, PROCEDURE */ - char *str; /* STRING */ + int val; /* VAR */ + float fval; /* FLOAT */ + ScriptData *defn; /* FUNCTION, PROCEDURE */ + Common::String *str; /* STRING */ } u; int nargs; bool global; @@ -172,11 +172,14 @@ public: static void c_xpop(); static void c_printtop(); + static void c_add(); static void c_sub(); static void c_mul(); static void c_div(); static void c_negate(); + static void c_ampersand(); + static void c_constpush(); static void c_fconstpush(); static void c_stringpush(); |