ref: 74f2ad2c0bbe0e4c1d52d54265db2663c18bdb80
parent: e23d2070a0a3a1ddd78806525b1596e1785216b4
author: Tor Andersson <[email protected]>
date: Sat Jan 11 11:51:48 EST 2014
Count lines in block comments as well.
--- a/jslex.c
+++ b/jslex.c
@@ -170,10 +170,15 @@
}
}
-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 @@
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)) {