diff options
author | Eugene Sandulenko | 2016-07-08 23:36:12 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 4763228ef36bc8af38567f4ccbf4583051da0740 (patch) | |
tree | 47f7cbb1f3571dde7507497449200bc52172aab5 /engines/director/lingo | |
parent | 336f0bee9d49979bf527a1e7bb076aba0652f96e (diff) | |
download | scummvm-rg350-4763228ef36bc8af38567f4ccbf4583051da0740.tar.gz scummvm-rg350-4763228ef36bc8af38567f4ccbf4583051da0740.tar.bz2 scummvm-rg350-4763228ef36bc8af38567f4ccbf4583051da0740.zip |
DIRECTOR: Lingo: Added string constants as expressions
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 10 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 571 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 3 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 2 |
4 files changed, 303 insertions, 283 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 6151c1b60b..72e771ddef 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -116,6 +116,16 @@ void Lingo::c_fconstpush() { g_lingo->push(d); } +void Lingo::c_stringpush() { + Datum d; + char *s = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc]; + g_lingo->_pc += g_lingo->calcStringAlignment(s); + + d.u.s = new Common::String(s); + d.type = STRING; + g_lingo->push(d); +} + void Lingo::c_varpush() { char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc]; Datum d; diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index 049311e3fc..ed7a3c421f 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -430,18 +430,18 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 61 +#define YYFINAL 62 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 392 +#define YYLAST 380 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 57 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 33 /* YYNRULES -- Number of rules. */ -#define YYNRULES 98 +#define YYNRULES 99 /* YYNRULES -- Number of states. */ -#define YYNSTATES 208 +#define YYNSTATES 209 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -495,11 +495,11 @@ static const yytype_uint16 yyprhs[] = 56, 68, 81, 90, 102, 115, 122, 133, 144, 145, 149, 152, 154, 157, 159, 166, 168, 174, 176, 180, 184, 187, 191, 193, 195, 196, 197, 198, 201, 204, - 206, 208, 213, 218, 220, 222, 226, 230, 234, 238, - 242, 246, 250, 254, 258, 261, 264, 268, 271, 274, - 277, 279, 281, 284, 286, 290, 293, 296, 299, 302, - 306, 309, 313, 316, 319, 321, 325, 328, 332, 333, - 342, 343, 345, 349, 354, 355, 359, 360, 362 + 206, 208, 210, 215, 220, 222, 224, 228, 232, 236, + 240, 244, 248, 252, 256, 260, 263, 266, 270, 273, + 276, 279, 281, 283, 286, 288, 292, 295, 298, 301, + 304, 308, 311, 315, 318, 321, 323, 327, 330, 334, + 335, 344, 345, 347, 351, 356, 357, 361, 362, 364 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -525,23 +525,23 @@ static const yytype_int8 yyrhs[] = 34, 77, 76, -1, 78, -1, 78, 45, 78, -1, 52, 70, 53, -1, 32, 37, -1, 32, 36, 10, -1, 21, -1, 15, -1, -1, -1, -1, 77, 59, - -1, 77, 63, -1, 7, -1, 8, -1, 9, 52, - 89, 53, -1, 10, 52, 89, 53, -1, 10, -1, - 61, -1, 78, 46, 78, -1, 78, 47, 78, -1, - 78, 48, 78, -1, 78, 49, 78, -1, 78, 54, - 78, -1, 78, 55, 78, -1, 78, 44, 78, -1, - 78, 39, 78, -1, 78, 40, 78, -1, 46, 78, - -1, 47, 78, -1, 52, 78, 53, -1, 25, 11, - -1, 26, 10, -1, 31, 78, -1, 81, -1, 17, - -1, 19, 80, -1, 10, -1, 80, 56, 10, -1, - 20, 23, -1, 20, 28, -1, 20, 30, -1, 20, - 82, -1, 20, 82, 83, -1, 20, 83, -1, 35, - 18, 11, -1, 18, 11, -1, 35, 11, -1, 11, - -1, 29, 27, 11, -1, 27, 11, -1, 35, 27, - 11, -1, -1, 24, 10, 85, 75, 86, 59, 87, - 77, -1, -1, 10, -1, 86, 56, 10, -1, 86, - 59, 56, 10, -1, -1, 10, 75, 89, -1, -1, - 78, -1, 89, 56, 78, -1 + -1, 77, 63, -1, 7, -1, 8, -1, 11, -1, + 9, 52, 89, 53, -1, 10, 52, 89, 53, -1, + 10, -1, 61, -1, 78, 46, 78, -1, 78, 47, + 78, -1, 78, 48, 78, -1, 78, 49, 78, -1, + 78, 54, 78, -1, 78, 55, 78, -1, 78, 44, + 78, -1, 78, 39, 78, -1, 78, 40, 78, -1, + 46, 78, -1, 47, 78, -1, 52, 78, 53, -1, + 25, 11, -1, 26, 10, -1, 31, 78, -1, 81, + -1, 17, -1, 19, 80, -1, 10, -1, 80, 56, + 10, -1, 20, 23, -1, 20, 28, -1, 20, 30, + -1, 20, 82, -1, 20, 82, 83, -1, 20, 83, + -1, 35, 18, 11, -1, 18, 11, -1, 35, 11, + -1, 11, -1, 29, 27, 11, -1, 27, 11, -1, + 35, 27, 11, -1, -1, 24, 10, 85, 75, 86, + 59, 87, 77, -1, -1, 10, -1, 86, 56, 10, + -1, 86, 59, 56, 10, -1, -1, 10, 75, 89, + -1, -1, 78, -1, 89, 56, 78, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -552,11 +552,11 @@ static const yytype_uint16 yyrline[] = 150, 166, 180, 187, 196, 205, 215, 225, 236, 237, 240, 241, 244, 245, 248, 256, 257, 265, 266, 267, 269, 271, 277, 283, 290, 292, 294, 295, 296, 299, - 304, 307, 313, 321, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, 336, 339, 340, 341, - 342, 343, 345, 348, 349, 360, 361, 362, 363, 368, - 374, 381, 382, 383, 384, 387, 388, 389, 417, 417, - 424, 425, 426, 427, 429, 432, 440, 441, 442 + 304, 307, 310, 316, 324, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 337, 338, 339, 342, 343, + 344, 345, 346, 348, 351, 352, 363, 364, 365, 366, + 371, 377, 384, 385, 386, 387, 390, 391, 392, 420, + 420, 427, 428, 429, 430, 432, 435, 443, 444, 445 }; #endif @@ -604,10 +604,10 @@ static const yytype_uint8 yyr1[] = 66, 66, 67, 67, 68, 69, 69, 70, 70, 70, 71, 72, 73, 74, 75, 76, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, - 79, 79, 79, 80, 80, 81, 81, 81, 81, 81, - 81, 82, 82, 82, 82, 83, 83, 83, 85, 84, - 86, 86, 86, 86, 87, 88, 89, 89, 89 + 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, + 79, 79, 79, 79, 80, 80, 81, 81, 81, 81, + 81, 81, 82, 82, 82, 82, 83, 83, 83, 85, + 84, 86, 86, 86, 86, 87, 88, 89, 89, 89 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -618,11 +618,11 @@ static const yytype_uint8 yyr2[] = 11, 12, 8, 11, 12, 6, 10, 10, 0, 3, 2, 1, 2, 1, 6, 1, 5, 1, 3, 3, 2, 3, 1, 1, 0, 0, 0, 2, 2, 1, - 1, 4, 4, 1, 1, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 3, 2, 2, 2, - 1, 1, 2, 1, 3, 2, 2, 2, 2, 3, - 2, 3, 2, 2, 1, 3, 2, 3, 0, 8, - 0, 1, 3, 4, 0, 3, 0, 1, 3 + 1, 1, 4, 4, 1, 1, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 2, 2, 3, 2, 2, + 2, 1, 1, 2, 1, 3, 2, 2, 2, 2, + 3, 2, 3, 2, 2, 1, 3, 2, 3, 0, + 8, 0, 1, 3, 4, 0, 3, 0, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -630,193 +630,191 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 11, 49, 50, 0, 44, 71, 0, 0, 42, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 54, 17, 10, 18, 0, 0, 0, 15, 7, - 70, 6, 8, 96, 96, 96, 73, 72, 84, 0, - 75, 0, 76, 0, 77, 0, 78, 80, 88, 67, - 68, 53, 0, 54, 69, 0, 40, 0, 64, 65, - 0, 1, 4, 0, 0, 0, 0, 0, 37, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 97, 0, - 0, 95, 0, 82, 86, 0, 83, 0, 0, 0, - 79, 44, 0, 0, 41, 0, 0, 66, 2, 0, - 45, 0, 0, 44, 0, 62, 63, 61, 55, 56, - 57, 58, 59, 60, 51, 0, 52, 74, 85, 81, - 87, 90, 12, 14, 13, 46, 0, 39, 46, 0, - 38, 98, 91, 0, 45, 0, 0, 45, 45, 16, - 0, 94, 47, 48, 0, 0, 45, 44, 25, 92, - 0, 46, 0, 45, 46, 46, 0, 0, 43, 44, - 45, 33, 0, 93, 89, 19, 46, 45, 45, 22, - 45, 35, 31, 0, 0, 32, 28, 0, 45, 0, - 0, 30, 0, 0, 45, 44, 45, 44, 0, 0, - 0, 0, 44, 26, 0, 27, 0, 0, 20, 23, - 0, 45, 29, 45, 21, 24, 36, 34 + 0, 11, 49, 50, 0, 44, 51, 72, 0, 0, + 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 55, 17, 10, 18, 0, 0, 0, 15, + 7, 71, 6, 8, 97, 97, 97, 74, 73, 85, + 0, 76, 0, 77, 0, 78, 0, 79, 81, 89, + 68, 69, 54, 0, 55, 70, 0, 40, 0, 65, + 66, 0, 1, 4, 0, 0, 0, 0, 0, 37, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, + 0, 0, 96, 0, 83, 87, 0, 84, 0, 0, + 0, 80, 44, 0, 0, 41, 0, 0, 67, 2, + 0, 45, 0, 0, 44, 0, 63, 64, 62, 56, + 57, 58, 59, 60, 61, 52, 0, 53, 75, 86, + 82, 88, 91, 12, 14, 13, 46, 0, 39, 46, + 0, 38, 99, 92, 0, 45, 0, 0, 45, 45, + 16, 0, 95, 47, 48, 0, 0, 45, 44, 25, + 93, 0, 46, 0, 45, 46, 46, 0, 0, 43, + 44, 45, 33, 0, 94, 90, 19, 46, 45, 45, + 22, 45, 35, 31, 0, 0, 32, 28, 0, 45, + 0, 0, 30, 0, 0, 45, 44, 45, 44, 0, + 0, 0, 0, 44, 26, 0, 27, 0, 0, 20, + 23, 0, 45, 29, 45, 21, 24, 36, 34 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 19, 142, 20, 53, 22, 143, 24, 186, 170, - 171, 161, 172, 67, 25, 26, 27, 162, 196, 126, - 134, 28, 139, 37, 30, 46, 47, 31, 91, 133, - 151, 32, 79 + -1, 20, 143, 21, 54, 23, 144, 25, 187, 171, + 172, 162, 173, 68, 26, 27, 28, 163, 197, 127, + 135, 29, 140, 38, 31, 47, 48, 32, 92, 134, + 152, 33, 80 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -147 +#define YYPACT_NINF -150 static const yytype_int16 yypact[] = { - 169, -147, -147, -147, -26, 337, -147, 46, 23, -147, - 50, 78, 51, 197, 11, 54, 197, 197, 197, 6, - -147, 8, -147, -147, -147, 38, 48, 243, 325, -147, - -147, -147, -147, 197, 197, 197, -147, 35, -147, 83, - -147, 89, -147, 76, -147, 12, 53, -147, -147, -147, - -147, 55, 197, -147, 282, 92, -147, -23, 95, 95, - 313, -147, -147, 169, 243, 197, 243, 71, 75, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 325, -28, - 9, 52, 99, -147, -147, 102, -147, 116, 120, 105, - -147, -147, 282, 100, -147, 197, 197, -147, -147, 80, - 325, 84, 301, 90, 197, 325, 325, 325, 118, 118, - 95, 95, 325, 325, -147, 197, -147, -147, -147, -147, - -147, 130, -147, 325, 325, -147, 3, -147, -147, 292, - 325, 325, -147, -24, 215, 110, 197, 215, -147, -147, - 136, 96, -147, -147, 132, 197, 325, 69, -5, -147, - 141, -147, 121, 325, -147, -147, 133, 145, -147, -147, - 145, -147, 243, -147, 215, -147, -147, 215, 215, -147, - 145, 145, -147, 243, 292, -147, 125, 122, 215, 152, - 155, -147, 90, 140, -147, -147, -147, -147, 164, 150, - 162, 168, -6, -147, 292, -147, 261, 153, -147, -147, - 166, 215, -147, -147, -147, -147, -147, -147 + 152, -150, -150, -150, -41, 55, -150, -150, 51, 296, + -150, 73, 81, 95, 180, 16, 105, 180, 180, 180, + 4, -150, 8, -150, -150, -150, 39, 76, 226, 325, + -150, -150, -150, -150, 180, 180, 180, -150, 62, -150, + 112, -150, 114, -150, 103, -150, 3, 21, -150, -150, + -150, -150, 79, 180, -150, 80, 122, -150, -7, -13, + -13, 301, -150, -150, 152, 226, 180, 226, 99, 313, + 180, 180, 180, 180, 180, 180, 180, 180, 180, 325, + 37, 58, 83, 126, -150, -150, 129, -150, 130, 131, + 110, -150, -150, 80, 133, -150, 180, 180, -150, -150, + 92, 325, 93, 289, 97, 180, 325, 325, 325, 249, + 249, -13, -13, 325, 325, -150, 180, -150, -150, -150, + -150, -150, 139, -150, 325, 325, -150, -1, -150, -150, + 275, 325, 325, -150, 57, 198, 115, 180, 198, -150, + -150, 141, 98, -150, -150, 142, 180, 325, 46, -5, + -150, 145, -150, 125, 325, -150, -150, 146, 151, -150, + -150, 151, -150, 226, -150, 198, -150, -150, 198, 198, + -150, 151, 151, -150, 226, 275, -150, 132, 134, 198, + 158, 163, -150, 97, 147, -150, -150, -150, -150, 164, + 154, 171, 177, -8, -150, 275, -150, 244, 162, -150, + -150, 174, 198, -150, -150, -150, -150, -150, -150 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -147, -147, -17, 128, 7, -125, 0, -147, -147, -147, - 44, -129, 27, -61, -147, -147, -147, -146, -4, -42, - -111, 2, 21, -147, -147, -147, 157, -147, -147, -147, - -147, -147, -21 + -150, -150, -18, 136, 6, -106, 0, -150, -150, -150, + 47, -121, 30, -62, -150, -150, -150, -149, -4, -122, + -71, 1, 23, -150, -150, -150, 155, -150, -150, -150, + -150, -150, 9 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -54 +#define YYTABLE_NINF -55 static const yytype_int16 yytable[] = { - 23, 35, 63, 99, 138, 101, 61, 21, -9, -46, - 158, 173, 95, 80, 81, 54, 135, 137, 58, 59, - 60, 29, 96, 86, 173, 114, 33, 62, 115, 68, - 87, 175, 140, 159, 38, 78, 78, 78, 136, 88, - 164, 39, 175, 167, 168, -46, 40, 55, 56, 184, - 41, 42, 43, 44, 92, 178, 36, 62, 45, -9, - 48, 50, 116, 23, 57, 115, 68, 100, 102, 202, - 21, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 41, 201, 43, 155, 29, 156, 128, 121, 89, 49, - 64, 82, 144, 65, 83, 147, 148, 123, 124, 129, - 84, 177, 94, 85, 154, 103, 130, 34, 115, 117, - 122, 166, 183, 118, 69, 70, 141, 131, 176, 71, - 104, 72, 73, 74, 75, 179, 180, 119, 182, 76, - 77, 120, 88, 125, 69, 70, 188, 127, 146, 71, - 132, 62, 193, 157, 195, 145, 149, 153, 152, 76, - 77, 163, 150, 165, 169, 174, 187, 69, 70, 206, - 158, 207, 71, 185, 68, 191, 74, 75, 189, -5, - 1, 190, 76, 77, 192, 68, 2, 3, 4, 5, - 197, 194, 198, 199, 200, 204, 6, 205, 7, 8, - 9, 98, 160, 10, 11, 12, 203, 181, 0, 0, - 13, 14, 15, 90, 2, 3, 4, 51, 0, 0, - 0, 0, 0, 0, 0, 16, 17, 0, 0, 0, - -5, 18, 2, 3, 4, 51, 0, 0, 52, 0, - 15, 0, 6, 0, 7, 8, 9, 0, 0, 0, - 11, 12, 0, 16, 17, 0, 13, 14, 15, 18, - 2, 3, 4, 51, 0, 0, 0, 0, 0, 0, - 0, 16, 17, 0, 0, 0, 62, 18, 2, 3, - 4, 51, 0, 0, 52, 0, 15, 0, 6, 0, - 7, 8, 9, 0, 0, 0, 11, 12, 0, 16, - 17, 0, 13, 14, 15, 66, 0, 0, 0, 2, - 3, 4, 51, 0, 93, 0, 0, 16, 17, 6, - 0, 7, 8, 18, 0, 0, 0, 11, 12, 0, - 0, 69, 70, 13, 0, 15, 71, 0, 72, 73, - 74, 75, 0, 0, 0, 0, 76, 77, 16, 17, - 69, 70, 0, 0, 18, 71, 104, 72, 73, 74, - 75, 0, 69, 70, 97, 76, 77, 71, 0, 72, - 73, 74, 75, 0, 69, 70, 97, 76, 77, 71, - 0, 72, 73, 74, 75, 0, -53, -53, 0, 76, - 77, -53, 0, 0, 0, -53, -53, 0, 0, 34, - 0, -53, -53 + 24, 36, 64, 100, 62, 102, 22, -46, -9, 174, + 159, 34, 136, 145, 87, 55, 148, 149, 59, 60, + 61, 88, 174, 30, 139, 155, 70, 71, 96, 69, + 89, 72, 167, 160, 137, 79, 79, 79, 97, 177, + 176, 77, 78, -46, 81, 82, 180, 181, 42, 183, + 44, 176, 56, 57, 93, 63, 90, 189, 138, -9, + 156, 37, 157, 194, 24, 196, 69, 101, 103, 185, + 22, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 207, 165, 208, 49, 168, 169, 129, 30, 122, 203, + 115, 65, 50, 116, -54, -54, 179, 124, 125, -54, + 130, 178, 94, -54, -54, 51, 131, 35, 63, -54, + -54, 117, 184, 141, 116, 58, 142, 132, 83, 70, + 71, 66, 202, 84, 72, 85, 73, 74, 75, 76, + 86, 35, 95, 104, 77, 78, 118, 89, 147, 116, + 119, 120, 121, 123, 158, 126, 128, 154, 63, 133, + 146, 150, -5, 1, 151, 164, 175, 166, 153, 2, + 3, 4, 5, 6, 69, 192, 159, 170, 188, 7, + 186, 8, 9, 10, 190, 69, 11, 12, 13, 191, + 198, 193, 195, 14, 15, 16, 199, 2, 3, 4, + 52, 6, 200, 201, 205, 206, 161, 204, 17, 18, + 99, 182, 91, -5, 19, 2, 3, 4, 52, 6, + 0, 53, 0, 16, 0, 7, 0, 8, 9, 10, + 0, 0, 0, 12, 13, 0, 17, 18, 0, 14, + 15, 16, 19, 2, 3, 4, 52, 6, 0, 0, + 0, 0, 0, 0, 17, 18, 0, 0, 0, 63, + 19, 2, 3, 4, 52, 6, 0, 53, 0, 16, + 0, 7, 0, 8, 9, 10, 0, 0, 0, 12, + 13, 0, 17, 18, 0, 14, 15, 16, 67, 0, + 0, 0, 2, 3, 4, 52, 6, 0, 70, 71, + 17, 18, 7, 72, 8, 9, 19, 75, 76, 0, + 12, 13, 0, 77, 78, 0, 14, 39, 16, 0, + 0, 0, 0, 0, 40, 0, 0, 0, 0, 41, + 0, 17, 18, 42, 43, 44, 45, 19, 70, 71, + 0, 46, 0, 72, 105, 73, 74, 75, 76, 0, + 70, 71, 98, 77, 78, 72, 0, 73, 74, 75, + 76, 0, 70, 71, 98, 77, 78, 72, 105, 73, + 74, 75, 76, 0, 70, 71, 0, 77, 78, 72, + 0, 73, 74, 75, 76, 0, 0, 0, 0, 77, + 78 }; static const yytype_int16 yycheck[] = { - 0, 5, 19, 64, 129, 66, 0, 0, 0, 15, - 15, 157, 35, 34, 35, 13, 13, 128, 16, 17, - 18, 0, 45, 11, 170, 53, 52, 51, 56, 27, - 18, 160, 56, 38, 11, 33, 34, 35, 35, 27, - 151, 18, 171, 154, 155, 51, 23, 36, 37, 174, - 27, 28, 29, 30, 52, 166, 10, 51, 35, 51, - 10, 10, 53, 63, 10, 56, 64, 65, 66, 194, - 63, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 27, 192, 29, 14, 63, 16, 103, 91, 35, 11, - 52, 56, 134, 45, 11, 137, 138, 95, 96, 103, - 11, 162, 10, 27, 146, 34, 104, 52, 56, 10, - 10, 153, 173, 11, 39, 40, 133, 115, 160, 44, - 45, 46, 47, 48, 49, 167, 168, 11, 170, 54, - 55, 11, 27, 53, 39, 40, 178, 53, 136, 44, - 10, 51, 184, 147, 186, 35, 10, 145, 16, 54, - 55, 10, 56, 32, 21, 159, 34, 39, 40, 201, - 15, 203, 44, 38, 162, 182, 48, 49, 16, 0, - 1, 16, 54, 55, 34, 173, 7, 8, 9, 10, - 16, 185, 32, 21, 16, 32, 17, 21, 19, 20, - 21, 63, 148, 24, 25, 26, 196, 170, -1, -1, - 31, 32, 33, 46, 7, 8, 9, 10, -1, -1, - -1, -1, -1, -1, -1, 46, 47, -1, -1, -1, - 51, 52, 7, 8, 9, 10, -1, -1, 31, -1, - 33, -1, 17, -1, 19, 20, 21, -1, -1, -1, - 25, 26, -1, 46, 47, -1, 31, 32, 33, 52, - 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, - -1, 46, 47, -1, -1, -1, 51, 52, 7, 8, - 9, 10, -1, -1, 31, -1, 33, -1, 17, -1, - 19, 20, 21, -1, -1, -1, 25, 26, -1, 46, - 47, -1, 31, 32, 33, 52, -1, -1, -1, 7, - 8, 9, 10, -1, 22, -1, -1, 46, 47, 17, - -1, 19, 20, 52, -1, -1, -1, 25, 26, -1, - -1, 39, 40, 31, -1, 33, 44, -1, 46, 47, - 48, 49, -1, -1, -1, -1, 54, 55, 46, 47, - 39, 40, -1, -1, 52, 44, 45, 46, 47, 48, - 49, -1, 39, 40, 53, 54, 55, 44, -1, 46, - 47, 48, 49, -1, 39, 40, 53, 54, 55, 44, - -1, 46, 47, 48, 49, -1, 39, 40, -1, 54, - 55, 44, -1, -1, -1, 48, 49, -1, -1, 52, - -1, 54, 55 + 0, 5, 20, 65, 0, 67, 0, 15, 0, 158, + 15, 52, 13, 135, 11, 14, 138, 139, 17, 18, + 19, 18, 171, 0, 130, 147, 39, 40, 35, 28, + 27, 44, 154, 38, 35, 34, 35, 36, 45, 161, + 161, 54, 55, 51, 35, 36, 168, 169, 27, 171, + 29, 172, 36, 37, 53, 51, 35, 179, 129, 51, + 14, 10, 16, 185, 64, 187, 65, 66, 67, 175, + 64, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 202, 152, 204, 10, 155, 156, 104, 64, 92, 195, + 53, 52, 11, 56, 39, 40, 167, 96, 97, 44, + 104, 163, 22, 48, 49, 10, 105, 52, 51, 54, + 55, 53, 174, 56, 56, 10, 134, 116, 56, 39, + 40, 45, 193, 11, 44, 11, 46, 47, 48, 49, + 27, 52, 10, 34, 54, 55, 10, 27, 137, 56, + 11, 11, 11, 10, 148, 53, 53, 146, 51, 10, + 35, 10, 0, 1, 56, 10, 160, 32, 16, 7, + 8, 9, 10, 11, 163, 183, 15, 21, 34, 17, + 38, 19, 20, 21, 16, 174, 24, 25, 26, 16, + 16, 34, 186, 31, 32, 33, 32, 7, 8, 9, + 10, 11, 21, 16, 32, 21, 149, 197, 46, 47, + 64, 171, 47, 51, 52, 7, 8, 9, 10, 11, + -1, 31, -1, 33, -1, 17, -1, 19, 20, 21, + -1, -1, -1, 25, 26, -1, 46, 47, -1, 31, + 32, 33, 52, 7, 8, 9, 10, 11, -1, -1, + -1, -1, -1, -1, 46, 47, -1, -1, -1, 51, + 52, 7, 8, 9, 10, 11, -1, 31, -1, 33, + -1, 17, -1, 19, 20, 21, -1, -1, -1, 25, + 26, -1, 46, 47, -1, 31, 32, 33, 52, -1, + -1, -1, 7, 8, 9, 10, 11, -1, 39, 40, + 46, 47, 17, 44, 19, 20, 52, 48, 49, -1, + 25, 26, -1, 54, 55, -1, 31, 11, 33, -1, + -1, -1, -1, -1, 18, -1, -1, -1, -1, 23, + -1, 46, 47, 27, 28, 29, 30, 52, 39, 40, + -1, 35, -1, 44, 45, 46, 47, 48, 49, -1, + 39, 40, 53, 54, 55, 44, -1, 46, 47, 48, + 49, -1, 39, 40, 53, 54, 55, 44, 45, 46, + 47, 48, 49, -1, 39, 40, -1, 54, 55, 44, + -1, 46, 47, 48, 49, -1, -1, -1, -1, 54, + 55 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 1, 7, 8, 9, 10, 17, 19, 20, 21, - 24, 25, 26, 31, 32, 33, 46, 47, 52, 58, - 60, 61, 62, 63, 64, 71, 72, 73, 78, 79, - 81, 84, 88, 52, 52, 75, 10, 80, 11, 18, - 23, 27, 28, 29, 30, 35, 82, 83, 10, 11, - 10, 10, 31, 61, 78, 36, 37, 10, 78, 78, - 78, 0, 51, 59, 52, 45, 52, 70, 78, 39, - 40, 44, 46, 47, 48, 49, 54, 55, 78, 89, - 89, 89, 56, 11, 11, 27, 11, 18, 27, 35, - 83, 85, 78, 22, 10, 35, 45, 53, 60, 70, - 78, 70, 78, 34, 45, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 53, 56, 53, 10, 11, 11, - 11, 75, 10, 78, 78, 53, 76, 53, 59, 75, - 78, 78, 10, 86, 77, 13, 35, 77, 62, 79, - 56, 59, 59, 63, 76, 35, 78, 76, 76, 10, - 56, 87, 16, 78, 76, 14, 16, 75, 15, 38, - 67, 68, 74, 10, 77, 32, 76, 77, 77, 21, - 66, 67, 69, 74, 75, 68, 76, 70, 77, 76, - 76, 69, 76, 70, 62, 38, 65, 34, 76, 16, - 16, 59, 34, 76, 75, 76, 75, 16, 32, 21, - 16, 77, 62, 63, 32, 21, 76, 76 + 0, 1, 7, 8, 9, 10, 11, 17, 19, 20, + 21, 24, 25, 26, 31, 32, 33, 46, 47, 52, + 58, 60, 61, 62, 63, 64, 71, 72, 73, 78, + 79, 81, 84, 88, 52, 52, 75, 10, 80, 11, + 18, 23, 27, 28, 29, 30, 35, 82, 83, 10, + 11, 10, 10, 31, 61, 78, 36, 37, 10, 78, + 78, 78, 0, 51, 59, 52, 45, 52, 70, 78, + 39, 40, 44, 46, 47, 48, 49, 54, 55, 78, + 89, 89, 89, 56, 11, 11, 27, 11, 18, 27, + 35, 83, 85, 78, 22, 10, 35, 45, 53, 60, + 70, 78, 70, 78, 34, 45, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 53, 56, 53, 10, 11, + 11, 11, 75, 10, 78, 78, 53, 76, 53, 59, + 75, 78, 78, 10, 86, 77, 13, 35, 77, 62, + 79, 56, 59, 59, 63, 76, 35, 78, 76, 76, + 10, 56, 87, 16, 78, 76, 14, 16, 75, 15, + 38, 67, 68, 74, 10, 77, 32, 76, 77, 77, + 21, 66, 67, 69, 74, 75, 68, 76, 70, 77, + 76, 76, 69, 76, 70, 62, 38, 65, 34, 76, + 16, 16, 59, 34, 76, 75, 76, 75, 16, 32, + 21, 16, 77, 62, 63, 32, 21, 76, 76 }; #define yyerrok (yyerrstatus = 0) @@ -1911,6 +1909,13 @@ yyreduce: case 51: #line 307 "engines/director/lingo/lingo-gr.y" { + (yyval.code) = g_lingo->code1(g_lingo->c_stringpush); + g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;} + break; + + case 52: +#line 310 "engines/director/lingo/lingo-gr.y" + { if ((yyvsp[(3) - (4)].narg) != g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs) error("Built-in function %s expects %d arguments but got %d", (yyvsp[(1) - (4)].s)->c_str(), g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs, (yyvsp[(3) - (4)].narg)); @@ -1918,8 +1923,8 @@ yyreduce: delete (yyvsp[(1) - (4)].s); ;} break; - case 52: -#line 313 "engines/director/lingo/lingo-gr.y" + case 53: +#line 316 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str()); @@ -1930,121 +1935,121 @@ yyreduce: delete (yyvsp[(1) - (4)].s); ;} break; - case 53: -#line 321 "engines/director/lingo/lingo-gr.y" + case 54: +#line 324 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); ;} break; - case 55: -#line 325 "engines/director/lingo/lingo-gr.y" + case 56: +#line 328 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_add); ;} break; - case 56: -#line 326 "engines/director/lingo/lingo-gr.y" + case 57: +#line 329 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_sub); ;} break; - case 57: -#line 327 "engines/director/lingo/lingo-gr.y" + case 58: +#line 330 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mul); ;} break; - case 58: -#line 328 "engines/director/lingo/lingo-gr.y" + case 59: +#line 331 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_div); ;} break; - case 59: -#line 329 "engines/director/lingo/lingo-gr.y" + case 60: +#line 332 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gt); ;} break; - case 60: -#line 330 "engines/director/lingo/lingo-gr.y" + case 61: +#line 333 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_lt); ;} break; - case 61: -#line 331 "engines/director/lingo/lingo-gr.y" + case 62: +#line 334 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_neq); ;} break; - case 62: -#line 332 "engines/director/lingo/lingo-gr.y" + case 63: +#line 335 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ge); ;} break; - case 63: -#line 333 "engines/director/lingo/lingo-gr.y" + case 64: +#line 336 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_le); ;} break; - case 64: -#line 334 "engines/director/lingo/lingo-gr.y" + case 65: +#line 337 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; - case 65: -#line 335 "engines/director/lingo/lingo-gr.y" + case 66: +#line 338 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; - case 66: -#line 336 "engines/director/lingo/lingo-gr.y" + case 67: +#line 339 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; - case 67: -#line 339 "engines/director/lingo/lingo-gr.y" + case 68: +#line 342 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} break; - case 68: -#line 340 "engines/director/lingo/lingo-gr.y" + case 69: +#line 343 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} break; - case 69: -#line 341 "engines/director/lingo/lingo-gr.y" + case 70: +#line 344 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; - case 71: -#line 343 "engines/director/lingo/lingo-gr.y" + case 72: +#line 346 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); ;} break; - case 73: -#line 348 "engines/director/lingo/lingo-gr.y" + case 74: +#line 351 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; - case 74: -#line 349 "engines/director/lingo/lingo-gr.y" + case 75: +#line 352 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} break; - case 75: -#line 360 "engines/director/lingo/lingo-gr.y" + case 76: +#line 363 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; - case 76: -#line 361 "engines/director/lingo/lingo-gr.y" + case 77: +#line 364 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; - case 77: -#line 362 "engines/director/lingo/lingo-gr.y" + case 78: +#line 365 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; - case 78: -#line 363 "engines/director/lingo/lingo-gr.y" + case 79: +#line 366 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -2052,8 +2057,8 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 79: -#line 368 "engines/director/lingo/lingo-gr.y" + case 80: +#line 371 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -2062,8 +2067,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 80: -#line 374 "engines/director/lingo/lingo-gr.y" + case 81: +#line 377 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -2071,48 +2076,48 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 81: -#line 381 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(3) - (3)].s); ;} - break; - case 82: -#line 382 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(2) - (2)].s); ;} +#line 384 "engines/director/lingo/lingo-gr.y" + { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 83: -#line 383 "engines/director/lingo/lingo-gr.y" +#line 385 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 84: -#line 384 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(1) - (1)].s); ;} +#line 386 "engines/director/lingo/lingo-gr.y" + { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 85: #line 387 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(3) - (3)].s); ;} + { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; case 86: -#line 388 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(2) - (2)].s); ;} +#line 390 "engines/director/lingo/lingo-gr.y" + { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 87: -#line 389 "engines/director/lingo/lingo-gr.y" - { (yyval.s) = (yyvsp[(3) - (3)].s); ;} +#line 391 "engines/director/lingo/lingo-gr.y" + { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 88: -#line 417 "engines/director/lingo/lingo-gr.y" - { g_lingo->_indef = true; ;} +#line 392 "engines/director/lingo/lingo-gr.y" + { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 89: -#line 418 "engines/director/lingo/lingo-gr.y" +#line 420 "engines/director/lingo/lingo-gr.y" + { g_lingo->_indef = true; ;} + break; + + case 90: +#line 421 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); @@ -2120,33 +2125,33 @@ yyreduce: g_lingo->_indef = false; ;} break; - case 90: -#line 424 "engines/director/lingo/lingo-gr.y" + case 91: +#line 427 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 91: -#line 425 "engines/director/lingo/lingo-gr.y" + case 92: +#line 428 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; - case 92: -#line 426 "engines/director/lingo/lingo-gr.y" + case 93: +#line 429 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; - case 93: -#line 427 "engines/director/lingo/lingo-gr.y" + case 94: +#line 430 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; - case 94: -#line 429 "engines/director/lingo/lingo-gr.y" + case 95: +#line 432 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArgStore(); ;} break; - case 95: -#line 432 "engines/director/lingo/lingo-gr.y" + case 96: +#line 435 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2155,24 +2160,24 @@ yyreduce: g_lingo->code1(numpar); ;} break; - case 96: -#line 440 "engines/director/lingo/lingo-gr.y" + case 97: +#line 443 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 97: -#line 441 "engines/director/lingo/lingo-gr.y" + case 98: +#line 444 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 1; ;} break; - case 98: -#line 442 "engines/director/lingo/lingo-gr.y" + case 99: +#line 445 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2176 "engines/director/lingo/lingo-gr.cpp" +#line 2181 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2386,6 +2391,6 @@ yyreturn: } -#line 445 "engines/director/lingo/lingo-gr.y" +#line 448 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index d58cb22de7..b76000af32 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -304,6 +304,9 @@ expr: INT { | FLOAT { $$ = g_lingo->code1(g_lingo->c_fconstpush); g_lingo->codeFloat($1); } + | STRING { + $$ = g_lingo->code1(g_lingo->c_stringpush); + g_lingo->codeString($1->c_str()); } | BLTIN '(' arglist ')' { if ($3 != g_lingo->_builtins[*$1]->nargs) error("Built-in function %s expects %d arguments but got %d", $1->c_str(), g_lingo->_builtins[*$1]->nargs, $3); diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index d88f7053a7..cc9f0acdf7 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -98,6 +98,7 @@ struct Datum { /* interpreter stack type */ union { int i; float f; + Common::String *s; Symbol *sym; } u; @@ -178,6 +179,7 @@ public: static void c_negate(); static void c_constpush(); static void c_fconstpush(); + static void c_stringpush(); static void c_varpush(); static void c_assign(); bool verify(Symbol *s); |