mirror of
https://github.com/ccxvii/mujs.git
synced 2026-09-21 22:53:41 +08:00
Set newline flag if a token is preceded by a line terminator.
This commit is contained in:
@@ -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
@@ -3,7 +3,7 @@
|
||||
|
||||
enum {
|
||||
TK_ERROR = 257,
|
||||
TK_NEWLINE,
|
||||
|
||||
TK_IDENTIFIER,
|
||||
TK_NUMBER,
|
||||
TK_STRING,
|
||||
|
||||
Reference in New Issue
Block a user