Skip to content

Commit

Permalink
DIRECTOR: Lingo: Avoid printing out unrecognizet tokens in lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 3, 2016
1 parent 2b6f00f commit 0c4d015
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 87 deletions.
179 changes: 92 additions & 87 deletions engines/director/lingo/lingo-lex.cpp
Expand Up @@ -364,30 +364,30 @@ static void yy_fatal_error (yyconst char msg[] );
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;

#define YY_NUM_RULES 36
#define YY_END_OF_BUFFER 37
#define YY_NUM_RULES 37
#define YY_END_OF_BUFFER 38
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
{
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[113] =
static yyconst flex_int16_t yy_accept[114] =
{ 0,
0, 0, 37, 36, 3, 34, 36, 36, 33, 33,
32, 33, 33, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 2, 2,
3, 34, 27, 0, 35, 1, 31, 32, 29, 28,
30, 30, 30, 30, 30, 30, 10, 5, 30, 30,
30, 30, 30, 30, 18, 30, 30, 30, 30, 30,
24, 30, 30, 1, 31, 30, 30, 7, 30, 30,
30, 30, 30, 14, 30, 30, 30, 20, 30, 22,
30, 30, 30, 4, 6, 8, 30, 11, 12, 30,
30, 30, 17, 30, 30, 23, 30, 25, 9, 13,

30, 16, 30, 30, 26, 30, 30, 21, 15, 30,
19, 0
0, 0, 38, 36, 3, 34, 34, 36, 36, 33,
33, 32, 33, 33, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 2,
2, 3, 34, 27, 0, 35, 1, 31, 32, 29,
28, 30, 30, 30, 30, 30, 30, 10, 5, 30,
30, 30, 30, 30, 30, 18, 30, 30, 30, 30,
30, 24, 30, 30, 1, 31, 30, 30, 7, 30,
30, 30, 30, 30, 14, 30, 30, 30, 20, 30,
22, 30, 30, 30, 4, 6, 8, 30, 11, 12,
30, 30, 30, 17, 30, 30, 23, 30, 25, 9,

13, 30, 16, 30, 30, 26, 30, 30, 21, 15,
30, 19, 0
} ;

static yyconst flex_int32_t yy_ec[256] =
Expand Down Expand Up @@ -430,82 +430,82 @@ static yyconst flex_int32_t yy_meta[36] =
4, 4, 4, 4, 4
} ;

static yyconst flex_int16_t yy_base[116] =
static yyconst flex_int16_t yy_base[117] =
{ 0,
0, 34, 131, 132, 128, 34, 116, 121, 132, 118,
30, 113, 112, 0, 97, 18, 94, 95, 23, 94,
29, 101, 99, 18, 99, 98, 30, 32, 114, 132,
113, 55, 132, 107, 132, 0, 102, 50, 132, 132,
0, 78, 81, 92, 86, 92, 0, 0, 76, 79,
88, 81, 70, 67, 0, 82, 69, 71, 67, 78,
0, 73, 64, 0, 83, 67, 73, 0, 60, 65,
62, 60, 58, 52, 62, 53, 50, 0, 63, 0,
55, 56, 57, 0, 0, 0, 59, 0, 0, 50,
60, 56, 0, 51, 57, 0, 53, 0, 0, 0,

48, 0, 43, 37, 0, 36, 31, 0, 0, 21,
0, 132, 61, 44, 65
0, 34, 133, 134, 130, 34, 37, 118, 123, 134,
120, 32, 115, 114, 0, 99, 20, 96, 97, 25,
96, 31, 103, 101, 20, 101, 100, 32, 34, 116,
134, 115, 57, 134, 109, 134, 0, 104, 52, 134,
134, 0, 80, 83, 94, 88, 94, 0, 0, 78,
81, 90, 83, 72, 69, 0, 84, 71, 73, 69,
80, 0, 75, 66, 0, 85, 69, 75, 0, 62,
67, 64, 62, 60, 54, 64, 55, 52, 0, 65,
0, 57, 58, 59, 0, 0, 0, 61, 0, 0,
52, 62, 58, 0, 53, 59, 0, 55, 0, 0,

0, 50, 0, 45, 39, 0, 38, 33, 0, 0,
23, 0, 134, 63, 46, 67
} ;

static yyconst flex_int16_t yy_def[116] =
static yyconst flex_int16_t yy_def[117] =
{ 0,
112, 1, 112, 112, 112, 112, 112, 113, 112, 112,
112, 112, 112, 114, 114, 114, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 114, 112, 112,
112, 112, 112, 113, 112, 115, 112, 112, 112, 112,
114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
114, 114, 114, 115, 112, 114, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 114, 114, 114,

114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
114, 0, 112, 112, 112
113, 1, 113, 113, 113, 113, 113, 113, 114, 113,
113, 113, 113, 113, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 113,
113, 113, 113, 113, 114, 113, 116, 113, 113, 113,
113, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 116, 113, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,

115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 0, 113, 113, 113
} ;

static yyconst flex_int16_t yy_nxt[168] =
static yyconst flex_int16_t yy_nxt[170] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
11, 12, 9, 13, 14, 14, 14, 15, 16, 17,
18, 14, 19, 20, 21, 22, 23, 24, 25, 26,
27, 14, 14, 28, 14, 29, 32, 32, 30, 37,
38, 43, 48, 44, 51, 52, 56, 41, 49, 57,
111, 60, 45, 62, 63, 53, 61, 32, 32, 37,
38, 34, 110, 34, 34, 64, 109, 108, 64, 107,
106, 105, 104, 103, 102, 101, 100, 99, 98, 97,
96, 95, 94, 93, 92, 91, 90, 89, 88, 87,
86, 85, 84, 65, 83, 82, 81, 80, 79, 78,

77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
67, 66, 65, 35, 31, 31, 59, 58, 55, 54,
50, 47, 46, 42, 40, 39, 36, 35, 33, 31,
112, 3, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112
4, 5, 6, 7, 4, 8, 9, 10, 11, 4,
12, 13, 10, 14, 15, 15, 15, 16, 17, 18,
19, 15, 20, 21, 22, 23, 24, 25, 26, 27,
28, 15, 15, 29, 15, 30, 33, 33, 31, 33,
33, 38, 39, 44, 49, 45, 52, 53, 57, 42,
50, 58, 112, 61, 46, 63, 64, 54, 62, 33,
33, 38, 39, 35, 111, 35, 35, 65, 110, 109,
65, 108, 107, 106, 105, 104, 103, 102, 101, 100,
99, 98, 97, 96, 95, 94, 93, 92, 91, 90,
89, 88, 87, 86, 85, 66, 84, 83, 82, 81,

80, 79, 78, 77, 76, 75, 74, 73, 72, 71,
70, 69, 68, 67, 66, 36, 32, 32, 60, 59,
56, 55, 51, 48, 47, 43, 41, 40, 37, 36,
34, 32, 113, 3, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113
} ;

static yyconst flex_int16_t yy_chk[168] =
static yyconst flex_int16_t yy_chk[170] =
{ 0,
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, 2, 6, 6, 2, 11,
11, 16, 19, 16, 21, 21, 24, 114, 19, 24,
110, 27, 16, 28, 28, 21, 27, 32, 32, 38,
38, 113, 107, 113, 113, 115, 106, 104, 115, 103,
101, 97, 95, 94, 92, 91, 90, 87, 83, 82,
81, 79, 77, 76, 75, 74, 73, 72, 71, 70,
69, 67, 66, 65, 63, 62, 60, 59, 58, 57,

56, 54, 53, 52, 51, 50, 49, 46, 45, 44,
43, 42, 37, 34, 31, 29, 26, 25, 23, 22,
20, 18, 17, 15, 13, 12, 10, 8, 7, 5,
3, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
112, 112, 112, 112, 112, 112, 112
1, 1, 1, 1, 1, 2, 6, 6, 2, 7,
7, 12, 12, 17, 20, 17, 22, 22, 25, 115,
20, 25, 111, 28, 17, 29, 29, 22, 28, 33,
33, 39, 39, 114, 108, 114, 114, 116, 107, 105,
116, 104, 102, 98, 96, 95, 93, 92, 91, 88,
84, 83, 82, 80, 78, 77, 76, 75, 74, 73,
72, 71, 70, 68, 67, 66, 64, 63, 61, 60,

59, 58, 57, 55, 54, 53, 52, 51, 50, 47,
46, 45, 44, 43, 38, 35, 32, 30, 27, 26,
24, 23, 21, 19, 18, 16, 14, 13, 11, 9,
8, 5, 3, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113
} ;

static yy_state_type yy_last_accepting_state;
Expand Down Expand Up @@ -797,13 +797,13 @@ YY_DECL
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 >= 113 )
if ( yy_current_state >= 114 )
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] != 132 );
while ( yy_base[yy_current_state] != 134 );

yy_find_action:
yy_act = yy_accept[yy_current_state];
Expand Down Expand Up @@ -1005,10 +1005,15 @@ YY_RULE_SETUP
YY_BREAK
case 36:
YY_RULE_SETUP
#line 86 "engines/director/lingo/lingo-lex.l"
#line 85 "engines/director/lingo/lingo-lex.l"

YY_BREAK
case 37:
YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
#line 1012 "engines/director/lingo/lingo-lex.cpp"
#line 1017 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();

Expand Down Expand Up @@ -1301,7 +1306,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 >= 113 )
if ( yy_current_state >= 114 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
Expand Down Expand Up @@ -1329,11 +1334,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 >= 113 )
if ( yy_current_state >= 114 )
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 == 112);
yy_is_jam = (yy_current_state == 113);

return yy_is_jam ? 0 : yy_current_state;
}
Expand Down Expand Up @@ -2008,7 +2013,7 @@ void yyfree (void * ptr )

#define YYTABLES_NAME "yytables"

#line 86 "engines/director/lingo/lingo-lex.l"
#line 87 "engines/director/lingo/lingo-lex.l"



Expand Down
1 change: 1 addition & 0 deletions engines/director/lingo/lingo-lex.l
Expand Up @@ -82,6 +82,7 @@ while { return tWHILE; }
{operator} { return *yytext; }
{newline} { return '\n'; }
{conststring} { yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
.
%%
Expand Down

0 comments on commit 0c4d015

Please sign in to comment.