Skip to content

Commit

Permalink
DIRECTOR: Lingo: Stub for when/then statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 3, 2016
1 parent 2e0078e commit 29b6f3e
Show file tree
Hide file tree
Showing 7 changed files with 727 additions and 694 deletions.
4 changes: 2 additions & 2 deletions engines/director/lingo/lingo-codegen.cpp
Expand Up @@ -124,13 +124,13 @@ void Lingo::cleanLocalVars() {
}

void Lingo::define(Common::String &name, int start, int nargs, Common::String *prefix) {
debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);

Symbol *sym;

if (prefix)
name = *prefix + "-" + name;

debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);

if (!_handlers.contains(name)) { // Create variable if it was not defined
sym = new Symbol;

Expand Down
1,045 changes: 533 additions & 512 deletions engines/director/lingo/lingo-gr.cpp

Large diffs are not rendered by default.

72 changes: 37 additions & 35 deletions engines/director/lingo/lingo-gr.h
Expand Up @@ -75,23 +75,24 @@
tSET = 291,
tTHEN = 292,
tTO = 293,
tWITH = 294,
tWHILE = 295,
tNLELSE = 296,
tFACTORY = 297,
tMETHOD = 298,
tGE = 299,
tLE = 300,
tGT = 301,
tLT = 302,
tEQ = 303,
tNEQ = 304,
tAND = 305,
tOR = 306,
tNOT = 307,
tCONCAT = 308,
tCONTAINS = 309,
tSTARTS = 310
tWHEN = 294,
tWITH = 295,
tWHILE = 296,
tNLELSE = 297,
tFACTORY = 298,
tMETHOD = 299,
tGE = 300,
tLE = 301,
tGT = 302,
tLT = 303,
tEQ = 304,
tNEQ = 305,
tAND = 306,
tOR = 307,
tNOT = 308,
tCONCAT = 309,
tCONTAINS = 310,
tSTARTS = 311
};
#endif
/* Tokens. */
Expand Down Expand Up @@ -131,23 +132,24 @@
#define tSET 291
#define tTHEN 292
#define tTO 293
#define tWITH 294
#define tWHILE 295
#define tNLELSE 296
#define tFACTORY 297
#define tMETHOD 298
#define tGE 299
#define tLE 300
#define tGT 301
#define tLT 302
#define tEQ 303
#define tNEQ 304
#define tAND 305
#define tOR 306
#define tNOT 307
#define tCONCAT 308
#define tCONTAINS 309
#define tSTARTS 310
#define tWHEN 294
#define tWITH 295
#define tWHILE 296
#define tNLELSE 297
#define tFACTORY 298
#define tMETHOD 299
#define tGE 300
#define tLE 301
#define tGT 302
#define tLT 303
#define tEQ 304
#define tNEQ 305
#define tAND 306
#define tOR 307
#define tNOT 308
#define tCONCAT 309
#define tCONTAINS 310
#define tSTARTS 311



Expand All @@ -164,7 +166,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
#line 168 "engines/director/lingo/lingo-gr.hpp"
#line 170 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
Expand Down
5 changes: 4 additions & 1 deletion engines/director/lingo/lingo-gr.y
Expand Up @@ -81,7 +81,7 @@ void yyerror(char *s) {
%token<f> FLOAT
%token<s> 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 tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWHEN
%token tWITH tWHILE tNLELSE tFACTORY tMETHOD
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
%token tCONCAT tCONTAINS tSTARTS
Expand Down Expand Up @@ -214,6 +214,9 @@ stmt: stmtoneliner
(*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
(*g_lingo->_currentScript)[$1 + 4] = inc; /* increment */
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
| tWHEN ID tTHEN expr {
g_lingo->code1(g_lingo->c_ifcode);
}
;

ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
Expand Down

0 comments on commit 29b6f3e

Please sign in to comment.