Detect newlines using charCodeAt instead of charCode

In generated parsers, detect newlines using charCodeAt instead of
charCode. This should be slightly faster.
redux
David Majda 8 years ago
parent 18d266be67
commit 88f1d1369b

@ -1001,7 +1001,7 @@ function generateJS(ast, options) {
' };',
'',
' while (p < pos) {',
' if (input.charAt(p) === "\\n") {',
' if (input.charCodeAt(p) === 10) {',
' details.line++;',
' details.column = 1;',
' } else {',

@ -439,7 +439,7 @@ module.exports = (function() {
};
while (p < pos) {
if (input.charAt(p) === "\n") {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
} else {

Loading…
Cancel
Save