You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2014/07/08 21:56:58 Error parsing JS: (anonymous): Line 2:5 Unexpected token <
exit status 1
Would it be possible to expand the parser to cover those? It would help for example for tools using otto parser for analysis of Javascript from the websites. Node, v8 and esprima handle those strings as line comments - similar to // .
Token::Value Scanner::ScanHtmlComment() {
// Check for <!-- comments.ASSERT(c0_ == '!');
Advance();
if (c0_ == '-') {
Advance();
if (c0_ == '-') returnSkipSingleLineComment();
PushBack('-'); // undo Advance()
}
PushBack('!'); // undo Advance()ASSERT(c0_ == '!');
return Token::LT;
}
// …// If there is an HTML comment end '-->' at the beginning of a// line (with only whitespace in front of it), we treat the rest// of the line as a comment. This is in line with the way// SpiderMonkey handles it.if (c0_ == '-' && has_line_terminator_before_next_) {
Advance();
if (c0_ == '-') {
Advance();
if (c0_ == '>') {
// Treat the rest of the line as a comment.SkipSingleLineComment();
// Continue skipping white space after the comment.continue;
}
PushBack('-'); // undo Advance()
}
PushBack('-'); // undo Advance()
}
// …case'-':
// - -- --> -=Advance();
if (c0_ == '-') {
Advance();
if (c0_ == '>' && has_line_terminator_before_next_) {
// For compatibility with SpiderMonkey, we skip lines that// start with an HTML comment end '-->'.
token = SkipSingleLineComment();
} else {
token = Token::DEC;
}
The program below produces an error:
2014/07/08 21:56:58 Error parsing JS: (anonymous): Line 2:5 Unexpected token <
exit status 1
Would it be possible to expand the parser to cover those? It would help for example for tools using otto parser for analysis of Javascript from the websites. Node, v8 and esprima handle those strings as line comments - similar to // .
References:
http://www.javascripter.net/faq/comments.htm
http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html:
for related historical reasons, the string "<!--" in JavaScript is actually treated as a line comment start, just like "//".
The text was updated successfully, but these errors were encountered: