diff options
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 175 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 23 |
2 files changed, 84 insertions, 114 deletions
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 66199ecaa1..54e62948a0 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -745,6 +745,9 @@ using namespace Director; int yyparse(); static void count() { + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: Read '%s' at %d:%d", yytext, g_lingo->_linenumber, g_lingo->_colnumber); + g_lingo->_colnumber += strlen(yytext); } @@ -777,7 +780,7 @@ static int checkImmediate(int token) { return token; } -#line 781 "engines/director/lingo/lingo-lex.cpp" +#line 784 "engines/director/lingo/lingo-lex.cpp" #define INITIAL 0 @@ -960,10 +963,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 82 "engines/director/lingo/lingo-lex.l" +#line 85 "engines/director/lingo/lingo-lex.l" -#line 967 "engines/director/lingo/lingo-lex.cpp" +#line 970 "engines/director/lingo/lingo-lex.cpp" if ( !(yy_init) ) { @@ -1049,84 +1052,84 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 84 "engines/director/lingo/lingo-lex.l" +#line 87 "engines/director/lingo/lingo-lex.l" YY_BREAK case 2: YY_RULE_SETUP -#line 85 "engines/director/lingo/lingo-lex.l" +#line 88 "engines/director/lingo/lingo-lex.l" { count(); } YY_BREAK case 3: YY_RULE_SETUP -#line 86 "engines/director/lingo/lingo-lex.l" +#line 89 "engines/director/lingo/lingo-lex.l" { count(); return ' '; } YY_BREAK case 4: YY_RULE_SETUP -#line 88 "engines/director/lingo/lingo-lex.l" +#line 91 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); return SYMBOL; } // D3 YY_BREAK case 5: YY_RULE_SETUP -#line 90 "engines/director/lingo/lingo-lex.l" +#line 93 "engines/director/lingo/lingo-lex.l" { count(); return tAFTER; } // D3 YY_BREAK case 6: YY_RULE_SETUP -#line 91 "engines/director/lingo/lingo-lex.l" +#line 94 "engines/director/lingo/lingo-lex.l" { count(); return tAND; } YY_BREAK case 7: YY_RULE_SETUP -#line 92 "engines/director/lingo/lingo-lex.l" +#line 95 "engines/director/lingo/lingo-lex.l" { count(); return tBEFORE; } // D3 YY_BREAK case 8: YY_RULE_SETUP -#line 93 "engines/director/lingo/lingo-lex.l" +#line 96 "engines/director/lingo/lingo-lex.l" { count(); return tCHAR; } // D3 YY_BREAK case 9: YY_RULE_SETUP -#line 94 "engines/director/lingo/lingo-lex.l" +#line 97 "engines/director/lingo/lingo-lex.l" { count(); return tCONTAINS; } YY_BREAK case 10: YY_RULE_SETUP -#line 95 "engines/director/lingo/lingo-lex.l" +#line 98 "engines/director/lingo/lingo-lex.l" { count(); return tDONE; } YY_BREAK case 11: YY_RULE_SETUP -#line 96 "engines/director/lingo/lingo-lex.l" +#line 99 "engines/director/lingo/lingo-lex.l" { count(); return tDOWN; } YY_BREAK case 12: YY_RULE_SETUP -#line 97 "engines/director/lingo/lingo-lex.l" +#line 100 "engines/director/lingo/lingo-lex.l" { count(); return tIF; } YY_BREAK case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 98 "engines/director/lingo/lingo-lex.l" +#line 101 "engines/director/lingo/lingo-lex.l" { countnl(); return tNLELSIF; } YY_BREAK case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 99 "engines/director/lingo/lingo-lex.l" +#line 102 "engines/director/lingo/lingo-lex.l" { countnl(); return tNLELSE; } YY_BREAK case 15: YY_RULE_SETUP -#line 100 "engines/director/lingo/lingo-lex.l" +#line 103 "engines/director/lingo/lingo-lex.l" { count(); return tELSE; } YY_BREAK case 16: YY_RULE_SETUP -#line 101 "engines/director/lingo/lingo-lex.l" +#line 104 "engines/director/lingo/lingo-lex.l" { count(); @@ -1141,168 +1144,165 @@ YY_RULE_SETUP YY_BREAK case 17: YY_RULE_SETUP -#line 112 "engines/director/lingo/lingo-lex.l" +#line 115 "engines/director/lingo/lingo-lex.l" { count(); return tFACTORY; } YY_BREAK case 18: YY_RULE_SETUP -#line 113 "engines/director/lingo/lingo-lex.l" +#line 116 "engines/director/lingo/lingo-lex.l" { count(); return tEXIT; } YY_BREAK case 19: YY_RULE_SETUP -#line 114 "engines/director/lingo/lingo-lex.l" +#line 117 "engines/director/lingo/lingo-lex.l" { count(); return tFRAME; } YY_BREAK case 20: YY_RULE_SETUP -#line 115 "engines/director/lingo/lingo-lex.l" +#line 118 "engines/director/lingo/lingo-lex.l" { count(); return tGLOBAL; } YY_BREAK case 21: YY_RULE_SETUP -#line 116 "engines/director/lingo/lingo-lex.l" +#line 119 "engines/director/lingo/lingo-lex.l" { count(); return tGO; } YY_BREAK case 22: YY_RULE_SETUP -#line 117 "engines/director/lingo/lingo-lex.l" +#line 120 "engines/director/lingo/lingo-lex.l" { count(); return tGO; } YY_BREAK case 23: YY_RULE_SETUP -#line 118 "engines/director/lingo/lingo-lex.l" +#line 121 "engines/director/lingo/lingo-lex.l" { count(); return tINSTANCE; } YY_BREAK case 24: YY_RULE_SETUP -#line 119 "engines/director/lingo/lingo-lex.l" +#line 122 "engines/director/lingo/lingo-lex.l" { count(); return tINTERSECTS; } YY_BREAK case 25: YY_RULE_SETUP -#line 120 "engines/director/lingo/lingo-lex.l" +#line 123 "engines/director/lingo/lingo-lex.l" { count(); return tINTO; } YY_BREAK case 26: YY_RULE_SETUP -#line 121 "engines/director/lingo/lingo-lex.l" +#line 124 "engines/director/lingo/lingo-lex.l" { count(); return tITEM; } YY_BREAK case 27: YY_RULE_SETUP -#line 122 "engines/director/lingo/lingo-lex.l" +#line 125 "engines/director/lingo/lingo-lex.l" { count(); return tLINE; } YY_BREAK case 28: YY_RULE_SETUP -#line 123 "engines/director/lingo/lingo-lex.l" +#line 126 "engines/director/lingo/lingo-lex.l" { count(); return checkImmediate(tLOOP); } YY_BREAK case 29: YY_RULE_SETUP -#line 124 "engines/director/lingo/lingo-lex.l" +#line 127 "engines/director/lingo/lingo-lex.l" { count(); return tMACRO; } YY_BREAK case 30: YY_RULE_SETUP -#line 125 "engines/director/lingo/lingo-lex.l" +#line 128 "engines/director/lingo/lingo-lex.l" { count(); return tMETHOD; } YY_BREAK case 31: YY_RULE_SETUP -#line 126 "engines/director/lingo/lingo-lex.l" +#line 129 "engines/director/lingo/lingo-lex.l" { count(); return tMOD; } YY_BREAK case 32: YY_RULE_SETUP -#line 127 "engines/director/lingo/lingo-lex.l" +#line 130 "engines/director/lingo/lingo-lex.l" { count(); return tMOVIE; } YY_BREAK case 33: YY_RULE_SETUP -#line 128 "engines/director/lingo/lingo-lex.l" +#line 131 "engines/director/lingo/lingo-lex.l" { count(); return tNEXT; } YY_BREAK case 34: YY_RULE_SETUP -#line 129 "engines/director/lingo/lingo-lex.l" +#line 132 "engines/director/lingo/lingo-lex.l" { count(); return tNOT; } YY_BREAK case 35: YY_RULE_SETUP -#line 130 "engines/director/lingo/lingo-lex.l" +#line 133 "engines/director/lingo/lingo-lex.l" { count(); return tOF; } YY_BREAK case 36: YY_RULE_SETUP -#line 131 "engines/director/lingo/lingo-lex.l" +#line 134 "engines/director/lingo/lingo-lex.l" { count(); return tON; } // D3 YY_BREAK case 37: YY_RULE_SETUP -#line 132 "engines/director/lingo/lingo-lex.l" +#line 135 "engines/director/lingo/lingo-lex.l" { count(); return tOPEN; } YY_BREAK case 38: YY_RULE_SETUP -#line 133 "engines/director/lingo/lingo-lex.l" +#line 136 "engines/director/lingo/lingo-lex.l" { count(); return tOR; } YY_BREAK case 39: YY_RULE_SETUP -#line 134 "engines/director/lingo/lingo-lex.l" +#line 137 "engines/director/lingo/lingo-lex.l" { count(); return tPLAY; } YY_BREAK case 40: YY_RULE_SETUP -#line 135 "engines/director/lingo/lingo-lex.l" +#line 138 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); return tPLAYACCEL; } YY_BREAK case 41: YY_RULE_SETUP -#line 136 "engines/director/lingo/lingo-lex.l" +#line 139 "engines/director/lingo/lingo-lex.l" { count(); return tPREVIOUS; } YY_BREAK case 42: YY_RULE_SETUP -#line 137 "engines/director/lingo/lingo-lex.l" +#line 140 "engines/director/lingo/lingo-lex.l" { count(); return tPROPERTY; } // D4 YY_BREAK case 43: YY_RULE_SETUP -#line 138 "engines/director/lingo/lingo-lex.l" +#line 141 "engines/director/lingo/lingo-lex.l" { count(); return tPUT; } YY_BREAK case 44: YY_RULE_SETUP -#line 139 "engines/director/lingo/lingo-lex.l" +#line 142 "engines/director/lingo/lingo-lex.l" { count(); return checkImmediate(tREPEAT); } YY_BREAK case 45: YY_RULE_SETUP -#line 140 "engines/director/lingo/lingo-lex.l" +#line 143 "engines/director/lingo/lingo-lex.l" { count(); return tSET; } YY_BREAK case 46: YY_RULE_SETUP -#line 141 "engines/director/lingo/lingo-lex.l" +#line 144 "engines/director/lingo/lingo-lex.l" { count(); return tSTARTS; } YY_BREAK case 47: YY_RULE_SETUP -#line 142 "engines/director/lingo/lingo-lex.l" +#line 145 "engines/director/lingo/lingo-lex.l" { count(); return tTELL; } YY_BREAK case 48: YY_RULE_SETUP -#line 143 "engines/director/lingo/lingo-lex.l" +#line 146 "engines/director/lingo/lingo-lex.l" { count(); - if (debugChannelSet(-1, kDebugLingoCompile)) - debug("LEXER: the last: Read '%s'", yytext); - yylval.e[0] = g_lingo->_theEntities["last"]->entity; yylval.e[1] = 0; // No field @@ -1315,9 +1315,6 @@ 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 @@ -1326,13 +1323,10 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 165 "engines/director/lingo/lingo-lex.l" +#line 162 "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++; @@ -1373,13 +1367,10 @@ YY_RULE_SETUP YY_BREAK case 51: YY_RULE_SETUP -#line 208 "engines/director/lingo/lingo-lex.l" +#line 202 "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++; @@ -1411,13 +1402,10 @@ YY_RULE_SETUP YY_BREAK case 52: YY_RULE_SETUP -#line 242 "engines/director/lingo/lingo-lex.l" +#line 233 "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++; @@ -1437,74 +1425,71 @@ YY_RULE_SETUP YY_BREAK case 53: YY_RULE_SETUP -#line 264 "engines/director/lingo/lingo-lex.l" +#line 252 "engines/director/lingo/lingo-lex.l" { count(); return tTHEN; } YY_BREAK case 54: YY_RULE_SETUP -#line 265 "engines/director/lingo/lingo-lex.l" +#line 253 "engines/director/lingo/lingo-lex.l" { count(); return tTO; } YY_BREAK case 55: YY_RULE_SETUP -#line 266 "engines/director/lingo/lingo-lex.l" +#line 254 "engines/director/lingo/lingo-lex.l" { count(); return tSPRITE; } YY_BREAK case 56: YY_RULE_SETUP -#line 267 "engines/director/lingo/lingo-lex.l" +#line 255 "engines/director/lingo/lingo-lex.l" { count(); return tWITH; } YY_BREAK case 57: YY_RULE_SETUP -#line 268 "engines/director/lingo/lingo-lex.l" +#line 256 "engines/director/lingo/lingo-lex.l" { count(); return tWITHIN; } YY_BREAK case 58: YY_RULE_SETUP -#line 269 "engines/director/lingo/lingo-lex.l" +#line 257 "engines/director/lingo/lingo-lex.l" { count(); return tWHEN; } YY_BREAK case 59: YY_RULE_SETUP -#line 270 "engines/director/lingo/lingo-lex.l" +#line 258 "engines/director/lingo/lingo-lex.l" { count(); return tWHILE; } YY_BREAK case 60: YY_RULE_SETUP -#line 271 "engines/director/lingo/lingo-lex.l" +#line 259 "engines/director/lingo/lingo-lex.l" { count(); return tWORD; } YY_BREAK case 61: YY_RULE_SETUP -#line 273 "engines/director/lingo/lingo-lex.l" +#line 261 "engines/director/lingo/lingo-lex.l" { count(); return tNEQ; } YY_BREAK case 62: YY_RULE_SETUP -#line 274 "engines/director/lingo/lingo-lex.l" +#line 262 "engines/director/lingo/lingo-lex.l" { count(); return tGE; } YY_BREAK case 63: YY_RULE_SETUP -#line 275 "engines/director/lingo/lingo-lex.l" +#line 263 "engines/director/lingo/lingo-lex.l" { count(); return tLE; } YY_BREAK case 64: YY_RULE_SETUP -#line 276 "engines/director/lingo/lingo-lex.l" +#line 264 "engines/director/lingo/lingo-lex.l" { count(); return tCONCAT; } YY_BREAK case 65: YY_RULE_SETUP -#line 278 "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; @@ -1543,41 +1528,41 @@ YY_RULE_SETUP YY_BREAK case 66: YY_RULE_SETUP -#line 320 "engines/director/lingo/lingo-lex.l" +#line 305 "engines/director/lingo/lingo-lex.l" { count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK case 67: YY_RULE_SETUP -#line 321 "engines/director/lingo/lingo-lex.l" +#line 306 "engines/director/lingo/lingo-lex.l" { count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK case 68: YY_RULE_SETUP -#line 322 "engines/director/lingo/lingo-lex.l" +#line 307 "engines/director/lingo/lingo-lex.l" { count(); return *yytext; } YY_BREAK case 69: /* rule 69 can match eol */ YY_RULE_SETUP -#line 323 "engines/director/lingo/lingo-lex.l" +#line 308 "engines/director/lingo/lingo-lex.l" { return '\n'; } YY_BREAK case 70: YY_RULE_SETUP -#line 324 "engines/director/lingo/lingo-lex.l" +#line 309 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK case 71: YY_RULE_SETUP -#line 325 "engines/director/lingo/lingo-lex.l" - +#line 310 "engines/director/lingo/lingo-lex.l" +{ count(); } YY_BREAK case 72: YY_RULE_SETUP -#line 327 "engines/director/lingo/lingo-lex.l" +#line 312 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1581 "engines/director/lingo/lingo-lex.cpp" +#line 1566 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2540,7 +2525,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 327 "engines/director/lingo/lingo-lex.l" +#line 312 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 93b57a079a..b69e3d0328 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -37,6 +37,9 @@ using namespace Director; int yyparse(); static void count() { + if (debugChannelSet(-1, kDebugLingoCompile)) + debug("LEXER: Read '%s' at %d:%d", yytext, g_lingo->_linenumber, g_lingo->_colnumber); + g_lingo->_colnumber += strlen(yytext); } @@ -143,9 +146,6 @@ whitespace [\t ] (?i:the[ \t]+last[\t ]+of[\t ]+) { count(); - if (debugChannelSet(-1, kDebugLingoCompile)) - debug("LEXER: the last: Read '%s'", yytext); - yylval.e[0] = g_lingo->_theEntities["last"]->entity; yylval.e[1] = 0; // No field @@ -154,9 +154,6 @@ 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 @@ -165,9 +162,6 @@ 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++; @@ -208,9 +202,6 @@ 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++; @@ -242,9 +233,6 @@ 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++; @@ -279,9 +267,6 @@ 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; @@ -322,7 +307,7 @@ whitespace [\t ] {operator} { count(); return *yytext; } {newline} { return '\n'; } {conststring} { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } -. +. { count(); } %% |