aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/director.cpp2
-rw-r--r--engines/director/lingo/lingo-gr.cpp187
-rw-r--r--engines/director/lingo/lingo-gr.y16
-rw-r--r--engines/director/lingo/lingo-lex.cpp165
-rw-r--r--engines/director/lingo/lingo-lex.l5
-rw-r--r--engines/director/lingo/lingo.cpp2
6 files changed, 199 insertions, 178 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a347d22732..fa3a4096f7 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -84,8 +84,6 @@ Common::Error DirectorEngine::run() {
_lingo->addCode("2 + 3 * 2 / (5 - 2)", kMovieScript, 3);
_lingo->executeScript(kMovieScript, 3);
- return Common::kNoError;
-
//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 99b976d172..b6874ecfc6 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -369,18 +369,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 2
+#define YYFINAL 23
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 55
+#define YYLAST 52
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 6
+#define YYNNTS 7
/* YYNRULES -- Number of rules. */
-#define YYNRULES 21
+#define YYNRULES 24
/* YYNRULES -- Number of states. */
-#define YYNSTATES 42
+#define YYNSTATES 41
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -426,30 +426,30 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 4, 7, 11, 15, 19, 24, 29,
- 34, 36, 38, 40, 44, 48, 52, 56, 59, 62,
- 66, 69
+ 0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
+ 19, 24, 29, 34, 36, 38, 40, 44, 48, 52,
+ 56, 59, 62, 66, 69
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, -1, 24, 20, -1, 24, 28, 20,
- -1, 24, 25, 20, -1, 24, 26, 20, -1, 12,
- 27, 8, 6, -1, 13, 6, 14, 27, -1, 13,
- 6, 9, 27, -1, 27, -1, 4, -1, 6, -1,
- 27, 15, 27, -1, 27, 16, 27, -1, 27, 17,
- 27, -1, 27, 18, 27, -1, 15, 27, -1, 16,
- 27, -1, 21, 27, 22, -1, 10, 7, -1, 11,
+ 24, 0, -1, 25, 20, 24, -1, 25, -1, -1,
+ 29, -1, 26, -1, 27, -1, 28, -1, -1, 12,
+ 28, 8, 6, -1, 13, 6, 14, 28, -1, 13,
+ 6, 9, 28, -1, 28, -1, 4, -1, 6, -1,
+ 28, 15, 28, -1, 28, 16, 28, -1, 28, 17,
+ 28, -1, 28, 18, 28, -1, 15, 28, -1, 16,
+ 28, -1, 21, 28, 22, -1, 10, 7, -1, 11,
6, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 70, 70, 71, 72, 73, 74, 78, 79, 80,
- 83, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- 97, 98
+ 0, 70, 70, 71, 74, 75, 76, 77, 78, 79,
+ 82, 83, 84, 87, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 101, 102
};
#endif
@@ -461,7 +461,8 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "UNARY", "INT", "FLOAT", "VAR", "STRING",
"OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
"'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "$accept", "list", "assign", "statement", "expr", "func", 0
+ "$accept", "program", "programline", "assign", "statement", "expr",
+ "func", 0
};
#endif
@@ -479,17 +480,17 @@ static const yytype_uint16 yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 23, 24, 24, 24, 24, 24, 25, 25, 25,
- 26, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 28, 28
+ 0, 23, 24, 24, 25, 25, 25, 25, 25, 25,
+ 26, 26, 26, 27, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 29, 29
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 0, 2, 3, 3, 3, 4, 4, 4,
- 1, 1, 1, 3, 3, 3, 3, 2, 2, 3,
- 2, 2
+ 0, 2, 3, 1, 0, 1, 1, 1, 1, 0,
+ 4, 4, 4, 1, 1, 1, 3, 3, 3, 3,
+ 2, 2, 3, 2, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -497,35 +498,35 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 11, 12, 0, 0, 0, 0, 0,
- 0, 3, 0, 0, 0, 10, 0, 20, 21, 0,
- 0, 17, 18, 0, 5, 6, 0, 0, 0, 0,
- 4, 0, 0, 0, 19, 13, 14, 15, 16, 7,
- 9, 8
+ 4, 14, 15, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 6, 7, 8, 5, 23, 24, 0, 0,
+ 20, 21, 0, 1, 4, 0, 0, 0, 0, 0,
+ 0, 0, 22, 2, 16, 17, 18, 19, 10, 12,
+ 11
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 13, 14, 15, 16
+ -1, 10, 11, 12, 13, 14, 15
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -11
+#define YYPACT_NINF -9
static const yytype_int8 yypact[] =
{
- -11, 23, -11, -11, -11, 2, 4, 26, 18, 26,
- 26, -11, 26, 8, 11, 0, 17, -11, -11, -4,
- -8, -11, -11, 33, -11, -11, 26, 26, 26, 26,
- -11, 34, 26, 26, -11, -10, -10, -11, -11, -11,
- 0, 0
+ 3, -9, -9, -2, 2, 23, 6, 23, 23, 23,
+ 17, 8, -9, -9, 19, -9, -9, -9, 25, -8,
+ -9, -9, 30, -9, 3, 23, 23, 23, 23, 24,
+ 23, 23, -9, -9, -7, -7, -9, -9, -9, 19,
+ 19
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -11, -11, -11, -11, -7, -11
+ -9, 7, -9, -9, -9, -5, -9
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -535,33 +536,33 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 19, 32, 21, 22, 31, 23, 33, 28, 29, 17,
- 18, 26, 27, 28, 29, 26, 27, 28, 29, 35,
- 36, 37, 38, 2, 20, 40, 41, 3, 24, 4,
- 3, 25, 4, 5, 6, 7, 8, 30, 9, 10,
- 39, 9, 10, 11, 12, 0, 0, 12, 26, 27,
- 28, 29, 0, 0, 0, 34
+ 18, 30, 20, 21, 22, 16, 31, 1, 17, 2,
+ 27, 28, 19, 3, 4, 5, 6, 23, 7, 8,
+ 34, 35, 36, 37, 9, 39, 40, 1, 24, 2,
+ 38, 33, 0, 29, 25, 26, 27, 28, 7, 8,
+ 25, 26, 27, 28, 9, 25, 26, 27, 28, 0,
+ 0, 0, 32
};
static const yytype_int8 yycheck[] =
{
- 7, 9, 9, 10, 8, 12, 14, 17, 18, 7,
- 6, 15, 16, 17, 18, 15, 16, 17, 18, 26,
- 27, 28, 29, 0, 6, 32, 33, 4, 20, 6,
- 4, 20, 6, 10, 11, 12, 13, 20, 15, 16,
- 6, 15, 16, 20, 21, -1, -1, 21, 15, 16,
- 17, 18, -1, -1, -1, 22
+ 5, 9, 7, 8, 9, 7, 14, 4, 6, 6,
+ 17, 18, 6, 10, 11, 12, 13, 0, 15, 16,
+ 25, 26, 27, 28, 21, 30, 31, 4, 20, 6,
+ 6, 24, -1, 8, 15, 16, 17, 18, 15, 16,
+ 15, 16, 17, 18, 21, 15, 16, 17, 18, -1,
+ -1, -1, 22
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 24, 0, 4, 6, 10, 11, 12, 13, 15,
- 16, 20, 21, 25, 26, 27, 28, 7, 6, 27,
- 6, 27, 27, 27, 20, 20, 15, 16, 17, 18,
- 20, 8, 9, 14, 22, 27, 27, 27, 27, 6,
- 27, 27
+ 0, 4, 6, 10, 11, 12, 13, 15, 16, 21,
+ 24, 25, 26, 27, 28, 29, 7, 6, 28, 6,
+ 28, 28, 28, 0, 20, 15, 16, 17, 18, 8,
+ 9, 14, 22, 24, 28, 28, 28, 28, 6, 28,
+ 28
};
#define yyerrok (yyerrstatus = 0)
@@ -1375,94 +1376,94 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 5:
-#line 73 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; ;}
+ case 6:
+#line 76 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_xpop); ;}
break;
- case 6:
-#line 74 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); return 1; ;}
+ case 8:
+#line 78 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_printtop); ;}
break;
- case 7:
-#line 78 "engines/director/lingo/lingo-gr.y"
+ case 10:
+#line 82 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
- case 8:
-#line 79 "engines/director/lingo/lingo-gr.y"
+ case 11:
+#line 83 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 9:
-#line 80 "engines/director/lingo/lingo-gr.y"
+ case 12:
+#line 84 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 10:
-#line 83 "engines/director/lingo/lingo-gr.y"
+ case 13:
+#line 87 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
- case 11:
-#line 86 "engines/director/lingo/lingo-gr.y"
+ case 14:
+#line 90 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
- case 12:
-#line 87 "engines/director/lingo/lingo-gr.y"
+ case 15:
+#line 91 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 13:
-#line 88 "engines/director/lingo/lingo-gr.y"
+ case 16:
+#line 92 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
- case 14:
-#line 89 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 93 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
- case 15:
-#line 90 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 94 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
- case 16:
-#line 91 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 95 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
- case 17:
-#line 92 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 96 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 18:
-#line 93 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 97 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
- case 19:
-#line 94 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 98 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 20:
-#line 97 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 101 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 21:
-#line 98 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 102 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1466 "engines/director/lingo/lingo-gr.cpp"
+#line 1467 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1676,6 +1677,6 @@ yyreturn:
}
-#line 101 "engines/director/lingo/lingo-gr.y"
+#line 105 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e0dc00f337..c05e985115 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -67,12 +67,16 @@ using namespace Director;
%%
-list: /* empty */
- | list '\n'
- | list func '\n'
- | list assign '\n' { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; }
- | list statement '\n' { g_lingo->code1(STOP); return 1; }
-// | list expr '\n' { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; }
+program: programline '\n' program
+ | programline
+ ;
+
+programline:
+ | func
+ | assign { g_lingo->code1(g_lingo->func_xpop); }
+ | statement
+ | expr { g_lingo->code1(g_lingo->func_printtop); }
+ | /* empty */
;
assign: FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 20b84859f0..59796ce3f4 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 15
-#define YY_END_OF_BUFFER 16
+#define YY_NUM_RULES 16
+#define YY_END_OF_BUFFER 17
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,12 +373,13 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[41] =
+static yyconst flex_int16_t yy_accept[44] =
{ 0,
- 0, 0, 16, 15, 2, 13, 15, 12, 12, 11,
- 9, 9, 9, 9, 9, 9, 13, 0, 14, 1,
- 10, 11, 9, 9, 9, 9, 9, 8, 1, 10,
- 9, 4, 6, 7, 3, 9, 9, 9, 5, 0
+ 0, 0, 17, 16, 3, 14, 16, 13, 13, 12,
+ 10, 10, 10, 10, 10, 10, 2, 2, 3, 14,
+ 0, 15, 1, 11, 12, 10, 10, 10, 10, 10,
+ 9, 1, 11, 10, 5, 7, 8, 4, 10, 10,
+ 10, 6, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -386,17 +387,17 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 5, 1, 1, 6, 1, 1, 6,
- 6, 6, 6, 6, 7, 8, 6, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 6, 1, 1,
- 6, 1, 1, 1, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 1, 1, 1, 6, 10, 1, 11, 10, 12, 10,
-
- 13, 10, 10, 10, 14, 10, 10, 10, 15, 16,
- 17, 18, 10, 10, 19, 20, 21, 10, 22, 10,
- 10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 5, 1, 6, 1, 1, 7, 1, 1, 7,
+ 7, 7, 7, 7, 8, 9, 7, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 7, 1, 1,
+ 7, 1, 1, 1, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 1, 1, 1, 7, 11, 1, 12, 11, 13, 11,
+
+ 14, 11, 11, 11, 15, 11, 11, 11, 16, 17,
+ 18, 19, 11, 11, 20, 21, 22, 11, 23, 11,
+ 11, 11, 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,
@@ -413,53 +414,55 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[23] =
+static yyconst flex_int32_t yy_meta[24] =
{ 0,
- 1, 1, 2, 3, 1, 1, 1, 1, 4, 4,
+ 1, 1, 2, 3, 1, 1, 1, 1, 1, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4
+ 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[44] =
+static yyconst flex_int16_t yy_base[47] =
{ 0,
- 0, 0, 56, 57, 57, 20, 50, 57, 47, 17,
- 0, 37, 40, 30, 37, 32, 24, 43, 57, 0,
- 38, 21, 0, 26, 31, 24, 23, 0, 0, 33,
- 24, 18, 0, 0, 0, 28, 23, 16, 0, 57,
- 30, 28, 34
+ 0, 22, 62, 63, 59, 22, 54, 63, 51, 19,
+ 0, 41, 44, 34, 41, 36, 51, 63, 50, 27,
+ 45, 63, 0, 40, 23, 0, 28, 33, 26, 25,
+ 0, 0, 35, 26, 20, 0, 0, 0, 30, 25,
+ 18, 0, 63, 33, 31, 37
} ;
-static yyconst flex_int16_t yy_def[44] =
+static yyconst flex_int16_t yy_def[47] =
{ 0,
- 40, 1, 40, 40, 40, 40, 41, 40, 40, 40,
- 42, 42, 42, 42, 42, 42, 40, 41, 40, 43,
- 40, 40, 42, 42, 42, 42, 42, 42, 43, 40,
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 0,
- 40, 40, 40
+ 43, 1, 43, 43, 43, 43, 44, 43, 43, 43,
+ 45, 45, 45, 45, 45, 45, 43, 43, 43, 43,
+ 44, 43, 46, 43, 43, 45, 45, 45, 45, 45,
+ 45, 46, 43, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 0, 43, 43, 43
} ;
-static yyconst flex_int16_t yy_nxt[80] =
+static yyconst flex_int16_t yy_nxt[87] =
{ 0,
- 4, 5, 6, 6, 7, 8, 9, 4, 10, 11,
- 11, 11, 11, 12, 13, 11, 11, 14, 15, 16,
- 11, 11, 17, 17, 21, 22, 17, 17, 21, 22,
- 18, 23, 18, 18, 29, 39, 38, 29, 37, 36,
- 35, 30, 34, 33, 32, 31, 30, 19, 28, 27,
- 26, 25, 24, 20, 19, 40, 3, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40
+ 4, 5, 6, 6, 4, 7, 8, 9, 4, 10,
+ 11, 11, 11, 11, 12, 13, 11, 11, 14, 15,
+ 16, 11, 11, 17, 20, 20, 18, 24, 25, 20,
+ 20, 24, 25, 21, 26, 21, 21, 32, 42, 41,
+ 32, 40, 39, 38, 33, 37, 36, 35, 34, 33,
+ 22, 19, 19, 31, 30, 29, 28, 27, 23, 22,
+ 19, 43, 3, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43
} ;
-static yyconst flex_int16_t yy_chk[80] =
+static yyconst flex_int16_t yy_chk[87] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 6, 6, 10, 10, 17, 17, 22, 22,
- 41, 42, 41, 41, 43, 38, 37, 43, 36, 32,
- 31, 30, 27, 26, 25, 24, 21, 18, 16, 15,
- 14, 13, 12, 9, 7, 3, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40
+ 1, 1, 1, 2, 6, 6, 2, 10, 10, 20,
+ 20, 25, 25, 44, 45, 44, 44, 46, 41, 40,
+ 46, 39, 35, 34, 33, 30, 29, 28, 27, 24,
+ 21, 19, 17, 16, 15, 14, 13, 12, 9, 7,
+ 5, 3, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43
} ;
static yy_state_type yy_last_accepting_state;
@@ -509,7 +512,7 @@ char *yytext;
int yyparse();
-#line 513 "engines/director/lingo/lingo-lex.cpp"
+#line 516 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -681,6 +684,9 @@ extern int yylex (void);
#endif
#define YY_RULE_SETUP \
+ if ( yyleng > 0 ) \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
+ (yytext[yyleng - 1] == '\n'); \
YY_USER_ACTION
/** The main scanner function which does all the work.
@@ -694,7 +700,7 @@ YY_DECL
#line 44 "engines/director/lingo/lingo-lex.l"
-#line 698 "engines/director/lingo/lingo-lex.cpp"
+#line 704 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -735,6 +741,7 @@ YY_DECL
yy_bp = yy_cp;
yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
yy_match:
do
{
@@ -747,13 +754,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 >= 41 )
+ if ( yy_current_state >= 44 )
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_base[yy_current_state] != 57 );
+ while ( yy_base[yy_current_state] != 63 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -785,75 +792,80 @@ YY_RULE_SETUP
case 2:
YY_RULE_SETUP
#line 47 "engines/director/lingo/lingo-lex.l"
-{ return ' '; }
+
YY_BREAK
case 3:
YY_RULE_SETUP
#line 48 "engines/director/lingo/lingo-lex.l"
-{ return OP_INTO; }
+{ return ' '; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 49 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCI; }
+{ return OP_INTO; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 50 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCIWAIT; }
+{ return FUNC_MCI; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_PUT; }
+{ return FUNC_MCIWAIT; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_SET; }
+{ return FUNC_PUT; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return OP_TO; }
+{ return FUNC_SET; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 55 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 54 "engines/director/lingo/lingo-lex.l"
+{ return OP_TO; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 13:
-/* rule 13 can match eol */
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 14:
+/* rule 14 can match eol */
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 62 "engines/director/lingo/lingo-lex.l"
+#line 61 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 63 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 857 "engines/director/lingo/lingo-lex.cpp"
+#line 869 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1133,6 +1145,7 @@ static int yy_get_next_buffer (void)
register char *yy_cp;
yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
@@ -1145,7 +1158,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 >= 41 )
+ if ( yy_current_state >= 44 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1173,11 +1186,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 >= 41 )
+ if ( yy_current_state >= 44 )
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 == 40);
+ yy_is_jam = (yy_current_state == 43);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1289,6 +1302,8 @@ static int yy_get_next_buffer (void)
*(yy_c_buf_p) = '\0'; /* preserve yytext */
(yy_hold_char) = *++(yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
+
return c;
}
#endif /* ifndef YY_NO_INPUT */
@@ -1850,7 +1865,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 62 "engines/director/lingo/lingo-lex.l"
+#line 63 "engines/director/lingo/lingo-lex.l"
@@ -1861,7 +1876,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 1;
+ yydebug = 0;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index ed61cae867..0d8324992b 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -44,7 +44,8 @@ newline [\n\r]+
%%
--[^\r\n]*
-[\t] { return ' '; }
+^[ \t]
+[\t]+ { return ' '; }
into { return OP_INTO; }
mci { return FUNC_MCI; }
mciwait { return FUNC_MCIWAIT; }
@@ -68,7 +69,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 1;
+ yydebug = 0;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index fc79167373..51d5312a38 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -113,6 +113,8 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
parse(code.c_str());
+ code1(STOP);
+
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}