Support for pattern-matching on mixin calls.

This commit is contained in:
cloudhead
2010-04-25 00:09:40 -04:00
parent 2ebbf37c4b
commit d56feee6f0
6 changed files with 155 additions and 14 deletions

View File

@@ -533,15 +533,21 @@ less.Parser = function Parser(env) {
if (match = $(/([#.][a-zA-Z0-9_-]+)\s*\(/g)) {
name = match[1];
while (param = $(/@[\w-]+/g)) {
if ($(':')) {
if (value = $(this.expression)) {
params.push({ name: param, value: value });
while (param = $(/@[\w-]+/g) || $(this.entities.literal)
|| $(this.entities.keyword)) {
// Variable
if (param[0] === '@') {
if ($(':')) {
if (value = $(this.expression)) {
params.push({ name: param, value: value });
} else {
throw new(Error)("Expected value");
}
} else {
throw new(Error)("Expected value");
params.push({ name: param });
}
} else {
params.push({ name: param });
params.push({ value: param });
}
if (! $(',')) { break }
}