From e69acbdc515fbb2042e8c92624e370288e0b4db3 Mon Sep 17 00:00:00 2001 From: Luke Page Date: Tue, 11 Dec 2012 21:33:43 +0000 Subject: [PATCH] basic comments parsing in mixin arguments. comments need more work and a general solution though. fixes #1071 --- lib/less/parser.js | 5 ++++- test/css/comments.css | 3 +++ test/less/comments.less | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/less/parser.js b/lib/less/parser.js index 54a5f8ab..2fd0cf69 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -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; diff --git a/test/css/comments.css b/test/css/comments.css index 352dd48e..88aaa80f 100644 --- a/test/css/comments.css +++ b/test/css/comments.css @@ -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; } diff --git a/test/less/comments.less b/test/less/comments.less index 1b5c63e4..6e8c8adb 100644 --- a/test/less/comments.less +++ b/test/less/comments.less @@ -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 } //