public override Node VisitComparison([NotNull] TigerParser.ComparisonContext context) { ComparisonNode node; switch (context.op.Text) { case "<>": node = new NeNode(context); break; case "=": node = new EqNode(context); break; case ">=": node = new GeNode(context); break; case "<=": node = new LeNode(context); break; case ">": node = new GtNode(context); break; case "<": node = new LtNode(context); break; default: throw new NotSupportedException(); } node.Children.Add(Visit(context.expr(0))); // LEFT EXPRESSION node.Children.Add(Visit(context.expr(1))); // RIGHT EXPRESSION return(node); }
/// <summary> /// Visit a parse tree produced by the <c>Comparison</c> /// labeled alternative in <see cref="TigerParser.expr"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitComparison([NotNull] TigerParser.ComparisonContext context) { return(VisitChildren(context)); }