From 78b198cee9920e62ea19879959316b426fe1834c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 15 Jul 2016 19:21:48 +0300 Subject: DIRECTOR: Lingo: Added support for parameter-less built-ins --- engines/director/lingo/lingo-gr.y | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'engines/director/lingo/lingo-gr.y') diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 9bdb29ed39..15c6c686b6 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -60,7 +60,7 @@ extern int yyparse(); using namespace Director; void yyerror(char *s) { g_lingo->_hadError = true; - warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber); + error("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber); } @@ -79,7 +79,7 @@ void yyerror(char *s) { %token INT %token THEENTITY THEENTITYWITHID %token FLOAT -%token BLTIN ID STRING HANDLER +%token BLTIN BLTINNOARGS 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 %token tWITH tWHILE tNLELSE tFACTORY tMETHOD @@ -350,6 +350,9 @@ expr: INT { if ($3 != g_lingo->_builtins[*$1]->nargs) error("Built-in function %s expects %d arguments but got %d", $1->c_str(), g_lingo->_builtins[*$1]->nargs, $3); + $$ = g_lingo->code1(g_lingo->_builtins[*$1]->func); + delete $1; } + | BLTINNOARGS { $$ = g_lingo->code1(g_lingo->_builtins[*$1]->func); delete $1; } | ID '(' arglist ')' { @@ -402,8 +405,8 @@ func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_ | tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; } | tPUT expr { g_lingo->code1(g_lingo->c_printtop); } | gotofunc - | tEXIT { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack - g_lingo->code1(g_lingo->c_procret); } + | tEXIT { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack + g_lingo->code1(g_lingo->c_procret); } | tGLOBAL globallist ; -- cgit v1.2.3