예제 #1
0
        private static QsiExpressionNode VisitArrayConstructorNode(ArrayConstructorNode node)
        {
            return(TreeHelper.Create <QsiInvokeExpressionNode>(n =>
            {
                n.Member.SetValue(TreeHelper.CreateFunction(PhoenixSqlKnownFunction.Array));
                n.Parameters.AddRange(node.Children.Select(Visit));

                PTree.RawNode[n] = node;
            }));
        }
        private static ExpressionNode ParseArrayInitialization(RuleContext rule)
        {
            // An array initialization is the call of a typeNode's constructor

            TypeNode             type            = ParseTreeParser.ParseType((CrawlParser.TypeContext)rule.GetChild(0));
            ArrayConstructorNode typeConstructor = CrawlSyntaxNode.ArrayConstructor(type.Interval, CrawlType.UnspecifiedType, type);
            // TypeConstructorNode is an ExpressionNode that corresponds to a TypeNode

            IEnumerable <ArgumentNode> arguments = ParseCallTail((RuleContext)rule.GetChild(1)).Select(x => CrawlSyntaxNode.Argument(x.Interval, false, x));

            return(CrawlSyntaxNode.Call(rule.SourceInterval, CrawlType.UnspecifiedType, typeConstructor, arguments));
        }