diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index e6656dd55..d4e7481a1 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -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; diff --git a/test/css/comments2.css b/test/css/comments2.css index 9d303006d..9fcbd46e8 100644 --- a/test/css/comments2.css +++ b/test/css/comments2.css @@ -10,3 +10,9 @@ margin: 10px; total-width: (1 * 6em * 12) + (2em * 12); } +.some-inline-comments { + a: yes /* comment */; + b: red /* comment */; + c: yes /* comment */; + d: red /* comment */; +} diff --git a/test/less/comments2.less b/test/less/comments2.less index 19ef5d7eb..dce78baa3 100644 --- a/test/less/comments2.less +++ b/test/less/comments2.less @@ -18,3 +18,14 @@ @gutter-width * // We strongly recommend you */ @columns); // do not change this formula. */ @total-width : @gridsystem-width; // set to 100% for fluid grid */ + +// ............................................................................. + +.some-inline-comments { + a: yes /* comment */; + b: red /* comment */; + @c: yes /* comment */; + @d: red /* comment */; + c: @c; + d: @d; +}