diff options
author | Eugene Sandulenko | 2017-02-07 11:09:06 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-02-07 11:09:06 +0100 |
commit | a9fb3e3225dac382318f7c1ef09e7c61aeb2ac4c (patch) | |
tree | b12b7869840d9a1b37046847a3f9a7aa3456be8c /engines/director/lingo | |
parent | cf503789850b628cbf0e7aeeed837370ca1439de (diff) | |
download | scummvm-rg350-a9fb3e3225dac382318f7c1ef09e7c61aeb2ac4c.tar.gz scummvm-rg350-a9fb3e3225dac382318f7c1ef09e7c61aeb2ac4c.tar.bz2 scummvm-rg350-a9fb3e3225dac382318f7c1ef09e7c61aeb2ac4c.zip |
DIRECTOR: Lingo: Added debug output to lexer and fixed builtin.lingo test
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 65 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 15 | ||||
-rw-r--r-- | engines/director/lingo/tests/builtin.lingo | 2 |
3 files changed, 56 insertions, 26 deletions
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 1598a2758e..829a423a01 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -1278,6 +1278,9 @@ YY_RULE_SETUP { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the sqrt: Read '%s'", yytext); + yylval.e[0] = g_lingo->_theEntities["sqrt"]->entity; yylval.e[1] = 0; // No field @@ -1286,10 +1289,13 @@ YY_RULE_SETUP YY_BREAK case 48: YY_RULE_SETUP -#line 150 "engines/director/lingo/lingo-lex.l" +#line 153 "engines/director/lingo/lingo-lex.l" { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the of: Read '%s'", yytext); + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -1330,10 +1336,13 @@ YY_RULE_SETUP YY_BREAK case 49: YY_RULE_SETUP -#line 190 "engines/director/lingo/lingo-lex.l" +#line 196 "engines/director/lingo/lingo-lex.l" { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the date: Read '%s'", yytext); + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -1365,10 +1374,13 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 221 "engines/director/lingo/lingo-lex.l" +#line 230 "engines/director/lingo/lingo-lex.l" { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the: Read '%s'", yytext); + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -1388,71 +1400,74 @@ YY_RULE_SETUP YY_BREAK case 51: YY_RULE_SETUP -#line 240 "engines/director/lingo/lingo-lex.l" +#line 252 "engines/director/lingo/lingo-lex.l" { count(); return tTHEN; } YY_BREAK case 52: YY_RULE_SETUP -#line 241 "engines/director/lingo/lingo-lex.l" +#line 253 "engines/director/lingo/lingo-lex.l" { count(); return tTO; } YY_BREAK case 53: YY_RULE_SETUP -#line 242 "engines/director/lingo/lingo-lex.l" +#line 254 "engines/director/lingo/lingo-lex.l" { count(); return tSPRITE; } YY_BREAK case 54: YY_RULE_SETUP -#line 243 "engines/director/lingo/lingo-lex.l" +#line 255 "engines/director/lingo/lingo-lex.l" { count(); return tWITH; } YY_BREAK case 55: YY_RULE_SETUP -#line 244 "engines/director/lingo/lingo-lex.l" +#line 256 "engines/director/lingo/lingo-lex.l" { count(); return tWITHIN; } YY_BREAK case 56: YY_RULE_SETUP -#line 245 "engines/director/lingo/lingo-lex.l" +#line 257 "engines/director/lingo/lingo-lex.l" { count(); return tWHEN; } YY_BREAK case 57: YY_RULE_SETUP -#line 246 "engines/director/lingo/lingo-lex.l" +#line 258 "engines/director/lingo/lingo-lex.l" { count(); return tWHILE; } YY_BREAK case 58: YY_RULE_SETUP -#line 247 "engines/director/lingo/lingo-lex.l" +#line 259 "engines/director/lingo/lingo-lex.l" { count(); return tWORD; } YY_BREAK case 59: YY_RULE_SETUP -#line 249 "engines/director/lingo/lingo-lex.l" +#line 261 "engines/director/lingo/lingo-lex.l" { count(); return tNEQ; } YY_BREAK case 60: YY_RULE_SETUP -#line 250 "engines/director/lingo/lingo-lex.l" +#line 262 "engines/director/lingo/lingo-lex.l" { count(); return tGE; } YY_BREAK case 61: YY_RULE_SETUP -#line 251 "engines/director/lingo/lingo-lex.l" +#line 263 "engines/director/lingo/lingo-lex.l" { count(); return tLE; } YY_BREAK case 62: YY_RULE_SETUP -#line 252 "engines/director/lingo/lingo-lex.l" +#line 264 "engines/director/lingo/lingo-lex.l" { count(); return tCONCAT; } YY_BREAK case 63: YY_RULE_SETUP -#line 254 "engines/director/lingo/lingo-lex.l" +#line 266 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: identifier: Read '%s'", yytext); + if (g_lingo->_ignoreMe && yylval.s->equalsIgnoreCase("me")) return ID; @@ -1491,41 +1506,41 @@ YY_RULE_SETUP YY_BREAK case 64: YY_RULE_SETUP -#line 293 "engines/director/lingo/lingo-lex.l" +#line 308 "engines/director/lingo/lingo-lex.l" { count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK case 65: YY_RULE_SETUP -#line 294 "engines/director/lingo/lingo-lex.l" +#line 309 "engines/director/lingo/lingo-lex.l" { count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK case 66: YY_RULE_SETUP -#line 295 "engines/director/lingo/lingo-lex.l" +#line 310 "engines/director/lingo/lingo-lex.l" { count(); return *yytext; } YY_BREAK case 67: /* rule 67 can match eol */ YY_RULE_SETUP -#line 296 "engines/director/lingo/lingo-lex.l" +#line 311 "engines/director/lingo/lingo-lex.l" { return '\n'; } YY_BREAK case 68: YY_RULE_SETUP -#line 297 "engines/director/lingo/lingo-lex.l" +#line 312 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK case 69: YY_RULE_SETUP -#line 298 "engines/director/lingo/lingo-lex.l" +#line 313 "engines/director/lingo/lingo-lex.l" YY_BREAK case 70: YY_RULE_SETUP -#line 300 "engines/director/lingo/lingo-lex.l" +#line 315 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1529 "engines/director/lingo/lingo-lex.cpp" +#line 1544 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2488,7 +2503,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 300 "engines/director/lingo/lingo-lex.l" +#line 315 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index a4134b81c0..d6bf59ad5d 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -142,6 +142,9 @@ whitespace [\t ] (?i:the[ \t]+sqrt[\t ]+of[\t ]+) { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the sqrt: Read '%s'", yytext); + yylval.e[0] = g_lingo->_theEntities["sqrt"]->entity; yylval.e[1] = 0; // No field @@ -150,6 +153,9 @@ whitespace [\t ] (?i:the[ \t]+[[:alpha:]]+[\t ]+of[\t ]+[[:alpha:]]+) { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the of: Read '%s'", yytext); + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -190,6 +196,9 @@ whitespace [\t ] (?i:the[ \t]+[[:alpha:]]+[ \t+](date|time)) { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the date: Read '%s'", yytext); + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -221,6 +230,9 @@ whitespace [\t ] (?i:the[ \t]+[[:alpha:]]+) { count(); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: the: Read '%s'", yytext); + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -255,6 +267,9 @@ whitespace [\t ] count(); yylval.s = new Common::String(yytext); + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: identifier: Read '%s'", yytext); + if (g_lingo->_ignoreMe && yylval.s->equalsIgnoreCase("me")) return ID; diff --git a/engines/director/lingo/tests/builtin.lingo b/engines/director/lingo/tests/builtin.lingo index e499a2361a..561ecd3659 100644 --- a/engines/director/lingo/tests/builtin.lingo +++ b/engines/director/lingo/tests/builtin.lingo @@ -27,4 +27,4 @@ move cast 1, cast 3 move cast 3 put findEmpty(cast 10) pasteClipBoardInto cast 2 -put the width of the cast 3 +put the width of cast 3 |