diff --git a/acorn.js b/acorn.js index bdf80843de..88a5f36231 100644 --- a/acorn.js +++ b/acorn.js @@ -438,10 +438,12 @@ function skipLineComment() { var start = tokPos; - tokPos += 2; - while (tokPos < inputLen && !newline.test(input.charAt(tokPos))) ++tokPos; - if (options.trackComments) - (tokComments || (tokComments = [])).push(input.slice(start, tokPos)); + var ch = input.charCodeAt(tokPos+=2); + while (tokPos < inputLen && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8329) { + ++tokPos; + ch = input.charCodeAt(tokPos); + } + (tokComments || (tokComments = [])).push(input.slice(start, tokPos)); } // Called at the start of the parse and after every token. Skips diff --git a/index.html b/index.html index 9a11c332fe..c2417029a9 100644 --- a/index.html +++ b/index.html @@ -257,10 +257,12 @@ the right position.
Called at the start of the parse and after every token. Skips
whitespace and comments, and, if options.trackComments is on,
will store all skipped comments in tokComments.
function skipSpace() {