public void Visit(Expression node) { }
public void Visit(Expression node) { node.Child.Accept(this); }
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)); }
public StatementUnit(Identifier identifier, Expression expression, string unitText, IStaticReturnType dataType, SourceLocation sourceLocation) : base(identifier, dataType, unitText, sourceLocation) { Expression = expression; }
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); }
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); }