Пример #1
0
 public void Visit(Expression node)
 {
 }
Пример #2
0
 public void Visit(Expression node)
 {
     node.Child.Accept(this);
 }
Пример #3
0
        public void Visit(Expression node)
        {
            //if expression is literal
            if (node.Child == null)
            {
                throw new Exception("Expression should have one and only one child");
            }

            node.Child.Accept(this);

            ReferenceTables.SetValue(node, ReferenceTables.GetValue(node.Child));
        }
Пример #4
0
 public StatementUnit(Identifier identifier, Expression expression, string unitText, IStaticReturnType dataType, SourceLocation sourceLocation)
     : base(identifier, dataType, unitText, sourceLocation)
 {
     Expression = expression;
 }
Пример #5
0
        private ITerminalWrapper GetValue(Expression key)
        {
            if (key.Child is IStaticReturnType)
            {
                TerminalWrapperFactory terminalWrapperFactory = new TerminalWrapperFactory();
                return terminalWrapperFactory.CreateWrapper(key.Child as IStaticReturnType);
            }

            return GetValue(key.Child);
        }
Пример #6
0
 public void Visit(Expression node)
 {
 }
Пример #7
0
        public override void ExitExpression(QLParser.ExpressionContext context)
        {
            IList<ElementBase> children = GetChildren();
            Expression expression;

            if (children.Count() == 1)
            {
                expression = new Expression(children[0], SourceLocation.CreateFor(context));
            }
            else if (children.Count() == 3)
            {
                ElementBase leftNode = children[0];
                BinaryTreeElementBase operatorNode = (BinaryTreeElementBase)children[1];
                ElementBase rightNode = children[2];

                operatorNode.Left = leftNode;
                operatorNode.Right = rightNode;

                expression = new Expression(operatorNode, SourceLocation.CreateFor(context));
            }
            else
            {
                _astBuilderExceptions.Add(new ParserError("Expression without a child"));
                return;
            }

            AppendToAST(expression);
        }