@Test(expected = TransformException.class) public void shouldThrow_whenTransformingOtherTree() { ParserRuleContext ctx = parseTree(ScotchParser::expression, "(1, 2, 3)"); new SymbolTransformer().getSymbol(ctx); }
public Symbol getSymbol(ParserRuleContext ctx) { return ctx.accept(this) .orElseThrow(() -> new TransformException("Could not get symbol from " + ctx.getClass().getSimpleName())); }
SymbolTransformer extends ScotchParserBaseVisitor<Optional<Symbol>> { public Symbol getSymbol(ParserRuleContext ctx) { return ctx.accept(this) .orElseThrow(() -> new TransformException("Could not get symbol from " + ctx.getClass().getSimpleName())); } }
SymbolTransformer extends ScotchParserBaseVisitor<Optional<Symbol>> { public Symbol getSymbol(ParserRuleContext ctx) { return ctx.accept(this) .orElseThrow(() -> new TransformException("Could not get symbol from " + ctx.getClass().getSimpleName())); }  }
SymbolTransformer extends ScotchParserBaseVisitor<Optional<Symbol>> { public Symbol getSymbol(ParserRuleContext ctx) { return ctx.accept(this) .orElseThrow(() -> new TransformException("Could not get symbol from " + ctx.getClass().getSimpleName())); }  @Override Optional<Symbol> defaultResult(); Symbol getSymbol(ParserRuleContext ctx); @Override Optional<Symbol> visitName(NameContext ctx); @Override Optional<Symbol> visitOperatorName(OperatorNameContext ctx); @Override Optional<Symbol> visitQualifiedName(QualifiedNameContext ctx); @Override Optional<Symbol> visitQualifiedType(QualifiedTypeContext ctx); }
SymbolTransformer extends ScotchParserBaseVisitor<Optional<Symbol>> { public Symbol getSymbol(ParserRuleContext ctx) { return ctx.accept(this) .orElseThrow(() -> new TransformException("Could not get symbol from " + ctx.getClass().getSimpleName())); }  @Override Optional<Symbol> defaultResult(); Symbol getSymbol(ParserRuleContext ctx); @Override Optional<Symbol> visitName(NameContext ctx); @Override Optional<Symbol> visitOperatorName(OperatorNameContext ctx); @Override Optional<Symbol> visitQualifiedName(QualifiedNameContext ctx); @Override Optional<Symbol> visitQualifiedType(QualifiedTypeContext ctx);  }