mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Review comments from @cloudhead - alter chunker to not chunk @{X} and
simplify process and depreciated != deprecated
This commit is contained in:
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -126,5 +126,5 @@ p a span {
|
||||
color: black;
|
||||
}
|
||||
:nth-child(3):nth-child(3) {
|
||||
second-use: depreciated;
|
||||
second-use: deprecated;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user