Skip to content

Commit

Permalink
Handle \r\n and \r newlines in get() with scanNewlines = true (that i…
Browse files Browse the repository at this point in the history
…s, when they're not whitespace)
  • Loading branch information
Gregor Richards authored and Gregor Richards committed Apr 21, 2011
1 parent d38a83d commit 8da0aa5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/jslex.js
Expand Up @@ -437,7 +437,9 @@ Narcissus.lexer = (function() {
this.lexZeroNumber(ch);
} else if (ch === '"' || ch === "'") {
this.lexString(ch);
} else if (this.scanNewlines && ch === '\n') {
} else if (this.scanNewlines && (ch === '\n' || ch === '\r')) {
// if this was a \r, look for \r\n
if (ch === '\r' && input[this.cursor] === '\n') this.cursor++;
token.type = NEWLINE;
token.value = '\n';
this.lineno++;
Expand Down

0 comments on commit 8da0aa5

Please sign in to comment.