multi comments in selectors and other places

This commit is contained in:
Luke Page
2013-03-20 08:51:47 +00:00
parent 6fc6dc2301
commit f068d2da68
3 changed files with 23 additions and 6 deletions

View File

@@ -577,6 +577,16 @@ less.Parser = function Parser(env) {
}
},
comments: function () {
var comment, comments = [];
while(comment = $(this.comment)) {
comments.push(comment);
}
return comments;
},
//
// Entities are tokens which can be found inside an Expression
//
@@ -893,7 +903,7 @@ less.Parser = function Parser(env) {
if (isCall) {
arg = $(this.expression);
} else {
$(this.comment);
$(this.comments);
if (input.charAt(i) === '.' && $(/^\.{3}/)) {
returner.variadic = true;
if ($(";") && !isSemiColonSeperated) {
@@ -1023,7 +1033,7 @@ less.Parser = function Parser(env) {
restore();
}
$(this.comment);
$(this.comments);
if ($(/^when/)) { // Guard
cond = expect(this.conditions, 'expected condition');
@@ -1199,9 +1209,9 @@ less.Parser = function Parser(env) {
while (s = $(this.selector)) {
selectors.push(s);
$(this.comment);
$(this.comments);
if (! $(',')) { break }
$(this.comment);
$(this.comments);
}
if (selectors.length > 0 && (rules = $(this.block))) {

View File

@@ -26,7 +26,8 @@
*/
/* @group Variables
------------------- */
#comments {
#comments,
.comments {
/**/
color: red;
/* A C-style comment */

View File

@@ -34,7 +34,13 @@
/* @group Variables
------------------- */
#comments /* boo */ {
#comments /* boo *//* boo again*/,
//.commented_out1
//.commented_out2
//.commented_out3
.comments //end of comments1
//end of comments2
{
/**/ // An empty comment
color: red; /* A C-style comment */ /* A C-style comment */
background-color: orange; // A little comment