diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index d85420e26..3f3ea563f 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -2321,6 +2321,11 @@ const Parser = function Parser(context, imports, fileInfo) { continue; } e = this.addition() || this.entity(); + + if (e instanceof tree.Comment) { + e = null; + } + if (e) { entities.push(e); // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here diff --git a/test/less/errors/invalid-color-with-comment.less b/test/less/errors/invalid-color-with-comment.less new file mode 100644 index 000000000..243341f0a --- /dev/null +++ b/test/less/errors/invalid-color-with-comment.less @@ -0,0 +1 @@ +.test {color: #fffff /* comment */ ;} \ No newline at end of file diff --git a/test/less/errors/invalid-color-with-comment.txt b/test/less/errors/invalid-color-with-comment.txt new file mode 100644 index 000000000..4d1c8ee04 --- /dev/null +++ b/test/less/errors/invalid-color-with-comment.txt @@ -0,0 +1,2 @@ +ParseError: Unrecognised input in {path}invalid-color-with-comment.less on line 1, column 36: +1 .test {color: #fffff /* comment */ ;}