mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Merge pull request #2806 from seven-phases-max/fix-named-colors-regression
Fix comments after named color regression
This commit is contained in:
@@ -325,26 +325,6 @@ var Parser = function Parser(context, imports, fileInfo) {
|
||||
}
|
||||
},
|
||||
|
||||
namedColor: function () {
|
||||
parserInput.save();
|
||||
var autoCommentAbsorb = parserInput.autoCommentAbsorb;
|
||||
parserInput.autoCommentAbsorb = false;
|
||||
var k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]*/);
|
||||
parserInput.autoCommentAbsorb = autoCommentAbsorb;
|
||||
if (!k) {
|
||||
parserInput.forget();
|
||||
return ;
|
||||
}
|
||||
var result = tree.Color.fromKeyword(k);
|
||||
if (!result) {
|
||||
parserInput.restore();
|
||||
} else {
|
||||
parserInput.forget();
|
||||
return result;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//
|
||||
// A function call
|
||||
//
|
||||
@@ -511,8 +491,24 @@ var Parser = function Parser(context, imports, fileInfo) {
|
||||
}
|
||||
return new(tree.Color)(rgb[1], undefined, '#' + colorCandidateString);
|
||||
}
|
||||
},
|
||||
|
||||
return this.namedColor();
|
||||
colorKeyword: function () {
|
||||
parserInput.save();
|
||||
var autoCommentAbsorb = parserInput.autoCommentAbsorb;
|
||||
parserInput.autoCommentAbsorb = false;
|
||||
var k = parserInput.$re(/^[A-Za-z]+/);
|
||||
parserInput.autoCommentAbsorb = autoCommentAbsorb;
|
||||
if (!k) {
|
||||
parserInput.forget();
|
||||
return;
|
||||
}
|
||||
parserInput.restore();
|
||||
var color = tree.Color.fromKeyword(k);
|
||||
if (color) {
|
||||
parserInput.$str(k);
|
||||
return color;
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
@@ -1706,8 +1702,8 @@ var Parser = function Parser(context, imports, fileInfo) {
|
||||
}
|
||||
|
||||
var o = this.sub() || entities.dimension() ||
|
||||
entities.variable() ||
|
||||
entities.call() || entities.color();
|
||||
entities.color() || entities.variable() ||
|
||||
entities.call() || entities.colorKeyword();
|
||||
|
||||
if (negate) {
|
||||
o.parensInOp = true;
|
||||
|
||||
Reference in New Issue
Block a user