diff options
| author | Eugene Sandulenko | 2016-07-04 10:43:35 +0200 | 
|---|---|---|
| committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 | 
| commit | eb724af3ea1eb7eeb3948c6ca9fd299ca0cfec76 (patch) | |
| tree | 83fadac984fcc8e3ca40e20998a509548b988371 | |
| parent | 350f81635f0186a9c93d8750d1d043f8c1cfda00 (diff) | |
| download | scummvm-rg350-eb724af3ea1eb7eeb3948c6ca9fd299ca0cfec76.tar.gz scummvm-rg350-eb724af3ea1eb7eeb3948c6ca9fd299ca0cfec76.tar.bz2 scummvm-rg350-eb724af3ea1eb7eeb3948c6ca9fd299ca0cfec76.zip  | |
DIRECTOR: Lingo: Parse basic 'else if' clause
| -rw-r--r-- | engines/director/director.cpp | 16 | ||||
| -rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 756 | ||||
| -rw-r--r-- | engines/director/lingo/lingo-gr.h | 116 | ||||
| -rw-r--r-- | engines/director/lingo/lingo-gr.y | 20 | ||||
| -rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 262 | ||||
| -rw-r--r-- | engines/director/lingo/lingo-lex.l | 1 | 
6 files changed, 596 insertions, 575 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index afc65b2cb6..4398f2b04d 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -94,16 +94,16 @@ Common::Error DirectorEngine::run() {  #if 0  	_lingo->addCode("--\n\ -	if y = 5 then\n\ -	  set x = 5\n\ -	else if y = 6 then\n\ -	  set x = 6\n\ -	else\n\ -	  set x = 7\n\ -	endif\n\ +	if 5 then\n\ +	  exit\n\ +	else if 6 then\n\ +	  exit\n\ +    else if 7 then\n\ +	  exit\n\ +	end if\n\  ", kMovieScript, 2); -_lingo->executeScript(kMovieScript, 2); +//_lingo->executeScript(kMovieScript, 2);  return Common::kNoError; diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 61b989a1e4..5d3bcd6b47 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -78,34 +78,35 @@       HANDLER = 267,       tDOWN = 268,       tELSE = 269, -     tEND = 270, -     tEXIT = 271, -     tFRAME = 272, -     tGLOBAL = 273, -     tGO = 274, -     tIF = 275, -     tINTO = 276, -     tLOOP = 277, -     tMACRO = 278, -     tMCI = 279, -     tMCIWAIT = 280, -     tMOVIE = 281, -     tNEXT = 282, -     tOF = 283, -     tPREVIOUS = 284, -     tPUT = 285, -     tREPEAT = 286, -     tSET = 287, -     tTHEN = 288, -     tTO = 289, -     tWITH = 290, -     tWHILE = 291, -     tGE = 292, -     tLE = 293, -     tGT = 294, -     tLT = 295, -     tEQ = 296, -     tNEQ = 297 +     tELSIF = 270, +     tEND = 271, +     tEXIT = 272, +     tFRAME = 273, +     tGLOBAL = 274, +     tGO = 275, +     tIF = 276, +     tINTO = 277, +     tLOOP = 278, +     tMACRO = 279, +     tMCI = 280, +     tMCIWAIT = 281, +     tMOVIE = 282, +     tNEXT = 283, +     tOF = 284, +     tPREVIOUS = 285, +     tPUT = 286, +     tREPEAT = 287, +     tSET = 288, +     tTHEN = 289, +     tTO = 290, +     tWITH = 291, +     tWHILE = 292, +     tGE = 293, +     tLE = 294, +     tGT = 295, +     tLT = 296, +     tEQ = 297, +     tNEQ = 298     };  #endif  /* Tokens.  */ @@ -121,34 +122,35 @@  #define HANDLER 267  #define tDOWN 268  #define tELSE 269 -#define tEND 270 -#define tEXIT 271 -#define tFRAME 272 -#define tGLOBAL 273 -#define tGO 274 -#define tIF 275 -#define tINTO 276 -#define tLOOP 277 -#define tMACRO 278 -#define tMCI 279 -#define tMCIWAIT 280 -#define tMOVIE 281 -#define tNEXT 282 -#define tOF 283 -#define tPREVIOUS 284 -#define tPUT 285 -#define tREPEAT 286 -#define tSET 287 -#define tTHEN 288 -#define tTO 289 -#define tWITH 290 -#define tWHILE 291 -#define tGE 292 -#define tLE 293 -#define tGT 294 -#define tLT 295 -#define tEQ 296 -#define tNEQ 297 +#define tELSIF 270 +#define tEND 271 +#define tEXIT 272 +#define tFRAME 273 +#define tGLOBAL 274 +#define tGO 275 +#define tIF 276 +#define tINTO 277 +#define tLOOP 278 +#define tMACRO 279 +#define tMCI 280 +#define tMCIWAIT 281 +#define tMOVIE 282 +#define tNEXT 283 +#define tOF 284 +#define tPREVIOUS 285 +#define tPUT 286 +#define tREPEAT 287 +#define tSET 288 +#define tTHEN 289 +#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 @@ -200,7 +202,7 @@ typedef union YYSTYPE  	int	narg;	/* number of arguments */  }  /* Line 193 of yacc.c.  */ -#line 204 "engines/director/lingo/lingo-gr.cpp" +#line 206 "engines/director/lingo/lingo-gr.cpp"  	YYSTYPE;  # define yystype YYSTYPE /* obsolescent; will be withdrawn */  # define YYSTYPE_IS_DECLARED 1 @@ -213,7 +215,7 @@ typedef union YYSTYPE  /* Line 216 of yacc.c.  */ -#line 217 "engines/director/lingo/lingo-gr.cpp" +#line 219 "engines/director/lingo/lingo-gr.cpp"  #ifdef short  # undef short @@ -428,20 +430,20 @@ union yyalloc  /* YYFINAL -- State number of the termination state.  */  #define YYFINAL  61  /* YYLAST -- Last index in YYTABLE.  */ -#define YYLAST   339 +#define YYLAST   327  /* YYNTOKENS -- Number of terminals.  */ -#define YYNTOKENS  55 +#define YYNTOKENS  56  /* YYNNTS -- Number of nonterminals.  */ -#define YYNNTS  28 +#define YYNNTS  29  /* YYNRULES -- Number of rules.  */ -#define YYNRULES  88 +#define YYNRULES  89  /* YYNRULES -- Number of states.  */ -#define YYNSTATES  189 +#define YYNSTATES  187  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */  #define YYUNDEFTOK  2 -#define YYMAXUTOK   297 +#define YYMAXUTOK   298  #define YYTRANSLATE(YYX)						\    ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -450,12 +452,12 @@ union yyalloc  static const yytype_uint8 yytranslate[] =  {         0,     2,     2,     2,     2,     2,     2,     2,     2,     2, -      49,     2,     2,     2,     2,     2,     2,     2,     2,     2, +      50,     2,     2,     2,     2,     2,     2,     2,     2,     2,         2,     2,     2,     2,     2,     2,     2,     2,     2,     2, -       2,     2,     2,     2,     2,     2,     2,    48,     2,     2, -      50,    51,    46,    44,    54,    45,     2,    47,     2,     2, +       2,     2,     2,     2,     2,     2,     2,    49,     2,     2, +      51,    52,    47,    45,    55,    46,     2,    48,     2,     2,         2,     2,     2,     2,     2,     2,     2,     2,     2,     2, -      53,    43,    52,     2,     2,     2,     2,     2,     2,     2, +      54,    44,    53,     2,     2,     2,     2,     2,     2,     2,         2,     2,     2,     2,     2,     2,     2,     2,     2,     2,         2,     2,     2,     2,     2,     2,     2,     2,     2,     2,         2,     2,     2,     2,     2,     2,     2,     2,     2,     2, @@ -478,7 +480,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 +      35,    36,    37,    38,    39,    40,    41,    42,    43  };  #if YYDEBUG @@ -488,50 +490,50 @@ static const yytype_uint16 yyprhs[] =  {         0,     0,     3,     7,     9,    10,    12,    14,    16,    18,        20,    22,    24,    29,    34,    39,    41,    43,    45,    54, -      66,    79,    86,    94,   105,   116,   118,   122,   129,   131, -     135,   139,   142,   146,   148,   149,   150,   151,   154,   157, -     159,   161,   166,   171,   173,   175,   179,   183,   187,   191, -     195,   199,   203,   207,   211,   214,   217,   221,   224,   227, -     230,   232,   234,   237,   239,   243,   246,   249,   252,   255, -     259,   262,   266,   269,   272,   274,   278,   281,   285,   286, -     295,   296,   298,   302,   307,   308,   312,   313,   315 +      66,    79,    86,    94,   105,   116,   119,   121,   126,   128, +     132,   136,   139,   143,   145,   147,   148,   149,   150,   153, +     156,   158,   160,   165,   170,   172,   174,   178,   182,   186, +     190,   194,   198,   202,   206,   210,   213,   216,   220,   223, +     226,   229,   231,   233,   236,   238,   242,   245,   248,   251, +     254,   258,   261,   265,   268,   271,   273,   277,   280,   284, +     285,   294,   295,   297,   301,   306,   307,   311,   312,   314  };  /* YYRHS -- A `-1'-separated list of the rules' RHS.  */  static const yytype_int8 yyrhs[] =  { -      56,     0,    -1,    57,    49,    56,    -1,    57,    -1,    -1, -      77,    -1,    72,    -1,    81,    -1,    58,    -1,    60,    -1, -      59,    -1,     1,    -1,    30,    71,    21,    10,    -1,    32, -      10,    43,    71,    -1,    32,    10,    34,    71,    -1,    71, -      -1,    72,    -1,    61,    -1,    65,    50,    64,    51,    70, -      69,    15,    31,    -1,    66,    43,    71,    69,    34,    71, -      69,    70,    69,    15,    31,    -1,    66,    43,    71,    69, -      13,    34,    71,    69,    70,    69,    15,    31,    -1,    67, -      64,    33,    68,    59,    69,    -1,    67,    64,    33,    70, -      69,    15,    20,    -1,    67,    64,    33,    70,    69,    14, -      70,    69,    15,    20,    -1,    67,    64,    33,    70,    69, -      68,    62,    69,    15,    20,    -1,    63,    -1,    63,    49, -      62,    -1,    14,    67,    64,    33,    70,    69,    -1,    71, -      -1,    71,    43,    71,    -1,    50,    64,    51,    -1,    31, -      36,    -1,    31,    35,    10,    -1,    20,    -1,    -1,    -1, -      -1,    70,    49,    -1,    70,    59,    -1,     7,    -1,     8, -      -1,     9,    50,    82,    51,    -1,    10,    50,    82,    51, -      -1,    10,    -1,    58,    -1,    71,    44,    71,    -1,    71, -      45,    71,    -1,    71,    46,    71,    -1,    71,    47,    71, -      -1,    71,    52,    71,    -1,    71,    53,    71,    -1,    71, -      42,    71,    -1,    71,    37,    71,    -1,    71,    38,    71, -      -1,    44,    71,    -1,    45,    71,    -1,    50,    71,    51, -      -1,    24,    11,    -1,    25,    10,    -1,    30,    71,    -1, -      74,    -1,    16,    -1,    18,    73,    -1,    10,    -1,    73, -      54,    10,    -1,    19,    22,    -1,    19,    27,    -1,    19, -      29,    -1,    19,    75,    -1,    19,    75,    76,    -1,    19, -      76,    -1,    34,    17,    11,    -1,    17,    11,    -1,    34, -      11,    -1,    11,    -1,    28,    26,    11,    -1,    26,    11, -      -1,    34,    26,    11,    -1,    -1,    23,    10,    78,    68, -      79,    49,    80,    70,    -1,    -1,    10,    -1,    79,    54, -      10,    -1,    79,    49,    54,    10,    -1,    -1,    10,    68, -      82,    -1,    -1,    71,    -1,    82,    54,    71,    -1 +      57,     0,    -1,    58,    50,    57,    -1,    58,    -1,    -1, +      79,    -1,    74,    -1,    83,    -1,    59,    -1,    61,    -1, +      60,    -1,     1,    -1,    31,    73,    22,    10,    -1,    33, +      10,    44,    73,    -1,    33,    10,    35,    73,    -1,    73, +      -1,    74,    -1,    62,    -1,    66,    51,    65,    52,    72, +      71,    16,    32,    -1,    67,    44,    73,    71,    35,    73, +      71,    72,    71,    16,    32,    -1,    67,    44,    73,    71, +      13,    35,    73,    71,    72,    71,    16,    32,    -1,    68, +      65,    34,    70,    60,    71,    -1,    68,    65,    34,    72, +      71,    16,    21,    -1,    68,    65,    34,    72,    71,    14, +      72,    71,    16,    21,    -1,    68,    65,    34,    72,    71, +      70,    63,    71,    16,    21,    -1,    64,    63,    -1,    64, +      -1,    69,    65,    34,    72,    -1,    73,    -1,    73,    44, +      73,    -1,    51,    65,    52,    -1,    32,    37,    -1,    32, +      36,    10,    -1,    21,    -1,    15,    -1,    -1,    -1,    -1, +      72,    50,    -1,    72,    60,    -1,     7,    -1,     8,    -1, +       9,    51,    84,    52,    -1,    10,    51,    84,    52,    -1, +      10,    -1,    59,    -1,    73,    45,    73,    -1,    73,    46, +      73,    -1,    73,    47,    73,    -1,    73,    48,    73,    -1, +      73,    53,    73,    -1,    73,    54,    73,    -1,    73,    43, +      73,    -1,    73,    38,    73,    -1,    73,    39,    73,    -1, +      45,    73,    -1,    46,    73,    -1,    51,    73,    52,    -1, +      25,    11,    -1,    26,    10,    -1,    31,    73,    -1,    76, +      -1,    17,    -1,    19,    75,    -1,    10,    -1,    75,    55, +      10,    -1,    20,    23,    -1,    20,    28,    -1,    20,    30, +      -1,    20,    77,    -1,    20,    77,    78,    -1,    20,    78, +      -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,    80,    70,    81, +      50,    82,    72,    -1,    -1,    10,    -1,    81,    55,    10, +      -1,    81,    50,    55,    10,    -1,    -1,    10,    70,    84, +      -1,    -1,    73,    -1,    84,    55,    73,    -1  };  /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */ @@ -540,12 +542,12 @@ static const yytype_uint16 yyrline[] =         0,    92,    92,    93,    96,    97,    98,    99,   100,   101,       102,   103,   106,   112,   118,   126,   127,   128,   133,   144,       160,   174,   182,   188,   196,   206,   207,   210,   220,   221, -     222,   224,   226,   232,   234,   236,   238,   239,   240,   243, -     248,   251,   257,   265,   268,   269,   270,   271,   272,   273, -     274,   275,   276,   277,   278,   279,   280,   283,   284,   285, -     286,   287,   289,   292,   293,   304,   305,   306,   307,   312, -     318,   325,   326,   327,   328,   331,   332,   333,   361,   361, -     368,   369,   370,   371,   373,   376,   384,   385,   386 +     222,   224,   226,   232,   234,   236,   238,   240,   241,   242, +     245,   250,   253,   259,   267,   270,   271,   272,   273,   274, +     275,   276,   277,   278,   279,   280,   281,   282,   285,   286, +     287,   288,   289,   291,   294,   295,   306,   307,   308,   309, +     314,   320,   327,   328,   329,   330,   333,   334,   335,   363, +     363,   370,   371,   372,   373,   375,   378,   386,   387,   388  };  #endif @@ -555,16 +557,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", "tEND", -  "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", -  "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", -  "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", -  "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", -  "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program", -  "programline", "asgn", "stmt", "stmtoneliner", "ifstmt", "elseif", -  "elseif1", "cond", "repeatwhile", "repeatwith", "if", "begin", "end", -  "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe", -  "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0 +  "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", "stmtoneliner", "ifstmt", "elseifstmt", +  "elseifstmt1", "cond", "repeatwhile", "repeatwith", "if", "elseif", +  "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc", +  "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro", +  "arglist", 0  };  #endif @@ -577,23 +580,23 @@ static const yytype_uint16 yytoknum[] =       265,   266,   267,   268,   269,   270,   271,   272,   273,   274,       275,   276,   277,   278,   279,   280,   281,   282,   283,   284,       285,   286,   287,   288,   289,   290,   291,   292,   293,   294, -     295,   296,   297,    61,    43,    45,    42,    47,    37,    10, -      40,    41,    62,    60,    44 +     295,   296,   297,   298,    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,    55,    56,    56,    57,    57,    57,    57,    57,    57, -      57,    57,    58,    58,    58,    59,    59,    59,    59,    59, -      59,    60,    61,    61,    61,    62,    62,    63,    64,    64, -      64,    65,    66,    67,    68,    69,    70,    70,    70,    71, -      71,    71,    71,    71,    71,    71,    71,    71,    71,    71, -      71,    71,    71,    71,    71,    71,    71,    72,    72,    72, -      72,    72,    72,    73,    73,    74,    74,    74,    74,    74, -      74,    75,    75,    75,    75,    76,    76,    76,    78,    77, -      79,    79,    79,    79,    80,    81,    82,    82,    82 +       0,    56,    57,    57,    58,    58,    58,    58,    58,    58, +      58,    58,    59,    59,    59,    60,    60,    60,    60,    60, +      60,    61,    62,    62,    62,    63,    63,    64,    65,    65, +      65,    66,    67,    68,    69,    70,    71,    72,    72,    72, +      73,    73,    73,    73,    73,    73,    73,    73,    73,    73, +      73,    73,    73,    73,    73,    73,    73,    73,    74,    74, +      74,    74,    74,    74,    75,    75,    76,    76,    76,    76, +      76,    76,    77,    77,    77,    77,    78,    78,    78,    80, +      79,    81,    81,    81,    81,    82,    83,    84,    84,    84  };  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */ @@ -601,13 +604,13 @@ static const yytype_uint8 yyr2[] =  {         0,     2,     3,     1,     0,     1,     1,     1,     1,     1,         1,     1,     4,     4,     4,     1,     1,     1,     8,    11, -      12,     6,     7,    10,    10,     1,     3,     6,     1,     3, -       3,     2,     3,     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 +      12,     6,     7,    10,    10,     2,     1,     4,     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 @@ -615,173 +618,171 @@ static const yytype_uint8 yyr2[] =     means the default is an error.  */  static const yytype_uint8 yydefact[] =  { -       0,    11,    39,    40,     0,    34,    61,     0,     0,    33, +       0,    11,    40,    41,     0,    35,    62,     0,     0,    33,         0,     0,     0,     0,     0,     0,     0,     0,     0,     0, -       3,    44,    10,     9,    17,     0,     0,     0,    15,     6, -      60,     5,     7,    86,    86,    86,    63,    62,    74,     0, -      65,     0,    66,     0,    67,     0,    68,    70,    78,    57, -      58,    43,     0,    44,    59,     0,    31,     0,    54,    55, +       3,    45,    10,     9,    17,     0,     0,     0,    15,     6, +      61,     5,     7,    87,    87,    87,    64,    63,    75,     0, +      66,     0,    67,     0,    68,     0,    69,    71,    79,    58, +      59,    44,     0,    45,    60,     0,    31,     0,    55,    56,         0,     1,     0,     0,     0,     0,     0,    28,     0,     0, -       0,     0,     0,     0,     0,     0,     0,    87,     0,     0, -      85,     0,    72,    76,     0,    73,     0,     0,     0,    69, -      34,     0,     0,    32,     0,     0,    56,     2,     0,    35, -       0,     0,    34,     0,    52,    53,    51,    45,    46,    47, -      48,    49,    50,    41,     0,    42,    64,    75,    71,    77, -      80,    12,    14,    13,    36,     0,    30,     0,    35,    29, -      88,    81,     0,    35,     0,     0,    35,     0,    16,    37, -      38,     0,    84,     0,     0,     0,    35,    21,     0,    36, -       0,     0,     0,    36,    82,     0,    35,    36,    36,    35, -      22,     0,    35,    25,    83,    79,    18,    36,    35,     0, -       0,     0,     0,    35,     0,     0,     0,     0,    26,     0, -       0,    23,    36,    24,     0,    19,    35,    20,    27 +       0,     0,     0,     0,     0,     0,     0,    88,     0,     0, +      86,     0,    73,    77,     0,    74,     0,     0,     0,    70, +      35,     0,     0,    32,     0,     0,    57,     2,     0,    36, +       0,     0,    35,     0,    53,    54,    52,    46,    47,    48, +      49,    50,    51,    42,     0,    43,    65,    76,    72,    78, +      81,    12,    14,    13,    37,     0,    30,     0,    36,    29, +      89,    82,     0,    36,     0,     0,    36,     0,    16,    38, +      39,    35,    85,     0,     0,     0,    36,    21,     0,    37, +       0,     0,     0,    37,    83,     0,    36,    37,    37,    36, +      22,    34,    36,    26,     0,    84,    80,    18,    37,    36, +       0,     0,    25,     0,    36,     0,     0,     0,    37,     0, +       0,    23,    24,    27,     0,    19,    20  };  /* YYDEFGOTO[NTERM-NUM].  */  static const yytype_int16 yydefgoto[] =  {        -1,    19,    20,    53,   140,    23,    24,   162,   163,    66, -      25,    26,   137,    35,   125,   128,    28,   138,    37,    30, -      46,    47,    31,    90,   132,   153,    32,    78 +      25,    26,   137,   164,    35,   125,   128,    28,   138,    37, +      30,    46,    47,    31,    90,   132,   153,    32,    78  };  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing     STATE-NUM.  */ -#define YYPACT_NINF -87 +#define YYPACT_NINF -84  static const yytype_int16 yypact[] =  { -     126,   -87,   -87,   -87,   -43,   286,   -87,    -1,    88,   -87, -      16,    13,    51,   197,    17,    64,   197,   197,   197,    80, -      33,     2,   -87,   -87,   -87,    36,    45,   241,   274,   -87, -     -87,   -87,   -87,   197,   197,   197,   -87,    38,   -87,    82, -     -87,    83,   -87,    69,   -87,    20,    -7,   -87,   -87,   -87, -     -87,    46,   197,   -87,    -3,    90,   -87,   -11,   130,   130, -     250,   -87,   126,   241,   197,   241,    70,   262,   197,   197, -     197,   197,   197,   197,   197,   197,   197,   274,   -18,    -6, -      48,    96,   -87,   -87,   100,   -87,   108,   109,    95,   -87, -     -87,    -3,   113,   -87,   197,   197,   -87,   -87,    73,   274, -      74,   223,    -9,   197,   274,   274,   274,   101,   101,   130, -     130,   274,   274,   -87,   197,   -87,   -87,   -87,   -87,   -87, -     118,   -87,   274,   274,   -87,     4,   -87,   214,   170,   274, -     274,   -87,   -29,   170,   107,   197,   -87,   241,   -87,   -87, -     -87,    42,    75,   142,   140,   197,   274,   -87,   127,   -87, -     139,   148,   153,   -87,   -87,   133,   274,   -87,   -87,   170, -     -87,   146,   -87,   120,   -87,   170,   -87,   -87,   170,   158, -     241,   159,   148,   170,   166,   164,   152,   167,   -87,   176, -     161,   -87,   -87,   -87,   162,   -87,   170,   -87,   -87 +     133,   -84,   -84,   -84,   -26,   273,   -84,    22,     8,   -84, +      43,    35,    79,   129,    47,    84,   129,   129,   129,    97, +      48,    15,   -84,   -84,   -84,    49,    61,   161,   261,   -84, +     -84,   -84,   -84,   129,   129,   129,   -84,    51,   -84,   104, +     -84,   105,   -84,    90,   -84,     6,    13,   -84,   -84,   -84, +     -84,    69,   129,   -84,    65,   111,   -84,   -17,    -9,    -9, +     237,   -84,   133,   161,   129,   161,    89,   249,   129,   129, +     129,   129,   129,   129,   129,   129,   129,   261,    23,    36, +      70,   116,   -84,   -84,   117,   -84,   119,   120,   100,   -84, +     -84,    65,   125,   -84,   129,   129,   -84,   -84,    92,   261, +      93,   219,    -3,   129,   261,   261,   261,   198,   198,    -9, +      -9,   261,   261,   -84,   129,   -84,   -84,   -84,   -84,   -84, +     136,   -84,   261,   261,   -84,   -12,   -84,   223,   178,   261, +     261,   -84,    -1,   178,   112,   129,   -84,   161,   -84,   -84, +     -84,    63,    94,   138,   139,   129,   261,   -84,   122,   -84, +     140,   148,   157,   -84,   -84,   141,   261,   -84,   -84,   178, +     -84,   -84,   -84,   148,   161,   -84,   178,   -84,   -84,   178, +     156,   160,   -84,   143,   178,   165,   168,   169,   -84,   166, +     159,   -84,   -84,   178,   164,   -84,   -84  };  /* YYPGOTO[NTERM-NUM].  */  static const yytype_int16 yypgoto[] =  { -     -87,   134,   -87,    14,    10,   -87,   -87,    25,   -87,   -62, -     -87,   -87,     0,   -86,   -55,   -70,    -5,    15,   -87,   -87, -     -87,   157,   -87,   -87,   -87,   -87,   -87,    50 +     -84,   131,   -84,     7,     2,   -84,   -84,    37,   -84,   -57, +     -84,   -84,     9,   -84,   -74,   -60,   -83,   -13,    10,   -84, +     -84,   -84,   155,   -84,   -84,   -84,   -84,   -84,    58  };  /* 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 -44 +#define YYTABLE_NINF -45  static const yytype_int16 yytable[] =  { -      27,    98,    -8,   100,   120,   -36,   -36,    33,    54,    36, -      22,    58,    59,    60,    21,    29,   127,   134,    92,    41, -     142,    43,    67,    94,    49,   143,    48,    88,    77,    77, -      77,    85,    95,   113,    68,    69,   114,    86,   135,    70, -     -36,    71,    72,    73,    74,   115,    87,    91,   114,    75, -      76,    -8,    55,    56,   133,   151,   149,   150,    67,    99, -     101,    50,    27,   104,   105,   106,   107,   108,   109,   110, -     111,   112,    22,   141,    57,   148,    21,    29,   144,   159, -      61,   147,    62,   165,    79,    80,    63,   168,    64,   122, -     123,   157,    81,    82,    83,    84,    34,   173,   129,    38, -      93,   167,   114,   102,   169,    39,   116,   171,   176,   130, -      40,   117,   186,   174,    41,    42,    43,    44,   179,   118, -     119,    87,    45,   121,   124,   126,    -4,     1,   131,   152, -     146,   188,    67,     2,     3,     4,     5,   136,    68,    69, -     156,   145,     6,    70,     7,     8,     9,    73,    74,    10, -      11,    12,   154,    75,    76,   155,    13,    14,    15,   160, -     158,   170,   161,   164,   166,    67,     9,    68,    69,   172, -      16,    17,    70,   175,   177,    -4,    18,     2,     3,     4, -      51,   180,    75,    76,   181,   182,     6,   183,     7,     8, -       9,   184,   185,   187,    11,    12,    97,   178,     0,     0, -      13,    14,    15,    89,     2,     3,     4,    51,     0,     0, -       0,     0,     0,     0,    16,    17,     0,     0,     0,   139, -      18,     2,     3,     4,    51,     0,     0,    52,     0,    15, -       6,     0,     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,    16,    17, -      68,    69,     0,     0,    18,    70,   103,    71,    72,    73, -      74,    52,     0,    15,    96,    75,    76,     0,     0,     0, -       0,     0,     0,     0,     0,    16,    17,    68,    69,     0, -       0,    65,    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,   -43,   -43,     0,    75,    76,   -43,     0, -       0,     0,   -43,   -43,     0,     0,    34,     0,   -43,   -43 +      54,   134,    22,    58,    59,    60,    98,    21,   100,    27, +      29,   -37,   -37,   -37,    67,    -8,   120,    85,    94,    38, +      77,    77,    77,   135,    86,    33,    39,    95,   127,    68, +      69,    40,    36,    87,    70,    41,    42,    43,    44,    91, +      41,   133,    43,    45,    75,    76,    49,   -37,    88,   142, +      67,    99,   101,    48,   143,   104,   105,   106,   107,   108, +     109,   110,   111,   112,    22,    -8,   159,   151,   141,    21, +     166,    27,    29,   144,   169,   113,   147,   149,   114,   150, +     148,   122,   123,    55,    56,   174,   157,    92,   115,    50, +     129,   114,    79,    80,    57,   183,   168,    61,    62,   170, +      63,   130,   171,    68,    69,    64,    81,   173,    70,   175, +      71,    72,    73,    74,   179,    82,    83,    84,    75,    76, +      34,    93,   146,   102,    67,   114,   116,    87,   117,   136, +     118,   119,   156,    -4,     1,   121,     2,     3,     4,    51, +       2,     3,     4,     5,   124,   126,   131,   145,   154,   152, +       6,    67,     7,     8,     9,   155,   158,    10,    11,    12, +      52,   160,    15,   161,    13,    14,    15,   165,     2,     3, +       4,    51,   176,   167,    16,    17,   177,   178,    16,    17, +      18,   180,   184,    -4,    18,     2,     3,     4,    51,   181, +     182,   185,    52,    97,    15,     6,   186,     7,     8,     9, +     172,    89,     0,    11,    12,     0,    16,    17,     0,    13, +      14,    15,    65,     0,     0,     0,     0,     0,     0,     0, +       0,     0,     0,    16,    17,     0,     0,     0,   139,    18, +       2,     3,     4,    51,     0,     0,    68,    69,     0,     0, +       6,    70,     7,     8,     9,    73,    74,     0,    11,    12, +       0,    75,    76,     0,    13,    14,    15,    68,    69,     0, +       0,     0,    70,   103,    71,    72,    73,    74,    16,    17, +       0,    96,    75,    76,    18,    68,    69,     0,     0,     0, +      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,   -44,   -44,     0,    75,    76,   -44,     0,     0,     0, +     -44,   -44,     0,     0,    34,     0,   -44,   -44  };  static const yytype_int16 yycheck[] =  { -       0,    63,     0,    65,    90,    14,    15,    50,    13,    10, -       0,    16,    17,    18,     0,     0,   102,    13,    21,    26, -      49,    28,    27,    34,    11,    54,    10,    34,    33,    34, -      35,    11,    43,    51,    37,    38,    54,    17,    34,    42, -      49,    44,    45,    46,    47,    51,    26,    52,    54,    52, -      53,    49,    35,    36,   124,   141,    14,    15,    63,    64, -      65,    10,    62,    68,    69,    70,    71,    72,    73,    74, -      75,    76,    62,   128,    10,   137,    62,    62,   133,   149, -       0,   136,    49,   153,    34,    35,    50,   157,    43,    94, -      95,   146,    54,    11,    11,    26,    50,   167,   103,    11, -      10,   156,    54,    33,   159,    17,    10,   162,   170,   114, -      22,    11,   182,   168,    26,    27,    28,    29,   173,    11, -      11,    26,    34,    10,    51,    51,     0,     1,    10,    54, -     135,   186,   137,     7,     8,     9,    10,   127,    37,    38, -     145,    34,    16,    42,    18,    19,    20,    46,    47,    23, -      24,    25,    10,    52,    53,    15,    30,    31,    32,    20, -      33,   161,    14,    10,    31,   170,    20,    37,    38,    49, -      44,    45,    42,    15,    15,    49,    50,     7,     8,     9, -      10,    15,    52,    53,    20,    33,    16,    20,    18,    19, -      20,    15,    31,    31,    24,    25,    62,   172,    -1,    -1, -      30,    31,    32,    46,     7,     8,     9,    10,    -1,    -1, -      -1,    -1,    -1,    -1,    44,    45,    -1,    -1,    -1,    49, -      50,     7,     8,     9,    10,    -1,    -1,    30,    -1,    32, -      16,    -1,    18,    19,    20,    -1,    -1,    -1,    24,    25, -      -1,    44,    45,    -1,    30,    31,    32,    50,     7,     8, -       9,    10,    -1,    -1,    -1,    -1,    -1,    -1,    44,    45, -      37,    38,    -1,    -1,    50,    42,    43,    44,    45,    46, -      47,    30,    -1,    32,    51,    52,    53,    -1,    -1,    -1, -      -1,    -1,    -1,    -1,    -1,    44,    45,    37,    38,    -1, -      -1,    50,    42,    -1,    44,    45,    46,    47,    -1,    37, -      38,    51,    52,    53,    42,    43,    44,    45,    46,    47, -      -1,    37,    38,    -1,    52,    53,    42,    -1,    44,    45, -      46,    47,    -1,    37,    38,    -1,    52,    53,    42,    -1, -      -1,    -1,    46,    47,    -1,    -1,    50,    -1,    52,    53 +      13,    13,     0,    16,    17,    18,    63,     0,    65,     0, +       0,    14,    15,    16,    27,     0,    90,    11,    35,    11, +      33,    34,    35,    35,    18,    51,    18,    44,   102,    38, +      39,    23,    10,    27,    43,    27,    28,    29,    30,    52, +      27,   124,    29,    35,    53,    54,    11,    50,    35,    50, +      63,    64,    65,    10,    55,    68,    69,    70,    71,    72, +      73,    74,    75,    76,    62,    50,   149,   141,   128,    62, +     153,    62,    62,   133,   157,    52,   136,    14,    55,    16, +     137,    94,    95,    36,    37,   168,   146,    22,    52,    10, +     103,    55,    34,    35,    10,   178,   156,     0,    50,   159, +      51,   114,   162,    38,    39,    44,    55,   164,    43,   169, +      45,    46,    47,    48,   174,    11,    11,    27,    53,    54, +      51,    10,   135,    34,   137,    55,    10,    27,    11,   127, +      11,    11,   145,     0,     1,    10,     7,     8,     9,    10, +       7,     8,     9,    10,    52,    52,    10,    35,    10,    55, +      17,   164,    19,    20,    21,    16,    34,    24,    25,    26, +      31,    21,    33,    15,    31,    32,    33,    10,     7,     8, +       9,    10,    16,    32,    45,    46,    16,    34,    45,    46, +      51,    16,    16,    50,    51,     7,     8,     9,    10,    21, +      21,    32,    31,    62,    33,    17,    32,    19,    20,    21, +     163,    46,    -1,    25,    26,    -1,    45,    46,    -1,    31, +      32,    33,    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1, +      -1,    -1,    -1,    45,    46,    -1,    -1,    -1,    50,    51, +       7,     8,     9,    10,    -1,    -1,    38,    39,    -1,    -1, +      17,    43,    19,    20,    21,    47,    48,    -1,    25,    26, +      -1,    53,    54,    -1,    31,    32,    33,    38,    39,    -1, +      -1,    -1,    43,    44,    45,    46,    47,    48,    45,    46, +      -1,    52,    53,    54,    51,    38,    39,    -1,    -1,    -1, +      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  };  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing     symbol of state STATE-NUM.  */  static const yytype_uint8 yystos[] =  { -       0,     1,     7,     8,     9,    10,    16,    18,    19,    20, -      23,    24,    25,    30,    31,    32,    44,    45,    50,    56, -      57,    58,    59,    60,    61,    65,    66,    67,    71,    72, -      74,    77,    81,    50,    50,    68,    10,    73,    11,    17, -      22,    26,    27,    28,    29,    34,    75,    76,    10,    11, -      10,    10,    30,    58,    71,    35,    36,    10,    71,    71, -      71,     0,    49,    50,    43,    50,    64,    71,    37,    38, -      42,    44,    45,    46,    47,    52,    53,    71,    82,    82, -      82,    54,    11,    11,    26,    11,    17,    26,    34,    76, -      78,    71,    21,    10,    34,    43,    51,    56,    64,    71, -      64,    71,    33,    43,    71,    71,    71,    71,    71,    71, -      71,    71,    71,    51,    54,    51,    10,    11,    11,    11, -      68,    10,    71,    71,    51,    69,    51,    68,    70,    71, -      71,    10,    79,    70,    13,    34,    59,    67,    72,    49, -      59,    69,    49,    54,    69,    34,    71,    69,    64,    14, -      15,    68,    54,    80,    10,    15,    71,    69,    33,    70, -      20,    14,    62,    63,    10,    70,    31,    69,    70,    69, -      67,    69,    49,    70,    69,    15,    64,    15,    62,    69, -      15,    20,    33,    20,    15,    31,    70,    31,    69 +       0,     1,     7,     8,     9,    10,    17,    19,    20,    21, +      24,    25,    26,    31,    32,    33,    45,    46,    51,    57, +      58,    59,    60,    61,    62,    66,    67,    68,    73,    74, +      76,    79,    83,    51,    51,    70,    10,    75,    11,    18, +      23,    27,    28,    29,    30,    35,    77,    78,    10,    11, +      10,    10,    31,    59,    73,    36,    37,    10,    73,    73, +      73,     0,    50,    51,    44,    51,    65,    73,    38,    39, +      43,    45,    46,    47,    48,    53,    54,    73,    84,    84, +      84,    55,    11,    11,    27,    11,    18,    27,    35,    78, +      80,    73,    22,    10,    35,    44,    52,    57,    65,    73, +      65,    73,    34,    44,    73,    73,    73,    73,    73,    73, +      73,    73,    73,    52,    55,    52,    10,    11,    11,    11, +      70,    10,    73,    73,    52,    71,    52,    70,    72,    73, +      73,    10,    81,    72,    13,    35,    60,    68,    74,    50, +      60,    71,    50,    55,    71,    35,    73,    71,    65,    14, +      16,    70,    55,    82,    10,    16,    73,    71,    34,    72, +      21,    15,    63,    64,    69,    10,    72,    32,    71,    72, +      71,    71,    63,    65,    72,    71,    16,    16,    34,    71, +      16,    21,    21,    72,    16,    32,    32  };  #define yyerrok		(yyerrstatus = 0) @@ -1730,12 +1731,12 @@ yyreduce:  #line 210 "engines/director/lingo/lingo-gr.y"      {  		inst then = 0, else1 = 0, end = 0; -		WRITE_UINT32(&then, (yyvsp[(5) - (6)].code)); -		WRITE_UINT32(&else1, (yyvsp[(6) - (6)].code)); +		WRITE_UINT32(&then, (yyvsp[(4) - (4)].code)); +		WRITE_UINT32(&else1, 0);  		WRITE_UINT32(&end, 0); -		(*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 1] = then;      /* thenpart */ -		(*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 2] = else1;     /* elsepart */ -		(*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 3] = end; ;} +		(*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 1] = then;      /* thenpart */ +		(*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 2] = else1;     /* elsepart */ +		(*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 3] = end; ;}      break;    case 28: @@ -1769,21 +1770,26 @@ yyreduce:    case 34:  #line 234 "engines/director/lingo/lingo-gr.y" -    { (yyval.code) = g_lingo->_currentScript->size(); ;} +    { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}      break;    case 35:  #line 236 "engines/director/lingo/lingo-gr.y" -    { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} +    { (yyval.code) = g_lingo->_currentScript->size(); ;}      break;    case 36:  #line 238 "engines/director/lingo/lingo-gr.y" +    { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;} +    break; + +  case 37: +#line 240 "engines/director/lingo/lingo-gr.y"      { (yyval.code) = g_lingo->_currentScript->size(); ;}      break; -  case 39: -#line 243 "engines/director/lingo/lingo-gr.y" +  case 40: +#line 245 "engines/director/lingo/lingo-gr.y"      {  		(yyval.code) = g_lingo->code1(g_lingo->c_constpush);  		inst i = 0; @@ -1791,15 +1797,15 @@ yyreduce:  		g_lingo->code1(i); ;}      break; -  case 40: -#line 248 "engines/director/lingo/lingo-gr.y" +  case 41: +#line 250 "engines/director/lingo/lingo-gr.y"      {  		(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);  		g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}      break; -  case 41: -#line 251 "engines/director/lingo/lingo-gr.y" +  case 42: +#line 253 "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)); @@ -1808,8 +1814,8 @@ yyreduce:  		delete (yyvsp[(1) - (4)].s); ;}      break; -  case 42: -#line 257 "engines/director/lingo/lingo-gr.y" +  case 43: +#line 259 "engines/director/lingo/lingo-gr.y"      {  		(yyval.code) = g_lingo->code1(g_lingo->c_call);  		g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str()); @@ -1820,121 +1826,121 @@ yyreduce:  		delete (yyvsp[(1) - (4)].s); ;}      break; -  case 43: -#line 265 "engines/director/lingo/lingo-gr.y" +  case 44: +#line 267 "engines/director/lingo/lingo-gr.y"      {  		(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));  		delete (yyvsp[(1) - (1)].s); ;}      break; -  case 45: -#line 269 "engines/director/lingo/lingo-gr.y" +  case 46: +#line 271 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_add); ;}      break; -  case 46: -#line 270 "engines/director/lingo/lingo-gr.y" +  case 47: +#line 272 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_sub); ;}      break; -  case 47: -#line 271 "engines/director/lingo/lingo-gr.y" +  case 48: +#line 273 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_mul); ;}      break; -  case 48: -#line 272 "engines/director/lingo/lingo-gr.y" +  case 49: +#line 274 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_div); ;}      break; -  case 49: -#line 273 "engines/director/lingo/lingo-gr.y" +  case 50: +#line 275 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_gt); ;}      break; -  case 50: -#line 274 "engines/director/lingo/lingo-gr.y" +  case 51: +#line 276 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_lt); ;}      break; -  case 51: -#line 275 "engines/director/lingo/lingo-gr.y" +  case 52: +#line 277 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_neq); ;}      break; -  case 52: -#line 276 "engines/director/lingo/lingo-gr.y" +  case 53: +#line 278 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_ge); ;}      break; -  case 53: -#line 277 "engines/director/lingo/lingo-gr.y" +  case 54: +#line 279 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_le); ;}      break; -  case 54: -#line 278 "engines/director/lingo/lingo-gr.y" +  case 55: +#line 280 "engines/director/lingo/lingo-gr.y"      { (yyval.code) = (yyvsp[(2) - (2)].code); ;}      break; -  case 55: -#line 279 "engines/director/lingo/lingo-gr.y" +  case 56: +#line 281 "engines/director/lingo/lingo-gr.y"      { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}      break; -  case 56: -#line 280 "engines/director/lingo/lingo-gr.y" +  case 57: +#line 282 "engines/director/lingo/lingo-gr.y"      { (yyval.code) = (yyvsp[(2) - (3)].code); ;}      break; -  case 57: -#line 283 "engines/director/lingo/lingo-gr.y" +  case 58: +#line 285 "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 58: -#line 284 "engines/director/lingo/lingo-gr.y" +  case 59: +#line 286 "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 59: -#line 285 "engines/director/lingo/lingo-gr.y" +  case 60: +#line 287 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_printtop); ;}      break; -  case 61: -#line 287 "engines/director/lingo/lingo-gr.y" +  case 62: +#line 289 "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 63: -#line 292 "engines/director/lingo/lingo-gr.y" +  case 64: +#line 294 "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 64: -#line 293 "engines/director/lingo/lingo-gr.y" +  case 65: +#line 295 "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 65: -#line 304 "engines/director/lingo/lingo-gr.y" +  case 66: +#line 306 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_gotoloop); ;}      break; -  case 66: -#line 305 "engines/director/lingo/lingo-gr.y" +  case 67: +#line 307 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_gotonext); ;}      break; -  case 67: -#line 306 "engines/director/lingo/lingo-gr.y" +  case 68: +#line 308 "engines/director/lingo/lingo-gr.y"      { g_lingo->code1(g_lingo->c_gotoprevious); ;}      break; -  case 68: -#line 307 "engines/director/lingo/lingo-gr.y" +  case 69: +#line 309 "engines/director/lingo/lingo-gr.y"      {  		g_lingo->code1(g_lingo->c_goto);  		g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -1942,8 +1948,8 @@ yyreduce:  		delete (yyvsp[(2) - (2)].s); ;}      break; -  case 69: -#line 312 "engines/director/lingo/lingo-gr.y" +  case 70: +#line 314 "engines/director/lingo/lingo-gr.y"      {  		g_lingo->code1(g_lingo->c_goto);  		g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -1952,8 +1958,8 @@ yyreduce:  		delete (yyvsp[(3) - (3)].s); ;}      break; -  case 70: -#line 318 "engines/director/lingo/lingo-gr.y" +  case 71: +#line 320 "engines/director/lingo/lingo-gr.y"      {  		g_lingo->code1(g_lingo->c_goto);  		g_lingo->codeString(""); @@ -1961,48 +1967,48 @@ yyreduce:  		delete (yyvsp[(2) - (2)].s); ;}      break; -  case 71: -#line 325 "engines/director/lingo/lingo-gr.y" +  case 72: +#line 327 "engines/director/lingo/lingo-gr.y"      { (yyval.s) = (yyvsp[(3) - (3)].s); ;}      break; -  case 72: -#line 326 "engines/director/lingo/lingo-gr.y" +  case 73: +#line 328 "engines/director/lingo/lingo-gr.y"      { (yyval.s) = (yyvsp[(2) - (2)].s); ;}      break; -  case 73: -#line 327 "engines/director/lingo/lingo-gr.y" +  case 74: +#line 329 "engines/director/lingo/lingo-gr.y"      { (yyval.s) = (yyvsp[(2) - (2)].s); ;}      break; -  case 74: -#line 328 "engines/director/lingo/lingo-gr.y" +  case 75: +#line 330 "engines/director/lingo/lingo-gr.y"      { (yyval.s) = (yyvsp[(1) - (1)].s); ;}      break; -  case 75: -#line 331 "engines/director/lingo/lingo-gr.y" +  case 76: +#line 333 "engines/director/lingo/lingo-gr.y"      { (yyval.s) = (yyvsp[(3) - (3)].s); ;}      break; -  case 76: -#line 332 "engines/director/lingo/lingo-gr.y" +  case 77: +#line 334 "engines/director/lingo/lingo-gr.y"      { (yyval.s) = (yyvsp[(2) - (2)].s); ;}      break; -  case 77: -#line 333 "engines/director/lingo/lingo-gr.y" +  case 78: +#line 335 "engines/director/lingo/lingo-gr.y"      { (yyval.s) = (yyvsp[(3) - (3)].s); ;}      break; -  case 78: -#line 361 "engines/director/lingo/lingo-gr.y" +  case 79: +#line 363 "engines/director/lingo/lingo-gr.y"      { g_lingo->_indef = true; ;}      break; -  case 79: -#line 362 "engines/director/lingo/lingo-gr.y" +  case 80: +#line 364 "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); @@ -2010,33 +2016,33 @@ yyreduce:  			g_lingo->_indef = false; ;}      break; -  case 80: -#line 368 "engines/director/lingo/lingo-gr.y" +  case 81: +#line 370 "engines/director/lingo/lingo-gr.y"      { (yyval.narg) = 0; ;}      break; -  case 81: -#line 369 "engines/director/lingo/lingo-gr.y" +  case 82: +#line 371 "engines/director/lingo/lingo-gr.y"      { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}      break; -  case 82: -#line 370 "engines/director/lingo/lingo-gr.y" +  case 83: +#line 372 "engines/director/lingo/lingo-gr.y"      { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}      break; -  case 83: -#line 371 "engines/director/lingo/lingo-gr.y" +  case 84: +#line 373 "engines/director/lingo/lingo-gr.y"      { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}      break; -  case 84: -#line 373 "engines/director/lingo/lingo-gr.y" +  case 85: +#line 375 "engines/director/lingo/lingo-gr.y"      { g_lingo->codeArgStore(); ;}      break; -  case 85: -#line 376 "engines/director/lingo/lingo-gr.y" +  case 86: +#line 378 "engines/director/lingo/lingo-gr.y"      {  		g_lingo->code1(g_lingo->c_call);  		g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2045,24 +2051,24 @@ yyreduce:  		g_lingo->code1(numpar); ;}      break; -  case 86: -#line 384 "engines/director/lingo/lingo-gr.y" +  case 87: +#line 386 "engines/director/lingo/lingo-gr.y"      { (yyval.narg) = 0; ;}      break; -  case 87: -#line 385 "engines/director/lingo/lingo-gr.y" +  case 88: +#line 387 "engines/director/lingo/lingo-gr.y"      { (yyval.narg) = 1; ;}      break; -  case 88: -#line 386 "engines/director/lingo/lingo-gr.y" +  case 89: +#line 388 "engines/director/lingo/lingo-gr.y"      { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}      break;  /* Line 1267 of yacc.c.  */ -#line 2066 "engines/director/lingo/lingo-gr.cpp" +#line 2072 "engines/director/lingo/lingo-gr.cpp"        default: break;      }    YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2276,6 +2282,6 @@ yyreturn:  } -#line 389 "engines/director/lingo/lingo-gr.y" +#line 391 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h index 2aff182464..4216ad6d2e 100644 --- a/engines/director/lingo/lingo-gr.h +++ b/engines/director/lingo/lingo-gr.h @@ -51,34 +51,35 @@       HANDLER = 267,       tDOWN = 268,       tELSE = 269, -     tEND = 270, -     tEXIT = 271, -     tFRAME = 272, -     tGLOBAL = 273, -     tGO = 274, -     tIF = 275, -     tINTO = 276, -     tLOOP = 277, -     tMACRO = 278, -     tMCI = 279, -     tMCIWAIT = 280, -     tMOVIE = 281, -     tNEXT = 282, -     tOF = 283, -     tPREVIOUS = 284, -     tPUT = 285, -     tREPEAT = 286, -     tSET = 287, -     tTHEN = 288, -     tTO = 289, -     tWITH = 290, -     tWHILE = 291, -     tGE = 292, -     tLE = 293, -     tGT = 294, -     tLT = 295, -     tEQ = 296, -     tNEQ = 297 +     tELSIF = 270, +     tEND = 271, +     tEXIT = 272, +     tFRAME = 273, +     tGLOBAL = 274, +     tGO = 275, +     tIF = 276, +     tINTO = 277, +     tLOOP = 278, +     tMACRO = 279, +     tMCI = 280, +     tMCIWAIT = 281, +     tMOVIE = 282, +     tNEXT = 283, +     tOF = 284, +     tPREVIOUS = 285, +     tPUT = 286, +     tREPEAT = 287, +     tSET = 288, +     tTHEN = 289, +     tTO = 290, +     tWITH = 291, +     tWHILE = 292, +     tGE = 293, +     tLE = 294, +     tGT = 295, +     tLT = 296, +     tEQ = 297, +     tNEQ = 298     };  #endif  /* Tokens.  */ @@ -94,34 +95,35 @@  #define HANDLER 267  #define tDOWN 268  #define tELSE 269 -#define tEND 270 -#define tEXIT 271 -#define tFRAME 272 -#define tGLOBAL 273 -#define tGO 274 -#define tIF 275 -#define tINTO 276 -#define tLOOP 277 -#define tMACRO 278 -#define tMCI 279 -#define tMCIWAIT 280 -#define tMOVIE 281 -#define tNEXT 282 -#define tOF 283 -#define tPREVIOUS 284 -#define tPUT 285 -#define tREPEAT 286 -#define tSET 287 -#define tTHEN 288 -#define tTO 289 -#define tWITH 290 -#define tWHILE 291 -#define tGE 292 -#define tLE 293 -#define tGT 294 -#define tLT 295 -#define tEQ 296 -#define tNEQ 297 +#define tELSIF 270 +#define tEND 271 +#define tEXIT 272 +#define tFRAME 273 +#define tGLOBAL 274 +#define tGO 275 +#define tIF 276 +#define tINTO 277 +#define tLOOP 278 +#define tMACRO 279 +#define tMCI 280 +#define tMCIWAIT 281 +#define tMOVIE 282 +#define tNEXT 283 +#define tOF 284 +#define tPREVIOUS 285 +#define tPUT 286 +#define tREPEAT 287 +#define tSET 288 +#define tTHEN 289 +#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 @@ -137,7 +139,7 @@ typedef union YYSTYPE  	int	narg;	/* number of arguments */  }  /* Line 1529 of yacc.c.  */ -#line 141 "engines/director/lingo/lingo-gr.hpp" +#line 143 "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 de153b9bdc..35d589b782 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -74,11 +74,11 @@ using namespace Director;  %token<i> INT  %token<f> FLOAT  %token<s> BLTIN ID STRING HANDLER -%token tDOWN tELSE tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT +%token tDOWN tELSE tELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT  %token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE  %token tGE tLE tGT tLT tEQ tNEQ -%type<code> asgn begin cond end expr if repeatwhile repeatwith stmtlist +%type<code> asgn begin cond elseif end expr if repeatwhile repeatwith stmtlist  %type<s> gotoframe gotomovie  %type<narg> argdef arglist @@ -193,7 +193,7 @@ ifstmt:	if cond tTHEN stmtlist end tEND tIF {  		(*g_lingo->_currentScript)[$1 + 1] = then;      /* thenpart */  		(*g_lingo->_currentScript)[$1 + 2] = else1;     /* elsepart */  		(*g_lingo->_currentScript)[$1 + 3] = end; }     /* end, if cond fails */ -	| if cond tTHEN stmtlist end begin elseif end tEND tIF { +	| if cond tTHEN stmtlist end begin elseifstmt end tEND tIF {  		inst then = 0, else1 = 0, end = 0;  		WRITE_UINT32(&then, $4);  		WRITE_UINT32(&else1, $6); @@ -203,14 +203,14 @@ ifstmt:	if cond tTHEN stmtlist end tEND tIF {  		(*g_lingo->_currentScript)[$1 + 3] = end; }     /* end, if cond fails */  	; -elseif:	elseif1 -	|	elseif1 '\n' elseif +elseifstmt:	elseifstmt1 elseifstmt +	|	elseifstmt1  	; -elseif1:	tELSE if cond tTHEN stmtlist end { +elseifstmt1:	elseif cond tTHEN stmtlist {  		inst then = 0, else1 = 0, end = 0; -		WRITE_UINT32(&then, $5); -		WRITE_UINT32(&else1, $6); +		WRITE_UINT32(&then, $4); +		WRITE_UINT32(&else1, 0);  		WRITE_UINT32(&end, 0);  		(*g_lingo->_currentScript)[$2 + 1] = then;      /* thenpart */  		(*g_lingo->_currentScript)[$2 + 2] = else1;     /* elsepart */ @@ -229,7 +229,9 @@ repeatwith:		tREPEAT tWITH ID	{  		g_lingo->codeString($3->c_str());  		delete $3; }  	; -if:	  tIF	{ $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); } +if:	  tIF					{ $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); } +	; +elseif:	  tELSIF			{ $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }  	;  begin:	  /* nothing */		{ $$ = g_lingo->_currentScript->size(); }  	; diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index bd84f79d7b..bbe427579a 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 38 -#define YY_END_OF_BUFFER 39 +#define YY_NUM_RULES 39 +#define YY_END_OF_BUFFER 40  /* This struct is not used in this scanner,     but its presence is necessary. */  struct yy_trans_info @@ -373,21 +373,22 @@ struct yy_trans_info  	flex_int32_t yy_verify;  	flex_int32_t yy_nxt;  	}; -static yyconst flex_int16_t yy_accept[121] = +static yyconst flex_int16_t yy_accept[124] =      {   0, -        0,    0,   39,   37,    3,   35,   35,   37,   37,   37, -       34,   34,   33,   34,   34,   31,   31,   31,   31,   31, -       31,   31,   31,   31,   31,   31,   31,   31,   31,   31, -        2,    2,    3,   35,    0,   28,    0,   36,    1,   32, -       33,   30,   29,   31,   31,   31,   31,   31,   31,   31, -       11,    5,   31,   31,   31,   31,   31,   31,   19,   31, -       31,   31,   31,   31,   25,   31,   31,    1,   32,   31, -       31,    7,   31,   31,   31,   31,   31,   31,   15,   31, -       31,   31,   21,   31,   23,   31,   31,   31,    4,    6, -        8,   31,   31,   12,   13,   31,   31,   31,   18,   31, - -       31,   24,   31,   26,    9,   31,   14,   31,   17,   31, -       31,   27,   10,   31,   31,   22,   16,   31,   20,    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,    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      } ;  static yyconst flex_int32_t yy_ec[256] = @@ -432,43 +433,43 @@ static yyconst flex_int32_t yy_meta[58] =          4,    4,    4,    4,    4,    4,    4      } ; -static yyconst flex_int16_t yy_base[124] = +static yyconst flex_int16_t yy_base[127] =      {   0, -        0,   56,  244,  270,   60,   56,   63,   66,  230,  235, -      270,  232,   62,  155,  145,    0,   46,   50,   46,   53, +        0,   56,  250,  287,   60,   56,   63,   66,  236,  241, +      287,  236,   62,  228,  203,    0,   46,   50,   46,   53,         62,   51,   75,   64,   64,   78,   68,   72,   93,   94, -      123,  131,  141,   90,  145,  270,  116,  270,    0,  111, -      108,  270,  270,    0,   45,   89,  112,  108,  125,  123, +      123,  131,  141,   90,  145,  287,  161,  287,    0,  147, +      108,  287,  287,    0,   45,   89,  112,  108,  125,  123,          0,    0,  122,  127,  139,  134,  125,  124,    0,  142, -      131,  135,  133,  147,    0,  144,  137,    0,   77,  143, +      131,  135,  133,  147,    0,  144,  137,    0,  112,  143,        152,    0,  141,  148,  161,  154,  158,  162,  161,  174, -      168,  167,    0,  179,    0,  175,  179,  183,    0,    0, +      168,  167,    0,  179,    0,  175,  179,  183,    0,   83,          0,  187,  192,    0,    0,  181,  195,  192,    0,  189, -      199,    0,  196,    0,    0,  193,    0,  193,    0,  196, -      194,    0,    0,  199,  202,    0,    0,  209,    0,  270, -      261,   81,  265 +      199,    0,  196,    0,  233,    0,  193,    0,  201,    0, +      198,  199,    0,  220,    0,  210,  210,    0,  287,    0, +      213,    0,  287,  278,  118,  282      } ; -static yyconst flex_int16_t yy_def[124] = +static yyconst flex_int16_t yy_def[127] =      {   0, -      120,    1,  120,  120,  120,  120,  120,  120,  120,  121, -      120,  120,  120,  120,  120,  122,  122,  122,  122,  122, -      122,  122,  122,  122,  122,  122,  122,  122,  122,  122, -      120,  120,  120,  120,  120,  120,  121,  120,  123,  120, -      120,  120,  120,  122,  122,  122,  122,  122,  122,  122, -      122,  122,  122,  122,  122,  122,  122,  122,  122,  122, -      122,  122,  122,  122,  122,  122,  122,  123,  120,  122, -      122,  122,  122,  122,  122,  122,  122,  122,  122,  122, -      122,  122,  122,  122,  122,  122,  122,  122,  122,  122, -      122,  122,  122,  122,  122,  122,  122,  122,  122,  122, - -      122,  122,  122,  122,  122,  122,  122,  122,  122,  122, -      122,  122,  122,  122,  122,  122,  122,  122,  122,    0, -      120,  120,  120 +      123,    1,  123,  123,  123,  123,  123,  123,  123,  124, +      123,  123,  123,  123,  123,  125,  125,  125,  125,  125, +      125,  125,  125,  125,  125,  125,  125,  125,  125,  125, +      123,  123,  123,  123,  123,  123,  124,  123,  126,  123, +      123,  123,  123,  125,  125,  125,  125,  125,  125,  125, +      125,  125,  125,  125,  125,  125,  125,  125,  125,  125, +      125,  125,  125,  125,  125,  125,  125,  126,  123,  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,  123,  125,  125,  125,  125,  125, +      125,  125,  125,  123,  125,  125,  125,  125,  123,  125, +      125,  125,    0,  123,  123,  123      } ; -static yyconst flex_int16_t yy_nxt[328] = +static yyconst flex_int16_t yy_nxt[345] =      {   0,          4,    5,    6,    7,    8,    9,   10,   11,   12,    4,         13,   14,   11,   15,   16,   16,   16,   17,   18,   19, @@ -478,37 +479,39 @@ static yyconst flex_int16_t yy_nxt[328] =         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,   70, -       51,   52,   58,   59,   44,   48,   62,   69,   53,   55, +       51,   52,   58,   59,  105,   48,   62,  105,   53,   55,         63,   56,   34,   34,   45,   46,   49,   47,   50,   54,         70,   51,   57,   52,   58,   59,   48,   60,   62,   53,         61,   55,   63,   56,   64,   66,   67,   40,   41,   71, -       65,   69,   38,   57,   33,   34,   34,   35,   60,   72, +       65,   44,   69,   57,   33,   34,   34,   35,   60,   72,         73,   61,   35,   34,   34,   35,   64,   66,   67,   74,         71,   65,   33,   34,   34,   35,   35,   34,   34,   35, -       75,   72,   73,   76,   77,   78,   79,   43,   80,   81, -       82,   74,   83,   84,   85,   86,   87,   42,   88,   89, +       75,   72,   73,   76,   77,   78,   79,   69,   80,   81, +       82,   74,   83,   84,   85,   86,   87,   38,   88,   89,         90,   75,   91,   92,   76,   77,   93,   78,   79,   80,         81,   94,   82,   83,   84,   85,   95,   86,   87,   88,         89,   96,   90,   91,   92,   97,   98,  101,   93,   99, -      100,  102,   94,  103,  104,  105,  106,   95,  107,  108, -      109,  110,   96,  111,  112,  114,   97,  113,   98,  101, -       99,  100,  102,  115,  103,  116,  104,  105,  106,  107, -      117,  108,  109,  110,  118,  111,  112,  114,  113,  119, -       39,   38,   36,  120,  115,  120,  116,  120,  120,  120, -      120,  117,  120,  120,  120,  118,  120,  120,  120,  120, -      119,   37,  120,   37,   37,   68,  120,  120,   68,    3, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, - -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120 +      100,  102,   94,  103,  104,  106,  107,   95,  108,  109, +      110,  111,   96,  112,  113,   43,   97,  115,   98,  101, +       99,  100,  102,  116,  103,  117,  104,  106,  107,  108, +      118,  109,  110,  111,  105,  112,  113,  105,  115,  119, +       42,  120,  121,  122,   39,  116,  117,   38,   36,  123, +      123,  118,  123,  123,  123,  114,  123,  123,  123,  123, +      123,  119,  120,  121,  122,  123,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  114,   37,  123, +       37,   37,   68,  123,  123,   68,    3,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, + +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123      } ; -static yyconst flex_int16_t yy_chk[328] = +static yyconst flex_int16_t yy_chk[345] =      {   0,          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,          1,    1,    1,    1,    1,    1,    1,    1,    1,    1, @@ -518,34 +521,36 @@ static yyconst flex_int16_t yy_chk[328] =          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,  122,   18,   27,   69,   21,   23, +       20,   21,   24,   25,   90,   18,   27,   90,   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,   40,   37,   23,   31,   31,   31,   31,   26,   47, +       29,  125,   69,   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,   15,   57,   58, -       60,   49,   61,   62,   63,   64,   66,   14,   67,   70, +       50,   47,   48,   53,   54,   55,   56,   40,   57,   58, +       60,   49,   61,   62,   63,   64,   66,   37,   67,   70,         71,   50,   73,   74,   53,   54,   75,   55,   56,   57,         58,   76,   60,   61,   62,   63,   77,   64,   66,   67,         70,   78,   71,   73,   74,   79,   80,   84,   75,   81,         82,   86,   76,   87,   88,   92,   93,   77,   96,   97, -       98,  100,   78,  101,  103,  108,   79,  106,   80,   84, -       81,   82,   86,  110,   87,  111,   88,   92,   93,   96, -      114,   97,   98,  100,  115,  101,  103,  108,  106,  118, -       12,   10,    9,    3,  110,    0,  111,    0,    0,    0, -        0,  114,    0,    0,    0,  115,    0,    0,    0,    0, -      118,  121,    0,  121,  121,  123,    0,    0,  123,  120, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, - -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120,  120,  120,  120, -      120,  120,  120,  120,  120,  120,  120 +       98,  100,   78,  101,  103,   15,   79,  107,   80,   84, +       81,   82,   86,  109,   87,  111,   88,   92,   93,   96, +      112,   97,   98,  100,  105,  101,  103,  105,  107,  114, +       14,  116,  117,  121,   12,  109,  111,   10,    9,    3, +        0,  112,    0,    0,    0,  105,    0,    0,    0,    0, +        0,  114,  116,  117,  121,    0,    0,    0,    0,    0, +        0,    0,    0,    0,    0,    0,    0,  105,  124,    0, +      124,  124,  126,    0,    0,  126,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, + +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123,  123,  123,  123,  123,  123,  123, +      123,  123,  123,  123      } ;  static yy_state_type yy_last_accepting_state; @@ -595,7 +600,7 @@ char *yytext;  int yyparse(); -#line 599 "engines/director/lingo/lingo-lex.cpp" +#line 604 "engines/director/lingo/lingo-lex.cpp"  #define INITIAL 0 @@ -783,7 +788,7 @@ YY_DECL  #line 45 "engines/director/lingo/lingo-lex.l" -#line 787 "engines/director/lingo/lingo-lex.cpp" +#line 792 "engines/director/lingo/lingo-lex.cpp"  	if ( !(yy_init) )  		{ @@ -837,13 +842,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 >= 121 ) +				if ( yy_current_state >= 124 )  					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] != 270 ); +		while ( yy_base[yy_current_state] != 287 );  yy_find_action:  		yy_act = yy_accept[yy_current_state]; @@ -895,131 +900,136 @@ YY_RULE_SETUP  case 6:  YY_RULE_SETUP  #line 53 "engines/director/lingo/lingo-lex.l" -{ return tELSE; } +{ return tELSIF; }  	YY_BREAK  case 7:  YY_RULE_SETUP  #line 54 "engines/director/lingo/lingo-lex.l" -{ return tEND; } +{ return tELSE; }  	YY_BREAK  case 8:  YY_RULE_SETUP  #line 55 "engines/director/lingo/lingo-lex.l" -{ return tEXIT; } +{ return tEND; }  	YY_BREAK  case 9:  YY_RULE_SETUP  #line 56 "engines/director/lingo/lingo-lex.l" -{ return tFRAME; } +{ return tEXIT; }  	YY_BREAK  case 10:  YY_RULE_SETUP  #line 57 "engines/director/lingo/lingo-lex.l" -{ return tGLOBAL; } +{ return tFRAME; }  	YY_BREAK  case 11:  YY_RULE_SETUP  #line 58 "engines/director/lingo/lingo-lex.l" -{ return tGO; } +{ return tGLOBAL; }  	YY_BREAK  case 12:  YY_RULE_SETUP  #line 59 "engines/director/lingo/lingo-lex.l" -{ return tINTO; } +{ return tGO; }  	YY_BREAK  case 13:  YY_RULE_SETUP  #line 60 "engines/director/lingo/lingo-lex.l" -{ return tLOOP; } +{ return tINTO; }  	YY_BREAK  case 14:  YY_RULE_SETUP  #line 61 "engines/director/lingo/lingo-lex.l" -{ return tMACRO; } +{ return tLOOP; }  	YY_BREAK  case 15:  YY_RULE_SETUP  #line 62 "engines/director/lingo/lingo-lex.l" -{ return tMCI; } +{ return tMACRO; }  	YY_BREAK  case 16:  YY_RULE_SETUP  #line 63 "engines/director/lingo/lingo-lex.l" -{ return tMCIWAIT; } +{ return tMCI; }  	YY_BREAK  case 17:  YY_RULE_SETUP  #line 64 "engines/director/lingo/lingo-lex.l" -{ return tMOVIE; } +{ return tMCIWAIT; }  	YY_BREAK  case 18:  YY_RULE_SETUP  #line 65 "engines/director/lingo/lingo-lex.l" -{ return tNEXT; } +{ return tMOVIE; }  	YY_BREAK  case 19:  YY_RULE_SETUP  #line 66 "engines/director/lingo/lingo-lex.l" -{ return tOF; } +{ return tNEXT; }  	YY_BREAK  case 20:  YY_RULE_SETUP  #line 67 "engines/director/lingo/lingo-lex.l" -{ return tPREVIOUS; } +{ return tOF; }  	YY_BREAK  case 21:  YY_RULE_SETUP  #line 68 "engines/director/lingo/lingo-lex.l" -{ return tPUT; } +{ return tPREVIOUS; }  	YY_BREAK  case 22:  YY_RULE_SETUP  #line 69 "engines/director/lingo/lingo-lex.l" -{ return tREPEAT; } +{ return tPUT; }  	YY_BREAK  case 23:  YY_RULE_SETUP  #line 70 "engines/director/lingo/lingo-lex.l" -{ return tSET; } +{ return tREPEAT; }  	YY_BREAK  case 24:  YY_RULE_SETUP  #line 71 "engines/director/lingo/lingo-lex.l" -{ return tTHEN; } +{ return tSET; }  	YY_BREAK  case 25:  YY_RULE_SETUP  #line 72 "engines/director/lingo/lingo-lex.l" -{ return tTO; } +{ return tTHEN; }  	YY_BREAK  case 26:  YY_RULE_SETUP  #line 73 "engines/director/lingo/lingo-lex.l" -{ return tWITH; } +{ return tTO; }  	YY_BREAK  case 27:  YY_RULE_SETUP  #line 74 "engines/director/lingo/lingo-lex.l" -{ return tWHILE; } +{ return tWITH; }  	YY_BREAK  case 28:  YY_RULE_SETUP -#line 76 "engines/director/lingo/lingo-lex.l" -{ return tNEQ; } +#line 75 "engines/director/lingo/lingo-lex.l" +{ return tWHILE; }  	YY_BREAK  case 29:  YY_RULE_SETUP  #line 77 "engines/director/lingo/lingo-lex.l" -{ return tGE; } +{ return tNEQ; }  	YY_BREAK  case 30:  YY_RULE_SETUP  #line 78 "engines/director/lingo/lingo-lex.l" -{ return tLE; } +{ return tGE; }  	YY_BREAK  case 31:  YY_RULE_SETUP -#line 80 "engines/director/lingo/lingo-lex.l" +#line 79 "engines/director/lingo/lingo-lex.l" +{ return tLE; } +	YY_BREAK +case 32: +YY_RULE_SETUP +#line 81 "engines/director/lingo/lingo-lex.l"  {  		yylval.s = new Common::String(yytext); @@ -1029,43 +1039,43 @@ YY_RULE_SETUP  		return ID;  	}  	YY_BREAK -case 32: -YY_RULE_SETUP -#line 88 "engines/director/lingo/lingo-lex.l" -{ yylval.f = atof(yytext); return FLOAT; } -	YY_BREAK  case 33:  YY_RULE_SETUP  #line 89 "engines/director/lingo/lingo-lex.l" -{ yylval.i = strtol(yytext, NULL, 10); return INT; } +{ yylval.f = atof(yytext); return FLOAT; }  	YY_BREAK  case 34:  YY_RULE_SETUP  #line 90 "engines/director/lingo/lingo-lex.l" -{ return *yytext; } +{ yylval.i = strtol(yytext, NULL, 10); return INT; }  	YY_BREAK  case 35: -/* rule 35 can match eol */  YY_RULE_SETUP  #line 91 "engines/director/lingo/lingo-lex.l" -{ return '\n'; } +{ return *yytext; }  	YY_BREAK  case 36: +/* rule 36 can match eol */  YY_RULE_SETUP  #line 92 "engines/director/lingo/lingo-lex.l" -{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } +{ return '\n'; }  	YY_BREAK  case 37:  YY_RULE_SETUP  #line 93 "engines/director/lingo/lingo-lex.l" - +{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }  	YY_BREAK  case 38:  YY_RULE_SETUP -#line 95 "engines/director/lingo/lingo-lex.l" +#line 94 "engines/director/lingo/lingo-lex.l" + +	YY_BREAK +case 39: +YY_RULE_SETUP +#line 96 "engines/director/lingo/lingo-lex.l"  ECHO;  	YY_BREAK -#line 1069 "engines/director/lingo/lingo-lex.cpp" +#line 1079 "engines/director/lingo/lingo-lex.cpp"  case YY_STATE_EOF(INITIAL):  	yyterminate(); @@ -1358,7 +1368,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 >= 121 ) +			if ( yy_current_state >= 124 )  				yy_c = yy_meta[(unsigned int) yy_c];  			}  		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1386,11 +1396,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 >= 121 ) +		if ( yy_current_state >= 124 )  			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 == 120); +	yy_is_jam = (yy_current_state == 123);  	return yy_is_jam ? 0 : yy_current_state;  } @@ -2065,7 +2075,7 @@ void yyfree (void * ptr )  #define YYTABLES_NAME "yytables" -#line 95 "engines/director/lingo/lingo-lex.l" +#line 96 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 6144bba448..2580f4f822 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -50,6 +50,7 @@ whitespace [\t ]  (?i:down)			{ return tDOWN; }  (?i:if)				{ return tIF; } +(?i:else[\t ]+if)	{ return tELSIF; }  (?i:else)			{ return tELSE; }  (?i:end)			{ return tEND; }  (?i:exit)			{ return tEXIT; }  | 
