[Scummvm-cvs-logs] scummvm master -> 05b4f29932d6dd89d1164c0c135db094fa6f734e

sev- sev at scummvm.org
Fri Aug 5 23:13:30 CEST 2016


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
464f360e97 DIRECTOR: Lingo: Made built-in functions generic
05b4f29932 DIRECTOR: Lingo: Added generic built-in procedures


Commit: 464f360e97ed5010b77ed469b25c3be7f87ba0d4
    https://github.com/scummvm/scummvm/commit/464f360e97ed5010b77ed469b25c3be7f87ba0d4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-05T22:55:47+02:00

Commit Message:
DIRECTOR: Lingo: Made built-in functions generic

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/lingo/lingo-code.cpp
    engines/director/lingo/lingo-lex.l
    engines/director/lingo/lingo.cpp
    engines/director/lingo/lingo.h



diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index acec593..0361fa7 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -27,35 +27,37 @@ namespace Director {
 static struct BuiltinProto {
 	const char *name;
 	void (*func)(void);
-	int nparams;
+	int minArgs;
+	int maxArgs;
+	bool parens;
 } builtins[] = {
 	// Math
-	{ "abs",	Lingo::b_abs, 1 },
-	{ "atan",	Lingo::b_atan, 1 },
-	{ "cos",	Lingo::b_cos, 1 },
-	{ "exp",	Lingo::b_exp, 1 },
-	{ "float",	Lingo::b_float, 1 },
-	{ "integer",Lingo::b_integer, 1 },
-	{ "log",	Lingo::b_log, 1 },
-	{ "pi",		Lingo::b_pi, 0 },
-	{ "power",	Lingo::b_power, 2 },
-	{ "random",	Lingo::b_random, 1 },
-	{ "sin",	Lingo::b_sin, 1 },
-	{ "sqrt",	Lingo::b_sqrt, 1 },
-	{ "tan",	Lingo::b_tan, 1 },
+	{ "abs",	Lingo::b_abs,		1, 1, true },
+	{ "atan",	Lingo::b_atan,		1, 1, true },
+	{ "cos",	Lingo::b_cos,		1, 1, true },
+	{ "exp",	Lingo::b_exp,		1, 1, true },
+	{ "float",	Lingo::b_float,		1, 1, true },
+	{ "integer",Lingo::b_integer,	1, 1, true },
+	{ "log",	Lingo::b_log,		1, 1, true },
+	{ "pi",		Lingo::b_pi,		0, 0, true },
+	{ "power",	Lingo::b_power,		2, 2, true },
+	{ "random",	Lingo::b_random,	1, 1, true },
+	{ "sin",	Lingo::b_sin,		1, 1, true },
+	{ "sqrt",	Lingo::b_sqrt,		1, 1, true },
+	{ "tan",	Lingo::b_tan,		1, 1, true },
 	// String
-	{ "chars",	Lingo::b_chars, 3 },
-	{ "length",	Lingo::b_length, 1 },
-	{ "string",	Lingo::b_string, 1 },
+	{ "chars",	Lingo::b_chars,		3, 3, true },
+	{ "length",	Lingo::b_length,	1, 1, true },
+	{ "string",	Lingo::b_string,	1, 1, true },
 	// Misc
-	{ "closeDA",	 	Lingo::b_closeDA, -1 },
-	{ "continue",		Lingo::b_continue, -1 },
-	{ "dontpassevent",	Lingo::b_dontpassevent, -1 },
-	{ "updatestage",	Lingo::b_updatestage, -1 },
-	{ "ilk",	 		Lingo::b_ilk, 1 },
+	{ "closeDA",	 	Lingo::b_closeDA, 		0, 0, false },
+	{ "continue",		Lingo::b_continue,		0, 0, false },
+	{ "dontpassevent",	Lingo::b_dontpassevent,	0, 0, false },
+	{ "updatestage",	Lingo::b_updatestage,	0, 0, false },
+	{ "ilk",	 		Lingo::b_ilk,			1, 2, true },
 	// point
-	{ "point",	Lingo::b_point, 2 },
-	{ 0, 0, 0 }
+	{ "point",	Lingo::b_point, 2, 2, true },
+	{ 0, 0, 0, 0, false }
 };
 
 void Lingo::initBuiltIns() {
@@ -65,7 +67,9 @@ void Lingo::initBuiltIns() {
 		sym->name = (char *)calloc(strlen(blt->name) + 1, 1);
 		Common::strlcpy(sym->name, blt->name, strlen(blt->name));
 		sym->type = BLTIN;
-		sym->nargs = blt->nparams;
+		sym->nargs = blt->minArgs;
+		sym->maxArgs = blt->maxArgs;
+		sym->parens = blt->parens;
 		sym->u.func = blt->func;
 
 		_handlers[blt->name] = sym;
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index bcd479f..0d5b07c 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -740,10 +740,27 @@ void Lingo::c_call() {
 	g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
 
 	int nargs = READ_UINT32(&(*g_lingo->_currentScript)[g_lingo->_pc++]);
+	bool drop = false;
+
+	Symbol *sym;
 
 	if (!g_lingo->_handlers.contains(name)) {
 		warning("Call to undefined handler '%s'. Dropping %d stack items", name.c_str(), nargs);
+		drop = true;
+	} else {
+		sym = g_lingo->_handlers[name];
+
+		if (sym->type == BLTIN && sym->nargs != nargs && sym->maxArgs != nargs) {
+			if (sym->nargs == sym->maxArgs)
+				warning("Incorrect number of arguments to handler '%s', expecting %d. Dropping %d stack items", name.c_str(), sym->nargs, nargs);
+			else
+				warning("Incorrect number of arguments to handler '%s', expecting %d or %d. Dropping %d stack items", name.c_str(), sym->nargs, sym->maxArgs, nargs);
+
+			drop = true;
+		}
+	}
 
+	if (drop) {
 		for (int i = 0; i < nargs; i++)
 			g_lingo->pop();
 
@@ -753,8 +770,6 @@ void Lingo::c_call() {
 		return;
 	}
 
-	Symbol *sym = g_lingo->_handlers[name];
-
 	if (sym->nargs < nargs) {
 		warning("Incorrect number of arguments for function %s. Dropping extra %d", name.c_str(), nargs - sym->nargs);
 		for (int i = 0; i < nargs - sym->nargs; i++)
@@ -762,15 +777,8 @@ void Lingo::c_call() {
 	}
 
 	if (sym->type == BLTIN) {
-		if (sym->nargs > 0 && nargs < sym->nargs) {
-			warning("Too few arguments for function %s. Expecting %d but got %d", name.c_str(), sym->nargs, nargs);
-			for (int i = 0; i < nargs; i++)
-				g_lingo->pop();
+		// FIXME. TODO. Pass nargs
 
-			g_lingo->pushVoid();
-
-			return;
-		}
 		(*sym->u.func)();
 
 		return;
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 5e64922..2d871ce 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -185,7 +185,10 @@ whitespace [\t ]
 		yylval.s = new Common::String(yytext);
 
 		if (g_lingo->_handlers.contains(yytext)) {
-			if (g_lingo->_handlers[yytext]->type == BLTIN && g_lingo->_handlers[yytext]->nargs == -1)
+			if (g_lingo->_handlers[yytext]->type == BLTIN &&
+					g_lingo->_handlers[yytext]->nargs == 0 &&
+					g_lingo->_handlers[yytext]->maxArgs == 0 &&
+					!g_lingo->_handlers[yytext]->parens)
 				return BLTINNOARGS;
 		}
 
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 0bb4309..05478bb 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -72,6 +72,8 @@ Symbol::Symbol() {
 	type = VOID;
 	u.s = NULL;
 	nargs = 0;
+	maxArgs = 0;
+	parens = true;
 	global = false;
 }
 
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 8e73e23..94fe92f 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -89,7 +89,10 @@ struct Symbol {	/* symbol table entry */
 		Common::String	*s;	/* STRING */
 		FloatArray *arr;	/* ARRAY, POINT, RECT */
 	} u;
-	int nargs;
+	int nargs;		/* number of arguments */
+	int maxArgs;	/* maximal number of arguments, for builtins */
+	bool parens;	/* whether parens required or not, for builitins */
+
 	bool global;
 
 	Symbol();


Commit: 05b4f29932d6dd89d1164c0c135db094fa6f734e
    https://github.com/scummvm/scummvm/commit/05b4f29932d6dd89d1164c0c135db094fa6f734e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-05T23:13:01+02:00

Commit Message:
DIRECTOR: Lingo: Added generic built-in procedures

Changed paths:
    engines/director/lingo/lingo-code.cpp
    engines/director/lingo/lingo-gr.cpp
    engines/director/lingo/lingo-gr.h
    engines/director/lingo/lingo-gr.y
    engines/director/lingo/lingo-lex.cpp
    engines/director/lingo/lingo-lex.l
    engines/director/lingo/lingo.h



diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 0d5b07c..67793c8 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -121,6 +121,13 @@ void Lingo::c_constpush() {
 	g_lingo->push(d);
 }
 
+void Lingo::c_voidpush() {
+	Datum d;
+	d.u.i = 0;
+	d.type = VOID;
+	g_lingo->push(d);
+}
+
 void Lingo::c_fconstpush() {
 	Datum d;
 	inst i = (*g_lingo->_currentScript)[g_lingo->_pc];
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index b8e71e2..d8d15d5 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -80,59 +80,61 @@
      FLOAT = 269,
      BLTIN = 270,
      BLTINNOARGS = 271,
-     ID = 272,
-     STRING = 273,
-     HANDLER = 274,
-     tDOWN = 275,
-     tELSE = 276,
-     tNLELSIF = 277,
-     tEND = 278,
-     tEXIT = 279,
-     tFRAME = 280,
-     tGLOBAL = 281,
-     tGO = 282,
-     tIF = 283,
-     tINTO = 284,
-     tLOOP = 285,
-     tMACRO = 286,
-     tMCI = 287,
-     tMCIWAIT = 288,
-     tMOVIE = 289,
-     tNEXT = 290,
-     tOF = 291,
-     tPREVIOUS = 292,
-     tPUT = 293,
-     tREPEAT = 294,
-     tSET = 295,
-     tTHEN = 296,
-     tTO = 297,
-     tWHEN = 298,
-     tWITH = 299,
-     tWHILE = 300,
-     tNLELSE = 301,
-     tFACTORY = 302,
-     tMETHOD = 303,
-     tALERT = 304,
-     tBEEP = 305,
-     tCLOSERESFILE = 306,
-     tCLOSEXLIB = 307,
-     tCURSOR = 308,
-     tDELAY = 309,
-     tGE = 310,
-     tLE = 311,
-     tGT = 312,
-     tLT = 313,
-     tEQ = 314,
-     tNEQ = 315,
-     tAND = 316,
-     tOR = 317,
-     tNOT = 318,
-     tCONCAT = 319,
-     tCONTAINS = 320,
-     tSTARTS = 321,
-     tSPRITE = 322,
-     tINTERSECTS = 323,
-     tWITHIN = 324
+     BLTINNOARGSORONE = 272,
+     BLTINONEARG = 273,
+     ID = 274,
+     STRING = 275,
+     HANDLER = 276,
+     tDOWN = 277,
+     tELSE = 278,
+     tNLELSIF = 279,
+     tEND = 280,
+     tEXIT = 281,
+     tFRAME = 282,
+     tGLOBAL = 283,
+     tGO = 284,
+     tIF = 285,
+     tINTO = 286,
+     tLOOP = 287,
+     tMACRO = 288,
+     tMCI = 289,
+     tMCIWAIT = 290,
+     tMOVIE = 291,
+     tNEXT = 292,
+     tOF = 293,
+     tPREVIOUS = 294,
+     tPUT = 295,
+     tREPEAT = 296,
+     tSET = 297,
+     tTHEN = 298,
+     tTO = 299,
+     tWHEN = 300,
+     tWITH = 301,
+     tWHILE = 302,
+     tNLELSE = 303,
+     tFACTORY = 304,
+     tMETHOD = 305,
+     tALERT = 306,
+     tBEEP = 307,
+     tCLOSERESFILE = 308,
+     tCLOSEXLIB = 309,
+     tCURSOR = 310,
+     tDELAY = 311,
+     tGE = 312,
+     tLE = 313,
+     tGT = 314,
+     tLT = 315,
+     tEQ = 316,
+     tNEQ = 317,
+     tAND = 318,
+     tOR = 319,
+     tNOT = 320,
+     tCONCAT = 321,
+     tCONTAINS = 322,
+     tSTARTS = 323,
+     tSPRITE = 324,
+     tINTERSECTS = 325,
+     tWITHIN = 326
    };
 #endif
 /* Tokens.  */
@@ -150,59 +152,61 @@
 #define FLOAT 269
 #define BLTIN 270
 #define BLTINNOARGS 271
-#define ID 272
-#define STRING 273
-#define HANDLER 274
-#define tDOWN 275
-#define tELSE 276
-#define tNLELSIF 277
-#define tEND 278
-#define tEXIT 279
-#define tFRAME 280
-#define tGLOBAL 281
-#define tGO 282
-#define tIF 283
-#define tINTO 284
-#define tLOOP 285
-#define tMACRO 286
-#define tMCI 287
-#define tMCIWAIT 288
-#define tMOVIE 289
-#define tNEXT 290
-#define tOF 291
-#define tPREVIOUS 292
-#define tPUT 293
-#define tREPEAT 294
-#define tSET 295
-#define tTHEN 296
-#define tTO 297
-#define tWHEN 298
-#define tWITH 299
-#define tWHILE 300
-#define tNLELSE 301
-#define tFACTORY 302
-#define tMETHOD 303
-#define tALERT 304
-#define tBEEP 305
-#define tCLOSERESFILE 306
-#define tCLOSEXLIB 307
-#define tCURSOR 308
-#define tDELAY 309
-#define tGE 310
-#define tLE 311
-#define tGT 312
-#define tLT 313
-#define tEQ 314
-#define tNEQ 315
-#define tAND 316
-#define tOR 317
-#define tNOT 318
-#define tCONCAT 319
-#define tCONTAINS 320
-#define tSTARTS 321
-#define tSPRITE 322
-#define tINTERSECTS 323
-#define tWITHIN 324
+#define BLTINNOARGSORONE 272
+#define BLTINONEARG 273
+#define ID 274
+#define STRING 275
+#define HANDLER 276
+#define tDOWN 277
+#define tELSE 278
+#define tNLELSIF 279
+#define tEND 280
+#define tEXIT 281
+#define tFRAME 282
+#define tGLOBAL 283
+#define tGO 284
+#define tIF 285
+#define tINTO 286
+#define tLOOP 287
+#define tMACRO 288
+#define tMCI 289
+#define tMCIWAIT 290
+#define tMOVIE 291
+#define tNEXT 292
+#define tOF 293
+#define tPREVIOUS 294
+#define tPUT 295
+#define tREPEAT 296
+#define tSET 297
+#define tTHEN 298
+#define tTO 299
+#define tWHEN 300
+#define tWITH 301
+#define tWHILE 302
+#define tNLELSE 303
+#define tFACTORY 304
+#define tMETHOD 305
+#define tALERT 306
+#define tBEEP 307
+#define tCLOSERESFILE 308
+#define tCLOSEXLIB 309
+#define tCURSOR 310
+#define tDELAY 311
+#define tGE 312
+#define tLE 313
+#define tGT 314
+#define tLT 315
+#define tEQ 316
+#define tNEQ 317
+#define tAND 318
+#define tOR 319
+#define tNOT 320
+#define tCONCAT 321
+#define tCONTAINS 322
+#define tSTARTS 323
+#define tSPRITE 324
+#define tINTERSECTS 325
+#define tWITHIN 326
 
 
 
@@ -260,7 +264,7 @@ typedef union YYSTYPE
 	Common::Array<double> *arr;
 }
 /* Line 193 of yacc.c.  */
-#line 264 "engines/director/lingo/lingo-gr.cpp"
+#line 268 "engines/director/lingo/lingo-gr.cpp"
 	YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -273,7 +277,7 @@ typedef union YYSTYPE
 
 
 /* Line 216 of yacc.c.  */
-#line 277 "engines/director/lingo/lingo-gr.cpp"
+#line 281 "engines/director/lingo/lingo-gr.cpp"
 
 #ifdef short
 # undef short
@@ -486,22 +490,22 @@ union yyalloc
 #endif
 
 /* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  89
+#define YYFINAL  93
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   783
+#define YYLAST   824
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  83
+#define YYNTOKENS  85
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  34
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  127
+#define YYNRULES  130
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  266
+#define YYNSTATES  270
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   324
+#define YYMAXUTOK   326
 
 #define YYTRANSLATE(YYX)						\
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -510,12 +514,12 @@ union yyalloc
 static const yytype_uint8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-      76,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+      78,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,    75,    81,     2,
-      77,    78,    73,    71,    82,    72,     2,    74,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,    77,    83,     2,
+      79,    80,    75,    73,    84,    74,     2,    76,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-      80,    70,    79,     2,     2,     2,     2,     2,     2,     2,
+      82,    72,    81,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -541,7 +545,7 @@ static const yytype_uint8 yytranslate[] =
       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
-      65,    66,    67,    68,    69
+      65,    66,    67,    68,    69,    70,    71
 };
 
 #if YYDEBUG
@@ -558,63 +562,64 @@ static const yytype_uint16 yyprhs[] =
      246,   248,   251,   253,   257,   261,   265,   269,   273,   277,
      281,   285,   289,   293,   297,   300,   304,   308,   312,   316,
      319,   322,   326,   331,   336,   339,   342,   345,   347,   349,
-     352,   355,   358,   360,   363,   365,   368,   370,   373,   376,
-     378,   382,   385,   388,   391,   394,   398,   401,   405,   408,
-     411,   413,   417,   420,   424,   425,   434,   437,   438,   447,
-     448,   450,   454,   459,   460,   464,   465,   467
+     352,   355,   358,   360,   363,   366,   368,   371,   373,   376,
+     378,   381,   384,   386,   390,   393,   396,   399,   402,   406,
+     409,   413,   416,   419,   421,   425,   428,   432,   433,   442,
+     445,   446,   455,   456,   458,   462,   467,   468,   472,   473,
+     475
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int8 yyrhs[] =
 {
-      84,     0,    -1,    84,    85,    86,    -1,    86,    -1,     1,
-      76,    -1,    76,    -1,    -1,   110,    -1,   105,    -1,   115,
-      -1,    87,    -1,    89,    -1,    38,   104,    29,    17,    -1,
-      40,    17,    70,   104,    -1,    40,    12,    70,   104,    -1,
-      40,    13,   104,    70,   104,    -1,    40,    17,    42,   104,
-      -1,    40,    12,    42,   104,    -1,    40,    13,   104,    42,
-     104,    -1,   104,    -1,   105,    -1,    88,    -1,    90,    -1,
-      97,    77,    96,    78,   103,   102,    23,    39,    -1,    98,
-      70,   104,   102,    42,   104,   102,   103,   102,    23,    39,
-      -1,    98,    70,   104,   102,    20,    42,   104,   102,   103,
-     102,    23,    39,    -1,    43,    17,    41,   104,    -1,    99,
-      96,    41,    85,   103,   102,    23,    28,    -1,    99,    96,
-      41,    85,   103,   102,    46,   103,   102,    23,    28,    -1,
-      99,    96,    41,    85,   103,   102,   101,    92,   102,    23,
-      28,    -1,    99,    96,    41,   101,    88,   102,    -1,    99,
-      96,    41,   101,    88,   102,    46,   101,    88,   102,    -1,
-      99,    96,    41,   101,    88,   102,    93,   102,    91,   102,
-      -1,    -1,    46,   101,    88,    -1,    92,    95,    -1,    95,
-      -1,    93,    94,    -1,    94,    -1,   100,    96,    41,   101,
-      89,   102,    -1,    93,    -1,   100,    96,    41,   103,   102,
-      -1,   104,    -1,   104,    70,   104,    -1,    77,    96,    78,
-      -1,    39,    45,    -1,    39,    44,    17,    -1,    28,    -1,
-      22,    -1,    -1,    -1,    -1,   103,    85,    -1,   103,    89,
-      -1,    11,    -1,    14,    -1,    18,    -1,    16,    -1,    17,
-      77,   116,    78,    -1,    17,    -1,    12,    -1,    13,   104,
-      -1,    87,    -1,   104,    71,   104,    -1,   104,    72,   104,
-      -1,   104,    73,   104,    -1,   104,    74,   104,    -1,   104,
-      79,   104,    -1,   104,    80,   104,    -1,   104,    60,   104,
-      -1,   104,    55,   104,    -1,   104,    56,   104,    -1,   104,
-      61,   104,    -1,   104,    62,   104,    -1,    63,   104,    -1,
-     104,    81,   104,    -1,   104,    64,   104,    -1,   104,    65,
-     104,    -1,   104,    66,   104,    -1,    71,   104,    -1,    72,
-     104,    -1,    77,   104,    78,    -1,    67,   104,    68,   104,
-      -1,    67,   104,    69,   104,    -1,    32,    18,    -1,    33,
-      17,    -1,    38,   104,    -1,   107,    -1,    24,    -1,    26,
-     106,    -1,    49,   104,    -1,    50,    11,    -1,    50,    -1,
-      51,   104,    -1,    51,    -1,    52,   104,    -1,    52,    -1,
-      53,   104,    -1,    54,   104,    -1,    17,    -1,   106,    82,
-      17,    -1,    27,    30,    -1,    27,    35,    -1,    27,    37,
-      -1,    27,   108,    -1,    27,   108,   109,    -1,    27,   109,
-      -1,    42,    25,    18,    -1,    25,    18,    -1,    42,    18,
-      -1,    18,    -1,    36,    34,    18,    -1,    34,    18,    -1,
-      42,    34,    18,    -1,    -1,    31,    17,   111,   101,   113,
-      85,   114,   103,    -1,    47,    17,    -1,    -1,    48,    17,
-     112,   101,   113,    85,   114,   103,    -1,    -1,    17,    -1,
-     113,    82,    17,    -1,   113,    85,    82,    17,    -1,    -1,
-      17,   101,   116,    -1,    -1,   104,    -1,   116,    82,   104,
-      -1
+      86,     0,    -1,    86,    87,    88,    -1,    88,    -1,     1,
+      78,    -1,    78,    -1,    -1,   112,    -1,   107,    -1,   117,
+      -1,    89,    -1,    91,    -1,    40,   106,    31,    19,    -1,
+      42,    19,    72,   106,    -1,    42,    12,    72,   106,    -1,
+      42,    13,   106,    72,   106,    -1,    42,    19,    44,   106,
+      -1,    42,    12,    44,   106,    -1,    42,    13,   106,    44,
+     106,    -1,   106,    -1,   107,    -1,    90,    -1,    92,    -1,
+      99,    79,    98,    80,   105,   104,    25,    41,    -1,   100,
+      72,   106,   104,    44,   106,   104,   105,   104,    25,    41,
+      -1,   100,    72,   106,   104,    22,    44,   106,   104,   105,
+     104,    25,    41,    -1,    45,    19,    43,   106,    -1,   101,
+      98,    43,    87,   105,   104,    25,    30,    -1,   101,    98,
+      43,    87,   105,   104,    48,   105,   104,    25,    30,    -1,
+     101,    98,    43,    87,   105,   104,   103,    94,   104,    25,
+      30,    -1,   101,    98,    43,   103,    90,   104,    -1,   101,
+      98,    43,   103,    90,   104,    48,   103,    90,   104,    -1,
+     101,    98,    43,   103,    90,   104,    95,   104,    93,   104,
+      -1,    -1,    48,   103,    90,    -1,    94,    97,    -1,    97,
+      -1,    95,    96,    -1,    96,    -1,   102,    98,    43,   103,
+      91,   104,    -1,    95,    -1,   102,    98,    43,   105,   104,
+      -1,   106,    -1,   106,    72,   106,    -1,    79,    98,    80,
+      -1,    41,    47,    -1,    41,    46,    19,    -1,    30,    -1,
+      24,    -1,    -1,    -1,    -1,   105,    87,    -1,   105,    91,
+      -1,    11,    -1,    14,    -1,    20,    -1,    16,    -1,    19,
+      79,   118,    80,    -1,    19,    -1,    12,    -1,    13,   106,
+      -1,    89,    -1,   106,    73,   106,    -1,   106,    74,   106,
+      -1,   106,    75,   106,    -1,   106,    76,   106,    -1,   106,
+      81,   106,    -1,   106,    82,   106,    -1,   106,    62,   106,
+      -1,   106,    57,   106,    -1,   106,    58,   106,    -1,   106,
+      63,   106,    -1,   106,    64,   106,    -1,    65,   106,    -1,
+     106,    83,   106,    -1,   106,    66,   106,    -1,   106,    67,
+     106,    -1,   106,    68,   106,    -1,    73,   106,    -1,    74,
+     106,    -1,    79,   106,    80,    -1,    69,   106,    70,   106,
+      -1,    69,   106,    71,   106,    -1,    34,    20,    -1,    35,
+      19,    -1,    40,   106,    -1,   109,    -1,    26,    -1,    28,
+     108,    -1,    18,   106,    -1,    17,   106,    -1,    17,    -1,
+      51,   106,    -1,    52,    11,    -1,    52,    -1,    53,   106,
+      -1,    53,    -1,    54,   106,    -1,    54,    -1,    55,   106,
+      -1,    56,   106,    -1,    19,    -1,   108,    84,    19,    -1,
+      29,    32,    -1,    29,    37,    -1,    29,    39,    -1,    29,
+     110,    -1,    29,   110,   111,    -1,    29,   111,    -1,    44,
+      27,    20,    -1,    27,    20,    -1,    44,    20,    -1,    20,
+      -1,    38,    36,    20,    -1,    36,    20,    -1,    44,    36,
+      20,    -1,    -1,    33,    19,   113,   103,   115,    87,   116,
+     105,    -1,    49,    19,    -1,    -1,    50,    19,   114,   103,
+     115,    87,   116,   105,    -1,    -1,    19,    -1,   115,    84,
+      19,    -1,   115,    87,    84,    19,    -1,    -1,    19,   103,
+     118,    -1,    -1,   106,    -1,   118,    84,   106,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
@@ -629,10 +634,11 @@ static const yytype_uint16 yyrline[] =
      363,   370,   376,   377,   378,   379,   380,   381,   382,   383,
      384,   385,   386,   387,   388,   389,   390,   391,   392,   393,
      394,   395,   396,   397,   400,   401,   402,   403,   404,   406,
-     407,   408,   411,   414,   415,   418,   419,   422,   423,   426,
-     427,   438,   439,   440,   441,   446,   452,   459,   460,   461,
-     462,   465,   466,   467,   495,   495,   501,   504,   504,   510,
-     511,   512,   513,   515,   519,   527,   528,   529
+     407,   410,   413,   416,   417,   420,   423,   424,   427,   428,
+     431,   432,   435,   436,   447,   448,   449,   450,   455,   461,
+     468,   469,   470,   471,   474,   475,   476,   504,   504,   510,
+     513,   513,   519,   520,   521,   522,   524,   528,   536,   537,
+     538
 };
 #endif
 
@@ -643,17 +649,17 @@ static const char *const yytname[] =
 {
   "$end", "error", "$undefined", "UNARY", "CASTREF", "VOID", "VAR",
   "POINT", "RECT", "ARRAY", "SYMBOL", "INT", "THEENTITY",
-  "THEENTITYWITHID", "FLOAT", "BLTIN", "BLTINNOARGS", "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", "tWHEN", "tWITH", "tWHILE", "tNLELSE", "tFACTORY",
-  "tMETHOD", "tALERT", "tBEEP", "tCLOSERESFILE", "tCLOSEXLIB", "tCURSOR",
-  "tDELAY", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR",
-  "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "tSPRITE", "tINTERSECTS",
-  "tWITHIN", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
-  "')'", "'>'", "'<'", "'&'", "','", "$accept", "program", "nl",
-  "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
+  "THEENTITYWITHID", "FLOAT", "BLTIN", "BLTINNOARGS", "BLTINNOARGSORONE",
+  "BLTINONEARG", "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", "tWHEN", "tWITH", "tWHILE",
+  "tNLELSE", "tFACTORY", "tMETHOD", "tALERT", "tBEEP", "tCLOSERESFILE",
+  "tCLOSEXLIB", "tCURSOR", "tDELAY", "tGE", "tLE", "tGT", "tLT", "tEQ",
+  "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS",
+  "tSPRITE", "tINTERSECTS", "tWITHIN", "'='", "'+'", "'-'", "'*'", "'/'",
+  "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept",
+  "program", "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
   "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
   "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
   "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
@@ -674,27 +680,28 @@ static const yytype_uint16 yytoknum[] =
      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
-      61,    43,    45,    42,    47,    37,    10,    40,    41,    62,
-      60,    38,    44
+     325,   326,    61,    43,    45,    42,    47,    37,    10,    40,
+      41,    62,    60,    38,    44
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    83,    84,    84,    84,    85,    86,    86,    86,    86,
-      86,    86,    87,    87,    87,    87,    87,    87,    87,    88,
-      88,    89,    89,    89,    89,    89,    89,    90,    90,    90,
-      90,    90,    90,    91,    91,    92,    92,    93,    93,    94,
-      95,    95,    96,    96,    96,    97,    98,    99,   100,   101,
-     102,   103,   103,   103,   104,   104,   104,   104,   104,   104,
-     104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
-     104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
-     104,   104,   104,   104,   105,   105,   105,   105,   105,   105,
-     105,   105,   105,   105,   105,   105,   105,   105,   105,   106,
-     106,   107,   107,   107,   107,   107,   107,   108,   108,   108,
-     108,   109,   109,   109,   111,   110,   110,   112,   110,   113,
-     113,   113,   113,   114,   115,   116,   116,   116
+       0,    85,    86,    86,    86,    87,    88,    88,    88,    88,
+      88,    88,    89,    89,    89,    89,    89,    89,    89,    90,
+      90,    91,    91,    91,    91,    91,    91,    92,    92,    92,
+      92,    92,    92,    93,    93,    94,    94,    95,    95,    96,
+      97,    97,    98,    98,    98,    99,   100,   101,   102,   103,
+     104,   105,   105,   105,   106,   106,   106,   106,   106,   106,
+     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
+     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
+     106,   106,   106,   106,   107,   107,   107,   107,   107,   107,
+     107,   107,   107,   107,   107,   107,   107,   107,   107,   107,
+     107,   107,   108,   108,   109,   109,   109,   109,   109,   109,
+     110,   110,   110,   110,   111,   111,   111,   113,   112,   112,
+     114,   112,   115,   115,   115,   115,   116,   117,   118,   118,
+     118
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -709,10 +716,11 @@ static const yytype_uint8 yyr2[] =
        1,     2,     1,     3,     3,     3,     3,     3,     3,     3,
        3,     3,     3,     3,     2,     3,     3,     3,     3,     2,
        2,     3,     4,     4,     2,     2,     2,     1,     1,     2,
-       2,     2,     1,     2,     1,     2,     1,     2,     2,     1,
-       3,     2,     2,     2,     2,     3,     2,     3,     2,     2,
-       1,     3,     2,     3,     0,     8,     2,     0,     8,     0,
-       1,     3,     4,     0,     3,     0,     1,     3
+       2,     2,     1,     2,     2,     1,     2,     1,     2,     1,
+       2,     2,     1,     3,     2,     2,     2,     2,     3,     2,
+       3,     2,     2,     1,     3,     2,     3,     0,     8,     2,
+       0,     8,     0,     1,     3,     4,     0,     3,     0,     1,
+       3
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -720,85 +728,85 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       0,     0,    54,    60,     0,    55,    57,    49,    56,    88,
-       0,     0,    47,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    92,    94,    96,     0,     0,     0,     0,
-       0,     0,     0,     0,     3,    62,    21,    11,    22,     0,
-       0,     0,    19,     8,    87,     7,     9,     4,    59,     0,
-      62,    61,   125,   125,    99,    89,   110,     0,   101,     0,
-     102,     0,   103,     0,   104,   106,   114,    84,    85,    86,
-       0,    45,     0,     0,     0,     0,   116,   117,    90,    91,
-      93,    95,    97,    98,    74,     0,    79,    80,     0,     1,
-       5,     6,     0,     0,     0,     0,    42,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,   126,     0,   124,     0,   108,   112,     0,
-     109,     0,     0,     0,   105,    49,     0,    46,     0,     0,
-       0,     0,     0,     0,    49,     0,     0,    81,     2,     0,
-      50,     0,     0,    49,     0,    70,    71,    69,    72,    73,
-      76,    77,    78,    63,    64,    65,    66,    67,    68,    75,
-      58,     0,   100,   111,   107,   113,   119,    12,    17,    14,
-       0,     0,    16,    13,    26,   119,    82,    83,    51,     0,
-      44,    51,     0,    43,   127,   120,     0,    18,    15,     0,
-      50,     0,     0,    50,    50,    20,     0,   123,   123,    52,
-      53,     0,     0,    50,    49,    30,   121,     0,    51,    51,
-       0,    50,    51,     0,    51,     0,    48,    49,    50,    38,
-       0,   122,   115,   118,    23,    51,    50,    27,    50,    50,
-      40,    36,     0,     0,    37,    33,     0,    50,     0,     0,
-      35,     0,     0,    50,    49,    50,    49,     0,     0,     0,
-       0,    49,    31,     0,    32,     0,     0,    24,    28,    29,
-      50,    34,    50,    25,    41,    39
+       0,     0,    54,    60,     0,    55,    57,    92,     0,    49,
+      56,    88,     0,     0,    47,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    95,    97,    99,     0,     0,
+       0,     0,     0,     0,     0,     0,     3,    62,    21,    11,
+      22,     0,     0,     0,    19,     8,    87,     7,     9,     4,
+      59,     0,    62,    61,    91,    90,   128,   128,   102,    89,
+     113,     0,   104,     0,   105,     0,   106,     0,   107,   109,
+     117,    84,    85,    86,     0,    45,     0,     0,     0,     0,
+     119,   120,    93,    94,    96,    98,   100,   101,    74,     0,
+      79,    80,     0,     1,     5,     6,     0,     0,     0,     0,
+      42,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   129,     0,   127,
+       0,   111,   115,     0,   112,     0,     0,     0,   108,    49,
+       0,    46,     0,     0,     0,     0,     0,     0,    49,     0,
+       0,    81,     2,     0,    50,     0,     0,    49,     0,    70,
+      71,    69,    72,    73,    76,    77,    78,    63,    64,    65,
+      66,    67,    68,    75,    58,     0,   103,   114,   110,   116,
+     122,    12,    17,    14,     0,     0,    16,    13,    26,   122,
+      82,    83,    51,     0,    44,    51,     0,    43,   130,   123,
+       0,    18,    15,     0,    50,     0,     0,    50,    50,    20,
+       0,   126,   126,    52,    53,     0,     0,    50,    49,    30,
+     124,     0,    51,    51,     0,    50,    51,     0,    51,     0,
+      48,    49,    50,    38,     0,   125,   118,   121,    23,    51,
+      50,    27,    50,    50,    40,    36,     0,     0,    37,    33,
+       0,    50,     0,     0,    35,     0,     0,    50,    49,    50,
+      49,     0,     0,     0,     0,    49,    31,     0,    32,     0,
+       0,    24,    28,    29,    50,    34,    50,    25,    41,    39
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,    33,   199,    34,    50,    36,   200,    38,   245,   229,
-     230,   219,   231,    95,    39,    40,    41,   220,   255,   179,
-     190,    42,   195,    55,    44,    64,    65,    45,   125,   134,
-     186,   208,    46,   114
+      -1,    35,   203,    36,    52,    38,   204,    40,   249,   233,
+     234,   223,   235,    99,    41,    42,    43,   224,   259,   183,
+     194,    44,   199,    59,    46,    68,    69,    47,   129,   138,
+     190,   212,    48,   118
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -180
+#define YYPACT_NINF -213
 static const yytype_int16 yypact[] =
 {
-     213,   -38,  -180,  -180,   501,  -180,  -180,   675,  -180,  -180,
-      36,   735,  -180,    42,    31,    44,   501,   -24,    77,    53,
-      75,    76,   501,    87,   501,   501,   501,   501,   501,   501,
-     501,   501,   501,     6,  -180,     9,  -180,  -180,  -180,    39,
-      48,   519,   653,  -180,  -180,  -180,  -180,  -180,    43,   501,
-    -180,   653,   501,   501,  -180,    40,  -180,   103,  -180,   105,
-    -180,    90,  -180,    32,    41,  -180,  -180,  -180,  -180,     7,
-     108,  -180,   -30,   501,   -27,    85,  -180,  -180,   653,  -180,
-     653,   653,   653,   653,   284,   555,   284,   284,   604,  -180,
-    -180,   280,   519,   501,   519,    86,   631,   501,   501,   501,
-     501,   501,   501,   501,   501,   501,   501,   501,   501,   501,
-     501,   501,     7,   653,   -60,    47,   116,  -180,  -180,   122,
-    -180,   123,   125,   110,  -180,  -180,   128,  -180,   501,   501,
-     533,   501,   501,   501,  -180,   501,   501,  -180,  -180,    68,
-     653,    70,   577,    74,   501,   653,   653,   653,   653,   653,
-     653,   653,   653,   702,   702,   284,   284,   653,   653,   653,
-    -180,   501,  -180,  -180,  -180,  -180,   134,  -180,   653,   653,
-     501,   501,   653,   653,   653,   134,   653,   653,  -180,     4,
-    -180,  -180,   471,   653,   653,  -180,   -59,   653,   653,   -59,
-     342,   112,   501,   342,  -180,  -180,   138,    78,    78,  -180,
-    -180,   133,   501,   653,    -7,    -9,  -180,   140,  -180,  -180,
-     120,   653,  -180,   135,  -180,   143,  -180,  -180,   143,  -180,
-     519,  -180,   342,   342,  -180,  -180,   342,  -180,   342,   143,
-     143,  -180,   519,   471,  -180,   121,   127,   342,   146,   148,
-    -180,   149,   137,  -180,  -180,  -180,  -180,   152,   141,   151,
-     153,   -12,  -180,   471,  -180,   409,   144,  -180,  -180,  -180,
-     342,  -180,  -180,  -180,  -180,  -180
+     215,   -61,  -213,  -213,   563,  -213,  -213,   563,   563,   714,
+    -213,  -213,     7,   135,  -213,    18,    29,    32,   563,    27,
+      64,    44,    60,    65,   563,    78,   563,   563,   563,   563,
+     563,   563,   563,   563,   563,     2,  -213,     3,  -213,  -213,
+    -213,    12,    20,   580,   241,  -213,  -213,  -213,  -213,  -213,
+      14,   563,  -213,   241,   241,   241,   563,   563,  -213,    10,
+    -213,    81,  -213,   100,  -213,    86,  -213,    33,    52,  -213,
+    -213,  -213,  -213,   120,   104,  -213,   -31,   563,   -26,    57,
+    -213,  -213,   241,  -213,   241,   241,   241,   241,     4,   616,
+       4,     4,   665,  -213,  -213,   319,   580,   563,   580,    82,
+     692,   563,   563,   563,   563,   563,   563,   563,   563,   563,
+     563,   563,   563,   563,   563,   563,   120,   241,   -30,    40,
+     107,  -213,  -213,   108,  -213,   109,   111,    91,  -213,  -213,
+     113,  -213,   563,   563,   594,   563,   563,   563,  -213,   563,
+     563,  -213,  -213,    55,   241,    63,   638,    66,   563,   241,
+     241,   241,   241,   241,   241,   241,   241,   741,   741,     4,
+       4,   241,   241,   241,  -213,   563,  -213,  -213,  -213,  -213,
+     126,  -213,   241,   241,   563,   563,   241,   241,   241,   126,
+     241,   241,  -213,    -2,  -213,  -213,   516,   241,   241,  -213,
+     -19,   241,   241,   -19,   383,   102,   563,   383,  -213,  -213,
+     128,    68,    68,  -213,  -213,   123,   563,   241,   -10,    -1,
+    -213,   131,  -213,  -213,   112,   241,  -213,   127,  -213,   132,
+    -213,  -213,   132,  -213,   580,  -213,   383,   383,  -213,  -213,
+     383,  -213,   383,   132,   132,  -213,   580,   516,  -213,   110,
+     116,   383,   138,   140,  -213,   143,   117,  -213,  -213,  -213,
+    -213,   144,   129,   150,   151,   -14,  -213,   516,  -213,   452,
+     148,  -213,  -213,  -213,   383,  -213,  -213,  -213,  -213,  -213
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -180,  -180,   -28,    91,     8,  -179,     0,  -180,  -180,  -180,
-     -39,  -170,   -53,   -90,  -180,  -180,  -180,  -164,    -6,   -41,
-    -167,     3,    26,  -180,  -180,  -180,   126,  -180,  -180,  -180,
-      11,   -14,  -180,   136
+    -213,  -213,   -29,    90,    22,  -182,     0,  -213,  -213,  -213,
+     -18,  -186,   -43,   -82,  -213,  -213,  -213,  -212,    -8,    80,
+    -173,     1,    24,  -213,  -213,  -213,   124,  -213,  -213,  -213,
+      19,    -3,  -213,   147
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -808,201 +816,209 @@ static const yytype_int16 yypgoto[] =
 #define YYTABLE_NINF -60
 static const yytype_int16 yytable[] =
 {
-      37,    53,   139,   194,   141,    91,    89,    51,    35,   -10,
-     -51,   -51,   128,   216,   193,   131,   213,    90,   160,    69,
-      70,    71,   161,   196,   191,    78,    43,    80,    81,    82,
-      83,    84,    85,    86,    87,    88,   126,   217,    47,   214,
-     129,   222,   223,   132,    96,   226,   192,   228,   234,    67,
-     120,   232,   112,    54,   243,   113,   113,   121,   237,    66,
-     234,    68,    97,    98,   -51,   232,   122,    99,   100,   101,
-      75,   102,   103,   104,   261,    59,   130,    61,   105,   106,
-     107,   108,    90,   123,   260,   -10,   109,   110,   111,    72,
-      73,    37,    76,    77,    74,    96,   140,   142,    79,    35,
-     145,   146,   147,   148,   149,   150,   151,   152,   153,   154,
-     155,   156,   157,   158,   159,   181,    92,    43,    93,   166,
-      52,   117,   116,   118,   119,   127,   133,   143,   175,   161,
-     236,   168,   169,   162,   172,   173,   174,   182,   176,   177,
-     163,   164,   242,   165,   122,   167,   178,   183,   180,   201,
-      90,   185,   204,   205,   202,   206,   210,   221,   197,   224,
-     207,   198,   212,   227,   184,   216,   218,   244,   246,   248,
-     225,   249,   250,   187,   188,   256,   240,   235,   251,   258,
-     257,   259,   138,   263,   209,   238,   189,   239,   241,   115,
-     124,     0,     0,     0,     0,   203,   247,     0,   215,     0,
-       0,     0,   252,     0,   254,   211,     0,     0,     0,     0,
-       0,   233,     0,    -6,     1,     0,     0,     0,     0,   264,
-       0,   265,     0,    96,     2,     3,     4,     5,     0,     6,
-       7,     8,     0,     0,     0,    96,     0,     9,   253,    10,
-      11,    12,     0,     0,    13,    14,    15,     0,     0,     0,
-       0,    16,    17,    18,     0,   262,    19,     0,     0,     0,
-      20,    21,    22,    23,    24,    25,    26,    27,     0,     0,
-       0,     0,     0,     0,     0,     0,    28,     0,     0,     0,
-      29,     0,     0,     0,    30,    31,     0,     0,     0,    -6,
-      32,     2,     3,     4,     5,     0,     6,     7,     8,     0,
-       0,     0,     0,     0,     9,     0,    10,    11,    12,     0,
-       0,    13,    14,    15,     0,     0,     0,     0,    16,    17,
-      18,     0,     0,    19,     0,     0,     0,    20,    21,    22,
-      23,    24,    25,    26,    27,     0,     0,     0,     0,    97,
-      98,     0,     0,    28,    99,   100,   101,    29,   102,   103,
-     104,    30,    31,     2,     3,     4,     5,    32,     6,    48,
-       8,     0,     0,   109,   110,   111,     9,     0,    10,    11,
-      12,     0,     0,     0,    14,    15,     0,     0,     0,     0,
-      16,    17,    18,     0,     0,    19,     0,     0,     0,     0,
-       0,    22,    23,    24,    25,    26,    27,     0,     0,     0,
-       0,     0,     0,     0,     0,    28,     0,     0,     0,    29,
-       0,     0,     0,    30,    31,     0,     0,     0,    90,    32,
-       2,     3,     4,     5,     0,     6,    48,     8,     0,     0,
-       0,     0,     0,     9,     0,    10,    11,    12,     0,     0,
-       0,    14,    15,     0,     0,     0,     0,    16,    17,    18,
-       0,     0,    19,     0,     0,     0,     0,     0,    22,    23,
-      24,    25,    26,    27,     0,     0,     0,     0,     0,     0,
-       0,     0,    28,     0,     0,     0,    29,     0,     0,     0,
-      30,    31,     2,     3,     4,     5,    32,     6,    48,     8,
-       0,     0,     0,     0,     0,     9,     0,    10,    11,     0,
-       0,     0,     0,    14,    15,     0,     0,     0,     0,    16,
-       0,    18,     2,     3,     4,     5,     0,     6,    48,     8,
-      22,    23,    24,    25,    26,    27,     0,     0,     0,     0,
-       2,     3,     4,     5,    28,     6,    48,     8,    29,    49,
-       0,    18,    30,    31,     0,     0,     0,     0,    32,     0,
-       0,     0,     0,     0,     0,     0,     0,    49,     0,    18,
-       0,     0,     0,     0,    28,     0,     0,     0,    29,     0,
-       0,     0,    30,    31,     0,   170,     0,     0,    32,     0,
-       0,     0,    28,     0,     0,     0,    29,     0,    97,    98,
-      30,    31,     0,    99,   100,   101,    94,   102,   103,   104,
-       0,     0,     0,   171,   105,   106,   107,   108,     0,     0,
-      97,    98,   109,   110,   111,    99,   100,   101,     0,   102,
-     103,   104,     0,   135,   136,     0,   105,   106,   107,   108,
-       0,     0,    97,    98,   109,   110,   111,    99,   100,   101,
-       0,   102,   103,   104,     0,     0,     0,   144,   105,   106,
-     107,   108,     0,     0,     0,   137,   109,   110,   111,    97,
-      98,     0,     0,     0,    99,   100,   101,     0,   102,   103,
-     104,     0,     0,     0,     0,   105,   106,   107,   108,     0,
-       0,     0,   137,   109,   110,   111,    97,    98,     0,     0,
-       0,    99,   100,   101,     0,   102,   103,   104,     0,     0,
-       0,   144,   105,   106,   107,   108,     0,     0,    97,    98,
-     109,   110,   111,    99,   100,   101,     0,   102,   103,   104,
-       0,     0,     0,     0,   105,   106,   107,   108,     0,     0,
-     -59,   -59,   109,   110,   111,   -59,   -59,   -59,     0,   -59,
-     -59,   -59,     0,     0,     0,     0,     0,     0,   -59,   -59,
-       0,     0,    52,    56,   -59,   -59,   -59,    97,    98,     0,
-      57,     0,    99,   100,   101,    58,   102,   103,   104,    59,
-      60,    61,    62,     0,     0,   107,   108,    63,     0,     0,
-       0,   109,   110,   111
+      39,    57,    93,   -10,   198,    53,    95,   236,    54,    55,
+     -51,   -51,   197,   132,   143,   217,   145,    49,   135,    73,
+     195,   236,    37,   220,    45,    82,    58,    84,    85,    86,
+      87,    88,    89,    90,    91,    92,   238,    70,   218,   226,
+     227,   133,   196,   230,   100,   232,   136,   221,   238,    71,
+     164,    72,   116,   124,   165,   247,   241,   117,   117,    94,
+     125,   101,   102,    79,   -51,   200,   103,   104,   105,   126,
+     106,   107,   108,    74,    75,   265,    76,    77,   134,    80,
+      94,   -10,   264,    78,    81,   113,   114,   115,    63,    83,
+      65,    96,    97,    56,   120,    39,   127,   100,   144,   146,
+     137,   121,   149,   150,   151,   152,   153,   154,   155,   156,
+     157,   158,   159,   160,   161,   162,   163,    37,   185,    45,
+     122,   170,   123,   131,   165,   147,   166,   126,   167,   168,
+     179,   169,   171,   172,   173,   182,   176,   177,   178,   186,
+     180,   181,   240,   184,    94,   189,   206,   210,   214,   187,
+     225,   130,   211,   228,   246,    60,   220,   231,   248,   250,
+     255,   201,    61,   252,   202,   253,   188,    62,   254,   260,
+     261,    63,    64,    65,    66,   191,   192,   101,   102,    67,
+     262,   263,   103,   104,   105,   142,   106,   107,   108,   267,
+     244,   222,   128,   109,   110,   111,   112,   207,   193,   213,
+     219,   113,   114,   115,   119,     0,     0,   215,     0,     0,
+       0,     0,     0,   237,     0,    -6,     1,     0,     0,     0,
+       0,     0,     0,     0,     0,   100,     2,     3,     4,     5,
+       0,     6,     7,     8,     9,    10,     0,   100,     0,     0,
+     257,    11,     0,    12,    13,    14,     0,     0,    15,    16,
+      17,     0,     0,     0,     0,    18,    19,    20,     0,   266,
+      21,     0,     0,     0,    22,    23,    24,    25,    26,    27,
+      28,    29,     0,     0,   205,     0,     0,   208,   209,     0,
+      30,     0,     0,     0,    31,     0,     0,   216,    32,    33,
+       0,     0,     0,    -6,    34,   229,     0,     0,   101,   102,
+       0,     0,   239,   103,   104,   105,     0,   106,   107,   108,
+     242,     0,   243,   245,   109,   110,   111,   112,     0,     0,
+       0,   251,   113,   114,   115,     0,     0,   256,     0,   258,
+       2,     3,     4,     5,     0,     6,     7,     8,     9,    10,
+       0,     0,     0,     0,   268,    11,   269,    12,    13,    14,
+       0,     0,    15,    16,    17,     0,     0,     0,     0,    18,
+      19,    20,     0,     0,    21,     0,     0,     0,    22,    23,
+      24,    25,    26,    27,    28,    29,     0,     0,     0,     0,
+       0,     0,     0,     0,    30,     0,     0,     0,    31,     0,
+       0,     0,    32,    33,     2,     3,     4,     5,    34,     6,
+       7,     8,    50,    10,     0,     0,     0,     0,     0,    11,
+       0,    12,    13,    14,     0,     0,     0,    16,    17,     0,
+       0,     0,     0,    18,    19,    20,     0,     0,    21,     0,
+       0,     0,     0,     0,    24,    25,    26,    27,    28,    29,
+       0,     0,     0,     0,     0,     0,     0,     0,    30,     0,
+       0,     0,    31,     0,     0,     0,    32,    33,     0,     0,
+       0,    94,    34,     2,     3,     4,     5,     0,     6,     7,
+       8,    50,    10,     0,     0,     0,     0,     0,    11,     0,
+      12,    13,    14,     0,     0,     0,    16,    17,     0,     0,
+       0,     0,    18,    19,    20,     0,     0,    21,     0,     0,
+       0,     0,     0,    24,    25,    26,    27,    28,    29,     0,
+       0,     0,     0,     0,     0,     0,     0,    30,     0,     0,
+       0,    31,     0,     0,     0,    32,    33,     2,     3,     4,
+       5,    34,     6,     7,     8,    50,    10,     0,     0,     0,
+       0,     0,    11,     0,    12,    13,     0,     0,     0,     0,
+      16,    17,     0,     0,     0,     0,    18,     0,    20,     0,
+       0,     0,     0,     0,     0,     0,     0,    24,    25,    26,
+      27,    28,    29,     0,     2,     3,     4,     5,     0,     6,
+       0,    30,    50,    10,     0,    31,     0,     0,     0,    32,
+      33,     2,     3,     4,     5,    34,     6,     0,     0,    50,
+      10,     0,     0,    51,     0,    20,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+      51,     0,    20,     0,     0,     0,     0,     0,    30,     0,
+       0,     0,    31,     0,     0,     0,    32,    33,   174,     0,
+       0,     0,    34,     0,     0,    30,     0,     0,     0,    31,
+       0,   101,   102,    32,    33,     0,   103,   104,   105,    98,
+     106,   107,   108,     0,     0,     0,   175,   109,   110,   111,
+     112,     0,     0,   101,   102,   113,   114,   115,   103,   104,
+     105,     0,   106,   107,   108,     0,   139,   140,     0,   109,
+     110,   111,   112,     0,     0,   101,   102,   113,   114,   115,
+     103,   104,   105,     0,   106,   107,   108,     0,     0,     0,
+     148,   109,   110,   111,   112,     0,     0,     0,   141,   113,
+     114,   115,   101,   102,     0,     0,     0,   103,   104,   105,
+       0,   106,   107,   108,     0,     0,     0,     0,   109,   110,
+     111,   112,     0,     0,     0,   141,   113,   114,   115,   101,
+     102,     0,     0,     0,   103,   104,   105,     0,   106,   107,
+     108,     0,     0,     0,   148,   109,   110,   111,   112,     0,
+       0,   -59,   -59,   113,   114,   115,   -59,   -59,   -59,     0,
+     -59,   -59,   -59,     0,     0,     0,     0,     0,     0,   -59,
+     -59,     0,     0,    56,     0,   -59,   -59,   -59,   101,   102,
+       0,     0,     0,   103,   104,   105,     0,   106,   107,   108,
+       0,     0,     0,     0,     0,     0,   111,   112,     0,     0,
+       0,     0,   113,   114,   115
 };
 
 static const yytype_int16 yycheck[] =
 {
-       0,     7,    92,   182,    94,    33,     0,     4,     0,     0,
-      22,    23,    42,    22,   181,    42,    23,    76,    78,    16,
-      44,    45,    82,    82,    20,    22,     0,    24,    25,    26,
-      27,    28,    29,    30,    31,    32,    29,    46,    76,    46,
-      70,   208,   209,    70,    41,   212,    42,   214,   218,    18,
-      18,   215,    49,    17,   233,    52,    53,    25,   225,    17,
-     230,    17,    55,    56,    76,   229,    34,    60,    61,    62,
-      17,    64,    65,    66,   253,    34,    73,    36,    71,    72,
-      73,    74,    76,    42,   251,    76,    79,    80,    81,    12,
-      13,    91,    17,    17,    17,    92,    93,    94,    11,    91,
-      97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
-     107,   108,   109,   110,   111,   143,    77,    91,    70,   125,
-      77,    18,    82,    18,    34,    17,    41,    41,   134,    82,
-     220,   128,   129,    17,   131,   132,   133,   143,   135,   136,
-      18,    18,   232,    18,    34,    17,    78,   144,    78,   190,
-      76,    17,   193,   194,    42,    17,    23,    17,   186,    39,
-      82,   189,   203,    28,   161,    22,   205,    46,    41,    23,
-     211,    23,    23,   170,   171,    23,   229,   218,    41,    28,
-      39,    28,    91,    39,   198,   226,   175,   228,   229,    53,
-      64,    -1,    -1,    -1,    -1,   192,   237,    -1,   204,    -1,
-      -1,    -1,   243,    -1,   245,   202,    -1,    -1,    -1,    -1,
-      -1,   217,    -1,     0,     1,    -1,    -1,    -1,    -1,   260,
-      -1,   262,    -1,   220,    11,    12,    13,    14,    -1,    16,
-      17,    18,    -1,    -1,    -1,   232,    -1,    24,   244,    26,
-      27,    28,    -1,    -1,    31,    32,    33,    -1,    -1,    -1,
-      -1,    38,    39,    40,    -1,   255,    43,    -1,    -1,    -1,
-      47,    48,    49,    50,    51,    52,    53,    54,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    63,    -1,    -1,    -1,
-      67,    -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    76,
-      77,    11,    12,    13,    14,    -1,    16,    17,    18,    -1,
-      -1,    -1,    -1,    -1,    24,    -1,    26,    27,    28,    -1,
-      -1,    31,    32,    33,    -1,    -1,    -1,    -1,    38,    39,
-      40,    -1,    -1,    43,    -1,    -1,    -1,    47,    48,    49,
-      50,    51,    52,    53,    54,    -1,    -1,    -1,    -1,    55,
-      56,    -1,    -1,    63,    60,    61,    62,    67,    64,    65,
-      66,    71,    72,    11,    12,    13,    14,    77,    16,    17,
-      18,    -1,    -1,    79,    80,    81,    24,    -1,    26,    27,
-      28,    -1,    -1,    -1,    32,    33,    -1,    -1,    -1,    -1,
-      38,    39,    40,    -1,    -1,    43,    -1,    -1,    -1,    -1,
-      -1,    49,    50,    51,    52,    53,    54,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    63,    -1,    -1,    -1,    67,
-      -1,    -1,    -1,    71,    72,    -1,    -1,    -1,    76,    77,
-      11,    12,    13,    14,    -1,    16,    17,    18,    -1,    -1,
-      -1,    -1,    -1,    24,    -1,    26,    27,    28,    -1,    -1,
-      -1,    32,    33,    -1,    -1,    -1,    -1,    38,    39,    40,
-      -1,    -1,    43,    -1,    -1,    -1,    -1,    -1,    49,    50,
-      51,    52,    53,    54,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    63,    -1,    -1,    -1,    67,    -1,    -1,    -1,
-      71,    72,    11,    12,    13,    14,    77,    16,    17,    18,
-      -1,    -1,    -1,    -1,    -1,    24,    -1,    26,    27,    -1,
-      -1,    -1,    -1,    32,    33,    -1,    -1,    -1,    -1,    38,
-      -1,    40,    11,    12,    13,    14,    -1,    16,    17,    18,
-      49,    50,    51,    52,    53,    54,    -1,    -1,    -1,    -1,
-      11,    12,    13,    14,    63,    16,    17,    18,    67,    38,
-      -1,    40,    71,    72,    -1,    -1,    -1,    -1,    77,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    38,    -1,    40,
-      -1,    -1,    -1,    -1,    63,    -1,    -1,    -1,    67,    -1,
-      -1,    -1,    71,    72,    -1,    42,    -1,    -1,    77,    -1,
-      -1,    -1,    63,    -1,    -1,    -1,    67,    -1,    55,    56,
-      71,    72,    -1,    60,    61,    62,    77,    64,    65,    66,
-      -1,    -1,    -1,    70,    71,    72,    73,    74,    -1,    -1,
-      55,    56,    79,    80,    81,    60,    61,    62,    -1,    64,
-      65,    66,    -1,    68,    69,    -1,    71,    72,    73,    74,
-      -1,    -1,    55,    56,    79,    80,    81,    60,    61,    62,
-      -1,    64,    65,    66,    -1,    -1,    -1,    70,    71,    72,
-      73,    74,    -1,    -1,    -1,    78,    79,    80,    81,    55,
-      56,    -1,    -1,    -1,    60,    61,    62,    -1,    64,    65,
-      66,    -1,    -1,    -1,    -1,    71,    72,    73,    74,    -1,
-      -1,    -1,    78,    79,    80,    81,    55,    56,    -1,    -1,
-      -1,    60,    61,    62,    -1,    64,    65,    66,    -1,    -1,
-      -1,    70,    71,    72,    73,    74,    -1,    -1,    55,    56,
-      79,    80,    81,    60,    61,    62,    -1,    64,    65,    66,
-      -1,    -1,    -1,    -1,    71,    72,    73,    74,    -1,    -1,
-      55,    56,    79,    80,    81,    60,    61,    62,    -1,    64,
-      65,    66,    -1,    -1,    -1,    -1,    -1,    -1,    73,    74,
-      -1,    -1,    77,    18,    79,    80,    81,    55,    56,    -1,
-      25,    -1,    60,    61,    62,    30,    64,    65,    66,    34,
-      35,    36,    37,    -1,    -1,    73,    74,    42,    -1,    -1,
-      -1,    79,    80,    81
+       0,     9,     0,     0,   186,     4,    35,   219,     7,     8,
+      24,    25,   185,    44,    96,    25,    98,    78,    44,    18,
+      22,   233,     0,    24,     0,    24,    19,    26,    27,    28,
+      29,    30,    31,    32,    33,    34,   222,    19,    48,   212,
+     213,    72,    44,   216,    43,   218,    72,    48,   234,    20,
+      80,    19,    51,    20,    84,   237,   229,    56,    57,    78,
+      27,    57,    58,    19,    78,    84,    62,    63,    64,    36,
+      66,    67,    68,    46,    47,   257,    12,    13,    77,    19,
+      78,    78,   255,    19,    19,    81,    82,    83,    36,    11,
+      38,    79,    72,    79,    84,    95,    44,    96,    97,    98,
+      43,    20,   101,   102,   103,   104,   105,   106,   107,   108,
+     109,   110,   111,   112,   113,   114,   115,    95,   147,    95,
+      20,   129,    36,    19,    84,    43,    19,    36,    20,    20,
+     138,    20,    19,   132,   133,    80,   135,   136,   137,   147,
+     139,   140,   224,    80,    78,    19,    44,    19,    25,   148,
+      19,    31,    84,    41,   236,    20,    24,    30,    48,    43,
+      43,   190,    27,    25,   193,    25,   165,    32,    25,    25,
+      41,    36,    37,    38,    39,   174,   175,    57,    58,    44,
+      30,    30,    62,    63,    64,    95,    66,    67,    68,    41,
+     233,   209,    68,    73,    74,    75,    76,   196,   179,   202,
+     208,    81,    82,    83,    57,    -1,    -1,   206,    -1,    -1,
+      -1,    -1,    -1,   221,    -1,     0,     1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   224,    11,    12,    13,    14,
+      -1,    16,    17,    18,    19,    20,    -1,   236,    -1,    -1,
+     248,    26,    -1,    28,    29,    30,    -1,    -1,    33,    34,
+      35,    -1,    -1,    -1,    -1,    40,    41,    42,    -1,   259,
+      45,    -1,    -1,    -1,    49,    50,    51,    52,    53,    54,
+      55,    56,    -1,    -1,   194,    -1,    -1,   197,   198,    -1,
+      65,    -1,    -1,    -1,    69,    -1,    -1,   207,    73,    74,
+      -1,    -1,    -1,    78,    79,   215,    -1,    -1,    57,    58,
+      -1,    -1,   222,    62,    63,    64,    -1,    66,    67,    68,
+     230,    -1,   232,   233,    73,    74,    75,    76,    -1,    -1,
+      -1,   241,    81,    82,    83,    -1,    -1,   247,    -1,   249,
+      11,    12,    13,    14,    -1,    16,    17,    18,    19,    20,
+      -1,    -1,    -1,    -1,   264,    26,   266,    28,    29,    30,
+      -1,    -1,    33,    34,    35,    -1,    -1,    -1,    -1,    40,
+      41,    42,    -1,    -1,    45,    -1,    -1,    -1,    49,    50,
+      51,    52,    53,    54,    55,    56,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    69,    -1,
+      -1,    -1,    73,    74,    11,    12,    13,    14,    79,    16,
+      17,    18,    19,    20,    -1,    -1,    -1,    -1,    -1,    26,
+      -1,    28,    29,    30,    -1,    -1,    -1,    34,    35,    -1,
+      -1,    -1,    -1,    40,    41,    42,    -1,    -1,    45,    -1,
+      -1,    -1,    -1,    -1,    51,    52,    53,    54,    55,    56,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    65,    -1,
+      -1,    -1,    69,    -1,    -1,    -1,    73,    74,    -1,    -1,
+      -1,    78,    79,    11,    12,    13,    14,    -1,    16,    17,
+      18,    19,    20,    -1,    -1,    -1,    -1,    -1,    26,    -1,
+      28,    29,    30,    -1,    -1,    -1,    34,    35,    -1,    -1,
+      -1,    -1,    40,    41,    42,    -1,    -1,    45,    -1,    -1,
+      -1,    -1,    -1,    51,    52,    53,    54,    55,    56,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,
+      -1,    69,    -1,    -1,    -1,    73,    74,    11,    12,    13,
+      14,    79,    16,    17,    18,    19,    20,    -1,    -1,    -1,
+      -1,    -1,    26,    -1,    28,    29,    -1,    -1,    -1,    -1,
+      34,    35,    -1,    -1,    -1,    -1,    40,    -1,    42,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    51,    52,    53,
+      54,    55,    56,    -1,    11,    12,    13,    14,    -1,    16,
+      -1,    65,    19,    20,    -1,    69,    -1,    -1,    -1,    73,
+      74,    11,    12,    13,    14,    79,    16,    -1,    -1,    19,
+      20,    -1,    -1,    40,    -1,    42,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      40,    -1,    42,    -1,    -1,    -1,    -1,    -1,    65,    -1,
+      -1,    -1,    69,    -1,    -1,    -1,    73,    74,    44,    -1,
+      -1,    -1,    79,    -1,    -1,    65,    -1,    -1,    -1,    69,
+      -1,    57,    58,    73,    74,    -1,    62,    63,    64,    79,
+      66,    67,    68,    -1,    -1,    -1,    72,    73,    74,    75,
+      76,    -1,    -1,    57,    58,    81,    82,    83,    62,    63,
+      64,    -1,    66,    67,    68,    -1,    70,    71,    -1,    73,
+      74,    75,    76,    -1,    -1,    57,    58,    81,    82,    83,
+      62,    63,    64,    -1,    66,    67,    68,    -1,    -1,    -1,
+      72,    73,    74,    75,    76,    -1,    -1,    -1,    80,    81,
+      82,    83,    57,    58,    -1,    -1,    -1,    62,    63,    64,
+      -1,    66,    67,    68,    -1,    -1,    -1,    -1,    73,    74,
+      75,    76,    -1,    -1,    -1,    80,    81,    82,    83,    57,
+      58,    -1,    -1,    -1,    62,    63,    64,    -1,    66,    67,
+      68,    -1,    -1,    -1,    72,    73,    74,    75,    76,    -1,
+      -1,    57,    58,    81,    82,    83,    62,    63,    64,    -1,
+      66,    67,    68,    -1,    -1,    -1,    -1,    -1,    -1,    75,
+      76,    -1,    -1,    79,    -1,    81,    82,    83,    57,    58,
+      -1,    -1,    -1,    62,    63,    64,    -1,    66,    67,    68,
+      -1,    -1,    -1,    -1,    -1,    -1,    75,    76,    -1,    -1,
+      -1,    -1,    81,    82,    83
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,     1,    11,    12,    13,    14,    16,    17,    18,    24,
-      26,    27,    28,    31,    32,    33,    38,    39,    40,    43,
-      47,    48,    49,    50,    51,    52,    53,    54,    63,    67,
-      71,    72,    77,    84,    86,    87,    88,    89,    90,    97,
-      98,    99,   104,   105,   107,   110,   115,    76,    17,    38,
-      87,   104,    77,   101,    17,   106,    18,    25,    30,    34,
-      35,    36,    37,    42,   108,   109,    17,    18,    17,   104,
-      44,    45,    12,    13,    17,    17,    17,    17,   104,    11,
-     104,   104,   104,   104,   104,   104,   104,   104,   104,     0,
-      76,    85,    77,    70,    77,    96,   104,    55,    56,    60,
-      61,    62,    64,    65,    66,    71,    72,    73,    74,    79,
-      80,    81,   104,   104,   116,   116,    82,    18,    18,    34,
-      18,    25,    34,    42,   109,   111,    29,    17,    42,    70,
-     104,    42,    70,    41,   112,    68,    69,    78,    86,    96,
-     104,    96,   104,    41,    70,   104,   104,   104,   104,   104,
-     104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
-      78,    82,    17,    18,    18,    18,   101,    17,   104,   104,
-      42,    70,   104,   104,   104,   101,   104,   104,    78,   102,
-      78,    85,   101,   104,   104,    17,   113,   104,   104,   113,
-     103,    20,    42,   103,    88,   105,    82,    85,    85,    85,
-      89,   102,    42,   104,   102,   102,    17,    82,   114,   114,
-      23,   104,   102,    23,    46,   101,    22,    46,    93,    94,
-     100,    17,   103,   103,    39,   102,   103,    28,   103,    92,
-      93,    95,   100,   101,    94,   102,    96,   103,   102,   102,
-      95,   102,    96,    88,    46,    91,    41,   102,    23,    23,
-      23,    41,   102,   101,   102,   101,    23,    39,    28,    28,
-     103,    88,    89,    39,   102,   102
+       0,     1,    11,    12,    13,    14,    16,    17,    18,    19,
+      20,    26,    28,    29,    30,    33,    34,    35,    40,    41,
+      42,    45,    49,    50,    51,    52,    53,    54,    55,    56,
+      65,    69,    73,    74,    79,    86,    88,    89,    90,    91,
+      92,    99,   100,   101,   106,   107,   109,   112,   117,    78,
+      19,    40,    89,   106,   106,   106,    79,   103,    19,   108,
+      20,    27,    32,    36,    37,    38,    39,    44,   110,   111,
+      19,    20,    19,   106,    46,    47,    12,    13,    19,    19,
+      19,    19,   106,    11,   106,   106,   106,   106,   106,   106,
+     106,   106,   106,     0,    78,    87,    79,    72,    79,    98,
+     106,    57,    58,    62,    63,    64,    66,    67,    68,    73,
+      74,    75,    76,    81,    82,    83,   106,   106,   118,   118,
+      84,    20,    20,    36,    20,    27,    36,    44,   111,   113,
+      31,    19,    44,    72,   106,    44,    72,    43,   114,    70,
+      71,    80,    88,    98,   106,    98,   106,    43,    72,   106,
+     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
+     106,   106,   106,   106,    80,    84,    19,    20,    20,    20,
+     103,    19,   106,   106,    44,    72,   106,   106,   106,   103,
+     106,   106,    80,   104,    80,    87,   103,   106,   106,    19,
+     115,   106,   106,   115,   105,    22,    44,   105,    90,   107,
+      84,    87,    87,    87,    91,   104,    44,   106,   104,   104,
+      19,    84,   116,   116,    25,   106,   104,    25,    48,   103,
+      24,    48,    95,    96,   102,    19,   105,   105,    41,   104,
+     105,    30,   105,    94,    95,    97,   102,   103,    96,   104,
+      98,   105,   104,   104,    97,   104,    98,    90,    48,    93,
+      43,   104,    25,    25,    25,    43,   104,   103,   104,   103,
+      25,    41,    30,    30,   105,    90,    91,    41,   104,   104
 };
 
 #define yyerrok		(yyerrstatus = 0)
@@ -2324,84 +2340,105 @@ yyreduce:
 
   case 90:
 #line 407 "engines/director/lingo/lingo-gr.y"
-    { g_lingo->code1(g_lingo->c_alert); ;}
+    {
+		g_lingo->code1(g_lingo->_handlers[*(yyvsp[(1) - (2)].s)]->u.func);
+		delete (yyvsp[(1) - (2)].s); ;}
     break;
 
   case 91:
-#line 408 "engines/director/lingo/lingo-gr.y"
+#line 410 "engines/director/lingo/lingo-gr.y"
+    {
+		g_lingo->code1(g_lingo->_handlers[*(yyvsp[(1) - (2)].s)]->u.func);
+		delete (yyvsp[(1) - (2)].s); ;}
+    break;
+
+  case 92:
+#line 413 "engines/director/lingo/lingo-gr.y"
+    {
+		g_lingo->code2(g_ling->c_voidpush, g_lingo->_handlers[*(yyvsp[(1) - (1)].s)]->u.func);
+		delete (yyvsp[(1) - (1)].s); ;}
+    break;
+
+  case 93:
+#line 416 "engines/director/lingo/lingo-gr.y"
+    { g_lingo->code1(g_lingo->c_alert); ;}
+    break;
+
+  case 94:
+#line 417 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->codeConst((yyvsp[(2) - (2)].i));
 		g_lingo->code1(g_lingo->c_beep); ;}
     break;
 
-  case 92:
-#line 411 "engines/director/lingo/lingo-gr.y"
+  case 95:
+#line 420 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->codeConst(0);
 		g_lingo->code1(g_lingo->c_beep); ;}
     break;
 
-  case 93:
-#line 414 "engines/director/lingo/lingo-gr.y"
+  case 96:
+#line 423 "engines/director/lingo/lingo-gr.y"
     { g_lingo->code1(g_lingo->c_closeResFile); ;}
     break;
 
-  case 94:
-#line 415 "engines/director/lingo/lingo-gr.y"
+  case 97:
+#line 424 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->codeConst(0);
 		g_lingo->code1(g_lingo->c_closeResFile); ;}
     break;
 
-  case 95:
-#line 418 "engines/director/lingo/lingo-gr.y"
+  case 98:
+#line 427 "engines/director/lingo/lingo-gr.y"
     { g_lingo->code1(g_lingo->c_closeXlib); ;}
     break;
 
-  case 96:
-#line 419 "engines/director/lingo/lingo-gr.y"
+  case 99:
+#line 428 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->codeConst(0);
 		g_lingo->code1(g_lingo->c_closeXlib); ;}
     break;
 
-  case 97:
-#line 422 "engines/director/lingo/lingo-gr.y"
+  case 100:
+#line 431 "engines/director/lingo/lingo-gr.y"
     { g_lingo->code1(g_lingo->c_cursor); ;}
     break;
 
-  case 98:
-#line 423 "engines/director/lingo/lingo-gr.y"
+  case 101:
+#line 432 "engines/director/lingo/lingo-gr.y"
     { g_lingo->code1(g_lingo->c_delay); ;}
     break;
 
-  case 99:
-#line 426 "engines/director/lingo/lingo-gr.y"
+  case 102:
+#line 435 "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 100:
-#line 427 "engines/director/lingo/lingo-gr.y"
+  case 103:
+#line 436 "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 101:
-#line 438 "engines/director/lingo/lingo-gr.y"
+  case 104:
+#line 447 "engines/director/lingo/lingo-gr.y"
     { g_lingo->code1(g_lingo->c_gotoloop); ;}
     break;
 
-  case 102:
-#line 439 "engines/director/lingo/lingo-gr.y"
+  case 105:
+#line 448 "engines/director/lingo/lingo-gr.y"
     { g_lingo->code1(g_lingo->c_gotonext); ;}
     break;
 
-  case 103:
-#line 440 "engines/director/lingo/lingo-gr.y"
+  case 106:
+#line 449 "engines/director/lingo/lingo-gr.y"
     { g_lingo->code1(g_lingo->c_gotoprevious); ;}
     break;
 
-  case 104:
-#line 441 "engines/director/lingo/lingo-gr.y"
+  case 107:
+#line 450 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->code1(g_lingo->c_goto);
 		g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2409,8 +2446,8 @@ yyreduce:
 		delete (yyvsp[(2) - (2)].s); ;}
     break;
 
-  case 105:
-#line 446 "engines/director/lingo/lingo-gr.y"
+  case 108:
+#line 455 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->code1(g_lingo->c_goto);
 		g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2419,8 +2456,8 @@ yyreduce:
 		delete (yyvsp[(3) - (3)].s); ;}
     break;
 
-  case 106:
-#line 452 "engines/director/lingo/lingo-gr.y"
+  case 109:
+#line 461 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->code1(g_lingo->c_goto);
 		g_lingo->codeString("");
@@ -2428,48 +2465,48 @@ yyreduce:
 		delete (yyvsp[(2) - (2)].s); ;}
     break;
 
-  case 107:
-#line 459 "engines/director/lingo/lingo-gr.y"
+  case 110:
+#line 468 "engines/director/lingo/lingo-gr.y"
     { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
     break;
 
-  case 108:
-#line 460 "engines/director/lingo/lingo-gr.y"
+  case 111:
+#line 469 "engines/director/lingo/lingo-gr.y"
     { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
     break;
 
-  case 109:
-#line 461 "engines/director/lingo/lingo-gr.y"
+  case 112:
+#line 470 "engines/director/lingo/lingo-gr.y"
     { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
     break;
 
-  case 110:
-#line 462 "engines/director/lingo/lingo-gr.y"
+  case 113:
+#line 471 "engines/director/lingo/lingo-gr.y"
     { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
     break;
 
-  case 111:
-#line 465 "engines/director/lingo/lingo-gr.y"
+  case 114:
+#line 474 "engines/director/lingo/lingo-gr.y"
     { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
     break;
 
-  case 112:
-#line 466 "engines/director/lingo/lingo-gr.y"
+  case 115:
+#line 475 "engines/director/lingo/lingo-gr.y"
     { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
     break;
 
-  case 113:
-#line 467 "engines/director/lingo/lingo-gr.y"
+  case 116:
+#line 476 "engines/director/lingo/lingo-gr.y"
     { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
     break;
 
-  case 114:
-#line 495 "engines/director/lingo/lingo-gr.y"
+  case 117:
+#line 504 "engines/director/lingo/lingo-gr.y"
     { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); ;}
     break;
 
-  case 115:
-#line 496 "engines/director/lingo/lingo-gr.y"
+  case 118:
+#line 505 "engines/director/lingo/lingo-gr.y"
     {
 			g_lingo->codeConst(0); // Push fake value on stack
 			g_lingo->code1(g_lingo->c_procret);
@@ -2477,20 +2514,20 @@ yyreduce:
 			g_lingo->_indef = false; ;}
     break;
 
-  case 116:
-#line 501 "engines/director/lingo/lingo-gr.y"
+  case 119:
+#line 510 "engines/director/lingo/lingo-gr.y"
     {
 			g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
 		;}
     break;
 
-  case 117:
-#line 504 "engines/director/lingo/lingo-gr.y"
+  case 120:
+#line 513 "engines/director/lingo/lingo-gr.y"
     { g_lingo->_indef = true; ;}
     break;
 
-  case 118:
-#line 505 "engines/director/lingo/lingo-gr.y"
+  case 121:
+#line 514 "engines/director/lingo/lingo-gr.y"
     {
 			g_lingo->codeConst(0); // Push fake value on stack
 			g_lingo->code1(g_lingo->c_procret);
@@ -2498,33 +2535,33 @@ yyreduce:
 			g_lingo->_indef = false; ;}
     break;
 
-  case 119:
-#line 510 "engines/director/lingo/lingo-gr.y"
+  case 122:
+#line 519 "engines/director/lingo/lingo-gr.y"
     { (yyval.narg) = 0; ;}
     break;
 
-  case 120:
-#line 511 "engines/director/lingo/lingo-gr.y"
+  case 123:
+#line 520 "engines/director/lingo/lingo-gr.y"
     { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
     break;
 
-  case 121:
-#line 512 "engines/director/lingo/lingo-gr.y"
+  case 124:
+#line 521 "engines/director/lingo/lingo-gr.y"
     { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
     break;
 
-  case 122:
-#line 513 "engines/director/lingo/lingo-gr.y"
+  case 125:
+#line 522 "engines/director/lingo/lingo-gr.y"
     { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
     break;
 
-  case 123:
-#line 515 "engines/director/lingo/lingo-gr.y"
+  case 126:
+#line 524 "engines/director/lingo/lingo-gr.y"
     { g_lingo->codeArgStore(); ;}
     break;
 
-  case 124:
-#line 519 "engines/director/lingo/lingo-gr.y"
+  case 127:
+#line 528 "engines/director/lingo/lingo-gr.y"
     {
 		g_lingo->code1(g_lingo->c_call);
 		g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2533,24 +2570,24 @@ yyreduce:
 		g_lingo->code1(numpar); ;}
     break;
 
-  case 125:
-#line 527 "engines/director/lingo/lingo-gr.y"
+  case 128:
+#line 536 "engines/director/lingo/lingo-gr.y"
     { (yyval.narg) = 0; ;}
     break;
 
-  case 126:
-#line 528 "engines/director/lingo/lingo-gr.y"
+  case 129:
+#line 537 "engines/director/lingo/lingo-gr.y"
     { (yyval.narg) = 1; ;}
     break;
 
-  case 127:
-#line 529 "engines/director/lingo/lingo-gr.y"
+  case 130:
+#line 538 "engines/director/lingo/lingo-gr.y"
     { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
     break;
 
 
 /* Line 1267 of yacc.c.  */
-#line 2554 "engines/director/lingo/lingo-gr.cpp"
+#line 2591 "engines/director/lingo/lingo-gr.cpp"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2764,6 +2801,6 @@ yyreturn:
 }
 
 
-#line 532 "engines/director/lingo/lingo-gr.y"
+#line 541 "engines/director/lingo/lingo-gr.y"
 
 
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 484da36..d8799a2 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -53,59 +53,61 @@
      FLOAT = 269,
      BLTIN = 270,
      BLTINNOARGS = 271,
-     ID = 272,
-     STRING = 273,
-     HANDLER = 274,
-     tDOWN = 275,
-     tELSE = 276,
-     tNLELSIF = 277,
-     tEND = 278,
-     tEXIT = 279,
-     tFRAME = 280,
-     tGLOBAL = 281,
-     tGO = 282,
-     tIF = 283,
-     tINTO = 284,
-     tLOOP = 285,
-     tMACRO = 286,
-     tMCI = 287,
-     tMCIWAIT = 288,
-     tMOVIE = 289,
-     tNEXT = 290,
-     tOF = 291,
-     tPREVIOUS = 292,
-     tPUT = 293,
-     tREPEAT = 294,
-     tSET = 295,
-     tTHEN = 296,
-     tTO = 297,
-     tWHEN = 298,
-     tWITH = 299,
-     tWHILE = 300,
-     tNLELSE = 301,
-     tFACTORY = 302,
-     tMETHOD = 303,
-     tALERT = 304,
-     tBEEP = 305,
-     tCLOSERESFILE = 306,
-     tCLOSEXLIB = 307,
-     tCURSOR = 308,
-     tDELAY = 309,
-     tGE = 310,
-     tLE = 311,
-     tGT = 312,
-     tLT = 313,
-     tEQ = 314,
-     tNEQ = 315,
-     tAND = 316,
-     tOR = 317,
-     tNOT = 318,
-     tCONCAT = 319,
-     tCONTAINS = 320,
-     tSTARTS = 321,
-     tSPRITE = 322,
-     tINTERSECTS = 323,
-     tWITHIN = 324
+     BLTINNOARGSORONE = 272,
+     BLTINONEARG = 273,
+     ID = 274,
+     STRING = 275,
+     HANDLER = 276,
+     tDOWN = 277,
+     tELSE = 278,
+     tNLELSIF = 279,
+     tEND = 280,
+     tEXIT = 281,
+     tFRAME = 282,
+     tGLOBAL = 283,
+     tGO = 284,
+     tIF = 285,
+     tINTO = 286,
+     tLOOP = 287,
+     tMACRO = 288,
+     tMCI = 289,
+     tMCIWAIT = 290,
+     tMOVIE = 291,
+     tNEXT = 292,
+     tOF = 293,
+     tPREVIOUS = 294,
+     tPUT = 295,
+     tREPEAT = 296,
+     tSET = 297,
+     tTHEN = 298,
+     tTO = 299,
+     tWHEN = 300,
+     tWITH = 301,
+     tWHILE = 302,
+     tNLELSE = 303,
+     tFACTORY = 304,
+     tMETHOD = 305,
+     tALERT = 306,
+     tBEEP = 307,
+     tCLOSERESFILE = 308,
+     tCLOSEXLIB = 309,
+     tCURSOR = 310,
+     tDELAY = 311,
+     tGE = 312,
+     tLE = 313,
+     tGT = 314,
+     tLT = 315,
+     tEQ = 316,
+     tNEQ = 317,
+     tAND = 318,
+     tOR = 319,
+     tNOT = 320,
+     tCONCAT = 321,
+     tCONTAINS = 322,
+     tSTARTS = 323,
+     tSPRITE = 324,
+     tINTERSECTS = 325,
+     tWITHIN = 326
    };
 #endif
 /* Tokens.  */
@@ -123,59 +125,61 @@
 #define FLOAT 269
 #define BLTIN 270
 #define BLTINNOARGS 271
-#define ID 272
-#define STRING 273
-#define HANDLER 274
-#define tDOWN 275
-#define tELSE 276
-#define tNLELSIF 277
-#define tEND 278
-#define tEXIT 279
-#define tFRAME 280
-#define tGLOBAL 281
-#define tGO 282
-#define tIF 283
-#define tINTO 284
-#define tLOOP 285
-#define tMACRO 286
-#define tMCI 287
-#define tMCIWAIT 288
-#define tMOVIE 289
-#define tNEXT 290
-#define tOF 291
-#define tPREVIOUS 292
-#define tPUT 293
-#define tREPEAT 294
-#define tSET 295
-#define tTHEN 296
-#define tTO 297
-#define tWHEN 298
-#define tWITH 299
-#define tWHILE 300
-#define tNLELSE 301
-#define tFACTORY 302
-#define tMETHOD 303
-#define tALERT 304
-#define tBEEP 305
-#define tCLOSERESFILE 306
-#define tCLOSEXLIB 307
-#define tCURSOR 308
-#define tDELAY 309
-#define tGE 310
-#define tLE 311
-#define tGT 312
-#define tLT 313
-#define tEQ 314
-#define tNEQ 315
-#define tAND 316
-#define tOR 317
-#define tNOT 318
-#define tCONCAT 319
-#define tCONTAINS 320
-#define tSTARTS 321
-#define tSPRITE 322
-#define tINTERSECTS 323
-#define tWITHIN 324
+#define BLTINNOARGSORONE 272
+#define BLTINONEARG 273
+#define ID 274
+#define STRING 275
+#define HANDLER 276
+#define tDOWN 277
+#define tELSE 278
+#define tNLELSIF 279
+#define tEND 280
+#define tEXIT 281
+#define tFRAME 282
+#define tGLOBAL 283
+#define tGO 284
+#define tIF 285
+#define tINTO 286
+#define tLOOP 287
+#define tMACRO 288
+#define tMCI 289
+#define tMCIWAIT 290
+#define tMOVIE 291
+#define tNEXT 292
+#define tOF 293
+#define tPREVIOUS 294
+#define tPUT 295
+#define tREPEAT 296
+#define tSET 297
+#define tTHEN 298
+#define tTO 299
+#define tWHEN 300
+#define tWITH 301
+#define tWHILE 302
+#define tNLELSE 303
+#define tFACTORY 304
+#define tMETHOD 305
+#define tALERT 306
+#define tBEEP 307
+#define tCLOSERESFILE 308
+#define tCLOSEXLIB 309
+#define tCURSOR 310
+#define tDELAY 311
+#define tGE 312
+#define tLE 313
+#define tGT 314
+#define tLT 315
+#define tEQ 316
+#define tNEQ 317
+#define tAND 318
+#define tOR 319
+#define tNOT 320
+#define tCONCAT 321
+#define tCONTAINS 322
+#define tSTARTS 323
+#define tSPRITE 324
+#define tINTERSECTS 325
+#define tWITHIN 326
 
 
 
@@ -193,7 +197,7 @@ typedef union YYSTYPE
 	Common::Array<double> *arr;
 }
 /* Line 1529 of yacc.c.  */
-#line 197 "engines/director/lingo/lingo-gr.hpp"
+#line 201 "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 c5df8c3..d9f1ba8 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -81,7 +81,7 @@ void yyerror(char *s) {
 %token<i> INT
 %token<e> THEENTITY THEENTITYWITHID
 %token<f> FLOAT
-%token<s> BLTIN BLTINNOARGS ID STRING HANDLER
+%token<s> BLTIN BLTINNOARGS BLTINNOARGSORONE BLTINONEARG ID STRING HANDLER
 %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 tWHEN
 %token tWITH tWHILE tNLELSE tFACTORY tMETHOD tALERT tBEEP tCLOSERESFILE tCLOSEXLIB
@@ -404,7 +404,16 @@ func: tMCI STRING			{ g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_
 	| tEXIT					{ g_lingo->codeConst(0); // Push fake value on stack
 							  g_lingo->code1(g_lingo->c_procret); }
 	| tGLOBAL globallist
-	| tALERT expr			{ g_lingo->code1(g_lingo->c_alert); }
+	| BLTINONEARG expr		{
+		g_lingo->code1(g_lingo->_handlers[*$1]->u.func);
+		delete $1; }
+	| BLTINNOARGSORONE expr	{
+		g_lingo->code1(g_lingo->_handlers[*$1]->u.func);
+		delete $1; }
+	| BLTINNOARGSORONE 		{
+		g_lingo->code2(g_ling->c_voidpush, g_lingo->_handlers[*$1]->u.func);
+		delete $1; }
+	| tALERT expr		{ g_lingo->code1(g_lingo->c_alert); }
 	| tBEEP INT			{
 		g_lingo->codeConst($2);
 		g_lingo->code1(g_lingo->c_beep); }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 1cdd8a7..0b95167 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -1303,8 +1303,21 @@ YY_RULE_SETUP
 		yylval.s = new Common::String(yytext);
 
 		if (g_lingo->_handlers.contains(yytext)) {
-			if (g_lingo->_handlers[yytext]->type == BLTIN && g_lingo->_handlers[yytext]->nargs == -1)
-				return BLTINNOARGS;
+			if (g_lingo->_handlers[yytext]->type == BLTIN && g_lingo->_handlers[yytext]->parens == false) {
+				if (g_lingo->_handlers[yytext]->nargs == 0) {
+					if (g_lingo->_handlers[yytext]->maxArgs == 0)
+						return BLTINNOARGS;
+					else if (g_lingo->_handlers[yytext]->maxArgs == 1)
+						return BLTINNOARGSORONE;
+					else
+						error("Incorrect setup for builtin: %s", yytext);
+				} else if (g_lingo->_handlers[yytext]->nargs == 1 &&
+							g_lingo->_handlers[yytext]->maxArgs == 1) {
+					return BLTINONEARG;
+				} else {
+					error("Incorrect setup for builtin: %s", yytext);
+				}
+			}
 		}
 
 		return ID;
@@ -1312,41 +1325,41 @@ YY_RULE_SETUP
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 194 "engines/director/lingo/lingo-lex.l"
+#line 207 "engines/director/lingo/lingo-lex.l"
 { count(); yylval.f = atof(yytext); return FLOAT; }
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 195 "engines/director/lingo/lingo-lex.l"
+#line 208 "engines/director/lingo/lingo-lex.l"
 { count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 196 "engines/director/lingo/lingo-lex.l"
+#line 209 "engines/director/lingo/lingo-lex.l"
 { count(); return *yytext; }
 	YY_BREAK
 case 57:
 /* rule 57 can match eol */
 YY_RULE_SETUP
-#line 197 "engines/director/lingo/lingo-lex.l"
+#line 210 "engines/director/lingo/lingo-lex.l"
 { return '\n'; }
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 198 "engines/director/lingo/lingo-lex.l"
+#line 211 "engines/director/lingo/lingo-lex.l"
 { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 199 "engines/director/lingo/lingo-lex.l"
+#line 212 "engines/director/lingo/lingo-lex.l"
 
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 201 "engines/director/lingo/lingo-lex.l"
+#line 214 "engines/director/lingo/lingo-lex.l"
 ECHO;
 	YY_BREAK
-#line 1350 "engines/director/lingo/lingo-lex.cpp"
+#line 1363 "engines/director/lingo/lingo-lex.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -2346,7 +2359,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 201 "engines/director/lingo/lingo-lex.l"
+#line 214 "engines/director/lingo/lingo-lex.l"
 
 
 
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2d871ce..81ce73d 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -185,11 +185,21 @@ whitespace [\t ]
 		yylval.s = new Common::String(yytext);
 
 		if (g_lingo->_handlers.contains(yytext)) {
-			if (g_lingo->_handlers[yytext]->type == BLTIN &&
-					g_lingo->_handlers[yytext]->nargs == 0 &&
-					g_lingo->_handlers[yytext]->maxArgs == 0 &&
-					!g_lingo->_handlers[yytext]->parens)
-				return BLTINNOARGS;
+			if (g_lingo->_handlers[yytext]->type == BLTIN && g_lingo->_handlers[yytext]->parens == false) {
+				if (g_lingo->_handlers[yytext]->nargs == 0) {
+					if (g_lingo->_handlers[yytext]->maxArgs == 0)
+						return BLTINNOARGS;
+					else if (g_lingo->_handlers[yytext]->maxArgs == 1)
+						return BLTINNOARGSORONE;
+					else
+						error("Incorrect setup for builtin: %s", yytext);
+				} else if (g_lingo->_handlers[yytext]->nargs == 1 &&
+							g_lingo->_handlers[yytext]->maxArgs == 1) {
+					return BLTINONEARG;
+				} else {
+					error("Incorrect setup for builtin: %s", yytext);
+				}
+			}
 		}
 
 		return ID;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 94fe92f..52da1bb 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -216,6 +216,7 @@ public:
 	static void c_within();
 
 	static void c_constpush();
+	static void c_voidpush();
 	static void c_fconstpush();
 	static void c_stringpush();
 	static void c_varpush();






More information about the Scummvm-git-logs mailing list