[Pkg-javascript-commits] [less.js] 20/25: Eat up comments instead of calling them parse error: * in @keyframe declaration #2059, * after rule name before semicolon #826.
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:23:11 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v1.7.5
in repository less.js.
commit d086d64e12f3999c23e9c7c3a0f414688127c7de
Author: jurcovicovam <meri at meri.org>
Date: Wed Aug 27 17:50:33 2014 +0200
Eat up comments instead of calling them parse error:
* in @keyframe declaration #2059,
* after rule name before semicolon #826.
The comments are eaten instead of being printed into output, but it is
better then crashing on them.
---
lib/less/parser.js | 16 ++++++++++++++++
test/css/comments.css | 5 +++++
test/less/comments.less | 8 +++++++-
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/lib/less/parser.js b/lib/less/parser.js
index 6bfa5f2..7e0e55d 100644
--- a/lib/less/parser.js
+++ b/lib/less/parser.js
@@ -1578,6 +1578,7 @@ less.Parser = function Parser(env) {
value = this.detachedRuleset();
}
+ this.comments();
if (!value) {
// prefer to try to parse first if its a variable or we are compressing
// but always fallback on the other one
@@ -1822,6 +1823,8 @@ less.Parser = function Parser(env) {
break;
}
+ this.comments();
+
if (hasIdentifier) {
value = this.entity();
if (!value) {
@@ -1839,6 +1842,8 @@ less.Parser = function Parser(env) {
}
}
+ this.comments();
+
if (hasBlock) {
rules = this.blockRuleset();
}
@@ -2053,9 +2058,20 @@ less.Parser = function Parser(env) {
return name.push(a[1]);
}
}
+ function cutOutBlockComments() {
+ //match block comments
+ var a = /^\s*\/\*(?:[^*]|\*+[^\/*])*\*+\//.exec(c);
+ if (a) {
+ length += a[0].length;
+ c = c.slice(a[0].length);
+ return true;
+ }
+ return false;
+ }
match(/^(\*?)/);
while (match(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/)); // !
+ while (cutOutBlockComments());
if ((name.length > 1) && match(/^\s*((?:\+_|\+)?)\s*:/)) {
// at last, we have the complete match now. move forward,
// convert name particles to tree objects and return:
diff --git a/test/css/comments.css b/test/css/comments.css
index 58b78ea..d3c57b4 100644
--- a/test/css/comments.css
+++ b/test/css/comments.css
@@ -58,6 +58,11 @@
.sr-only-focusable {
clip: auto;
}
+ at -webkit-keyframes hover {
+ 0% {
+ color: red;
+ }
+}
#last {
color: #0000ff;
}
diff --git a/test/less/comments.less b/test/less/comments.less
index 3e5578b..468877c 100644
--- a/test/less/comments.less
+++ b/test/less/comments.less
@@ -62,7 +62,7 @@
*/
.selector /* .with */, .lots, /* of */ .comments {
- color: grey, /* blue */ orange;
+ color/* survive *//* me too */: grey, /* blue */ orange;
-webkit-border-radius: 2px /* webkit only */;
-moz-border-radius: (2px * 4) /* moz only with operation */;
}
@@ -84,6 +84,12 @@
clip: auto;
}
+ at -webkit-keyframes /* Safari */ hover /* and Chrome */ {
+ 0% {
+ color: red;
+ }
+}
+
#last { color: blue }
//
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list