Review comments from @cloudhead - alter chunker to not chunk @{X} and

simplify process and depreciated != deprecated
This commit is contained in:
Luke Page
2012-09-02 12:12:04 +01:00
parent 7f466c1bfe
commit 3031517c13
3 changed files with 11 additions and 15 deletions

View File

@@ -155,7 +155,7 @@ less.Parser = function Parser(env) {
// grammar is mostly white-space insensitive.
//
if (match) {
while(skipWhitespace(length)) { length = 0; }
skipWhitespace(length);
if(typeof(match) === 'string') {
return match;
@@ -282,7 +282,7 @@ less.Parser = function Parser(env) {
// Split the input into chunks.
chunks = (function (chunks) {
var j = 0,
skip = /[^"'`\{\}\/\(\)\\]+/g,
skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`\\\r\n]|\\.)*)`/g,
level = 0,
@@ -321,7 +321,7 @@ less.Parser = function Parser(env) {
}
}
}
switch (c) {
case '{': if (! inParam) { level ++; chunk.push(c); break }
case '}': if (! inParam) { level --; chunk.push(c); chunks[++j] = chunk = []; break }
@@ -682,15 +682,10 @@ less.Parser = function Parser(env) {
// A variable entity useing the protective {} e.g. @{var}
variableCurly: function () {
var name, index = i;
var name, curly, index = i;
if (input.charAt(i) === '@' && input.charAt(i+1) === '{') {
// {,} start a new chunk, so need to absorb seperately
$('@');
$('{');
name = $(/^[\w-]+/);
$('}');
return new(tree.Variable)("@" + name, index, env.filename);
if (input.charAt(i) === '@' && (curly = $(/^@\{([\w-]+)\}/))) {
return new(tree.Variable)("@" + curly[1], index, env.filename);
}
},

View File

@@ -126,5 +126,5 @@ p a span {
color: black;
}
:nth-child(3):nth-child(3) {
second-use: depreciated;
second-use: deprecated;
}

View File

@@ -107,11 +107,12 @@ a {
::bnord {color: red }
&::bnord {color: red }
}
// selector interpolation - depreciated
@theme: ~"blood";
// selector interpolation - deprecated
@theme: blood;
(~".@{theme}") {
color: red;
}
// selector interpolation - new format
@selector: ~".@{theme}";
@{selector} {
color:red;
@@ -126,5 +127,5 @@ a {
}
@num: 3;
:nth-child(@{num}):nth-child(@num) {
second-use: depreciated;
second-use: deprecated;
}