in src/parser/scssParser.ts [610:663]
public _parseMixinReference(): nodes.Node | null {
if (!this.peekKeyword('@include')) {
return null;
}
const node = <nodes.MixinReference>this.create(nodes.MixinReference);
this.consumeToken();
// Could be module or mixin identifier, set as mixin as default.
const firstIdent = this._parseIdent([nodes.ReferenceType.Mixin]);
if (!node.setIdentifier(firstIdent)) {
return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]);
}
// Is a module accessor.
if (!this.hasWhitespace() && this.acceptDelim('.') && !this.hasWhitespace()) {
const secondIdent = this._parseIdent([nodes.ReferenceType.Mixin]);
if (!secondIdent) {
return this.finish(node, ParseError.IdentifierExpected, [TokenType.CurlyR]);
}
const moduleToken = <nodes.Module>this.create(nodes.Module);
// Re-purpose first matched ident as identifier for module token.
firstIdent.referenceTypes = [nodes.ReferenceType.Module];
moduleToken.setIdentifier(firstIdent);
// Override identifier with second ident.
node.setIdentifier(secondIdent);
node.addChild(moduleToken);
}
if (this.accept(TokenType.ParenthesisL)) {
if (node.getArguments().addChild(this._parseFunctionArgument())) {
while (this.accept(TokenType.Comma)) {
if (this.peek(TokenType.ParenthesisR)) {
break;
}
if (!node.getArguments().addChild(this._parseFunctionArgument())) {
return this.finish(node, ParseError.ExpressionExpected);
}
}
}
if (!this.accept(TokenType.ParenthesisR)) {
return this.finish(node, ParseError.RightParenthesisExpected);
}
}
if (this.peekIdent('using') || this.peek(TokenType.CurlyL)) {
node.setContent(this._parseMixinContentDeclaration());
}
return this.finish(node);
}