mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Support for pattern-matching on mixin calls.
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user