Merge pull request #2806 from seven-phases-max/fix-named-colors-regression

Fix comments after named color regression
This commit is contained in:
Max Mikhailov
2016-02-06 06:01:48 +03:00
3 changed files with 36 additions and 23 deletions

View File

@@ -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;