aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/director.cpp5
-rw-r--r--engines/director/lingo/lingo-gr.cpp209
-rw-r--r--engines/director/lingo/lingo-gr.h30
-rw-r--r--engines/director/lingo/lingo-gr.y21
-rw-r--r--engines/director/lingo/lingo-lex.cpp154
-rw-r--r--engines/director/lingo/lingo-lex.l19
6 files changed, 268 insertions, 170 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a05884a245..0c1f02390c 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -71,6 +71,11 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
_lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"");
+#if 0
+ _lingo->parse("set x = 1\n\
+ set y to 2\n\
+ put 5 into z\n");
+#endif
_soundManager = new DirectorSound();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 929bb4b450..79b953186c 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -67,18 +67,28 @@
know about them. */
enum yytokentype {
UNARY = 258,
- INT = 259,
- VAR = 260,
- STRING = 261,
- FUNC_MCI = 262
+ FLOAT = 259,
+ INT = 260,
+ VAR = 261,
+ STRING = 262,
+ OP_INTO = 263,
+ OP_TO = 264,
+ FUNC_MCI = 265,
+ FUNC_PUT = 266,
+ FUNC_SET = 267
};
#endif
/* Tokens. */
#define UNARY 258
-#define INT 259
-#define VAR 260
-#define STRING 261
-#define FUNC_MCI 262
+#define FLOAT 259
+#define INT 260
+#define VAR 261
+#define STRING 262
+#define OP_INTO 263
+#define OP_TO 264
+#define FUNC_MCI 265
+#define FUNC_PUT 266
+#define FUNC_SET 267
@@ -122,9 +132,9 @@ int func_mci(Common::String *s);
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 39 "engines/director/lingo/lingo-gr.y"
-{ int i; Common::String *s; }
+{ float f; int i; Common::String *s; }
/* Line 193 of yacc.c. */
-#line 128 "engines/director/lingo/lingo-gr.cpp"
+#line 138 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -137,7 +147,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 141 "engines/director/lingo/lingo-gr.cpp"
+#line 151 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -350,22 +360,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 16
+#define YYFINAL 19
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 52
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 16
+#define YYNTOKENS 22
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 5
/* YYNRULES -- Number of rules. */
-#define YYNRULES 18
+#define YYNRULES 19
/* YYNRULES -- Number of states. */
-#define YYNSTATES 30
+#define YYNSTATES 37
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 262
+#define YYMAXUTOK 267
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -374,12 +384,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 19, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 18, 2, 2,
+ 20, 21, 16, 14, 2, 15, 2, 17, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 13, 2, 2,
- 14, 15, 11, 9, 2, 10, 2, 12, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 8, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 13, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -399,7 +409,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7
+ 5, 6, 7, 8, 9, 10, 11, 12
};
#if YYDEBUG
@@ -407,26 +417,27 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 5, 8, 10, 12, 14, 16, 20,
- 24, 28, 32, 36, 40, 43, 46, 50, 51
+ 0, 0, 3, 5, 9, 11, 13, 15, 17, 21,
+ 25, 29, 33, 36, 39, 43, 44, 47, 52, 57
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 17, 0, -1, 18, -1, 17, 18, -1, 19, -1,
- 20, -1, 4, -1, 5, -1, 5, 8, 19, -1,
- 19, 9, 19, -1, 19, 10, 19, -1, 19, 11,
- 19, -1, 19, 12, 19, -1, 19, 13, 19, -1,
- 9, 19, -1, 10, 19, -1, 14, 19, 15, -1,
- -1, 7, 6, -1
+ 23, 0, -1, 24, -1, 23, 19, 24, -1, 25,
+ -1, 26, -1, 5, -1, 6, -1, 25, 14, 25,
+ -1, 25, 15, 25, -1, 25, 16, 25, -1, 25,
+ 17, 25, -1, 14, 25, -1, 15, 25, -1, 20,
+ 25, 21, -1, -1, 10, 7, -1, 11, 25, 8,
+ 6, -1, 12, 6, 13, 25, -1, 12, 6, 9,
+ 25, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 57, 57, 58, 61, 62, 65, 66, 67, 68,
- 69, 70, 71, 72, 73, 74, 75, 76, 79
+ 0, 62, 62, 63, 66, 67, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, 79, 82, 83, 84, 85
};
#endif
@@ -435,9 +446,10 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "INT", "VAR", "STRING",
- "FUNC_MCI", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'('", "')'",
- "$accept", "list", "statement", "expr", "func", 0
+ "$end", "error", "$undefined", "UNARY", "FLOAT", "INT", "VAR", "STRING",
+ "OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_PUT", "FUNC_SET", "'='", "'+'",
+ "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept", "list",
+ "statement", "expr", "func", 0
};
#endif
@@ -446,23 +458,24 @@ static const char *const yytname[] =
token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
- 0, 256, 257, 258, 259, 260, 261, 262, 61, 43,
- 45, 42, 47, 37, 40, 41
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 61, 43, 45, 42, 47, 37, 10,
+ 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 16, 17, 17, 18, 18, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 20
+ 0, 22, 23, 23, 24, 24, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 26, 26, 26, 26
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 1, 2, 1, 1, 1, 1, 3, 3,
- 3, 3, 3, 3, 2, 2, 3, 0, 2
+ 0, 2, 1, 3, 1, 1, 1, 1, 3, 3,
+ 3, 3, 2, 2, 3, 0, 2, 4, 4, 4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -470,31 +483,33 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 17, 6, 7, 0, 17, 17, 17, 17, 2, 4,
- 5, 17, 18, 14, 15, 0, 1, 3, 17, 17,
- 17, 17, 17, 8, 16, 9, 10, 11, 12, 13
+ 15, 6, 7, 0, 15, 0, 15, 15, 15, 0,
+ 2, 4, 5, 16, 0, 0, 12, 13, 0, 1,
+ 15, 15, 15, 15, 15, 0, 15, 15, 14, 3,
+ 8, 9, 10, 11, 17, 19, 18
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 7, 8, 9, 10
+ -1, 9, 10, 11, 12
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -5
+#define YYPACT_NINF -9
static const yytype_int8 yypact[] =
{
- -1, -5, -3, 4, 26, 26, 26, 19, -5, 39,
- -5, 26, -5, -5, -5, 32, -5, -5, 26, 26,
- 26, 26, 26, 39, -5, 9, 9, -5, -5, -5
+ 1, -9, -9, -6, 20, 4, 20, 20, 20, 5,
+ -9, 35, -9, -9, 22, 18, -9, -9, 27, -9,
+ 1, 20, 20, 20, 20, 8, 20, 20, -9, -9,
+ -8, -8, -9, -9, -9, 35, 35
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -5, -5, 5, -4, -5
+ -9, -9, 9, -4, -9
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -504,31 +519,32 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 13, 14, 15, 1, 2, 11, 3, 23, 4, 5,
- 12, 0, 17, 6, 25, 26, 27, 28, 29, 16,
- 20, 21, 22, 1, 2, 0, 3, 0, 4, 5,
- 1, 2, 0, 6, 0, 4, 5, 0, 0, 0,
- 6, 18, 19, 20, 21, 22, 0, 24, 18, 19,
- 20, 21, 22
+ 14, 13, 16, 17, 18, 19, 1, 2, 23, 24,
+ 15, 3, 4, 5, 34, 6, 7, 30, 31, 32,
+ 33, 8, 35, 36, 20, 1, 2, 26, 0, 29,
+ 25, 27, 0, 0, 6, 7, 21, 22, 23, 24,
+ 8, 21, 22, 23, 24, 0, 0, 0, 28, 21,
+ 22, 23, 24
};
static const yytype_int8 yycheck[] =
{
- 4, 5, 6, 4, 5, 8, 7, 11, 9, 10,
- 6, -1, 7, 14, 18, 19, 20, 21, 22, 0,
- 11, 12, 13, 4, 5, -1, 7, -1, 9, 10,
- 4, 5, -1, 14, -1, 9, 10, -1, -1, -1,
- 14, 9, 10, 11, 12, 13, -1, 15, 9, 10,
- 11, 12, 13
+ 4, 7, 6, 7, 8, 0, 5, 6, 16, 17,
+ 6, 10, 11, 12, 6, 14, 15, 21, 22, 23,
+ 24, 20, 26, 27, 19, 5, 6, 9, -1, 20,
+ 8, 13, -1, -1, 14, 15, 14, 15, 16, 17,
+ 20, 14, 15, 16, 17, -1, -1, -1, 21, 14,
+ 15, 16, 17
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 4, 5, 7, 9, 10, 14, 17, 18, 19,
- 20, 8, 6, 19, 19, 19, 0, 18, 9, 10,
- 11, 12, 13, 19, 15, 19, 19, 19, 19, 19
+ 0, 5, 6, 10, 11, 12, 14, 15, 20, 23,
+ 24, 25, 26, 7, 25, 6, 25, 25, 25, 0,
+ 19, 14, 15, 16, 17, 8, 9, 13, 21, 24,
+ 25, 25, 25, 25, 6, 25, 25
};
#define yyerrok (yyerrstatus = 0)
@@ -1343,78 +1359,83 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 61 "engines/director/lingo/lingo-gr.y"
+#line 66 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 5:
-#line 62 "engines/director/lingo/lingo-gr.y"
+#line 67 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 6:
-#line 65 "engines/director/lingo/lingo-gr.y"
+#line 70 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); ;}
break;
case 7:
-#line 66 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
+#line 71 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
break;
case 8:
-#line 67 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(1) - (3)].s)] = (yyvsp[(3) - (3)].i); delete (yyvsp[(1) - (3)].s); ;}
+#line 72 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
break;
case 9:
-#line 68 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
+#line 73 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
break;
case 10:
-#line 69 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
+#line 74 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
break;
case 11:
-#line 70 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
+#line 75 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
break;
case 12:
-#line 71 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
+#line 76 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
break;
case 13:
-#line 72 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) % (yyvsp[(3) - (3)].i); ;}
+#line 77 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
break;
case 14:
-#line 73 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
+#line 78 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
break;
- case 15:
-#line 74 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
+ case 16:
+#line 82 "engines/director/lingo/lingo-gr.y"
+ { func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 16:
-#line 75 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
+ case 17:
+#line 83 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(4) - (4)].s)] = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
break;
case 18:
-#line 79 "engines/director/lingo/lingo-gr.y"
- { func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
+#line 84 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+ break;
+
+ case 19:
+#line 85 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1418 "engines/director/lingo/lingo-gr.cpp"
+#line 1439 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1628,11 +1649,11 @@ yyreturn:
}
-#line 81 "engines/director/lingo/lingo-gr.y"
+#line 88 "engines/director/lingo/lingo-gr.y"
int func_mci(Common::String *s) {
- warning("mci: %s", s->c_str());
+ warning("STUB: mci(\"%s\")", s->c_str());
return 0;
}
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 5204868f4e..1cf31e05c0 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -40,18 +40,28 @@
know about them. */
enum yytokentype {
UNARY = 258,
- INT = 259,
- VAR = 260,
- STRING = 261,
- FUNC_MCI = 262
+ FLOAT = 259,
+ INT = 260,
+ VAR = 261,
+ STRING = 262,
+ OP_INTO = 263,
+ OP_TO = 264,
+ FUNC_MCI = 265,
+ FUNC_PUT = 266,
+ FUNC_SET = 267
};
#endif
/* Tokens. */
#define UNARY 258
-#define INT 259
-#define VAR 260
-#define STRING 261
-#define FUNC_MCI 262
+#define FLOAT 259
+#define INT 260
+#define VAR 261
+#define STRING 262
+#define OP_INTO 263
+#define OP_TO 264
+#define FUNC_MCI 265
+#define FUNC_PUT 266
+#define FUNC_SET 267
@@ -59,9 +69,9 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 39 "engines/director/lingo/lingo-gr.y"
-{ int i; Common::String *s; }
+{ float f; int i; Common::String *s; }
/* Line 1529 of yacc.c. */
-#line 65 "engines/director/lingo/lingo-gr.hpp"
+#line 75 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 25b6736474..af0ad42824 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -36,13 +36,18 @@ int func_mci(Common::String *s);
%}
-%union { int i; Common::String *s; }
+%union { float f; int i; Common::String *s; }
%token UNARY
+%token<f> FLOAT
%token<i> INT
%token<s> VAR
%token<s> STRING
+%token OP_INTO
+%token OP_TO
%token FUNC_MCI
+%token FUNC_PUT
+%token FUNC_SET
%type<i> expr
%type<i> func
@@ -55,7 +60,7 @@ int func_mci(Common::String *s);
%%
list: statement
- | list statement
+ | list '\n' statement
;
statement: expr { warning("%d", $1); }
@@ -63,25 +68,27 @@ statement: expr { warning("%d", $1); }
;
expr: INT { $$ = $1; }
- | VAR { $$ = vars[*$1]; delete $1; }
- | VAR '=' expr { $$ = vars[*$1] = $3; delete $1; }
+ | VAR { $$ = vars[*$1]; delete $1; }
| expr '+' expr { $$ = $1 + $3; }
| expr '-' expr { $$ = $1 - $3; }
| expr '*' expr { $$ = $1 * $3; }
| expr '/' expr { $$ = $1 / $3; }
- | expr '%' expr { $$ = $1 % $3; }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = -$2; }
| '(' expr ')' { $$ = $2; }
|
;
-func: FUNC_MCI STRING { func_mci($2); delete $2; }
+func: FUNC_MCI STRING { func_mci($2); delete $2; }
+ | FUNC_PUT expr OP_INTO VAR { $$ = vars[*$4] = $2; delete $4; }
+ | FUNC_SET VAR '=' expr { $$ = vars[*$2] = $4; delete $2; }
+ | FUNC_SET VAR OP_TO expr { $$ = vars[*$2] = $4; delete $2; }
+ ;
%%
int func_mci(Common::String *s) {
- warning("mci: %s", s->c_str());
+ warning("STUB: mci(\"%s\")", s->c_str());
return 0;
}
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index d0391b6721..784e59dca2 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 6
-#define YY_END_OF_BUFFER 7
+#define YY_NUM_RULES 12
+#define YY_END_OF_BUFFER 13
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,28 +373,30 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[17] =
+static yyconst flex_int16_t yy_accept[33] =
{ 0,
- 0, 0, 7, 6, 6, 4, 3, 2, 2, 0,
- 5, 3, 2, 2, 1, 0
+ 0, 0, 13, 12, 10, 12, 9, 8, 6, 6,
+ 6, 6, 6, 6, 10, 0, 11, 7, 8, 6,
+ 6, 6, 6, 6, 5, 7, 6, 2, 3, 4,
+ 1, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 1, 1, 3, 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, 3, 1, 1, 4, 1, 1, 1,
- 1, 4, 4, 4, 4, 1, 4, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 4, 1, 1,
- 4, 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, 6, 6, 6, 6,
- 1, 1, 1, 4, 6, 1, 6, 6, 7, 6,
-
- 6, 6, 6, 6, 8, 6, 6, 6, 9, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 4, 1, 1, 5, 1, 1, 1,
+ 1, 5, 5, 5, 5, 6, 5, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 5, 1, 1,
+ 5, 1, 1, 1, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 1, 1, 1, 5, 8, 1, 8, 8, 9, 8,
+
+ 10, 8, 8, 8, 11, 8, 8, 8, 12, 13,
+ 14, 15, 8, 8, 16, 17, 18, 8, 8, 8,
+ 8, 8, 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,
@@ -411,35 +413,48 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[10] =
+static yyconst flex_int32_t yy_meta[19] =
{ 0,
- 1, 2, 1, 1, 3, 3, 3, 3, 3
+ 1, 2, 1, 1, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3
} ;
-static yyconst flex_int16_t yy_base[19] =
+static yyconst flex_int16_t yy_base[35] =
{ 0,
- 0, 0, 19, 20, 15, 20, 12, 0, 9, 12,
- 20, 9, 0, 5, 0, 20, 9, 8
+ 0, 0, 44, 45, 17, 39, 45, 15, 0, 29,
+ 32, 22, 29, 24, 21, 33, 45, 29, 19, 0,
+ 18, 23, 16, 15, 0, 24, 16, 0, 0, 0,
+ 0, 45, 26, 25
} ;
-static yyconst flex_int16_t yy_def[19] =
+static yyconst flex_int16_t yy_def[35] =
{ 0,
- 16, 1, 16, 16, 17, 16, 16, 18, 18, 17,
- 16, 16, 18, 18, 18, 0, 16, 16
+ 32, 1, 32, 32, 32, 33, 32, 32, 34, 34,
+ 34, 34, 34, 34, 32, 33, 32, 32, 32, 34,
+ 34, 34, 34, 34, 34, 32, 34, 34, 34, 34,
+ 34, 0, 32, 32
} ;
-static yyconst flex_int16_t yy_nxt[30] =
+static yyconst flex_int16_t yy_nxt[64] =
{ 0,
- 4, 4, 5, 6, 7, 8, 8, 8, 9, 10,
- 13, 10, 15, 12, 11, 14, 12, 11, 16, 3,
- 16, 16, 16, 16, 16, 16, 16, 16, 16
+ 4, 5, 5, 6, 7, 4, 8, 9, 9, 9,
+ 10, 11, 9, 9, 12, 13, 14, 9, 15, 15,
+ 18, 19, 15, 15, 18, 19, 16, 20, 16, 31,
+ 26, 30, 29, 28, 27, 26, 17, 25, 24, 23,
+ 22, 21, 17, 32, 3, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32
} ;
-static yyconst flex_int16_t yy_chk[30] =
+static yyconst flex_int16_t yy_chk[64] =
{ 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 17,
- 18, 17, 14, 12, 10, 9, 7, 5, 3, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 5, 5,
+ 8, 8, 15, 15, 19, 19, 33, 34, 33, 27,
+ 26, 24, 23, 22, 21, 18, 16, 14, 13, 12,
+ 11, 10, 6, 3, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32
} ;
static yy_state_type yy_last_accepting_state;
@@ -489,7 +504,7 @@ char *yytext;
void yyparse();
-#line 493 "engines/director/lingo/lingo-lex.cpp"
+#line 508 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -671,10 +686,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 42 "engines/director/lingo/lingo-lex.l"
+#line 44 "engines/director/lingo/lingo-lex.l"
-#line 678 "engines/director/lingo/lingo-lex.cpp"
+#line 693 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -727,13 +742,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 >= 17 )
+ if ( yy_current_state >= 33 )
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] != 20 );
+ while ( yy_base[yy_current_state] != 45 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -759,35 +774,66 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 44 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCI; }
+#line 46 "engines/director/lingo/lingo-lex.l"
+{ return OP_INTO; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 45 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 47 "engines/director/lingo/lingo-lex.l"
+{ return FUNC_MCI; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 46 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+#line 48 "engines/director/lingo/lingo-lex.l"
+{ return FUNC_PUT; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 47 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+#line 49 "engines/director/lingo/lingo-lex.l"
+{ return FUNC_SET; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 48 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return STRING; }
+#line 50 "engines/director/lingo/lingo-lex.l"
+{ return OP_TO; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 50 "engines/director/lingo/lingo-lex.l"
+#line 52 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return VAR; }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 53 "engines/director/lingo/lingo-lex.l"
+{ yylval.f = atof(yytext); return FLOAT; }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 54 "engines/director/lingo/lingo-lex.l"
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 55 "engines/director/lingo/lingo-lex.l"
+{ return *yytext; }
+ YY_BREAK
+case 10:
+/* rule 10 can match eol */
+YY_RULE_SETUP
+#line 56 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 57 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return STRING; }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 59 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 791 "engines/director/lingo/lingo-lex.cpp"
+#line 837 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1079,7 +1125,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 >= 17 )
+ if ( yy_current_state >= 33 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1107,11 +1153,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 >= 17 )
+ if ( yy_current_state >= 33 )
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 == 16);
+ yy_is_jam = (yy_current_state == 32);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1784,7 +1830,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 50 "engines/director/lingo/lingo-lex.l"
+#line 59 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 575d09ec9a..cf1078e84a 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -35,17 +35,26 @@ void yyparse();
%}
variable [_[:alpha:]][_[:alnum:]]*
+constfloat [[:digit:]]+\.[[:digit:]]*
constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
operator [-+*/%=^:,]
+newline [\n\r]+
%%
-mci { return FUNC_MCI; }
-{variable} { yylval.s = new Common::String(yytext); return VAR; }
-{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
-{operator} { return *yytext; }
-{conststring} { yylval.s = new Common::String(yytext); return STRING; }
+into { return OP_INTO; }
+mci { return FUNC_MCI; }
+put { return FUNC_PUT; }
+set { return FUNC_SET; }
+to { return OP_TO; }
+
+{variable} { yylval.s = new Common::String(yytext); return VAR; }
+{constfloat} { yylval.f = atof(yytext); return FLOAT; }
+{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
+{operator} { return *yytext; }
+{newline} { return '\n'; }
+{conststring} { yylval.s = new Common::String(yytext); return STRING; }
%%