コード例 #1
0
ファイル: FuncCallNode.cs プロジェクト: TheByte/sones
        public void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            System.Diagnostics.Debug.Assert(parseNode.Span.Start.Line == 0);

            _SourceParsedString = context.CurrentParseTree.SourceText.Substring(parseNode.Span.Start.Position, parseNode.Span.Length);

            _FuncName = parseNode.ChildNodes[0].Token.ValueString.ToUpper();

            FuncDefinition = new ChainPartFuncDefinition(); // new
            FuncDefinition.SourceParsedString = _SourceParsedString; // new
            FuncDefinition.FuncName = _FuncName; // new

            #region Retrieve the parameters

            if (parseNode.ChildNodes.Count > 1)// && parseNode.ChildNodes[1].HasChildNodes())
            {

                if (parseNode.ChildNodes[1].Token != null)
                {
                    if (parseNode.ChildNodes[1].Token.Terminal.DisplayName == "*")
                    {
                        #region asterisk

                        if (GetTypeReferenceDefinitions(context).Count != 1)
                        {
                            throw new GraphDBException(new Error_FunctionParameterInvalidReference(("It is not allowed to execute a function with an asterisk as parameter and more than one type.")));
                        }

                        var listOfReferences = GetTypeReferenceDefinitions(context);
                        var idChainDef = new IDChainDefinition(listOfReferences.First().TypeName, listOfReferences);

                        FuncDefinition.Parameters.Add(idChainDef); // new

                        #endregion
                    }
                    else
                    {
                        GenerateData(context, parseNode.ChildNodes.Skip(1).ToList());
                    }
                }
                else
                {
                    GenerateData(context, parseNode.ChildNodes.Skip(1).ToList());
                }
            }
            else if (parseNode.ChildNodes.Count > 1)
            {
                GenerateData(context, parseNode.ChildNodes.Skip(1).ToList());
            }

            #endregion
        }
コード例 #2
0
ファイル: SelectionElement.cs プロジェクト: anukat2015/sones
        public SelectionElementFunction(SelectionElement mySelectionElement, ChainPartFuncDefinition myFunction, List<AExpressionDefinition> myParameters)
        {
            this.Alias = mySelectionElement.Alias;
            this.EdgeList = mySelectionElement.EdgeList;
            this.Element = mySelectionElement.Element;
            this.Selection = mySelectionElement.Selection;
            this.IsGroupedOrAggregated = mySelectionElement.IsGroupedOrAggregated;
            this.LevelKey = mySelectionElement.LevelKey;
            this.RelatedIDChainDefinition = mySelectionElement.RelatedIDChainDefinition;

            Function = myFunction;
            Parameters = myParameters;
        }
コード例 #3
0
 public Error_AggregateNotAllowed(ChainPartFuncDefinition myAggregateNode)
 {
     Aggregate = myAggregateNode;
 }