minor refactoring in chunkification

This commit is contained in:
cloudhead 2010-07-01 02:05:55 +02:00
parent 1a56c6d225
commit 3318f0a294

View File

@ -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) {