diff options
author | Eugene Sandulenko | 2016-07-06 21:11:40 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 2415a4cb419a2b877ca8868871fddd4cb878b7ff (patch) | |
tree | 6adc372f67652b10fdf437ae070d224418a7812d | |
parent | a6ded367c831152252138ba2981be88f48401886 (diff) | |
download | scummvm-rg350-2415a4cb419a2b877ca8868871fddd4cb878b7ff.tar.gz scummvm-rg350-2415a4cb419a2b877ca8868871fddd4cb878b7ff.tar.bz2 scummvm-rg350-2415a4cb419a2b877ca8868871fddd4cb878b7ff.zip |
DIRECTOR: Lingo: Fix mixing of one-line and multi-line ifs
-rw-r--r-- | engines/director/director.cpp | 3 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 812 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.h | 32 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 44 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 346 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 3 |
6 files changed, 632 insertions, 608 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index cc39573f99..539846a416 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -110,7 +110,8 @@ Common::Error DirectorEngine::run() { _lingo->addCode("--\n\ set x = 1\n\ - if 5 then exit\n\ + if x = 5 then exit\n\ + else put 10.0\n\ repeat with x = 1 to 5\n\ if x = 1 then\n\ put 1\n\ diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index c647d59883..50370daed5 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -78,7 +78,7 @@ HANDLER = 267, tDOWN = 268, tELSE = 269, - tELSIF = 270, + tNLELSIF = 270, tEND = 271, tEXIT = 272, tFRAME = 273, @@ -101,12 +101,13 @@ tTO = 290, tWITH = 291, tWHILE = 292, - tGE = 293, - tLE = 294, - tGT = 295, - tLT = 296, - tEQ = 297, - tNEQ = 298 + tNLELSE = 293, + tGE = 294, + tLE = 295, + tGT = 296, + tLT = 297, + tEQ = 298, + tNEQ = 299 }; #endif /* Tokens. */ @@ -122,7 +123,7 @@ #define HANDLER 267 #define tDOWN 268 #define tELSE 269 -#define tELSIF 270 +#define tNLELSIF 270 #define tEND 271 #define tEXIT 272 #define tFRAME 273 @@ -145,12 +146,13 @@ #define tTO 290 #define tWITH 291 #define tWHILE 292 -#define tGE 293 -#define tLE 294 -#define tGT 295 -#define tLT 296 -#define tEQ 297 -#define tNEQ 298 +#define tNLELSE 293 +#define tGE 294 +#define tLE 295 +#define tGT 296 +#define tLT 297 +#define tEQ 298 +#define tNEQ 299 @@ -202,7 +204,7 @@ typedef union YYSTYPE int narg; /* number of arguments */ } /* Line 193 of yacc.c. */ -#line 206 "engines/director/lingo/lingo-gr.cpp" +#line 208 "engines/director/lingo/lingo-gr.cpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -215,7 +217,7 @@ typedef union YYSTYPE /* Line 216 of yacc.c. */ -#line 219 "engines/director/lingo/lingo-gr.cpp" +#line 221 "engines/director/lingo/lingo-gr.cpp" #ifdef short # undef short @@ -428,22 +430,22 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 60 +#define YYFINAL 61 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 336 +#define YYLAST 389 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 56 +#define YYNTOKENS 57 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 28 +#define YYNNTS 30 /* YYNRULES -- Number of rules. */ -#define YYNRULES 90 +#define YYNRULES 92 /* YYNRULES -- Number of states. */ #define YYNSTATES 195 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 298 +#define YYMAXUTOK 299 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -452,12 +454,12 @@ union yyalloc static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 50, 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, 49, 2, 2, - 51, 52, 47, 45, 55, 46, 2, 48, 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, 2, 2, 2, - 54, 44, 53, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -480,7 +482,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, 42, 43 + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 }; #if YYDEBUG @@ -489,70 +491,69 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint16 yyprhs[] = { 0, 0, 3, 7, 9, 10, 12, 14, 16, 18, - 20, 22, 27, 32, 37, 39, 41, 43, 52, 64, - 77, 86, 94, 106, 119, 131, 134, 136, 144, 150, - 152, 156, 160, 163, 167, 169, 171, 172, 173, 174, - 177, 180, 182, 184, 189, 194, 196, 198, 202, 206, - 210, 214, 218, 222, 226, 230, 234, 237, 240, 244, - 247, 250, 253, 255, 257, 260, 262, 266, 269, 272, - 275, 278, 282, 285, 289, 292, 295, 297, 301, 304, - 308, 309, 318, 319, 321, 325, 330, 331, 335, 336, - 338 + 20, 22, 27, 32, 37, 39, 41, 43, 45, 54, + 66, 79, 88, 100, 112, 121, 122, 126, 129, 131, + 139, 145, 147, 151, 155, 158, 162, 164, 166, 167, + 168, 169, 172, 175, 177, 179, 184, 189, 191, 193, + 197, 201, 205, 209, 213, 217, 221, 225, 229, 232, + 235, 239, 242, 245, 248, 250, 252, 255, 257, 261, + 264, 267, 270, 273, 277, 280, 284, 287, 290, 292, + 296, 299, 303, 304, 313, 314, 316, 320, 325, 326, + 330, 331, 333 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 57, 0, -1, 57, 50, 58, -1, 58, -1, -1, - 78, -1, 73, -1, 82, -1, 59, -1, 60, -1, - 1, -1, 31, 72, 22, 10, -1, 33, 10, 44, - 72, -1, 33, 10, 35, 72, -1, 72, -1, 73, - -1, 61, -1, 65, 51, 64, 52, 71, 70, 16, - 32, -1, 66, 44, 72, 70, 35, 72, 70, 71, - 70, 16, 32, -1, 66, 44, 72, 70, 13, 35, - 72, 70, 71, 70, 16, 32, -1, 67, 64, 34, - 50, 71, 70, 16, 21, -1, 67, 64, 34, 69, - 60, 70, 50, -1, 67, 64, 34, 50, 71, 70, - 14, 71, 70, 16, 21, -1, 67, 64, 34, 69, - 60, 70, 50, 14, 69, 60, 70, 50, -1, 67, - 64, 34, 50, 71, 70, 69, 62, 70, 16, 21, - -1, 62, 63, -1, 63, -1, 68, 64, 34, 69, - 60, 70, 50, -1, 68, 64, 34, 71, 70, -1, - 72, -1, 72, 44, 72, -1, 51, 64, 52, -1, - 32, 37, -1, 32, 36, 10, -1, 21, -1, 15, - -1, -1, -1, -1, 71, 50, -1, 71, 60, -1, - 7, -1, 8, -1, 9, 51, 83, 52, -1, 10, - 51, 83, 52, -1, 10, -1, 59, -1, 72, 45, - 72, -1, 72, 46, 72, -1, 72, 47, 72, -1, - 72, 48, 72, -1, 72, 53, 72, -1, 72, 54, - 72, -1, 72, 43, 72, -1, 72, 38, 72, -1, - 72, 39, 72, -1, 45, 72, -1, 46, 72, -1, - 51, 72, 52, -1, 25, 11, -1, 26, 10, -1, - 31, 72, -1, 75, -1, 17, -1, 19, 74, -1, - 10, -1, 74, 55, 10, -1, 20, 23, -1, 20, - 28, -1, 20, 30, -1, 20, 76, -1, 20, 76, - 77, -1, 20, 77, -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, 79, 69, 80, 50, 81, 71, -1, -1, 10, - -1, 80, 55, 10, -1, 80, 50, 55, 10, -1, - -1, 10, 69, 83, -1, -1, 72, -1, 83, 55, - 72, -1 + 58, 0, -1, 58, 51, 59, -1, 59, -1, -1, + 81, -1, 76, -1, 85, -1, 60, -1, 62, -1, + 1, -1, 31, 75, 22, 10, -1, 33, 10, 45, + 75, -1, 33, 10, 35, 75, -1, 75, -1, 76, + -1, 61, -1, 63, -1, 68, 52, 67, 53, 74, + 73, 16, 32, -1, 69, 45, 75, 73, 35, 75, + 73, 74, 73, 16, 32, -1, 69, 45, 75, 73, + 13, 35, 75, 73, 74, 73, 16, 32, -1, 70, + 67, 34, 51, 74, 73, 16, 21, -1, 70, 67, + 34, 51, 74, 73, 14, 74, 73, 16, 21, -1, + 70, 67, 34, 51, 74, 73, 72, 65, 73, 16, + 21, -1, 70, 67, 34, 72, 61, 73, 64, 73, + -1, -1, 38, 72, 61, -1, 65, 66, -1, 66, + -1, 71, 67, 34, 72, 62, 73, 51, -1, 71, + 67, 34, 74, 73, -1, 75, -1, 75, 45, 75, + -1, 52, 67, 53, -1, 32, 37, -1, 32, 36, + 10, -1, 21, -1, 15, -1, -1, -1, -1, 74, + 51, -1, 74, 62, -1, 7, -1, 8, -1, 9, + 52, 86, 53, -1, 10, 52, 86, 53, -1, 10, + -1, 60, -1, 75, 46, 75, -1, 75, 47, 75, + -1, 75, 48, 75, -1, 75, 49, 75, -1, 75, + 54, 75, -1, 75, 55, 75, -1, 75, 44, 75, + -1, 75, 39, 75, -1, 75, 40, 75, -1, 46, + 75, -1, 47, 75, -1, 52, 75, 53, -1, 25, + 11, -1, 26, 10, -1, 31, 75, -1, 78, -1, + 17, -1, 19, 77, -1, 10, -1, 77, 56, 10, + -1, 20, 23, -1, 20, 28, -1, 20, 30, -1, + 20, 79, -1, 20, 79, 80, -1, 20, 80, -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, 82, 72, 83, 51, + 84, 74, -1, -1, 10, -1, 83, 56, 10, -1, + 83, 51, 56, 10, -1, -1, 10, 72, 86, -1, + -1, 75, -1, 86, 56, 75, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 93, 93, 94, 97, 98, 99, 100, 101, 102, - 103, 106, 112, 118, 126, 127, 128, 133, 144, 160, - 174, 181, 189, 198, 208, 219, 220, 223, 229, 237, - 238, 239, 241, 243, 249, 255, 262, 264, 266, 267, - 268, 271, 276, 279, 285, 293, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 311, - 312, 313, 314, 315, 317, 320, 321, 332, 333, 334, - 335, 340, 346, 353, 354, 355, 356, 359, 360, 361, - 389, 389, 396, 397, 398, 399, 401, 404, 412, 413, - 414 + 103, 106, 112, 118, 125, 126, 128, 129, 134, 145, + 161, 175, 182, 191, 200, 211, 212, 215, 216, 219, + 225, 233, 234, 235, 237, 239, 245, 251, 258, 260, + 262, 263, 264, 267, 272, 275, 281, 289, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 307, 308, 309, 310, 311, 313, 316, 317, 328, + 329, 330, 331, 336, 342, 349, 350, 351, 352, 355, + 356, 357, 385, 385, 392, 393, 394, 395, 397, 400, + 408, 409, 410 }; #endif @@ -562,16 +563,17 @@ static const yytype_uint16 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT", - "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tELSIF", - "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", "ifstmt", "elseifstmt", "elseifstmt1", - "cond", "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", - "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe", - "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0 + "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", + "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", + "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", + "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", + "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", + "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", + "','", "$accept", "program", "programline", "asgn", "stmtoneliner", + "stmt", "ifstmt", "elsestmt", "elseifstmt", "elseifstmt1", "cond", + "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist", + "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie", + "defn", "@1", "argdef", "argstore", "macro", "arglist", 0 }; #endif @@ -584,39 +586,39 @@ 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, 297, 298, 61, 43, 45, 42, 47, 37, - 10, 40, 41, 62, 60, 44 + 295, 296, 297, 298, 299, 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, 56, 57, 57, 58, 58, 58, 58, 58, 58, - 58, 59, 59, 59, 60, 60, 60, 60, 60, 60, - 61, 61, 61, 61, 61, 62, 62, 63, 63, 64, - 64, 64, 65, 66, 67, 68, 69, 70, 71, 71, - 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, - 73, 73, 73, 73, 73, 74, 74, 75, 75, 75, - 75, 75, 75, 76, 76, 76, 76, 77, 77, 77, - 79, 78, 80, 80, 80, 80, 81, 82, 83, 83, - 83 + 0, 57, 58, 58, 59, 59, 59, 59, 59, 59, + 59, 60, 60, 60, 61, 61, 62, 62, 62, 62, + 62, 63, 63, 63, 63, 64, 64, 65, 65, 66, + 66, 67, 67, 67, 68, 69, 70, 71, 72, 73, + 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 76, 76, 76, 76, 76, 76, 77, 77, 78, + 78, 78, 78, 78, 78, 79, 79, 79, 79, 80, + 80, 80, 82, 81, 83, 83, 83, 83, 84, 85, + 86, 86, 86 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 3, 1, 0, 1, 1, 1, 1, 1, - 1, 4, 4, 4, 1, 1, 1, 8, 11, 12, - 8, 7, 11, 12, 11, 2, 1, 7, 5, 1, - 3, 3, 2, 3, 1, 1, 0, 0, 0, 2, - 2, 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 + 1, 4, 4, 4, 1, 1, 1, 1, 8, 11, + 12, 8, 11, 11, 8, 0, 3, 2, 1, 7, + 5, 1, 3, 3, 2, 3, 1, 1, 0, 0, + 0, 2, 2, 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 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -624,150 +626,160 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 10, 41, 42, 0, 36, 63, 0, 0, 34, + 0, 10, 43, 44, 0, 38, 65, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 46, 9, 16, 0, 0, 0, 14, 6, 62, - 5, 7, 88, 88, 88, 65, 64, 76, 0, 67, - 0, 68, 0, 69, 0, 70, 72, 80, 59, 60, - 45, 0, 46, 61, 0, 32, 0, 56, 57, 0, - 1, 0, 0, 0, 0, 0, 29, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 89, 0, 0, 87, - 0, 74, 78, 0, 75, 0, 0, 0, 71, 36, - 0, 0, 33, 0, 0, 58, 2, 0, 37, 0, - 0, 36, 0, 54, 55, 53, 47, 48, 49, 50, - 51, 52, 43, 0, 44, 66, 77, 73, 79, 82, - 11, 13, 12, 38, 0, 31, 38, 0, 30, 90, - 83, 0, 37, 0, 0, 37, 37, 15, 86, 0, - 39, 40, 0, 0, 37, 36, 0, 0, 38, 84, - 0, 37, 38, 38, 0, 0, 21, 85, 81, 17, - 38, 37, 37, 20, 35, 37, 26, 0, 36, 37, - 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, - 36, 37, 0, 18, 22, 24, 0, 37, 0, 19, - 37, 28, 23, 0, 27 + 3, 48, 16, 9, 17, 0, 0, 0, 14, 6, + 64, 5, 7, 90, 90, 90, 67, 66, 78, 0, + 69, 0, 70, 0, 71, 0, 72, 74, 82, 61, + 62, 47, 0, 48, 63, 0, 34, 0, 58, 59, + 0, 1, 0, 0, 0, 0, 0, 31, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 91, 0, 0, + 89, 0, 76, 80, 0, 77, 0, 0, 0, 73, + 38, 0, 0, 35, 0, 0, 60, 2, 0, 39, + 0, 0, 38, 0, 56, 57, 55, 49, 50, 51, + 52, 53, 54, 45, 0, 46, 68, 79, 75, 81, + 84, 11, 13, 12, 40, 0, 33, 40, 0, 32, + 92, 85, 0, 39, 0, 0, 39, 39, 15, 88, + 0, 41, 42, 0, 0, 39, 38, 25, 0, 40, + 86, 0, 39, 40, 40, 0, 0, 38, 39, 87, + 83, 18, 40, 39, 39, 21, 37, 39, 28, 0, + 0, 24, 39, 0, 0, 27, 0, 0, 26, 0, + 0, 0, 0, 38, 0, 19, 22, 23, 0, 39, + 20, 39, 30, 0, 29 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 19, 20, 52, 141, 23, 165, 166, 65, 24, - 25, 26, 167, 34, 124, 132, 27, 137, 36, 29, - 45, 46, 30, 89, 131, 148, 31, 77 + -1, 19, 20, 53, 22, 142, 24, 158, 167, 168, + 66, 25, 26, 27, 169, 35, 125, 133, 28, 138, + 37, 30, 46, 47, 31, 90, 132, 149, 32, 78 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -109 +#define YYPACT_NINF -123 static const yytype_int16 yypact[] = { - 133, -109, -109, -109, -8, 282, -109, 41, 192, -109, - 43, 20, 64, 70, -14, 72, 70, 70, 70, 5, - -109, 6, -109, -109, 45, 42, 163, 270, -109, -109, - -109, -109, 70, 70, 70, -109, 37, -109, 83, -109, - 88, -109, 75, -109, 80, -20, -109, -109, -109, -109, - 58, 70, -109, 221, 102, -109, -18, -4, -4, 246, - -109, 133, 163, 70, 163, 79, 258, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 270, 21, 35, 62, - 109, -109, -109, 111, -109, 112, 113, 93, -109, -109, - 221, 115, -109, 70, 70, -109, -109, 74, 270, 76, - 234, 81, 70, 270, 270, 270, -6, -6, -4, -4, - 270, 270, -109, 70, -109, -109, -109, -109, -109, 122, - -109, 270, 270, -109, -11, -109, -109, 225, 270, 270, - -109, -25, 180, 100, 70, 180, -109, -109, 82, 134, - -109, -109, 129, 70, 270, 22, 96, 137, -109, -109, - 116, 270, -109, -109, 128, 136, 141, -109, 180, -109, - -109, 180, 180, -109, -109, 136, -109, 163, -109, 180, - 140, 144, -109, 145, 135, 225, 147, 142, 146, 155, - 4, -109, 148, -109, -109, -109, 225, 180, 118, -109, - -109, -109, -109, 127, -109 + 124, -123, -123, -123, -45, 317, -123, 24, 277, -123, + 39, 43, 51, 152, 9, 64, 152, 152, 152, 2, + -123, 4, -123, -123, -123, 26, 12, 198, 305, -123, + -123, -123, -123, 152, 152, 152, -123, 29, -123, 76, + -123, 77, -123, 66, -123, -2, -3, -123, -123, -123, + -123, 42, 152, -123, 237, 81, -123, -12, -4, -4, + 281, -123, 124, 198, 152, 198, 61, 293, 152, 152, + 152, 152, 152, 152, 152, 152, 152, 305, -38, -15, + 40, 87, -123, -123, 89, -123, 90, 91, 79, -123, + -123, 237, 93, -123, 152, 152, -123, -123, 55, 305, + 60, 269, 53, 152, 305, 305, 305, 334, 334, -4, + -4, 305, 305, -123, 152, -123, -123, -123, -123, -123, + 105, -123, 305, 305, -123, -8, -123, -123, 247, 305, + 305, -123, -14, 170, 82, 152, 170, -123, -123, 62, + 106, -123, -123, 104, 152, 305, 63, 83, 112, -123, + -123, 94, 305, -123, -123, 102, 113, -123, -123, -123, + 170, -123, -123, 170, 170, -123, -123, 113, -123, 198, + 247, -123, 170, 111, 119, -123, 121, 95, -123, 126, + 108, 125, 130, 5, 115, -123, -123, -123, 216, 170, + -123, -123, -123, 101, -123 }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = +static const yytype_int8 yypgoto[] = { - -109, -109, 120, 10, 0, -109, -109, 17, -61, -109, - -109, -109, -109, -85, -51, -108, -5, 14, -109, -109, - -109, 150, -109, -109, -109, -109, -109, 71 + -123, -123, 92, 10, -122, 0, -123, -123, -123, -9, + -62, -123, -123, -123, -123, -71, -53, -110, -5, 14, + -123, -123, -123, 107, -123, -123, -123, -123, -123, 47 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -46 +#define YYTABLE_NINF -48 static const yytype_int16 yytable[] = { - 22, 97, 133, 99, 119, 60, -8, 40, 53, 42, - 21, 57, 58, 59, 28, 87, 127, 93, 135, -38, - -38, 66, 54, 55, 134, 138, 94, 76, 76, 76, - 139, 48, 67, 68, 67, 68, 153, 69, 154, 69, - 158, 72, 73, 32, 161, 162, 90, 74, 75, 74, - 75, 35, 169, 47, -38, 61, -8, 66, 98, 100, - 155, 22, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 21, 187, 112, 49, 28, 113, 2, 3, 4, - 50, 142, 56, 175, 145, 146, 63, 114, 121, 122, - 113, 84, 80, 152, 81, 186, 62, 128, 85, 82, - 160, 51, 83, 15, 78, 79, 174, 86, 129, 33, - 170, 171, 92, 101, 173, 16, 17, 113, 176, 115, - 86, 18, 116, 117, 118, 120, 123, 136, 125, 144, - 188, 126, 130, -4, 1, 143, 191, 147, 151, 193, - 2, 3, 4, 5, 149, 150, 156, 157, 159, 163, - 6, 164, 7, 8, 9, 168, 177, 10, 11, 12, - 178, 179, 66, 182, 13, 14, 15, 184, 192, 180, - 2, 3, 4, 50, 183, 181, 185, 194, 16, 17, - 189, 96, 172, -4, 18, 0, 190, 2, 3, 4, - 50, 0, 0, 0, 51, 88, 15, 6, 0, 7, - 8, 9, 0, 37, 0, 11, 12, 0, 16, 17, - 38, 13, 14, 15, 64, 39, 0, 0, 0, 40, - 41, 42, 43, 0, 0, 16, 17, 44, 0, 0, - 140, 18, 2, 3, 4, 50, 0, 0, 0, 0, - 0, 0, 6, 91, 7, 8, 9, 0, 0, 0, - 11, 12, 0, 0, 0, 0, 13, 14, 15, 67, - 68, 0, 0, 0, 69, 0, 70, 71, 72, 73, - 16, 17, 67, 68, 74, 75, 18, 69, 102, 70, - 71, 72, 73, 0, 67, 68, 95, 74, 75, 69, - 0, 70, 71, 72, 73, 0, 67, 68, 95, 74, - 75, 69, 102, 70, 71, 72, 73, 0, 67, 68, - 0, 74, 75, 69, 0, 70, 71, 72, 73, 0, - -45, -45, 0, 74, 75, -45, 0, 0, 0, -45, - -45, 0, 0, 33, 0, -45, -45 + 23, 98, 61, 100, -8, 134, 137, 33, 54, 85, + 21, 58, 59, 60, 29, 113, 86, 136, 114, 120, + -40, -40, 67, 94, 41, 87, 43, 135, 77, 77, + 77, 128, 88, 95, 36, 68, 69, 139, 115, 160, + 70, 114, 140, 163, 164, 55, 56, 91, 178, 48, + 75, 76, 172, 62, 49, -8, -40, 64, 67, 99, + 101, 50, 23, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 21, 189, 57, 156, 29, 154, 63, 155, + 143, 79, 80, 146, 147, 81, 170, 82, 83, 122, + 123, 93, 153, 84, 34, 102, 114, 116, 129, 162, + 117, 118, 119, 121, 127, 171, 87, 177, 124, 130, + 173, 174, 188, 126, 176, 131, 150, 144, 148, 179, + 151, 157, 159, 165, -4, 1, 161, 180, 166, 183, + 145, 2, 3, 4, 5, 181, 192, 182, 193, 152, + 185, 6, 184, 7, 8, 9, 186, 190, 10, 11, + 12, 187, 194, 89, 97, 13, 14, 15, 175, 2, + 3, 4, 51, 0, 67, 0, 0, 0, 0, 0, + 16, 17, 0, 0, 0, -4, 18, 2, 3, 4, + 51, 0, 0, 52, 0, 15, 0, 6, 191, 7, + 8, 9, 0, 0, 0, 11, 12, 0, 16, 17, + 0, 13, 14, 15, 18, 2, 3, 4, 51, 0, + 0, 0, 0, 0, 0, 0, 16, 17, 0, 0, + 0, 141, 18, 2, 3, 4, 51, 0, 0, 52, + 0, 15, 0, 6, 0, 7, 8, 9, 0, 0, + 0, 11, 12, 0, 16, 17, 0, 13, 14, 15, + 65, 0, 0, 0, 2, 3, 4, 51, 0, 92, + 0, 0, 16, 17, 6, 0, 7, 8, 18, 0, + 0, 0, 11, 12, 0, 0, 68, 69, 13, 0, + 15, 70, 0, 71, 72, 73, 74, 0, 38, 0, + 0, 75, 76, 16, 17, 39, 0, 0, 0, 18, + 40, 0, 0, 0, 41, 42, 43, 44, 68, 69, + 0, 0, 45, 70, 103, 71, 72, 73, 74, 0, + 68, 69, 96, 75, 76, 70, 0, 71, 72, 73, + 74, 0, 68, 69, 96, 75, 76, 70, 103, 71, + 72, 73, 74, 0, 68, 69, 0, 75, 76, 70, + 0, 71, 72, 73, 74, 0, -47, -47, 0, 75, + 76, -47, 0, 0, 0, -47, -47, 0, 0, 34, + 0, -47, -47, 68, 69, 0, 0, 0, 70, 0, + 0, 0, 73, 74, 0, 0, 0, 0, 75, 76 }; static const yytype_int16 yycheck[] = { - 0, 62, 13, 64, 89, 0, 0, 27, 13, 29, - 0, 16, 17, 18, 0, 35, 101, 35, 126, 15, - 16, 26, 36, 37, 35, 50, 44, 32, 33, 34, - 55, 11, 38, 39, 38, 39, 14, 43, 16, 43, - 148, 47, 48, 51, 152, 153, 51, 53, 54, 53, - 54, 10, 160, 10, 50, 50, 50, 62, 63, 64, - 145, 61, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 61, 180, 52, 10, 61, 55, 7, 8, 9, - 10, 132, 10, 168, 135, 136, 44, 52, 93, 94, - 55, 11, 55, 144, 11, 180, 51, 102, 18, 11, - 151, 31, 27, 33, 33, 34, 167, 27, 113, 51, - 161, 162, 10, 34, 165, 45, 46, 55, 169, 10, - 27, 51, 11, 11, 11, 10, 52, 127, 52, 134, - 181, 50, 10, 0, 1, 35, 187, 55, 143, 190, - 7, 8, 9, 10, 10, 16, 50, 10, 32, 21, - 17, 15, 19, 20, 21, 14, 16, 24, 25, 26, - 16, 16, 167, 16, 31, 32, 33, 21, 50, 34, - 7, 8, 9, 10, 32, 175, 21, 50, 45, 46, - 32, 61, 165, 50, 51, -1, 186, 7, 8, 9, - 10, -1, -1, -1, 31, 45, 33, 17, -1, 19, - 20, 21, -1, 11, -1, 25, 26, -1, 45, 46, - 18, 31, 32, 33, 51, 23, -1, -1, -1, 27, - 28, 29, 30, -1, -1, 45, 46, 35, -1, -1, - 50, 51, 7, 8, 9, 10, -1, -1, -1, -1, - -1, -1, 17, 22, 19, 20, 21, -1, -1, -1, - 25, 26, -1, -1, -1, -1, 31, 32, 33, 38, - 39, -1, -1, -1, 43, -1, 45, 46, 47, 48, - 45, 46, 38, 39, 53, 54, 51, 43, 44, 45, - 46, 47, 48, -1, 38, 39, 52, 53, 54, 43, - -1, 45, 46, 47, 48, -1, 38, 39, 52, 53, - 54, 43, 44, 45, 46, 47, 48, -1, 38, 39, - -1, 53, 54, 43, -1, 45, 46, 47, 48, -1, - 38, 39, -1, 53, 54, 43, -1, -1, -1, 47, - 48, -1, -1, 51, -1, 53, 54 + 0, 63, 0, 65, 0, 13, 128, 52, 13, 11, + 0, 16, 17, 18, 0, 53, 18, 127, 56, 90, + 15, 16, 27, 35, 27, 27, 29, 35, 33, 34, + 35, 102, 35, 45, 10, 39, 40, 51, 53, 149, + 44, 56, 56, 153, 154, 36, 37, 52, 170, 10, + 54, 55, 162, 51, 11, 51, 51, 45, 63, 64, + 65, 10, 62, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 62, 183, 10, 146, 62, 14, 52, 16, + 133, 34, 35, 136, 137, 56, 157, 11, 11, 94, + 95, 10, 145, 27, 52, 34, 56, 10, 103, 152, + 11, 11, 11, 10, 51, 158, 27, 169, 53, 114, + 163, 164, 183, 53, 167, 10, 10, 35, 56, 172, + 16, 38, 10, 21, 0, 1, 32, 16, 15, 34, + 135, 7, 8, 9, 10, 16, 189, 16, 191, 144, + 32, 17, 16, 19, 20, 21, 21, 32, 24, 25, + 26, 21, 51, 46, 62, 31, 32, 33, 167, 7, + 8, 9, 10, -1, 169, -1, -1, -1, -1, -1, + 46, 47, -1, -1, -1, 51, 52, 7, 8, 9, + 10, -1, -1, 31, -1, 33, -1, 17, 188, 19, + 20, 21, -1, -1, -1, 25, 26, -1, 46, 47, + -1, 31, 32, 33, 52, 7, 8, 9, 10, -1, + -1, -1, -1, -1, -1, -1, 46, 47, -1, -1, + -1, 51, 52, 7, 8, 9, 10, -1, -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, -1, 22, + -1, -1, 46, 47, 17, -1, 19, 20, 52, -1, + -1, -1, 25, 26, -1, -1, 39, 40, 31, -1, + 33, 44, -1, 46, 47, 48, 49, -1, 11, -1, + -1, 54, 55, 46, 47, 18, -1, -1, -1, 52, + 23, -1, -1, -1, 27, 28, 29, 30, 39, 40, + -1, -1, 35, 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, 39, 40, -1, 54, + 55, 44, -1, -1, -1, 48, 49, -1, -1, 52, + -1, 54, 55, 39, 40, -1, -1, -1, 44, -1, + -1, -1, 48, 49, -1, -1, -1, -1, 54, 55 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -775,25 +787,25 @@ static const yytype_int16 yycheck[] = static const yytype_uint8 yystos[] = { 0, 1, 7, 8, 9, 10, 17, 19, 20, 21, - 24, 25, 26, 31, 32, 33, 45, 46, 51, 57, - 58, 59, 60, 61, 65, 66, 67, 72, 73, 75, - 78, 82, 51, 51, 69, 10, 74, 11, 18, 23, - 27, 28, 29, 30, 35, 76, 77, 10, 11, 10, - 10, 31, 59, 72, 36, 37, 10, 72, 72, 72, - 0, 50, 51, 44, 51, 64, 72, 38, 39, 43, - 45, 46, 47, 48, 53, 54, 72, 83, 83, 83, - 55, 11, 11, 27, 11, 18, 27, 35, 77, 79, - 72, 22, 10, 35, 44, 52, 58, 64, 72, 64, - 72, 34, 44, 72, 72, 72, 72, 72, 72, 72, - 72, 72, 52, 55, 52, 10, 11, 11, 11, 69, - 10, 72, 72, 52, 70, 52, 50, 69, 72, 72, - 10, 80, 71, 13, 35, 71, 60, 73, 50, 55, - 50, 60, 70, 35, 72, 70, 70, 55, 81, 10, - 16, 72, 70, 14, 16, 69, 50, 10, 71, 32, - 70, 71, 71, 21, 15, 62, 63, 68, 14, 71, - 70, 70, 63, 70, 64, 69, 70, 16, 16, 16, - 34, 60, 16, 32, 21, 21, 69, 71, 70, 32, - 60, 70, 50, 70, 50 + 24, 25, 26, 31, 32, 33, 46, 47, 52, 58, + 59, 60, 61, 62, 63, 68, 69, 70, 75, 76, + 78, 81, 85, 52, 52, 72, 10, 77, 11, 18, + 23, 27, 28, 29, 30, 35, 79, 80, 10, 11, + 10, 10, 31, 60, 75, 36, 37, 10, 75, 75, + 75, 0, 51, 52, 45, 52, 67, 75, 39, 40, + 44, 46, 47, 48, 49, 54, 55, 75, 86, 86, + 86, 56, 11, 11, 27, 11, 18, 27, 35, 80, + 82, 75, 22, 10, 35, 45, 53, 59, 67, 75, + 67, 75, 34, 45, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 53, 56, 53, 10, 11, 11, 11, + 72, 10, 75, 75, 53, 73, 53, 51, 72, 75, + 75, 10, 83, 74, 13, 35, 74, 61, 76, 51, + 56, 51, 62, 73, 35, 75, 73, 73, 56, 84, + 10, 16, 75, 73, 14, 16, 72, 38, 64, 10, + 74, 32, 73, 74, 74, 21, 15, 65, 66, 71, + 72, 73, 74, 73, 73, 66, 73, 67, 61, 73, + 16, 16, 16, 34, 16, 32, 21, 21, 72, 74, + 32, 62, 73, 73, 51 }; #define yyerrok (yyerrstatus = 0) @@ -1648,12 +1660,12 @@ yyreduce: break; case 14: -#line 126 "engines/director/lingo/lingo-gr.y" +#line 125 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_xpop); ;} break; - case 17: -#line 133 "engines/director/lingo/lingo-gr.y" + case 18: +#line 134 "engines/director/lingo/lingo-gr.y" { inst body = 0, end = 0; WRITE_UINT32(&body, (yyvsp[(5) - (8)].code)); @@ -1662,8 +1674,8 @@ yyreduce: (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;} break; - case 18: -#line 144 "engines/director/lingo/lingo-gr.y" + case 19: +#line 145 "engines/director/lingo/lingo-gr.y" { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; WRITE_UINT32(&init, (yyvsp[(3) - (11)].code)); @@ -1678,8 +1690,8 @@ yyreduce: (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;} break; - case 19: -#line 160 "engines/director/lingo/lingo-gr.y" + case 20: +#line 161 "engines/director/lingo/lingo-gr.y" { inst init = 0, finish = 0, body = 0, end = 0, inc = 0; WRITE_UINT32(&init, (yyvsp[(3) - (12)].code)); @@ -1694,8 +1706,8 @@ yyreduce: (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;} break; - case 20: -#line 174 "engines/director/lingo/lingo-gr.y" + case 21: +#line 175 "engines/director/lingo/lingo-gr.y" { inst then = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(5) - (8)].code)); @@ -1705,20 +1717,8 @@ yyreduce: g_lingo->processIf(0, 0); ;} break; - case 21: -#line 181 "engines/director/lingo/lingo-gr.y" - { - inst then = 0, end = 0; - WRITE_UINT32(&then, (yyvsp[(4) - (7)].code)); - WRITE_UINT32(&end, (yyvsp[(6) - (7)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */ - - g_lingo->processIf(0, 0); ;} - break; - case 22: -#line 189 "engines/director/lingo/lingo-gr.y" +#line 182 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(5) - (11)].code)); @@ -1731,21 +1731,7 @@ yyreduce: break; case 23: -#line 198 "engines/director/lingo/lingo-gr.y" - { - inst then = 0, else1 = 0, end = 0; - WRITE_UINT32(&then, (yyvsp[(4) - (12)].code)); - WRITE_UINT32(&else1, (yyvsp[(9) - (12)].code)); - WRITE_UINT32(&end, (yyvsp[(11) - (12)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */ - - g_lingo->processIf(0, 0); ;} - break; - - case 24: -#line 208 "engines/director/lingo/lingo-gr.y" +#line 191 "engines/director/lingo/lingo-gr.y" { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, (yyvsp[(5) - (11)].code)); @@ -1757,8 +1743,32 @@ yyreduce: g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;} break; - case 27: -#line 223 "engines/director/lingo/lingo-gr.y" + case 24: +#line 200 "engines/director/lingo/lingo-gr.y" + { + inst then = 0, else1 = 0, end = 0; + WRITE_UINT32(&then, (yyvsp[(4) - (8)].code)); + WRITE_UINT32(&else1, (yyvsp[(7) - (8)].code)); + WRITE_UINT32(&end, (yyvsp[(8) - (8)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = else1; /* elsepart */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */ + + g_lingo->processIf(0, 0); ;} + break; + + case 25: +#line 211 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = 0; ;} + break; + + case 26: +#line 212 "engines/director/lingo/lingo-gr.y" + { (yyval.code) = (yyvsp[(2) - (3)].code); ;} + break; + + case 29: +#line 219 "engines/director/lingo/lingo-gr.y" { inst then = 0; WRITE_UINT32(&then, (yyvsp[(4) - (7)].code)); @@ -1767,8 +1777,8 @@ yyreduce: g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;} break; - case 28: -#line 229 "engines/director/lingo/lingo-gr.y" + case 30: +#line 225 "engines/director/lingo/lingo-gr.y" { inst then = 0; WRITE_UINT32(&then, (yyvsp[(4) - (5)].code)); @@ -1777,23 +1787,23 @@ yyreduce: g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;} break; - case 29: -#line 237 "engines/director/lingo/lingo-gr.y" + case 31: +#line 233 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); ;} break; - case 30: -#line 238 "engines/director/lingo/lingo-gr.y" + case 32: +#line 234 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_eq, STOP); ;} break; - case 32: -#line 241 "engines/director/lingo/lingo-gr.y" + case 34: +#line 237 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;} break; - case 33: -#line 243 "engines/director/lingo/lingo-gr.y" + case 35: +#line 239 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP); g_lingo->code3(STOP, STOP, STOP); @@ -1801,8 +1811,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 34: -#line 249 "engines/director/lingo/lingo-gr.y" + case 36: +#line 245 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); @@ -1810,8 +1820,8 @@ yyreduce: g_lingo->codeLabel(0); ;} break; - case 35: -#line 255 "engines/director/lingo/lingo-gr.y" + case 37: +#line 251 "engines/director/lingo/lingo-gr.y" { inst skipEnd; WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions @@ -1820,23 +1830,23 @@ yyreduce: g_lingo->code1(skipEnd); ;} break; - case 36: -#line 262 "engines/director/lingo/lingo-gr.y" + case 38: +#line 258 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->_currentScript->size(); ;} break; - case 37: -#line 264 "engines/director/lingo/lingo-gr.y" + case 39: +#line 260 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} break; - case 38: -#line 266 "engines/director/lingo/lingo-gr.y" + case 40: +#line 262 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->_currentScript->size(); ;} break; - case 41: -#line 271 "engines/director/lingo/lingo-gr.y" + case 43: +#line 267 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; @@ -1844,15 +1854,15 @@ yyreduce: g_lingo->code1(i); ;} break; - case 42: -#line 276 "engines/director/lingo/lingo-gr.y" + case 44: +#line 272 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_fconstpush); g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;} break; - case 43: -#line 279 "engines/director/lingo/lingo-gr.y" + case 45: +#line 275 "engines/director/lingo/lingo-gr.y" { if ((yyvsp[(3) - (4)].narg) != g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs) error("Built-in function %s expects %d arguments but got %d", (yyvsp[(1) - (4)].s)->c_str(), g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs, (yyvsp[(3) - (4)].narg)); @@ -1861,8 +1871,8 @@ yyreduce: delete (yyvsp[(1) - (4)].s); ;} break; - case 44: -#line 285 "engines/director/lingo/lingo-gr.y" + case 46: +#line 281 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str()); @@ -1873,121 +1883,121 @@ yyreduce: delete (yyvsp[(1) - (4)].s); ;} break; - case 45: -#line 293 "engines/director/lingo/lingo-gr.y" + case 47: +#line 289 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); ;} break; - case 47: -#line 297 "engines/director/lingo/lingo-gr.y" + case 49: +#line 293 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_add); ;} break; - case 48: -#line 298 "engines/director/lingo/lingo-gr.y" + case 50: +#line 294 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_sub); ;} break; - case 49: -#line 299 "engines/director/lingo/lingo-gr.y" + case 51: +#line 295 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mul); ;} break; - case 50: -#line 300 "engines/director/lingo/lingo-gr.y" + case 52: +#line 296 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_div); ;} break; - case 51: -#line 301 "engines/director/lingo/lingo-gr.y" + case 53: +#line 297 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gt); ;} break; - case 52: -#line 302 "engines/director/lingo/lingo-gr.y" + case 54: +#line 298 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_lt); ;} break; - case 53: -#line 303 "engines/director/lingo/lingo-gr.y" + case 55: +#line 299 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_neq); ;} break; - case 54: -#line 304 "engines/director/lingo/lingo-gr.y" + case 56: +#line 300 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ge); ;} break; - case 55: -#line 305 "engines/director/lingo/lingo-gr.y" + case 57: +#line 301 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_le); ;} break; - case 56: -#line 306 "engines/director/lingo/lingo-gr.y" + case 58: +#line 302 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; - case 57: -#line 307 "engines/director/lingo/lingo-gr.y" + case 59: +#line 303 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; - case 58: -#line 308 "engines/director/lingo/lingo-gr.y" + case 60: +#line 304 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; - case 59: -#line 311 "engines/director/lingo/lingo-gr.y" + case 61: +#line 307 "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); ;} break; - case 60: -#line 312 "engines/director/lingo/lingo-gr.y" + case 62: +#line 308 "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 61: -#line 313 "engines/director/lingo/lingo-gr.y" + case 63: +#line 309 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; - case 63: -#line 315 "engines/director/lingo/lingo-gr.y" + case 65: +#line 311 "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 65: -#line 320 "engines/director/lingo/lingo-gr.y" + case 67: +#line 316 "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 66: -#line 321 "engines/director/lingo/lingo-gr.y" + case 68: +#line 317 "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 67: -#line 332 "engines/director/lingo/lingo-gr.y" + case 69: +#line 328 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; - case 68: -#line 333 "engines/director/lingo/lingo-gr.y" + case 70: +#line 329 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; - case 69: -#line 334 "engines/director/lingo/lingo-gr.y" + case 71: +#line 330 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; - case 70: -#line 335 "engines/director/lingo/lingo-gr.y" + case 72: +#line 331 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -1995,8 +2005,8 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 71: -#line 340 "engines/director/lingo/lingo-gr.y" + case 73: +#line 336 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -2005,8 +2015,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 72: -#line 346 "engines/director/lingo/lingo-gr.y" + case 74: +#line 342 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -2014,48 +2024,48 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 73: -#line 353 "engines/director/lingo/lingo-gr.y" + case 75: +#line 349 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 74: -#line 354 "engines/director/lingo/lingo-gr.y" + case 76: +#line 350 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 75: -#line 355 "engines/director/lingo/lingo-gr.y" + case 77: +#line 351 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 76: -#line 356 "engines/director/lingo/lingo-gr.y" + case 78: +#line 352 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; - case 77: -#line 359 "engines/director/lingo/lingo-gr.y" + case 79: +#line 355 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 78: -#line 360 "engines/director/lingo/lingo-gr.y" + case 80: +#line 356 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 79: -#line 361 "engines/director/lingo/lingo-gr.y" + case 81: +#line 357 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 80: -#line 389 "engines/director/lingo/lingo-gr.y" + case 82: +#line 385 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; - case 81: -#line 390 "engines/director/lingo/lingo-gr.y" + case 83: +#line 386 "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); @@ -2063,33 +2073,33 @@ yyreduce: g_lingo->_indef = false; ;} break; - case 82: -#line 396 "engines/director/lingo/lingo-gr.y" + case 84: +#line 392 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 83: -#line 397 "engines/director/lingo/lingo-gr.y" + case 85: +#line 393 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; - case 84: -#line 398 "engines/director/lingo/lingo-gr.y" + case 86: +#line 394 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; - case 85: -#line 399 "engines/director/lingo/lingo-gr.y" + case 87: +#line 395 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; - case 86: -#line 401 "engines/director/lingo/lingo-gr.y" + case 88: +#line 397 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArgStore(); ;} break; - case 87: -#line 404 "engines/director/lingo/lingo-gr.y" + case 89: +#line 400 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2098,24 +2108,24 @@ yyreduce: g_lingo->code1(numpar); ;} break; - case 88: -#line 412 "engines/director/lingo/lingo-gr.y" + case 90: +#line 408 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 89: -#line 413 "engines/director/lingo/lingo-gr.y" + case 91: +#line 409 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 1; ;} break; - case 90: -#line 414 "engines/director/lingo/lingo-gr.y" + case 92: +#line 410 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2119 "engines/director/lingo/lingo-gr.cpp" +#line 2129 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2329,6 +2339,6 @@ yyreturn: } -#line 417 "engines/director/lingo/lingo-gr.y" +#line 413 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h index 4216ad6d2e..62462ae2d5 100644 --- a/engines/director/lingo/lingo-gr.h +++ b/engines/director/lingo/lingo-gr.h @@ -51,7 +51,7 @@ HANDLER = 267, tDOWN = 268, tELSE = 269, - tELSIF = 270, + tNLELSIF = 270, tEND = 271, tEXIT = 272, tFRAME = 273, @@ -74,12 +74,13 @@ tTO = 290, tWITH = 291, tWHILE = 292, - tGE = 293, - tLE = 294, - tGT = 295, - tLT = 296, - tEQ = 297, - tNEQ = 298 + tNLELSE = 293, + tGE = 294, + tLE = 295, + tGT = 296, + tLT = 297, + tEQ = 298, + tNEQ = 299 }; #endif /* Tokens. */ @@ -95,7 +96,7 @@ #define HANDLER 267 #define tDOWN 268 #define tELSE 269 -#define tELSIF 270 +#define tNLELSIF 270 #define tEND 271 #define tEXIT 272 #define tFRAME 273 @@ -118,12 +119,13 @@ #define tTO 290 #define tWITH 291 #define tWHILE 292 -#define tGE 293 -#define tLE 294 -#define tGT 295 -#define tLT 296 -#define tEQ 297 -#define tNEQ 298 +#define tNLELSE 293 +#define tGE 294 +#define tLE 295 +#define tGT 296 +#define tLT 297 +#define tEQ 298 +#define tNEQ 299 @@ -139,7 +141,7 @@ typedef union YYSTYPE int narg; /* number of arguments */ } /* Line 1529 of yacc.c. */ -#line 143 "engines/director/lingo/lingo-gr.hpp" +#line 145 "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 b337912a5d..d65e683cb2 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -74,12 +74,12 @@ using namespace Director; %token<i> INT %token<f> FLOAT %token<s> BLTIN ID STRING HANDLER -%token tDOWN tELSE tELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO +%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO %token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO -%token tWITH tWHILE +%token tWITH tWHILE tNLELSE %token tGE tLE tGT tLT tEQ tNEQ -%type<code> asgn begin elseif end expr if repeatwhile repeatwith stmtlist +%type<code> asgn begin elseif elsestmt end expr if repeatwhile repeatwith stmtlist %type<s> gotoframe gotomovie %type<narg> argdef arglist @@ -122,9 +122,10 @@ asgn: tPUT expr tINTO ID { $$ = $4; delete $2; } ; - -stmt: expr { g_lingo->code1(g_lingo->c_xpop); } +stmtoneliner: expr { g_lingo->code1(g_lingo->c_xpop); } | func + ; +stmt: stmtoneliner | ifstmt // repeat while (expression = TRUE) // statements @@ -178,14 +179,6 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF { (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, 0); } - | if cond tTHEN begin stmt end '\n' { - inst then = 0, end = 0; - WRITE_UINT32(&then, $4); - WRITE_UINT32(&end, $6); - (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ - - g_lingo->processIf(0, 0); } | if cond tTHEN '\n' stmtlist end tELSE stmtlist end tEND tIF { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, $5); @@ -195,16 +188,6 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF { (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, 0); } - | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' { - inst then = 0, else1 = 0, end = 0; - WRITE_UINT32(&then, $4); - WRITE_UINT32(&else1, $9); - WRITE_UINT32(&end, $11); - (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ - (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */ - (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ - - g_lingo->processIf(0, 0); } | if cond tTHEN '\n' stmtlist end begin elseifstmt end tEND tIF { inst then = 0, else1 = 0, end = 0; WRITE_UINT32(&then, $5); @@ -214,6 +197,19 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF { (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ g_lingo->processIf(0, $9); } + | if cond tTHEN begin stmtoneliner end elsestmt end { + inst then = 0, else1 = 0, end = 0; + WRITE_UINT32(&then, $4); + WRITE_UINT32(&else1, $7); + WRITE_UINT32(&end, $8); + (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ + (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */ + (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */ + + g_lingo->processIf(0, 0); } + ; +elsestmt: /* nothing */ { $$ = 0; } + | tNLELSE begin stmtoneliner { $$ = $2; } ; elseifstmt: elseifstmt elseifstmt1 @@ -252,7 +248,7 @@ if: tIF { g_lingo->code1(0); // Do not skip end g_lingo->codeLabel(0); } // Mark beginning of the if() statement ; -elseif: tELSIF { +elseif: tNLELSIF { inst skipEnd; WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions $$ = g_lingo->code1(g_lingo->c_ifcode); diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 6abaa99eb2..d302e38d0d 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -364,8 +364,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 39 -#define YY_END_OF_BUFFER 40 +#define YY_NUM_RULES 40 +#define YY_END_OF_BUFFER 41 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -373,22 +373,23 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[126] = +static yyconst flex_int16_t yy_accept[132] = { 0, - 0, 0, 40, 38, 3, 36, 36, 38, 38, 38, - 35, 35, 34, 35, 35, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 2, 2, 3, 36, 0, 29, 0, 37, 1, 33, - 34, 31, 30, 32, 32, 32, 32, 32, 32, 32, - 12, 5, 32, 32, 32, 32, 32, 32, 20, 32, - 32, 32, 32, 32, 26, 32, 32, 2, 2, 1, - 33, 32, 32, 8, 32, 32, 32, 32, 32, 32, - 16, 32, 32, 32, 22, 32, 24, 32, 32, 32, - 4, 7, 9, 32, 32, 13, 14, 32, 32, 32, - - 19, 32, 32, 25, 32, 27, 0, 10, 32, 15, - 32, 18, 32, 32, 28, 0, 11, 32, 32, 23, - 6, 17, 32, 21, 0 + 0, 0, 41, 39, 3, 37, 37, 39, 39, 39, + 36, 36, 35, 36, 36, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 2, 2, 3, 37, 0, 0, 37, 30, 0, 38, + 1, 34, 35, 32, 31, 33, 33, 33, 33, 33, + 33, 33, 13, 5, 33, 33, 33, 33, 33, 33, + 21, 33, 33, 33, 33, 33, 27, 33, 33, 2, + 2, 0, 1, 34, 33, 33, 9, 33, 33, 33, + 33, 33, 33, 17, 33, 33, 33, 23, 33, 25, + 33, 33, 33, 0, 4, 8, 10, 33, 33, 14, + + 15, 33, 33, 33, 20, 33, 33, 26, 33, 28, + 0, 11, 33, 16, 33, 19, 33, 33, 29, 7, + 12, 33, 33, 24, 0, 18, 33, 0, 22, 6, + 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -433,126 +434,132 @@ static yyconst flex_int32_t yy_meta[58] = 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst flex_int16_t yy_base[129] = +static yyconst flex_int16_t yy_base[135] = { 0, - 0, 56, 218, 295, 60, 56, 63, 66, 199, 167, - 295, 164, 62, 158, 157, 0, 46, 50, 46, 53, - 62, 51, 75, 64, 64, 78, 68, 72, 93, 94, - 123, 131, 141, 90, 145, 295, 161, 295, 0, 147, - 108, 295, 295, 0, 45, 89, 112, 108, 125, 123, - 0, 0, 122, 127, 139, 134, 125, 124, 0, 142, - 131, 135, 133, 147, 0, 144, 137, 189, 193, 0, - 112, 155, 158, 0, 155, 174, 185, 176, 176, 176, - 172, 179, 177, 176, 0, 192, 0, 186, 189, 193, - 0, 83, 0, 197, 202, 0, 0, 191, 205, 203, - - 0, 206, 217, 0, 217, 0, 241, 0, 216, 0, - 222, 0, 219, 216, 0, 229, 0, 220, 220, 0, - 295, 0, 224, 0, 295, 286, 118, 290 + 0, 56, 212, 320, 60, 64, 68, 72, 175, 180, + 320, 174, 49, 169, 167, 0, 50, 54, 50, 57, + 66, 55, 79, 68, 68, 82, 72, 76, 97, 98, + 127, 135, 145, 94, 149, 153, 157, 320, 167, 320, + 0, 158, 112, 320, 320, 0, 49, 93, 116, 112, + 129, 135, 0, 0, 132, 137, 150, 145, 136, 135, + 0, 154, 143, 147, 145, 159, 0, 156, 149, 201, + 205, 168, 0, 116, 172, 192, 0, 181, 189, 200, + 190, 190, 191, 187, 200, 193, 192, 0, 208, 0, + 202, 205, 209, 204, 0, 0, 0, 213, 222, 0, + + 0, 213, 229, 229, 0, 229, 240, 0, 238, 0, + 239, 0, 235, 0, 238, 0, 235, 232, 0, 87, + 0, 233, 234, 0, 266, 0, 238, 252, 0, 320, + 320, 311, 122, 315 } ; -static yyconst flex_int16_t yy_def[129] = +static yyconst flex_int16_t yy_def[135] = { 0, - 125, 1, 125, 125, 125, 125, 125, 125, 125, 126, - 125, 125, 125, 125, 125, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 125, 125, 125, 125, 125, 125, 126, 125, 128, 125, - 125, 125, 125, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 125, 125, 128, - 125, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - - 127, 127, 127, 127, 127, 127, 125, 127, 127, 127, - 127, 127, 127, 127, 127, 125, 127, 127, 127, 127, - 125, 127, 127, 127, 0, 125, 125, 125 + 131, 1, 131, 131, 131, 131, 131, 131, 131, 132, + 131, 131, 131, 131, 131, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 131, 131, 131, 131, 131, 131, 131, 131, 132, 131, + 134, 131, 131, 131, 131, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 131, + 131, 131, 134, 131, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 133, 131, 133, 133, 133, 133, 133, 133, + + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 131, 133, 133, 133, 133, 133, 133, 133, 133, 131, + 133, 133, 133, 133, 131, 133, 133, 131, 133, 131, + 0, 131, 131, 131 } ; -static yyconst flex_int16_t yy_nxt[353] = +static yyconst flex_int16_t yy_nxt[378] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 13, 14, 11, 15, 16, 16, 16, 17, 18, 19, 20, 16, 21, 16, 22, 23, 24, 25, 26, 27, 28, 29, 16, 16, 30, 16, 16, 16, 16, 17, 18, 19, 20, 16, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 16, 16, 30, 16, 31, 34, 34, - 32, 33, 34, 34, 35, 34, 34, 35, 34, 34, - 35, 40, 41, 45, 46, 49, 47, 50, 54, 72, - 51, 52, 58, 59, 107, 48, 62, 107, 53, 55, - 63, 56, 34, 34, 45, 46, 49, 47, 50, 54, - - 72, 51, 57, 52, 58, 59, 48, 60, 62, 53, - 61, 55, 63, 56, 64, 66, 67, 40, 41, 73, - 65, 44, 71, 57, 68, 34, 34, 69, 60, 74, - 75, 61, 69, 34, 34, 69, 64, 66, 67, 76, - 73, 65, 33, 34, 34, 35, 35, 34, 34, 35, - 77, 74, 75, 78, 79, 80, 81, 71, 82, 83, - 84, 76, 85, 86, 87, 88, 89, 38, 90, 43, - 42, 77, 39, 38, 78, 79, 92, 80, 81, 82, - 83, 91, 84, 85, 86, 87, 93, 88, 89, 90, - 68, 34, 34, 69, 69, 34, 34, 69, 92, 94, - - 95, 100, 91, 96, 97, 98, 99, 93, 101, 102, - 103, 36, 104, 105, 106, 108, 109, 125, 110, 111, - 94, 112, 95, 100, 96, 97, 98, 99, 113, 101, - 102, 114, 103, 104, 105, 115, 106, 108, 109, 110, - 117, 111, 107, 112, 118, 107, 119, 120, 121, 125, - 113, 122, 123, 114, 124, 125, 125, 115, 125, 125, - 125, 117, 125, 116, 125, 125, 118, 119, 120, 125, - 121, 125, 122, 123, 125, 124, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 116, 37, 125, 37, 37, - 70, 125, 125, 70, 3, 125, 125, 125, 125, 125, - - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125 + 27, 28, 29, 16, 16, 30, 16, 31, 42, 43, + 32, 33, 34, 34, 35, 36, 37, 37, 36, 36, + 37, 37, 36, 35, 34, 34, 35, 47, 48, 51, + 49, 52, 56, 75, 53, 54, 60, 61, 125, 50, + 64, 125, 55, 57, 65, 58, 34, 34, 47, 48, + + 51, 49, 52, 56, 75, 53, 59, 54, 60, 61, + 50, 62, 64, 55, 63, 57, 65, 58, 66, 68, + 69, 42, 43, 76, 67, 46, 74, 59, 70, 34, + 34, 71, 62, 77, 78, 63, 71, 34, 34, 71, + 66, 68, 69, 79, 76, 67, 33, 34, 34, 35, + 35, 34, 34, 35, 36, 77, 78, 36, 36, 37, + 37, 36, 80, 81, 82, 79, 83, 84, 74, 85, + 86, 72, 87, 40, 88, 89, 90, 91, 92, 45, + 93, 44, 41, 80, 81, 82, 40, 38, 83, 84, + 85, 86, 94, 72, 87, 88, 89, 90, 95, 91, + + 92, 93, 70, 34, 34, 71, 71, 34, 34, 71, + 96, 131, 97, 94, 98, 99, 131, 100, 101, 95, + 102, 103, 104, 131, 105, 106, 107, 131, 108, 109, + 110, 112, 96, 97, 111, 98, 113, 99, 100, 101, + 114, 102, 103, 115, 104, 105, 106, 116, 107, 108, + 109, 117, 110, 112, 118, 111, 119, 120, 113, 121, + 122, 114, 123, 124, 126, 115, 127, 125, 129, 116, + 125, 130, 131, 117, 131, 131, 118, 131, 119, 120, + 121, 131, 122, 123, 124, 126, 131, 127, 128, 129, + 131, 131, 131, 130, 131, 131, 131, 131, 131, 131, + + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 128, 39, 131, 39, 39, 73, 131, 131, 73, 3, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131 } ; -static yyconst flex_int16_t yy_chk[353] = +static yyconst flex_int16_t yy_chk[378] = { 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 6, 6, - 2, 5, 5, 5, 5, 7, 7, 8, 8, 8, - 8, 13, 13, 17, 18, 19, 18, 20, 22, 45, - 20, 21, 24, 25, 92, 18, 27, 92, 21, 23, - 28, 23, 34, 34, 17, 18, 19, 18, 20, 22, - - 45, 20, 23, 21, 24, 25, 18, 26, 27, 21, - 26, 23, 28, 23, 29, 30, 30, 41, 41, 46, - 29, 127, 71, 23, 31, 31, 31, 31, 26, 47, - 48, 26, 32, 32, 32, 32, 29, 30, 30, 49, - 46, 29, 33, 33, 33, 33, 35, 35, 35, 35, - 50, 47, 48, 53, 54, 55, 56, 40, 57, 58, - 60, 49, 61, 62, 63, 64, 66, 37, 67, 15, - 14, 50, 12, 10, 53, 54, 73, 55, 56, 57, - 58, 72, 60, 61, 62, 63, 75, 64, 66, 67, - 68, 68, 68, 68, 69, 69, 69, 69, 73, 76, - - 77, 82, 72, 78, 79, 80, 81, 75, 83, 84, - 86, 9, 88, 89, 90, 94, 95, 3, 98, 99, - 76, 100, 77, 82, 78, 79, 80, 81, 102, 83, - 84, 103, 86, 88, 89, 105, 90, 94, 95, 98, - 109, 99, 107, 100, 111, 107, 113, 114, 116, 0, - 102, 118, 119, 103, 123, 0, 0, 105, 0, 0, - 0, 109, 0, 107, 0, 0, 111, 113, 114, 0, - 116, 0, 118, 119, 0, 123, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 107, 126, 0, 126, 126, - 128, 0, 0, 128, 125, 125, 125, 125, 125, 125, - - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125 + 1, 1, 1, 1, 1, 1, 1, 2, 13, 13, + 2, 5, 5, 5, 5, 6, 6, 6, 6, 7, + 7, 7, 7, 8, 8, 8, 8, 17, 18, 19, + 18, 20, 22, 47, 20, 21, 24, 25, 120, 18, + 27, 120, 21, 23, 28, 23, 34, 34, 17, 18, + + 19, 18, 20, 22, 47, 20, 23, 21, 24, 25, + 18, 26, 27, 21, 26, 23, 28, 23, 29, 30, + 30, 43, 43, 48, 29, 133, 74, 23, 31, 31, + 31, 31, 26, 49, 50, 26, 32, 32, 32, 32, + 29, 30, 30, 51, 48, 29, 33, 33, 33, 33, + 35, 35, 35, 35, 36, 49, 50, 36, 37, 37, + 37, 37, 52, 55, 56, 51, 57, 58, 42, 59, + 60, 36, 62, 39, 63, 64, 65, 66, 68, 15, + 69, 14, 12, 52, 55, 56, 10, 9, 57, 58, + 59, 60, 72, 36, 62, 63, 64, 65, 75, 66, + + 68, 69, 70, 70, 70, 70, 71, 71, 71, 71, + 76, 3, 78, 72, 79, 80, 0, 81, 82, 75, + 83, 84, 85, 0, 86, 87, 89, 0, 91, 92, + 93, 98, 76, 78, 94, 79, 99, 80, 81, 82, + 102, 83, 84, 103, 85, 86, 87, 104, 89, 91, + 92, 106, 93, 98, 107, 94, 109, 111, 99, 113, + 115, 102, 117, 118, 122, 103, 123, 125, 127, 104, + 125, 128, 0, 106, 0, 0, 107, 0, 109, 111, + 113, 0, 115, 117, 118, 122, 0, 123, 125, 127, + 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 125, 132, 0, 132, 132, 134, 0, 0, 134, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131 } ; static yy_state_type yy_last_accepting_state; @@ -602,7 +609,7 @@ char *yytext; int yyparse(); -#line 606 "engines/director/lingo/lingo-lex.cpp" +#line 613 "engines/director/lingo/lingo-lex.cpp" #define INITIAL 0 @@ -790,7 +797,7 @@ YY_DECL #line 45 "engines/director/lingo/lingo-lex.l" -#line 794 "engines/director/lingo/lingo-lex.cpp" +#line 801 "engines/director/lingo/lingo-lex.cpp" if ( !(yy_init) ) { @@ -844,13 +851,13 @@ yy_match: 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 >= 126 ) + if ( yy_current_state >= 132 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 295 ); + while ( yy_base[yy_current_state] != 320 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -900,138 +907,145 @@ YY_RULE_SETUP { return tIF; } YY_BREAK case 6: +/* rule 6 can match eol */ YY_RULE_SETUP #line 53 "engines/director/lingo/lingo-lex.l" -{ return tELSIF; } +{ return tNLELSIF; } YY_BREAK case 7: +/* rule 7 can match eol */ YY_RULE_SETUP #line 54 "engines/director/lingo/lingo-lex.l" -{ return tELSE; } +{ return tNLELSE; } YY_BREAK case 8: YY_RULE_SETUP #line 55 "engines/director/lingo/lingo-lex.l" -{ return tEND; } +{ return tELSE; } YY_BREAK case 9: YY_RULE_SETUP #line 56 "engines/director/lingo/lingo-lex.l" -{ return tEXIT; } +{ return tEND; } YY_BREAK case 10: YY_RULE_SETUP #line 57 "engines/director/lingo/lingo-lex.l" -{ return tFRAME; } +{ return tEXIT; } YY_BREAK case 11: YY_RULE_SETUP #line 58 "engines/director/lingo/lingo-lex.l" -{ return tGLOBAL; } +{ return tFRAME; } YY_BREAK case 12: YY_RULE_SETUP #line 59 "engines/director/lingo/lingo-lex.l" -{ return tGO; } +{ return tGLOBAL; } YY_BREAK case 13: YY_RULE_SETUP #line 60 "engines/director/lingo/lingo-lex.l" -{ return tINTO; } +{ return tGO; } YY_BREAK case 14: YY_RULE_SETUP #line 61 "engines/director/lingo/lingo-lex.l" -{ return tLOOP; } +{ return tINTO; } YY_BREAK case 15: YY_RULE_SETUP #line 62 "engines/director/lingo/lingo-lex.l" -{ return tMACRO; } +{ return tLOOP; } YY_BREAK case 16: YY_RULE_SETUP #line 63 "engines/director/lingo/lingo-lex.l" -{ return tMCI; } +{ return tMACRO; } YY_BREAK case 17: YY_RULE_SETUP #line 64 "engines/director/lingo/lingo-lex.l" -{ return tMCIWAIT; } +{ return tMCI; } YY_BREAK case 18: YY_RULE_SETUP #line 65 "engines/director/lingo/lingo-lex.l" -{ return tMOVIE; } +{ return tMCIWAIT; } YY_BREAK case 19: YY_RULE_SETUP #line 66 "engines/director/lingo/lingo-lex.l" -{ return tNEXT; } +{ return tMOVIE; } YY_BREAK case 20: YY_RULE_SETUP #line 67 "engines/director/lingo/lingo-lex.l" -{ return tOF; } +{ return tNEXT; } YY_BREAK case 21: YY_RULE_SETUP #line 68 "engines/director/lingo/lingo-lex.l" -{ return tPREVIOUS; } +{ return tOF; } YY_BREAK case 22: YY_RULE_SETUP #line 69 "engines/director/lingo/lingo-lex.l" -{ return tPUT; } +{ return tPREVIOUS; } YY_BREAK case 23: YY_RULE_SETUP #line 70 "engines/director/lingo/lingo-lex.l" -{ return tREPEAT; } +{ return tPUT; } YY_BREAK case 24: YY_RULE_SETUP #line 71 "engines/director/lingo/lingo-lex.l" -{ return tSET; } +{ return tREPEAT; } YY_BREAK case 25: YY_RULE_SETUP #line 72 "engines/director/lingo/lingo-lex.l" -{ return tTHEN; } +{ return tSET; } YY_BREAK case 26: YY_RULE_SETUP #line 73 "engines/director/lingo/lingo-lex.l" -{ return tTO; } +{ return tTHEN; } YY_BREAK case 27: YY_RULE_SETUP #line 74 "engines/director/lingo/lingo-lex.l" -{ return tWITH; } +{ return tTO; } YY_BREAK case 28: YY_RULE_SETUP #line 75 "engines/director/lingo/lingo-lex.l" -{ return tWHILE; } +{ return tWITH; } YY_BREAK case 29: YY_RULE_SETUP -#line 77 "engines/director/lingo/lingo-lex.l" -{ return tNEQ; } +#line 76 "engines/director/lingo/lingo-lex.l" +{ return tWHILE; } YY_BREAK case 30: YY_RULE_SETUP #line 78 "engines/director/lingo/lingo-lex.l" -{ return tGE; } +{ return tNEQ; } YY_BREAK case 31: YY_RULE_SETUP #line 79 "engines/director/lingo/lingo-lex.l" -{ return tLE; } +{ return tGE; } YY_BREAK case 32: YY_RULE_SETUP -#line 81 "engines/director/lingo/lingo-lex.l" +#line 80 "engines/director/lingo/lingo-lex.l" +{ return tLE; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 82 "engines/director/lingo/lingo-lex.l" { yylval.s = new Common::String(yytext); @@ -1041,43 +1055,43 @@ YY_RULE_SETUP return ID; } YY_BREAK -case 33: -YY_RULE_SETUP -#line 89 "engines/director/lingo/lingo-lex.l" -{ yylval.f = atof(yytext); return FLOAT; } - YY_BREAK case 34: YY_RULE_SETUP #line 90 "engines/director/lingo/lingo-lex.l" -{ yylval.i = strtol(yytext, NULL, 10); return INT; } +{ yylval.f = atof(yytext); return FLOAT; } YY_BREAK case 35: YY_RULE_SETUP #line 91 "engines/director/lingo/lingo-lex.l" -{ return *yytext; } +{ yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK case 36: -/* rule 36 can match eol */ YY_RULE_SETUP #line 92 "engines/director/lingo/lingo-lex.l" -{ return '\n'; } +{ return *yytext; } YY_BREAK case 37: +/* rule 37 can match eol */ YY_RULE_SETUP #line 93 "engines/director/lingo/lingo-lex.l" -{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } +{ return '\n'; } YY_BREAK case 38: YY_RULE_SETUP #line 94 "engines/director/lingo/lingo-lex.l" - +{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK case 39: YY_RULE_SETUP -#line 96 "engines/director/lingo/lingo-lex.l" +#line 95 "engines/director/lingo/lingo-lex.l" + + YY_BREAK +case 40: +YY_RULE_SETUP +#line 97 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1081 "engines/director/lingo/lingo-lex.cpp" +#line 1095 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1370,7 +1384,7 @@ static int yy_get_next_buffer (void) 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 >= 126 ) + if ( yy_current_state >= 132 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1398,11 +1412,11 @@ static int yy_get_next_buffer (void) 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 >= 126 ) + if ( yy_current_state >= 132 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 125); + yy_is_jam = (yy_current_state == 131); return yy_is_jam ? 0 : yy_current_state; } @@ -2077,7 +2091,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 96 "engines/director/lingo/lingo-lex.l" +#line 97 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 8ad8733ef2..c340bd69bc 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -50,7 +50,8 @@ whitespace [\t ] (?i:down) { return tDOWN; } (?i:if) { return tIF; } -(?i:else[\t ]+if) { return tELSIF; } +(?i:[\n\r]+[\t ]+else[\t ]+if) { return tNLELSIF; } +(?i:[\n\r]+[\t ]+else) { return tNLELSE; } (?i:else) { return tELSE; } (?i:end) { return tEND; } (?i:exit) { return tEXIT; } |