diff options
author | Eugene Sandulenko | 2019-12-31 15:48:11 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-12-31 16:27:28 +0100 |
commit | f3b4df74b5c5d0bf62531d7cf654560ab5e923fc (patch) | |
tree | 404b6944bbaa69f8311430735e6ecd2b3edb28dc /engines/director/lingo | |
parent | ccb0aa0bb1be057e2bde400f732f04a0cfce39ac (diff) | |
download | scummvm-rg350-f3b4df74b5c5d0bf62531d7cf654560ab5e923fc.tar.gz scummvm-rg350-f3b4df74b5c5d0bf62531d7cf654560ab5e923fc.tar.bz2 scummvm-rg350-f3b4df74b5c5d0bf62531d7cf654560ab5e923fc.zip |
DIRECTOR: LINGO: Implement parsing of 'the number of <xx> in' chunk functions
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-builtins.cpp | 45 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 571 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 23 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 5 |
4 files changed, 383 insertions, 261 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index c9d2a32c39..e9f4e366c6 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -221,6 +221,11 @@ static struct BuiltinProto { { "me", Lingo::b_me, -1,0, false, 3, BLTIN }, // D3 { "script", Lingo::b_script, 1, 1, false, 4, RBLTIN }, // D4 f { "window", Lingo::b_window, 1, 1, false, 4, RBLTIN }, // D4 f + // Chunk operations + { "numberOfChars", Lingo::b_numberofchars, 1, 1, false, 4, FBLTIN }, // D4 f + { "numberOfItems", Lingo::b_numberofitems, 1, 1, false, 4, FBLTIN }, // D4 f + { "numberOfLines", Lingo::b_numberoflines, 1, 1, false, 4, FBLTIN }, // D4 f + { "numberOfWords", Lingo::b_numberofwords, 1, 1, false, 4, FBLTIN }, // D4 f { 0, 0, 0, 0, false, 0, 0 } }; @@ -1757,5 +1762,45 @@ void Lingo::b_window(int nargs) { g_lingo->push(d); } +void Lingo::b_numberofchars(int nargs) { + Datum d = g_lingo->pop(); + + warning("STUB: b_numberofchars"); + d.toInt(); + d.u.i = 0; + + g_lingo->push(d); +} + +void Lingo::b_numberofitems(int nargs) { + Datum d = g_lingo->pop(); + + warning("STUB: b_numberofitems"); + d.toInt(); + d.u.i = 0; + + g_lingo->push(d); +} + +void Lingo::b_numberoflines(int nargs) { + Datum d = g_lingo->pop(); + + warning("STUB: b_numberoflines"); + d.toInt(); + d.u.i = 0; + + g_lingo->push(d); +} + +void Lingo::b_numberofwords(int nargs) { + Datum d = g_lingo->pop(); + + warning("STUB: b_numberofwords"); + d.toInt(); + d.u.i = 0; + + g_lingo->push(d); +} + } // End of namespace Director diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 58cc534724..2a1af94eb2 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -364,8 +364,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 75 -#define YY_END_OF_BUFFER 76 +#define YY_NUM_RULES 76 +#define YY_END_OF_BUFFER 77 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -373,41 +373,43 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[298] = +static yyconst flex_int16_t yy_accept[314] = { 0, - 0, 0, 76, 74, 4, 72, 72, 74, 74, 74, - 71, 71, 71, 70, 71, 67, 71, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 74, 3, 3, 68, 4, 72, - 0, 0, 0, 73, 5, 66, 2, 69, 70, 65, - 63, 64, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 22, 13, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 35, 36, 68, 38, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 56, 68, 68, - 68, 1, 3, 3, 0, 68, 5, 2, 69, 68, - - 7, 68, 68, 68, 68, 68, 68, 16, 68, 68, - 0, 68, 68, 68, 68, 68, 68, 68, 31, 68, - 68, 34, 68, 68, 68, 68, 44, 68, 46, 68, - 68, 68, 68, 68, 68, 68, 68, 0, 68, 68, - 68, 9, 68, 11, 12, 15, 0, 18, 68, 0, - 68, 68, 25, 26, 27, 28, 68, 68, 68, 33, - 37, 40, 68, 68, 68, 68, 68, 48, 0, 55, - 60, 68, 58, 62, 0, 68, 6, 68, 68, 0, - 16, 68, 21, 68, 68, 29, 68, 32, 0, 68, - 68, 68, 68, 68, 68, 54, 54, 54, 54, 61, - - 68, 0, 68, 8, 68, 0, 16, 19, 0, 68, - 68, 68, 0, 68, 68, 68, 45, 57, 47, 0, - 0, 54, 54, 54, 59, 0, 68, 68, 14, 0, - 68, 68, 0, 30, 0, 68, 68, 68, 0, 0, - 0, 0, 54, 54, 54, 0, 17, 10, 0, 23, - 68, 30, 30, 0, 68, 42, 43, 0, 0, 0, - 54, 54, 54, 17, 0, 68, 30, 0, 41, 0, - 0, 0, 0, 0, 54, 0, 24, 39, 53, 52, - 53, 0, 0, 0, 0, 0, 20, 52, 0, 0, - 0, 0, 49, 50, 51, 51, 0 - + 0, 0, 77, 75, 4, 73, 73, 75, 75, 75, + 72, 72, 72, 71, 72, 68, 72, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 75, 3, 3, 69, 4, 73, + 0, 0, 0, 74, 5, 67, 2, 70, 71, 66, + 64, 65, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 22, 13, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 35, 36, 69, 38, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 57, 69, 69, + 69, 1, 3, 3, 0, 69, 5, 2, 70, 69, + + 7, 69, 69, 69, 69, 69, 69, 16, 69, 69, + 0, 69, 69, 69, 69, 69, 69, 69, 31, 69, + 69, 34, 69, 69, 69, 69, 44, 69, 46, 69, + 69, 69, 69, 69, 69, 69, 69, 0, 69, 69, + 69, 9, 69, 11, 12, 15, 0, 18, 69, 0, + 69, 69, 25, 26, 27, 28, 69, 69, 69, 33, + 37, 40, 69, 69, 69, 69, 69, 48, 0, 56, + 61, 69, 59, 63, 0, 69, 6, 69, 69, 0, + 16, 69, 21, 69, 69, 29, 69, 32, 0, 69, + 69, 69, 69, 69, 69, 55, 55, 55, 55, 55, + + 62, 69, 0, 69, 8, 69, 0, 16, 19, 0, + 69, 69, 69, 0, 69, 69, 69, 45, 58, 47, + 0, 0, 55, 55, 55, 55, 60, 0, 69, 69, + 14, 0, 69, 69, 0, 30, 0, 69, 69, 69, + 0, 0, 0, 0, 55, 55, 55, 55, 0, 17, + 10, 0, 23, 69, 30, 30, 0, 69, 42, 43, + 0, 0, 0, 55, 55, 55, 55, 17, 0, 69, + 30, 0, 41, 0, 0, 0, 0, 55, 0, 55, + 0, 24, 39, 54, 53, 54, 0, 0, 55, 0, + 0, 0, 20, 53, 0, 0, 0, 0, 0, 49, + + 0, 0, 50, 51, 0, 51, 0, 53, 0, 53, + 0, 52, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -453,18 +455,18 @@ static yyconst flex_int32_t yy_meta[66] = 5, 5, 5, 5, 1 } ; -static yyconst flex_int16_t yy_base[312] = +static yyconst flex_int16_t yy_base[330] = { 0, - 0, 64, 554, 747, 68, 747, 747, 72, 492, 0, - 747, 426, 418, 55, 63, 747, 365, 59, 59, 59, + 0, 64, 436, 834, 68, 834, 834, 72, 428, 0, + 834, 406, 390, 55, 63, 834, 365, 59, 59, 59, 55, 63, 0, 64, 75, 70, 100, 77, 110, 102, - 98, 129, 128, 131, 83, 166, 187, 293, 191, 747, - 195, 144, 320, 747, 0, 747, 0, 305, 160, 747, - 747, 747, 0, 66, 131, 156, 162, 74, 173, 149, + 98, 129, 128, 131, 83, 166, 187, 293, 191, 834, + 195, 144, 320, 834, 0, 834, 0, 305, 160, 834, + 834, 834, 0, 66, 131, 156, 162, 74, 173, 149, 167, 180, 156, 91, 0, 174, 193, 172, 186, 198, 184, 200, 183, 188, 0, 0, 203, 0, 211, 208, 192, 210, 209, 215, 233, 228, 236, 0, 238, 231, - 234, 747, 290, 294, 271, 225, 0, 0, 223, 237, + 234, 834, 290, 294, 271, 225, 0, 0, 223, 237, 0, 246, 244, 243, 243, 251, 260, 213, 250, 268, 268, 270, 286, 282, 266, 283, 282, 284, 0, 292, @@ -472,66 +474,68 @@ static yyconst flex_int16_t yy_base[312] = 295, 303, 346, 307, 326, 307, 337, 177, 147, 328, 329, 0, 341, 0, 0, 269, 361, 0, 347, 337, 348, 335, 0, 0, 0, 0, 339, 340, 350, 0, - 0, 371, 347, 357, 362, 339, 346, 0, 382, 0, - 0, 374, 375, 0, 107, 91, 0, 380, 377, 405, - 0, 381, 409, 383, 381, 0, 386, 0, 416, 398, - 392, 390, 389, 407, 400, 439, 449, 455, 459, 0, - - 421, 86, 79, 0, 427, 415, 0, 0, 466, 426, - 431, 470, 440, 448, 442, 444, 0, 0, 0, 479, - 470, 484, 502, 517, 0, 42, 20, 448, 747, 460, - 464, 476, 521, 0, 479, 479, 474, 476, 526, 513, - 514, 512, 541, 543, 547, 18, 0, 0, 522, 0, - 499, 0, 0, 513, 520, 0, 0, 515, 558, 538, - 565, 567, 577, 747, 545, 547, 0, 563, 0, 564, - 584, 567, 591, 599, 589, 571, 0, 747, 747, 0, - 747, 601, 573, 610, 586, 622, 747, 0, 620, 630, - 636, 592, 641, 646, 654, 658, 747, 690, 692, 695, - - 698, 704, 709, 714, 716, 721, 726, 729, 732, 737, - 740 + 0, 371, 347, 357, 362, 339, 346, 0, 412, 0, + 0, 363, 362, 0, 107, 91, 0, 374, 375, 405, + 0, 375, 406, 387, 384, 0, 386, 0, 422, 403, + 389, 388, 393, 402, 395, 449, 462, 456, 466, 472, + + 0, 403, 86, 79, 0, 404, 413, 0, 0, 473, + 418, 459, 481, 451, 462, 449, 452, 0, 0, 0, + 495, 468, 497, 491, 519, 531, 0, 42, 20, 476, + 834, 485, 491, 504, 530, 0, 509, 507, 504, 499, + 542, 528, 524, 525, 554, 555, 564, 575, 18, 0, + 0, 544, 0, 532, 0, 0, 540, 551, 0, 0, + 544, 579, 555, 585, 595, 599, 610, 834, 565, 560, + 0, 587, 0, 593, 617, 600, 622, 627, 623, 645, + 605, 0, 834, 834, 0, 834, 643, 612, 659, 660, + 616, 673, 834, 0, 669, 681, 683, 687, 632, 689, + + 693, 658, 694, 702, 704, 708, 710, 717, 675, 726, + 577, 834, 834, 767, 769, 772, 775, 781, 786, 791, + 793, 798, 803, 806, 809, 814, 817, 822, 827 } ; -static yyconst flex_int16_t yy_def[312] = +static yyconst flex_int16_t yy_def[330] = { 0, - 297, 1, 297, 297, 297, 297, 297, 297, 298, 299, - 297, 297, 297, 297, 297, 297, 297, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 297, 297, 297, 300, 297, 297, - 297, 297, 298, 297, 301, 297, 302, 297, 297, 297, - 297, 297, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 297, 297, 297, 297, 300, 301, 302, 297, 300, - - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 297, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 300, 297, 300, 300, - 300, 300, 300, 300, 300, 300, 303, 300, 300, 297, - 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 300, 300, 300, 304, 300, - 300, 300, 300, 300, 297, 300, 300, 300, 300, 297, - 305, 300, 297, 300, 300, 300, 300, 300, 297, 300, - 300, 300, 300, 300, 300, 304, 304, 304, 304, 300, - - 300, 297, 300, 300, 300, 297, 305, 300, 297, 300, - 300, 306, 297, 300, 300, 300, 300, 300, 300, 297, - 297, 304, 304, 304, 300, 297, 300, 300, 297, 297, - 300, 300, 307, 308, 297, 300, 300, 300, 297, 297, - 297, 297, 304, 304, 304, 297, 300, 300, 297, 300, - 300, 309, 308, 297, 300, 300, 300, 297, 297, 297, - 304, 304, 304, 297, 297, 300, 309, 297, 300, 297, - 310, 297, 297, 297, 304, 297, 300, 297, 297, 311, - 297, 297, 297, 297, 297, 297, 297, 311, 297, 297, - 297, 297, 310, 310, 297, 310, 0, 297, 297, 297, - - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297 + 313, 1, 313, 313, 313, 313, 313, 313, 314, 315, + 313, 313, 313, 313, 313, 313, 313, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 313, 313, 313, 316, 313, 313, + 313, 313, 314, 313, 317, 313, 318, 313, 313, 313, + 313, 313, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 313, 313, 313, 313, 316, 317, 318, 313, 316, + + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 313, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 313, 316, 316, + 316, 316, 316, 316, 316, 316, 319, 316, 316, 313, + 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, + 316, 316, 316, 316, 316, 316, 316, 316, 320, 316, + 316, 316, 316, 316, 313, 316, 316, 316, 316, 313, + 321, 316, 313, 316, 316, 316, 316, 316, 313, 316, + 316, 316, 316, 316, 316, 320, 320, 320, 320, 320, + + 316, 316, 313, 316, 316, 316, 313, 321, 316, 313, + 316, 316, 322, 313, 316, 316, 316, 316, 316, 316, + 313, 313, 320, 320, 320, 320, 316, 313, 316, 316, + 313, 313, 316, 316, 323, 324, 313, 316, 316, 316, + 313, 313, 313, 313, 320, 320, 320, 320, 313, 316, + 316, 313, 316, 316, 325, 324, 313, 316, 316, 316, + 313, 313, 313, 320, 320, 320, 320, 313, 313, 316, + 325, 313, 316, 313, 326, 313, 313, 320, 313, 320, + 313, 316, 313, 313, 327, 313, 313, 313, 320, 313, + 313, 313, 313, 327, 313, 313, 313, 313, 313, 326, + + 313, 313, 326, 313, 313, 326, 328, 329, 313, 329, + 313, 313, 0, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313 } ; -static yyconst flex_int16_t yy_nxt[813] = +static yyconst flex_int16_t yy_nxt[900] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 13, 4, 14, 15, 16, 17, 18, 19, 20, 21, @@ -541,16 +545,16 @@ static yyconst flex_int16_t yy_nxt[813] = 26, 27, 28, 29, 30, 23, 31, 32, 33, 23, 23, 34, 23, 23, 35, 36, 48, 49, 37, 39, 40, 40, 41, 41, 40, 40, 41, 50, 51, 56, - 54, 264, 57, 247, 59, 92, 92, 55, 58, 60, - 63, 61, 111, 64, 68, 111, 65, 73, 246, 69, + 54, 268, 57, 250, 59, 92, 92, 55, 58, 60, + 63, 61, 111, 64, 68, 111, 65, 73, 249, 69, 100, 62, 104, 66, 56, 54, 74, 57, 59, 67, 38, 55, 58, 60, 63, 61, 70, 64, 82, 68, 71, 65, 73, 69, 100, 62, 104, 66, 79, 72, - 74, 75, 42, 67, 80, 227, 42, 81, 76, 226, - 77, 70, 78, 82, 203, 71, 92, 92, 86, 83, + 74, 75, 42, 67, 80, 229, 42, 81, 76, 228, + 77, 70, 78, 82, 204, 71, 92, 92, 86, 83, 101, 87, 79, 72, 89, 90, 75, 88, 80, 84, - 91, 81, 76, 85, 77, 202, 78, 93, 40, 40, + 91, 81, 76, 85, 77, 203, 78, 93, 40, 40, 94, 48, 49, 86, 83, 101, 87, 102, 103, 89, 90, 88, 107, 84, 91, 110, 108, 85, 94, 40, 40, 94, 39, 40, 40, 41, 41, 40, 40, 41, @@ -574,58 +578,67 @@ static yyconst flex_int16_t yy_nxt[813] = 169, 167, 172, 168, 42, 173, 174, 179, 42, 171, 177, 178, 147, 182, 184, 147, 183, 185, 186, 187, 188, 191, 189, 194, 170, 189, 172, 192, 193, 52, - 195, 174, 179, 169, 177, 178, 169, 190, 182, 184, - 183, 185, 186, 187, 200, 188, 191, 194, 170, 201, - - 204, 205, 192, 193, 195, 212, 180, 208, 197, 180, - 209, 210, 190, 209, 211, 198, 214, 189, 199, 200, - 189, 215, 216, 217, 201, 204, 205, 218, 47, 206, - 212, 208, 197, 219, 46, 210, 229, 213, 211, 198, - 220, 214, 199, 220, 231, 215, 216, 217, 221, 225, - 220, 232, 218, 220, 206, 228, 220, 219, 221, 220, - 220, 229, 213, 220, 221, 222, 236, 209, 221, 231, - 209, 233, 235, 225, 233, 224, 232, 237, 238, 228, - 239, 248, 53, 239, 250, 220, 223, 230, 220, 240, - 222, 236, 249, 221, 251, 254, 235, 44, 240, 255, - - 224, 237, 238, 220, 242, 248, 220, 256, 241, 250, - 223, 221, 230, 242, 240, 257, 249, 243, 220, 251, - 254, 220, 233, 240, 255, 233, 221, 239, 242, 258, - 239, 256, 241, 266, 244, 259, 260, 242, 265, 257, - 268, 243, 220, 245, 220, 220, 269, 220, 220, 270, - 221, 220, 221, 297, 258, 241, 221, 266, 244, 271, - 259, 260, 271, 265, 268, 272, 273, 245, 274, 273, - 269, 274, 276, 270, 221, 261, 221, 262, 220, 241, - 277, 220, 263, 278, 279, 271, 221, 281, 271, 272, - 286, 287, 282, 286, 289, 282, 276, 275, 221, 261, - - 284, 262, 282, 284, 277, 282, 263, 290, 278, 279, - 240, 284, 281, 295, 284, 297, 287, 297, 240, 289, - 283, 293, 275, 291, 293, 242, 291, 297, 285, 297, - 283, 294, 290, 242, 294, 240, 297, 291, 295, 285, - 291, 240, 293, 240, 283, 293, 297, 294, 297, 242, - 294, 292, 285, 297, 283, 296, 242, 242, 296, 296, - 297, 297, 296, 285, 297, 292, 240, 297, 297, 297, - 297, 297, 297, 297, 297, 292, 297, 297, 297, 297, - 242, 297, 297, 297, 297, 297, 297, 297, 297, 292, - 43, 43, 297, 43, 43, 43, 45, 45, 53, 53, - - 53, 97, 97, 97, 98, 98, 297, 98, 98, 98, - 181, 297, 297, 181, 181, 196, 297, 297, 196, 207, - 207, 207, 234, 297, 234, 234, 234, 252, 297, 297, - 252, 252, 253, 253, 253, 267, 267, 267, 280, 297, - 297, 280, 280, 288, 288, 288, 3, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297 + 195, 174, 179, 201, 177, 178, 202, 190, 182, 184, + 183, 185, 186, 187, 205, 188, 191, 194, 170, 206, + + 47, 209, 192, 193, 195, 213, 180, 210, 201, 180, + 210, 202, 190, 169, 46, 211, 169, 212, 216, 205, + 217, 215, 219, 189, 206, 209, 189, 218, 220, 207, + 213, 227, 230, 44, 231, 313, 233, 313, 197, 211, + 198, 212, 216, 214, 217, 199, 215, 219, 200, 313, + 221, 218, 220, 221, 207, 227, 230, 221, 222, 231, + 221, 233, 197, 221, 198, 222, 221, 221, 214, 199, + 221, 222, 200, 221, 210, 222, 221, 210, 223, 234, + 238, 222, 235, 237, 239, 235, 240, 242, 226, 313, + 313, 224, 221, 53, 232, 221, 241, 225, 221, 241, + + 222, 221, 244, 223, 234, 238, 222, 237, 239, 251, + 240, 253, 242, 226, 242, 224, 313, 252, 246, 232, + 221, 225, 254, 221, 243, 257, 244, 258, 222, 244, + 245, 235, 221, 251, 235, 221, 253, 259, 260, 242, + 222, 252, 246, 241, 261, 262, 241, 254, 243, 263, + 257, 247, 258, 244, 245, 221, 221, 248, 221, 221, + 269, 259, 260, 222, 222, 221, 270, 272, 221, 261, + 262, 243, 265, 222, 263, 247, 221, 273, 274, 221, + 275, 248, 276, 275, 222, 269, 277, 313, 264, 277, + 270, 272, 281, 282, 222, 243, 221, 265, 266, 221, + + 279, 273, 274, 279, 222, 312, 276, 283, 222, 313, + 267, 221, 264, 284, 221, 278, 281, 282, 275, 222, + 286, 275, 266, 287, 290, 293, 287, 290, 221, 312, + 280, 221, 283, 295, 267, 313, 222, 297, 284, 313, + 278, 242, 242, 313, 287, 286, 292, 287, 313, 292, + 293, 288, 291, 304, 222, 280, 244, 244, 295, 289, + 296, 290, 297, 296, 290, 313, 242, 242, 222, 313, + 300, 313, 288, 300, 298, 288, 291, 298, 304, 305, + 244, 244, 301, 289, 303, 301, 313, 303, 298, 291, + 300, 298, 242, 300, 301, 303, 288, 301, 303, 311, + + 242, 313, 299, 306, 305, 307, 306, 244, 307, 306, + 302, 307, 306, 291, 307, 244, 299, 242, 309, 313, + 313, 309, 302, 313, 311, 242, 299, 309, 313, 294, + 309, 244, 313, 313, 302, 313, 313, 313, 294, 244, + 299, 313, 313, 313, 313, 313, 302, 313, 313, 313, + 285, 313, 313, 313, 313, 313, 313, 294, 313, 313, + 313, 313, 313, 313, 313, 313, 294, 43, 43, 313, + 43, 43, 43, 45, 45, 53, 53, 53, 97, 97, + 97, 98, 98, 313, 98, 98, 98, 181, 313, 313, + 181, 181, 196, 313, 313, 196, 208, 208, 208, 236, + + 313, 236, 236, 236, 255, 313, 313, 255, 255, 256, + 256, 256, 271, 271, 271, 285, 313, 313, 285, 285, + 294, 294, 294, 308, 313, 313, 308, 308, 310, 313, + 310, 310, 310, 3, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313 + } ; -static yyconst flex_int16_t yy_chk[813] = +static yyconst flex_int16_t yy_chk[900] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -635,13 +648,13 @@ static yyconst flex_int16_t yy_chk[813] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 14, 14, 2, 5, 5, 5, 5, 8, 8, 8, 8, 15, 15, 19, - 18, 246, 20, 227, 21, 35, 35, 18, 20, 22, - 24, 22, 64, 24, 26, 64, 25, 28, 226, 26, + 18, 249, 20, 229, 21, 35, 35, 18, 20, 22, + 24, 22, 64, 24, 26, 64, 25, 28, 228, 26, 54, 22, 58, 25, 19, 18, 28, 20, 21, 25, 2, 18, 20, 22, 24, 22, 27, 24, 31, 26, 27, 25, 28, 26, 54, 22, 58, 25, 30, 27, - 28, 29, 5, 25, 30, 203, 8, 30, 29, 202, + 28, 29, 5, 25, 30, 204, 8, 30, 29, 203, 29, 27, 29, 31, 176, 27, 42, 42, 33, 32, 55, 33, 30, 27, 34, 34, 29, 33, 30, 32, 34, 30, 29, 32, 29, 175, 29, 36, 36, 36, @@ -668,55 +681,64 @@ static yyconst flex_int16_t yy_chk[813] = 133, 131, 135, 132, 93, 136, 137, 143, 94, 134, 140, 141, 147, 149, 151, 147, 150, 152, 157, 158, 159, 163, 162, 166, 133, 162, 135, 164, 165, 17, - 167, 137, 143, 169, 140, 141, 169, 162, 149, 151, - 150, 152, 157, 158, 172, 159, 163, 166, 133, 173, - - 178, 179, 164, 165, 167, 187, 180, 182, 169, 180, - 183, 184, 162, 183, 185, 169, 190, 189, 169, 172, - 189, 191, 192, 193, 173, 178, 179, 194, 13, 180, - 187, 182, 169, 195, 12, 184, 206, 189, 185, 169, - 196, 190, 169, 196, 210, 191, 192, 193, 196, 201, - 197, 211, 194, 197, 180, 205, 198, 195, 197, 198, - 199, 206, 189, 199, 198, 197, 214, 209, 199, 210, - 209, 212, 213, 201, 212, 199, 211, 215, 216, 205, - 220, 228, 212, 220, 231, 222, 198, 209, 222, 221, - 197, 214, 230, 222, 232, 235, 213, 9, 220, 236, - - 199, 215, 216, 223, 221, 228, 223, 237, 220, 231, - 198, 223, 209, 220, 221, 238, 230, 222, 224, 232, - 235, 224, 233, 220, 236, 233, 224, 239, 221, 240, - 239, 237, 220, 251, 223, 241, 242, 220, 249, 238, - 254, 222, 243, 224, 244, 243, 255, 244, 245, 258, - 243, 245, 244, 3, 240, 239, 245, 251, 223, 259, - 241, 242, 259, 249, 254, 260, 261, 224, 262, 261, - 255, 262, 265, 258, 261, 243, 262, 244, 263, 239, - 266, 263, 245, 268, 270, 271, 263, 272, 271, 260, - 275, 276, 273, 275, 283, 273, 265, 263, 275, 243, - - 274, 244, 282, 274, 266, 282, 245, 285, 268, 270, - 273, 284, 272, 292, 284, 0, 276, 0, 274, 283, - 273, 289, 263, 286, 289, 273, 286, 0, 274, 0, - 282, 290, 285, 274, 290, 273, 0, 291, 292, 284, - 291, 286, 293, 274, 273, 293, 0, 294, 0, 273, - 294, 286, 274, 0, 282, 295, 286, 274, 295, 296, - 0, 0, 296, 284, 0, 291, 286, 0, 0, 0, - 0, 0, 0, 0, 0, 286, 0, 0, 0, 0, - 286, 0, 0, 0, 0, 0, 0, 0, 0, 291, - 298, 298, 0, 298, 298, 298, 299, 299, 300, 300, - - 300, 301, 301, 301, 302, 302, 0, 302, 302, 302, - 303, 0, 0, 303, 303, 304, 0, 0, 304, 305, - 305, 305, 306, 0, 306, 306, 306, 307, 0, 0, - 307, 307, 308, 308, 308, 309, 309, 309, 310, 0, - 0, 310, 310, 311, 311, 311, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - - 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, - 297, 297 + 167, 137, 143, 172, 140, 141, 173, 162, 149, 151, + 150, 152, 157, 158, 178, 159, 163, 166, 133, 179, + + 13, 182, 164, 165, 167, 187, 180, 183, 172, 180, + 183, 173, 162, 169, 12, 184, 169, 185, 191, 178, + 192, 190, 194, 189, 179, 182, 189, 193, 195, 180, + 187, 202, 206, 9, 207, 3, 211, 0, 169, 184, + 169, 185, 191, 189, 192, 169, 190, 194, 169, 0, + 196, 193, 195, 196, 180, 202, 206, 198, 196, 207, + 198, 211, 169, 197, 169, 198, 197, 199, 189, 169, + 199, 197, 169, 200, 210, 199, 200, 210, 197, 212, + 215, 200, 213, 214, 216, 213, 217, 222, 200, 0, + 0, 198, 224, 213, 210, 224, 221, 199, 223, 221, + + 224, 223, 222, 197, 212, 215, 223, 214, 216, 230, + 217, 233, 222, 200, 221, 198, 0, 232, 224, 210, + 225, 199, 234, 225, 221, 237, 222, 238, 225, 221, + 223, 235, 226, 230, 235, 226, 233, 239, 240, 221, + 226, 232, 224, 241, 242, 243, 241, 234, 221, 244, + 237, 225, 238, 221, 223, 245, 246, 226, 245, 246, + 252, 239, 240, 245, 246, 247, 254, 257, 247, 242, + 243, 241, 246, 247, 244, 225, 248, 258, 261, 248, + 262, 226, 263, 262, 248, 252, 264, 0, 245, 264, + 254, 257, 269, 270, 264, 241, 265, 246, 247, 265, + + 266, 258, 261, 266, 265, 311, 263, 272, 266, 0, + 248, 267, 245, 274, 267, 265, 269, 270, 275, 267, + 276, 275, 247, 277, 279, 281, 277, 279, 278, 311, + 267, 278, 272, 288, 248, 0, 278, 291, 274, 0, + 265, 277, 279, 0, 287, 276, 280, 287, 0, 280, + 281, 277, 279, 299, 280, 267, 277, 279, 288, 278, + 289, 290, 291, 289, 290, 0, 277, 279, 289, 0, + 295, 0, 287, 295, 292, 277, 279, 292, 299, 302, + 277, 279, 296, 278, 297, 296, 0, 297, 298, 290, + 300, 298, 292, 300, 301, 303, 287, 301, 303, 309, + + 296, 0, 292, 304, 302, 305, 304, 292, 305, 306, + 296, 307, 306, 290, 307, 296, 298, 292, 308, 0, + 0, 308, 301, 0, 309, 296, 292, 310, 0, 308, + 310, 292, 0, 0, 296, 0, 0, 0, 310, 296, + 298, 0, 0, 0, 0, 0, 301, 0, 0, 0, + 307, 0, 0, 0, 0, 0, 0, 308, 0, 0, + 0, 0, 0, 0, 0, 0, 310, 314, 314, 0, + 314, 314, 314, 315, 315, 316, 316, 316, 317, 317, + 317, 318, 318, 0, 318, 318, 318, 319, 0, 0, + 319, 319, 320, 0, 0, 320, 321, 321, 321, 322, + + 0, 322, 322, 322, 323, 0, 0, 323, 323, 324, + 324, 324, 325, 325, 325, 326, 0, 0, 326, 326, + 327, 327, 327, 328, 0, 0, 328, 328, 329, 0, + 329, 329, 329, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, + 313, 313, 313, 313, 313, 313, 313, 313, 313 + } ; static yy_state_type yy_last_accepting_state; @@ -805,7 +827,7 @@ static int checkImmediate(int token) { return token; } -#line 809 "engines/director/lingo/lingo-lex.cpp" +#line 831 "engines/director/lingo/lingo-lex.cpp" #define INITIAL 0 @@ -991,7 +1013,7 @@ YY_DECL #line 87 "engines/director/lingo/lingo-lex.l" -#line 995 "engines/director/lingo/lingo-lex.cpp" +#line 1017 "engines/director/lingo/lingo-lex.cpp" if ( !(yy_init) ) { @@ -1045,13 +1067,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 298 ) + if ( yy_current_state >= 314 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 297 ); + while ( yy_current_state != 313 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -1381,6 +1403,33 @@ YY_RULE_SETUP count(); const char *ptr = &yytext[4]; // Skip 'the ' + while (*ptr == ' ' || *ptr == '\t') ptr++; + + ptr += 6; // skip 'number ' + while (*ptr == ' ' || *ptr == '\t') ptr++; + + ptr += 3; // Skip 'of ' + while (*ptr == ' ' || *ptr == '\t') ptr++; + + Common::String field; + while (*ptr != ' ' && *ptr != '\t') + field += *ptr++; + + yylval.s = new Common::String(Common::String::format("numberOf%s", field.c_str())); + + if (g_lingo->_builtins.contains(*yylval.s)) + return FBLTINONEARG; + else + error("LEXER: Unhandled chunk expression %s", yylval.s->c_str()); + } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 212 "engines/director/lingo/lingo-lex.l" +{ + count(); + + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -1431,9 +1480,9 @@ YY_RULE_SETUP warning("LEXER: Unhandled the entity %s", ptr); } YY_BREAK -case 53: +case 54: YY_RULE_SETUP -#line 242 "engines/director/lingo/lingo-lex.l" +#line 265 "engines/director/lingo/lingo-lex.l" { count(); @@ -1466,9 +1515,9 @@ YY_RULE_SETUP return THEENTITY; } YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 273 "engines/director/lingo/lingo-lex.l" +#line 296 "engines/director/lingo/lingo-lex.l" { count(); @@ -1489,74 +1538,74 @@ YY_RULE_SETUP warning("LEXER: Unhandled the entity %s", ptr); } YY_BREAK -case 55: +case 56: YY_RULE_SETUP -#line 292 "engines/director/lingo/lingo-lex.l" +#line 315 "engines/director/lingo/lingo-lex.l" { count(); return tTHEN; } YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 293 "engines/director/lingo/lingo-lex.l" +#line 316 "engines/director/lingo/lingo-lex.l" { count(); return tTO; } YY_BREAK -case 57: +case 58: YY_RULE_SETUP -#line 294 "engines/director/lingo/lingo-lex.l" +#line 317 "engines/director/lingo/lingo-lex.l" { count(); return tSPRITE; } YY_BREAK -case 58: +case 59: YY_RULE_SETUP -#line 295 "engines/director/lingo/lingo-lex.l" +#line 318 "engines/director/lingo/lingo-lex.l" { count(); return tWITH; } YY_BREAK -case 59: +case 60: YY_RULE_SETUP -#line 296 "engines/director/lingo/lingo-lex.l" +#line 319 "engines/director/lingo/lingo-lex.l" { count(); return tWITHIN; } YY_BREAK -case 60: +case 61: YY_RULE_SETUP -#line 297 "engines/director/lingo/lingo-lex.l" +#line 320 "engines/director/lingo/lingo-lex.l" { count(); return tWHEN; } YY_BREAK -case 61: +case 62: YY_RULE_SETUP -#line 298 "engines/director/lingo/lingo-lex.l" +#line 321 "engines/director/lingo/lingo-lex.l" { count(); return tWHILE; } YY_BREAK -case 62: +case 63: YY_RULE_SETUP -#line 299 "engines/director/lingo/lingo-lex.l" +#line 322 "engines/director/lingo/lingo-lex.l" { count(); return tWORD; } YY_BREAK -case 63: +case 64: YY_RULE_SETUP -#line 301 "engines/director/lingo/lingo-lex.l" +#line 324 "engines/director/lingo/lingo-lex.l" { count(); return tNEQ; } YY_BREAK -case 64: +case 65: YY_RULE_SETUP -#line 302 "engines/director/lingo/lingo-lex.l" +#line 325 "engines/director/lingo/lingo-lex.l" { count(); return tGE; } YY_BREAK -case 65: +case 66: YY_RULE_SETUP -#line 303 "engines/director/lingo/lingo-lex.l" +#line 326 "engines/director/lingo/lingo-lex.l" { count(); return tLE; } YY_BREAK -case 66: +case 67: YY_RULE_SETUP -#line 304 "engines/director/lingo/lingo-lex.l" +#line 327 "engines/director/lingo/lingo-lex.l" { count(); return tCONCAT; } YY_BREAK -case 67: +case 68: YY_RULE_SETUP -#line 305 "engines/director/lingo/lingo-lex.l" +#line 328 "engines/director/lingo/lingo-lex.l" { count(); return tEQ; } YY_BREAK -case 68: +case 69: YY_RULE_SETUP -#line 307 "engines/director/lingo/lingo-lex.l" +#line 330 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); @@ -1612,43 +1661,43 @@ YY_RULE_SETUP return ID; } YY_BREAK -case 69: +case 70: YY_RULE_SETUP -#line 361 "engines/director/lingo/lingo-lex.l" +#line 384 "engines/director/lingo/lingo-lex.l" { count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK -case 70: +case 71: YY_RULE_SETUP -#line 362 "engines/director/lingo/lingo-lex.l" +#line 385 "engines/director/lingo/lingo-lex.l" { count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK -case 71: +case 72: YY_RULE_SETUP -#line 363 "engines/director/lingo/lingo-lex.l" +#line 386 "engines/director/lingo/lingo-lex.l" { count(); return *yytext; } YY_BREAK -case 72: -/* rule 72 can match eol */ +case 73: +/* rule 73 can match eol */ YY_RULE_SETUP -#line 364 "engines/director/lingo/lingo-lex.l" +#line 387 "engines/director/lingo/lingo-lex.l" { count(); return '\n'; } YY_BREAK -case 73: +case 74: YY_RULE_SETUP -#line 365 "engines/director/lingo/lingo-lex.l" +#line 388 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK -case 74: +case 75: YY_RULE_SETUP -#line 366 "engines/director/lingo/lingo-lex.l" +#line 389 "engines/director/lingo/lingo-lex.l" { count(); } YY_BREAK -case 75: +case 76: YY_RULE_SETUP -#line 368 "engines/director/lingo/lingo-lex.l" +#line 391 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1652 "engines/director/lingo/lingo-lex.cpp" +#line 1701 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1942,7 +1991,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 298 ) + if ( yy_current_state >= 314 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1970,11 +2019,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 298 ) + if ( yy_current_state >= 314 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 297); + yy_is_jam = (yy_current_state == 313); return yy_is_jam ? 0 : yy_current_state; } @@ -2608,7 +2657,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 368 "engines/director/lingo/lingo-lex.l" +#line 391 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 4c9b1f1411..eaa9b00f2c 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -186,6 +186,29 @@ whitespace [\t ] return FBLTINONEARG; } +(?i:the[ \t]+number[\t ]+of[\t ]+[[:alpha:]]+[\t ]in) { + count(); + + const char *ptr = &yytext[4]; // Skip 'the ' + while (*ptr == ' ' || *ptr == '\t') ptr++; + + ptr += 6; // skip 'number ' + while (*ptr == ' ' || *ptr == '\t') ptr++; + + ptr += 3; // Skip 'of ' + while (*ptr == ' ' || *ptr == '\t') ptr++; + + Common::String field; + while (*ptr != ' ' && *ptr != '\t') + field += *ptr++; + + yylval.s = new Common::String(Common::String::format("numberOf%s", field.c_str())); + + if (g_lingo->_builtins.contains(*yylval.s)) + return FBLTINONEARG; + else + error("LEXER: Unhandled chunk expression %s", yylval.s->c_str()); + } (?i:the[ \t]+[[:alpha:]]+[\t ]+of[\t ]+{identifier}) { count(); diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 510aa3fe8b..644089ddcf 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -555,6 +555,11 @@ public: static void b_me(int nargs); static void b_script(int nargs); + static void b_numberofchars(int nargs); + static void b_numberofitems(int nargs); + static void b_numberoflines(int nargs); + static void b_numberofwords(int nargs); + void func_mci(Common::String &s); void func_mciwait(Common::String &s); void func_beep(int repeats); |