Esempio n. 1
0
        public void GetContent(CompilerContext myCompilerContext, ParseTreeNode myParseTreeNode)
        {
            if (myParseTreeNode.ChildNodes[0].HasChildNodes())
            {

                if (myParseTreeNode.ChildNodes[0].ChildNodes[0].ChildNodes.Count > 1)
                {

                    _IndexType = ((ATypeNode)myParseTreeNode.ChildNodes[0].ChildNodes[0].ChildNodes[0].AstNode).ReferenceAndType.TypeName;
                    _IndexAttribute = ((IDNode)myParseTreeNode.ChildNodes[0].ChildNodes[0].ChildNodes[2].AstNode).IDChainDefinition;

                }

                else
                {
                    //_IndexAttribute = myParseTreeNode.ChildNodes[0].ChildNodes[0].Token.ValueString;
                    _IndexAttribute = new IDChainDefinition();
                    _IndexAttribute.AddPart(new ChainPartTypeOrAttributeDefinition(myParseTreeNode.ChildNodes[0].ChildNodes[0].Token.ValueString));
                }

            }

            if (myParseTreeNode.ChildNodes.Count > 1 && myParseTreeNode.ChildNodes[1].HasChildNodes())
            {
                _OrderDirection = myParseTreeNode.ChildNodes[1].FirstChild.Token.ValueString;
            }
            else
            {
                _OrderDirection = String.Empty;
            }

            IndexAttributeDefinition = new IndexAttributeDefinition(_IndexAttribute, _IndexType, _OrderDirection);
        }
Esempio n. 2
0
        public void GetContent(CompilerContext myCompilerContext, ParseTreeNode myParseTreeNode)
        {
            if (myParseTreeNode.ChildNodes[0].HasChildNodes())
            {

                if (myParseTreeNode.ChildNodes[0].ChildNodes[0].AstNode is IDNode)
                {
                    _IndexAttribute = (myParseTreeNode.ChildNodes[0].ChildNodes[0].AstNode as IDNode).IDChainDefinition;
                    ParsingResult.PushIExceptional((myParseTreeNode.ChildNodes[0].ChildNodes[0].AstNode as IDNode).ParsingResult);
                }
                else
                {
                    ParsingResult.PushIError(new Error_NotImplemented(new System.Diagnostics.StackTrace(true), myParseTreeNode.ChildNodes[0].ChildNodes[0].AstNode .GetType().ToString()));
                }

            }

            if (myParseTreeNode.ChildNodes.Count > 1 && myParseTreeNode.ChildNodes[1].HasChildNodes())
            {
                _OrderDirection = myParseTreeNode.ChildNodes[1].FirstChild.Token.ValueString;
            }
            else
            {
                _OrderDirection = String.Empty;
            }
            #region index attribute validation

            if (_IndexAttribute.Count() > 2)
            {
                ParsingResult.PushIError(new Error_NotImplemented(new System.Diagnostics.StackTrace(true), "Only one attribute and one optional function are allowed! e.g. Name.TOUPPER()"));
            }

            #endregion

            IndexAttributeDefinition = new IndexAttributeDefinition(_IndexAttribute, _IndexType, _OrderDirection);
        }