Set newline flag if a token is preceded by a line terminator.

This commit is contained in:
Tor Andersson
2013-12-28 12:55:44 +01:00
parent 42683b9b4a
commit e928c1410c
3 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -346,6 +346,8 @@ static int lexregexp(js_State *J, const char **sp)
static int lex(js_State *J, const char **sp)
{
J->newline = 0;
while (1) {
int c = GET();
@@ -357,7 +359,8 @@ static int lex(js_State *J, const char **sp)
if (c == '\r' && PEEK() == '\n')
NEXT();
J->yyline++;
return TK_NEWLINE;
J->newline = 1;
continue;
}
if (c == '/') {
+1 -1
View File
@@ -3,7 +3,7 @@
enum {
TK_ERROR = 257,
TK_NEWLINE,
TK_IDENTIFIER,
TK_NUMBER,
TK_STRING,
+1
View File
@@ -35,6 +35,7 @@ struct js_State
struct { int g, i, m; } yyflags;
int yyline;
int lasttoken;
int newline;
int strict;
};