diff options
Diffstat (limited to 'engines/director/lingo/lingo-lex.cpp')
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 266 |
1 files changed, 140 insertions, 126 deletions
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 58d052ee0c..e8b376bf0a 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -401,15 +401,15 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 6, 1, 1, 7, 8, 1, 7, 7, 7, 7, 7, 9, 10, 7, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 12, 1, 13, - 14, 15, 1, 1, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, - 25, 31, 32, 33, 34, 35, 36, 37, 25, 25, - 1, 1, 1, 7, 25, 1, 38, 39, 40, 41, - - 42, 43, 44, 45, 46, 25, 25, 47, 48, 49, - 50, 51, 25, 52, 53, 54, 55, 56, 57, 58, - 25, 25, 1, 1, 1, 1, 1, 1, 1, 1, + 11, 11, 11, 11, 11, 11, 11, 7, 1, 12, + 13, 14, 1, 1, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, + 24, 30, 31, 32, 33, 34, 35, 36, 24, 24, + 1, 1, 1, 7, 37, 1, 38, 39, 40, 41, + + 42, 43, 44, 45, 46, 24, 24, 47, 48, 49, + 50, 51, 24, 52, 53, 54, 55, 56, 57, 58, + 24, 24, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -429,32 +429,32 @@ static yyconst flex_int32_t yy_ec[256] = static yyconst flex_int32_t yy_meta[59] = { 0, 1, 2, 3, 4, 2, 1, 1, 1, 1, 1, - 5, 2, 1, 1, 1, 6, 5, 5, 5, 5, - 5, 5, 6, 5, 5, 6, 5, 5, 5, 6, - 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, - 5, 5, 5, 5, 6, 5, 6, 5, 5, 5, - 6, 5, 5, 5, 5, 5, 5, 5 + 5, 1, 1, 1, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6 } ; static yyconst flex_int16_t yy_base[158] = { 0, - 0, 57, 202, 367, 61, 65, 69, 73, 188, 367, - 180, 168, 50, 65, 136, 53, 0, 53, 54, 68, - 56, 62, 71, 66, 103, 81, 97, 93, 64, 80, - 106, 113, 158, 162, 166, 94, 170, 137, 178, 99, - 132, 367, 367, 0, 122, 144, 367, 367, 367, 0, - 111, 148, 142, 152, 166, 162, 171, 160, 0, 0, - 157, 162, 174, 169, 160, 159, 167, 0, 0, 181, - 170, 174, 173, 197, 198, 0, 195, 189, 226, 234, - 194, 0, 75, 0, 199, 205, 214, 0, 209, 217, - 228, 219, 219, 219, 215, 222, 219, 0, 220, 0, - - 237, 0, 228, 256, 234, 241, 246, 258, 0, 0, - 0, 255, 261, 0, 0, 233, 262, 262, 0, 261, - 271, 256, 88, 0, 270, 0, 142, 267, 0, 267, - 0, 270, 0, 269, 268, 270, 290, 0, 301, 280, - 0, 278, 281, 0, 0, 296, 288, 0, 289, 367, - 0, 0, 367, 347, 349, 355, 360 + 0, 57, 188, 380, 61, 65, 69, 73, 153, 380, + 137, 91, 50, 66, 85, 54, 0, 54, 55, 65, + 56, 66, 75, 59, 82, 87, 97, 95, 77, 102, + 108, 116, 161, 165, 169, 138, 173, 141, 177, 101, + 87, 380, 380, 0, 78, 141, 380, 380, 380, 0, + 113, 106, 100, 153, 167, 163, 172, 161, 0, 0, + 158, 163, 175, 170, 161, 162, 167, 0, 0, 181, + 170, 174, 172, 190, 188, 0, 191, 186, 229, 239, + 196, 0, 74, 0, 197, 208, 203, 0, 204, 212, + 223, 218, 218, 218, 215, 229, 222, 0, 221, 0, + + 237, 0, 229, 259, 238, 243, 247, 252, 0, 0, + 0, 252, 258, 0, 0, 250, 259, 261, 0, 259, + 268, 255, 192, 0, 265, 0, 290, 268, 0, 268, + 0, 275, 0, 273, 270, 273, 308, 0, 314, 284, + 0, 280, 284, 0, 0, 279, 287, 0, 289, 380, + 0, 0, 380, 360, 362, 368, 373 } ; static yyconst flex_int16_t yy_def[158] = @@ -478,58 +478,59 @@ static yyconst flex_int16_t yy_def[158] = 155, 155, 0, 153, 153, 153, 153 } ; -static yyconst flex_int16_t yy_nxt[426] = +static yyconst flex_int16_t yy_nxt[439] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, - 13, 10, 14, 10, 15, 16, 17, 18, 19, 20, - 21, 22, 17, 23, 17, 24, 25, 26, 27, 28, - 29, 30, 31, 17, 17, 32, 17, 16, 17, 18, + 13, 14, 10, 15, 16, 17, 18, 19, 20, 21, + 22, 17, 23, 17, 24, 25, 26, 27, 28, 29, + 30, 31, 17, 17, 32, 17, 17, 16, 17, 18, 19, 20, 21, 22, 17, 23, 24, 25, 26, 27, 28, 29, 30, 31, 17, 17, 32, 17, 33, 45, 46, 34, 35, 36, 36, 37, 38, 39, 39, 38, 38, 39, 39, 38, 37, 36, 36, 37, 47, 48, - 51, 52, 53, 72, 40, 83, 57, 58, 40, 123, - 59, 60, 123, 54, 62, 55, 36, 36, 61, 73, - - 66, 51, 52, 53, 56, 72, 40, 57, 58, 67, - 40, 59, 74, 60, 54, 62, 55, 68, 63, 61, - 64, 73, 66, 70, 81, 56, 71, 69, 75, 84, - 67, 65, 83, 74, 76, 77, 78, 42, 38, 68, - 63, 38, 64, 139, 70, 81, 139, 71, 69, 49, - 75, 84, 65, 45, 46, 76, 40, 77, 78, 79, - 36, 36, 80, 80, 36, 36, 80, 35, 36, 36, - 37, 37, 36, 36, 37, 85, 44, 86, 40, 38, - 39, 39, 38, 87, 88, 89, 90, 43, 91, 92, - 93, 94, 95, 42, 96, 97, 85, 40, 86, 98, - - 99, 153, 100, 101, 87, 102, 88, 89, 90, 91, - 92, 93, 103, 94, 95, 96, 97, 104, 105, 40, - 98, 106, 99, 100, 101, 107, 102, 79, 36, 36, - 80, 108, 109, 110, 103, 80, 36, 36, 80, 104, - 105, 111, 106, 112, 113, 118, 107, 114, 115, 116, - 117, 119, 108, 109, 120, 110, 121, 123, 122, 125, - 123, 131, 111, 126, 112, 127, 113, 118, 114, 115, - 116, 117, 119, 128, 129, 120, 130, 132, 121, 122, - 125, 133, 131, 124, 134, 126, 135, 127, 136, 138, - 140, 153, 141, 142, 153, 128, 129, 143, 130, 132, - - 144, 145, 139, 133, 124, 139, 134, 147, 135, 136, - 148, 138, 140, 141, 149, 142, 150, 153, 143, 151, - 152, 144, 145, 153, 146, 153, 153, 153, 147, 153, - 153, 148, 153, 153, 153, 149, 153, 153, 150, 153, - 151, 152, 153, 153, 153, 153, 146, 41, 41, 153, - 41, 41, 41, 50, 50, 82, 82, 153, 153, 82, - 82, 137, 153, 153, 153, 137, 3, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 51, 52, 53, 40, 83, 57, 62, 40, 83, 54, + 58, 55, 42, 59, 60, 72, 63, 49, 64, 44, + + 56, 61, 51, 52, 53, 66, 40, 57, 62, 65, + 40, 54, 58, 55, 67, 59, 68, 60, 72, 63, + 73, 64, 56, 61, 70, 81, 69, 71, 66, 75, + 84, 65, 85, 74, 86, 76, 67, 77, 78, 68, + 36, 36, 38, 73, 43, 38, 70, 81, 69, 71, + 45, 46, 75, 84, 85, 74, 86, 76, 42, 40, + 77, 78, 79, 36, 36, 80, 80, 36, 36, 80, + 35, 36, 36, 37, 37, 36, 36, 37, 38, 39, + 39, 38, 40, 87, 88, 89, 90, 153, 91, 92, + 93, 94, 95, 123, 96, 40, 123, 97, 98, 99, + + 153, 100, 101, 102, 103, 87, 104, 88, 89, 90, + 91, 92, 93, 105, 94, 95, 96, 106, 40, 97, + 98, 110, 99, 100, 101, 102, 107, 103, 108, 104, + 79, 36, 36, 80, 109, 111, 105, 112, 113, 106, + 80, 36, 36, 80, 110, 114, 115, 116, 107, 117, + 108, 118, 153, 119, 120, 121, 109, 111, 122, 112, + 123, 113, 125, 123, 126, 127, 128, 114, 115, 116, + 129, 117, 130, 132, 118, 119, 120, 131, 121, 133, + 122, 134, 135, 138, 125, 124, 136, 126, 127, 128, + 140, 139, 141, 129, 139, 130, 132, 142, 150, 131, + + 143, 144, 133, 145, 134, 135, 138, 124, 136, 153, + 147, 148, 153, 140, 141, 139, 149, 151, 139, 152, + 142, 150, 143, 144, 153, 145, 153, 153, 153, 153, + 153, 153, 147, 148, 153, 153, 146, 153, 149, 151, + 153, 152, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 146, + 41, 41, 153, 41, 41, 41, 50, 50, 82, 82, + 153, 153, 82, 82, 137, 153, 153, 153, 137, 3, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153 + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153 } ; -static yyconst flex_int16_t yy_chk[426] = +static yyconst flex_int16_t yy_chk[439] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -539,45 +540,46 @@ static yyconst flex_int16_t yy_chk[426] = 1, 1, 1, 1, 1, 1, 1, 1, 2, 13, 13, 2, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 14, 14, - 16, 18, 19, 29, 6, 83, 21, 22, 7, 123, - 22, 23, 123, 20, 24, 20, 36, 36, 23, 30, - - 26, 16, 18, 19, 20, 29, 6, 21, 22, 26, - 7, 22, 30, 23, 20, 24, 20, 27, 25, 23, - 25, 30, 26, 28, 40, 20, 28, 27, 31, 51, - 26, 25, 45, 30, 31, 32, 32, 41, 38, 27, - 25, 38, 25, 127, 28, 40, 127, 28, 27, 15, - 31, 51, 25, 46, 46, 31, 38, 32, 32, 33, - 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, - 35, 37, 37, 37, 37, 52, 12, 53, 38, 39, - 39, 39, 39, 54, 55, 56, 57, 11, 58, 61, - 62, 63, 64, 9, 65, 66, 52, 39, 53, 67, - - 70, 3, 71, 72, 54, 73, 55, 56, 57, 58, - 61, 62, 74, 63, 64, 65, 66, 75, 77, 39, - 67, 78, 70, 71, 72, 81, 73, 79, 79, 79, - 79, 85, 86, 87, 74, 80, 80, 80, 80, 75, - 77, 89, 78, 90, 91, 96, 81, 92, 93, 94, - 95, 97, 85, 86, 99, 87, 101, 104, 103, 105, - 104, 116, 89, 106, 90, 107, 91, 96, 92, 93, - 94, 95, 97, 108, 112, 99, 113, 117, 101, 103, - 105, 118, 116, 104, 120, 106, 121, 107, 122, 125, - 128, 137, 130, 132, 137, 108, 112, 134, 113, 117, - - 135, 136, 139, 118, 104, 139, 120, 140, 121, 122, - 142, 125, 128, 130, 143, 132, 146, 0, 134, 147, - 149, 135, 136, 0, 139, 0, 0, 0, 140, 0, - 0, 142, 0, 0, 0, 143, 0, 0, 146, 0, - 147, 149, 0, 0, 0, 0, 139, 154, 154, 0, - 154, 154, 154, 155, 155, 156, 156, 0, 0, 156, - 156, 157, 0, 0, 0, 157, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 16, 18, 19, 6, 83, 21, 24, 7, 45, 20, + 22, 20, 41, 22, 23, 29, 25, 15, 25, 12, + + 20, 23, 16, 18, 19, 26, 6, 21, 24, 25, + 7, 20, 22, 20, 26, 22, 27, 23, 29, 25, + 30, 25, 20, 23, 28, 40, 27, 28, 26, 31, + 51, 25, 52, 30, 53, 31, 26, 32, 32, 27, + 36, 36, 38, 30, 11, 38, 28, 40, 27, 28, + 46, 46, 31, 51, 52, 30, 53, 31, 9, 38, + 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, + 35, 35, 35, 35, 37, 37, 37, 37, 39, 39, + 39, 39, 38, 54, 55, 56, 57, 3, 58, 61, + 62, 63, 64, 123, 65, 39, 123, 66, 67, 70, + + 0, 71, 72, 73, 74, 54, 75, 55, 56, 57, + 58, 61, 62, 77, 63, 64, 65, 78, 39, 66, + 67, 87, 70, 71, 72, 73, 81, 74, 85, 75, + 79, 79, 79, 79, 86, 89, 77, 90, 91, 78, + 80, 80, 80, 80, 87, 92, 93, 94, 81, 95, + 85, 96, 0, 97, 99, 101, 86, 89, 103, 90, + 104, 91, 105, 104, 106, 107, 108, 92, 93, 94, + 112, 95, 113, 117, 96, 97, 99, 116, 101, 118, + 103, 120, 121, 125, 105, 104, 122, 106, 107, 108, + 128, 127, 130, 112, 127, 113, 117, 132, 146, 116, + + 134, 135, 118, 136, 120, 121, 125, 104, 122, 137, + 140, 142, 137, 128, 130, 139, 143, 147, 139, 149, + 132, 146, 134, 135, 0, 136, 0, 0, 0, 0, + 0, 0, 140, 142, 0, 0, 139, 0, 143, 147, + 0, 149, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 139, + 154, 154, 0, 154, 154, 154, 155, 155, 156, 156, + 0, 0, 156, 156, 157, 0, 0, 0, 157, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153 + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153 } ; static yy_state_type yy_last_accepting_state; @@ -642,7 +644,7 @@ static void countnl() { g_lingo->_colnumber = strlen(p); } -#line 646 "engines/director/lingo/lingo-lex.cpp" +#line 648 "engines/director/lingo/lingo-lex.cpp" #define INITIAL 0 @@ -830,7 +832,7 @@ YY_DECL #line 60 "engines/director/lingo/lingo-lex.l" -#line 834 "engines/director/lingo/lingo-lex.cpp" +#line 836 "engines/director/lingo/lingo-lex.cpp" if ( !(yy_init) ) { @@ -890,7 +892,7 @@ yy_match: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 367 ); + while ( yy_base[yy_current_state] != 380 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1076,52 +1078,64 @@ YY_RULE_SETUP while (*ptr == ' ' || *ptr == '\t') ptr++; - return tTHEN; + if (g_lingo->_theEntities.contains(ptr)) { + yylval.i = g_lingo->_theEntities[ptr]->entity; + + if (g_lingo->_theEntities[ptr]->hasId) + return THEENTITYWITHID; + else + return THEENTITY; + } else if (g_lingo->_theEntityFields.contains(ptr)) { + yylval.i = g_lingo->_theEntityFields[ptr]->field; + return THEFIELD; + } + + error("Unhandled the entity %s", ptr); } YY_BREAK case 32: YY_RULE_SETUP -#line 102 "engines/director/lingo/lingo-lex.l" +#line 114 "engines/director/lingo/lingo-lex.l" { count(); return tTHEN; } YY_BREAK case 33: YY_RULE_SETUP -#line 103 "engines/director/lingo/lingo-lex.l" +#line 115 "engines/director/lingo/lingo-lex.l" { count(); return tTO; } YY_BREAK case 34: YY_RULE_SETUP -#line 104 "engines/director/lingo/lingo-lex.l" +#line 116 "engines/director/lingo/lingo-lex.l" { count(); return tWITH; } YY_BREAK case 35: YY_RULE_SETUP -#line 105 "engines/director/lingo/lingo-lex.l" +#line 117 "engines/director/lingo/lingo-lex.l" { count(); return tWHILE; } YY_BREAK case 36: YY_RULE_SETUP -#line 107 "engines/director/lingo/lingo-lex.l" +#line 119 "engines/director/lingo/lingo-lex.l" { count(); return tNEQ; } YY_BREAK case 37: YY_RULE_SETUP -#line 108 "engines/director/lingo/lingo-lex.l" +#line 120 "engines/director/lingo/lingo-lex.l" { count(); return tGE; } YY_BREAK case 38: YY_RULE_SETUP -#line 109 "engines/director/lingo/lingo-lex.l" +#line 121 "engines/director/lingo/lingo-lex.l" { count(); return tLE; } YY_BREAK case 39: YY_RULE_SETUP -#line 110 "engines/director/lingo/lingo-lex.l" +#line 122 "engines/director/lingo/lingo-lex.l" { count(); return tCONCAT; } YY_BREAK case 40: YY_RULE_SETUP -#line 112 "engines/director/lingo/lingo-lex.l" +#line 124 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); @@ -1134,41 +1148,41 @@ YY_RULE_SETUP YY_BREAK case 41: YY_RULE_SETUP -#line 121 "engines/director/lingo/lingo-lex.l" +#line 133 "engines/director/lingo/lingo-lex.l" { count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK case 42: YY_RULE_SETUP -#line 122 "engines/director/lingo/lingo-lex.l" +#line 134 "engines/director/lingo/lingo-lex.l" { count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK case 43: YY_RULE_SETUP -#line 123 "engines/director/lingo/lingo-lex.l" +#line 135 "engines/director/lingo/lingo-lex.l" { count(); return *yytext; } YY_BREAK case 44: /* rule 44 can match eol */ YY_RULE_SETUP -#line 124 "engines/director/lingo/lingo-lex.l" +#line 136 "engines/director/lingo/lingo-lex.l" { return '\n'; } YY_BREAK case 45: YY_RULE_SETUP -#line 125 "engines/director/lingo/lingo-lex.l" +#line 137 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK case 46: YY_RULE_SETUP -#line 126 "engines/director/lingo/lingo-lex.l" +#line 138 "engines/director/lingo/lingo-lex.l" YY_BREAK case 47: YY_RULE_SETUP -#line 128 "engines/director/lingo/lingo-lex.l" +#line 140 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1172 "engines/director/lingo/lingo-lex.cpp" +#line 1186 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2168,7 +2182,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 128 "engines/director/lingo/lingo-lex.l" +#line 140 "engines/director/lingo/lingo-lex.l" |