public override bool VisitExpression([NotNull] calculatorParser.ExpressionContext context) { if (context.children != null) { foreach (IParseTree c in context.children) { if (!Visit(c)) { Results[context] = false; return(false); } } } if (context.ChildCount == 0) { Results[context] = false; return(false); } bool lhs = Results[context.GetChild(0)]; if (context.ChildCount == 1) { Results[context] = lhs; return(lhs); } Results[context] = false; return(false); }
public override Expression VisitExpression([NotNull] calculatorParser.ExpressionContext context) { if (context.children != null) { foreach (IParseTree c in context.children) { Visit(c); } } if (_completeness.Results[context]) { Expression lhs = Results[context.GetChild(0)]; Results[context] = lhs; return(lhs); } Results[context] = null; return(null); }