Count lines in block comments as well.

This commit is contained in:
Tor Andersson
2014-01-11 18:11:23 +01:00
parent e23d2070a0
commit 74f2ad2c0b
+7 -2
View File
@@ -170,10 +170,15 @@ static inline void lexlinecomment(const char **sp)
}
}
static inline int lexcomment(const char **sp)
static inline int lexcomment(js_State *J, const char **sp)
{
while (1) {
int c = GET();
if (isnewline(c)) {
if (c == '\r' && PEEK() == '\n')
NEXT();
J->line++;
}
if (c == '*') {
while (c == '*')
c = GET();
@@ -434,7 +439,7 @@ static int lex(js_State *J, const char **sp)
lexlinecomment(sp);
continue;
} else if (LOOK('*')) {
if (lexcomment(sp))
if (lexcomment(J, sp))
return jsP_error(J, "multi-line comment not terminated");
continue;
} else if (isregexpcontext(J->lasttoken)) {