endlines and comments

possible fix for https://github.com/less/less.js/issues/2370

I have used the following command to test this issue: `printf "p {\r//less\rc:1;\r}\r" | lessc -`

I'm not sure if this the most efficient fix.
I also tried `var nextNewLine = inp.substr(parserInput.i + 1).search(/\n|\r/);` to replace the `indexOf` but then i expect possible mismatches for `\r\n` which match on the first `\r`.
This commit is contained in:
Bass Jobsen
2015-01-29 00:27:09 +01:00
parent edca7f4cfa
commit 48b379bbd0

View File

@@ -126,7 +126,7 @@ module.exports = function() {
curr = parserInput.i - currentPos,
endIndex = parserInput.i + current.length - curr,
mem = (parserInput.i += length),
inp = input,
inp = input.replace(/\r\n|\r/gm, "\n"),
c, nextChar, comment;
for (; parserInput.i < endIndex; parserInput.i++) {