in src/parser/lessParser.ts [613:667]
public _tryParseMixinReference(atRoot = true): nodes.Node | null {
const mark = this.mark();
const node = <nodes.MixinReference>this.create(nodes.MixinReference);
let identifier = this._parseMixinDeclarationIdentifier();
while (identifier) {
this.acceptDelim('>');
const nextId = this._parseMixinDeclarationIdentifier();
if (nextId) {
node.getNamespaces().addChild(identifier);
identifier = nextId;
} else {
break;
}
}
if (!node.setIdentifier(identifier)) {
this.restoreAtMark(mark);
return null;
}
let hasArguments = false;
if (this.accept(TokenType.ParenthesisL)) {
hasArguments = true;
if (node.getArguments().addChild(this._parseMixinArgument())) {
while (this.accept(TokenType.Comma) || this.accept(TokenType.SemiColon)) {
if (this.peek(TokenType.ParenthesisR)) {
break;
}
if (!node.getArguments().addChild(this._parseMixinArgument())) {
return this.finish(node, ParseError.ExpressionExpected);
}
}
}
if (!this.accept(TokenType.ParenthesisR)) {
return this.finish(node, ParseError.RightParenthesisExpected);
}
identifier.referenceTypes = [nodes.ReferenceType.Mixin];
} else {
identifier.referenceTypes = [nodes.ReferenceType.Mixin, nodes.ReferenceType.Rule];
}
if (this.peek(TokenType.BracketL)) {
if (!atRoot) {
this._addLookupChildren(node);
}
} else {
node.addChild(this._parsePrio());
}
if (!hasArguments && !this.peek(TokenType.SemiColon) && !this.peek(TokenType.CurlyR) && !this.peek(TokenType.EOF)) {
this.restoreAtMark(mark);
return null;
}
return this.finish(node);
}