diff --git a/lib/less/parser.js b/lib/less/parser.js index 35a0040..0df5789 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -204,12 +204,10 @@ less.Parser = function Parser(env) { comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g, level = 0, match, - chunk, + chunk = chunks[0], inString; for (var i = 0, c, cc; i < input.length; i++) { - chunk = chunks[j]; - skip.lastIndex = i; if (match = skip.exec(input)) { if (match.index === i) { @@ -218,8 +216,8 @@ less.Parser = function Parser(env) { } } c = input.charAt(i); - comment.lastIndex = i; + if (!inString && c === '/') { cc = input.charAt(i + 1); if (cc === '/' || cc === '*') { @@ -227,17 +225,17 @@ less.Parser = function Parser(env) { if (match.index === i) { i += match[0].length; chunk.push(match[0]); + c = input.charAt(i); } } } } - c = input.charAt(i); if (c === '{' && !inString) { level ++; chunk.push(c); } else if (c === '}' && !inString) { level --; chunk.push(c); - chunks[++j] = []; + chunks[++j] = chunk = []; } else { if (c === '"' || c === "'") { if (!inString) {