ScoreVisitorImpl extends AbstractParseTreeVisitor<FixValue<?>> implements ScoreVisitor<FixValue<?>> { @Override public FixValue<Boolean> visitLogicalOr(LogicalOrContext ctx) { @SuppressWarnings("unchecked") final FixValue<Boolean> operand0 = (FixValue<Boolean>) visit(ctx.expr(0)); @SuppressWarnings("unchecked") final FixValue<Boolean> operand1 = (FixValue<Boolean>) visit(ctx.expr(1)); try { switch (ctx.op.getText()) { case "||": case "or": return fixValueOperations.or.apply(operand0, operand1); } } catch (final Exception ex) { errorListener .onError(String.format("Semantic error; %s at '%s'", ex.getMessage(), ctx.getText())); } return null; } ScoreVisitorImpl(SymbolResolver symbolResolver);  ScoreVisitorImpl(SymbolResolver symbolResolver, SemanticErrorListener errorListener); boolean isTrace(); void setTrace(boolean trace); @Override FixValue<?> visitAddSub(AddSubContext ctx); @Override FixValue<?> visitAnyExpression(AnyExpressionContext ctx); @Override FixValue<?> visitAssignment(AssignmentContext ctx); @Override FixValue<?> visitCharacter(CharacterContext ctx); @Override FixValue<?> visitContains(ContainsContext ctx); @Override FixValue<?> visitDateonly(DateonlyContext ctx); @Override FixValue<?> visitDecimal(DecimalContext ctx); @Override FixValue<?> visitDuration(DurationContext ctx); @Override FixValue<Boolean> visitEquality(EqualityContext ctx); @Override FixValue<?> visitExist(ExistContext ctx); @Override FixValue<?> visitIndex(IndexContext ctx); @Override FixValue<?> visitInteger(IntegerContext ctx); @SuppressWarnings("unchecked") @Override FixValue<Boolean> visitLogicalAnd(LogicalAndContext ctx); @Override FixValue<Boolean> visitLogicalNot(LogicalNotContext ctx); @Override FixValue<Boolean> visitLogicalOr(LogicalOrContext ctx); @Override FixValue<?> visitMulDiv(MulDivContext ctx); @Override FixValue<?> visitParens(ParensContext ctx); @Override FixValue<?> visitPred(PredContext ctx); @Override FixValue<?> visitQual(QualContext ctx); @Override FixValue<?> visitRange(RangeContext ctx); @Override FixValue<Boolean> visitRelational(RelationalContext ctx); @Override FixValue<?> visitString(StringContext ctx); @Override FixValue<?> visitTimeonly(TimeonlyContext ctx); @Override FixValue<?> visitTimestamp(TimestampContext ctx); @SuppressWarnings("unchecked") @Override FixValue<?> visitUnaryMinus(UnaryMinusContext ctx); @Override FixValue<?> visitVar(VarContext ctx); @Override FixValue<?> visitVariable(VariableContext ctx);  }
@Test public void testVisitLogicalOr() throws IOException { TestData[] data = new TestData[] {new TestData("33 == 4 or 5 < 4", Boolean.FALSE), new TestData("33 == 4 or 5 > 4", Boolean.TRUE),}; for (int i = 0; i < data.length; i++) { ScoreParser parser = parse(data[i].getExpression()); AnyExpressionContext ctx = parser.anyExpression(); Object expression = visitor.visitAnyExpression(ctx); FixValue<?> fixValue = (FixValue<?>) expression; assertEquals(data[i].getExpected(), fixValue.getValue()); } }