aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-gr.y
diff options
context:
space:
mode:
authorEugene Sandulenko2016-07-02 20:49:32 +0200
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit95c14371e7deedd171619e58411437d3df80f693 (patch)
tree3237548060d3e22f2f27c86c3db4270d5b237b3e /engines/director/lingo/lingo-gr.y
parentca40ccd9d123d18d9ba5e7b9a504a9fb6ee10355 (diff)
downloadscummvm-rg350-95c14371e7deedd171619e58411437d3df80f693.tar.gz
scummvm-rg350-95c14371e7deedd171619e58411437d3df80f693.tar.bz2
scummvm-rg350-95c14371e7deedd171619e58411437d3df80f693.zip
DIRECTOR: Lingo: Differentiate built-in function from IDs
Diffstat (limited to 'engines/director/lingo/lingo-gr.y')
-rw-r--r--engines/director/lingo/lingo-gr.y17
1 files changed, 14 insertions, 3 deletions
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 1c57e3fbce..df083b5d45 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -73,7 +73,7 @@ using namespace Director;
%token UNARY VOID VAR
%token<i> INT
%token<f> FLOAT
-%token<s> ID STRING HANDLER
+%token<s> BLTIN ID STRING HANDLER
%token tDOWN tELSE 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
@@ -223,9 +223,20 @@ expr: INT {
| FLOAT {
$$ = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat($1); }
+ | BLTIN '(' arglist ')' {
+ 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; }
| ID '(' arglist ')' {
- $$ = g_lingo->codeFunc($1, $3);
- delete $1; }
+ $$ = g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString($1->c_str());
+
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, $3);
+ g_lingo->code1(numpar);
+ delete $1; }
| ID {
$$ = g_lingo->codeId(*$1);
delete $1; }