diff --git a/js-lex.c b/js-lex.c index ff64e6b..d8f3e01 100644 --- a/js-lex.c +++ b/js-lex.c @@ -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 == '/') { diff --git a/js-parse.h b/js-parse.h index b9bea35..82fb17f 100644 --- a/js-parse.h +++ b/js-parse.h @@ -3,7 +3,7 @@ enum { TK_ERROR = 257, - TK_NEWLINE, + TK_IDENTIFIER, TK_NUMBER, TK_STRING, diff --git a/js.h b/js.h index bf3a605..6e33654 100644 --- a/js.h +++ b/js.h @@ -35,6 +35,7 @@ struct js_State struct { int g, i, m; } yyflags; int yyline; int lasttoken; + int newline; int strict; };