protected virtual IAbstractDirective ProcessImportDirective(DothtmlDirectiveNode directiveNode) { var tokenizer = new BindingTokenizer(); tokenizer.Tokenize(directiveNode.ValueNode.Text); var parser = new BindingParser() { Tokens = tokenizer.Tokens }; var valueSyntaxRoot = parser.ReadDirectiveValue(); if (!parser.OnEnd()) { directiveNode.AddError($"Unexpected token: {parser.Peek()?.Text}."); } BindingParserNode alias = null; BindingParserNode name = null; if (valueSyntaxRoot is BinaryOperatorBindingParserNode) { var assigment = valueSyntaxRoot.CastTo <BinaryOperatorBindingParserNode>(); alias = assigment.FirstExpression; name = assigment.SecondExpression; } else { name = valueSyntaxRoot; } return(treeBuilder.BuildImportDirective(directiveNode, alias, name)); }
protected virtual IAbstractDirective ProcessImportDirective(DothtmlDirectiveNode directiveNode) { var valueSyntaxRoot = ParseImportDirectiveValue(directiveNode); BindingParserNode alias = null; BindingParserNode name = null; if (valueSyntaxRoot is BinaryOperatorBindingParserNode assigment) { alias = assigment.FirstExpression; name = assigment.SecondExpression; } else { name = valueSyntaxRoot; } return(treeBuilder.BuildImportDirective(directiveNode, alias, name)); }