basic comments parsing in mixin arguments. comments need more work and a general solution though. fixes #1071

This commit is contained in:
Luke Page
2012-12-11 21:33:43 +00:00
parent 033abfd8be
commit e69acbdc51
3 changed files with 17 additions and 1 deletions

View File

@@ -924,6 +924,7 @@ less.Parser = function Parser(env) {
name = match[1];
do {
$(this.comment);
if (input.charAt(i) === '.' && $(/^\.{3}/)) {
variadic = true;
params.push({ variadic: true });
@@ -956,6 +957,8 @@ less.Parser = function Parser(env) {
furthest = i;
restore();
}
$(this.comment);
if ($(/^when/)) { // Guard
cond = expect(this.conditions, 'expected condition');
@@ -1390,7 +1393,7 @@ less.Parser = function Parser(env) {
multiplication: function () {
var m, a, op, operation;
if (m = $(this.operand)) {
while (!peek(/^\/\*/) && (op = ($('/') || $('*'))) && (a = $(this.operand))) {
while (!peek(/^\/[*\/]/) && (op = ($('/') || $('*'))) && (a = $(this.operand))) {
operation = new(tree.Operation)(op, [operation || m, a]);
}
return operation || m;

View File

@@ -51,6 +51,9 @@
-webkit-border-radius: 2px /* webkit only */;
-moz-border-radius: 8px /* moz only with operation */;
}
.test {
color: 1px //put in @b - causes problems! --->;
}
#last {
color: #0000ff;
}

View File

@@ -61,5 +61,15 @@
-moz-border-radius: 2px * 4 /* moz only with operation */;
}
.mixin_def_with_colors(@a: white, // in
@b: 1px //put in @b - causes problems! --->
) // the
when (@a = white) {
.test {
color: @b;
}
}
.mixin_def_with_colors();
#last { color: blue }
//