@Test public void testGetParseTreeSentencesLineNumbers() { String configText = readResource("org/batfish/grammar/line_numbers", UTF_8); RecoveryCombinedParser cp = new RecoveryCombinedParser(configText, SETTINGS); ParserRuleContext tree = cp.parse(); ParseTreeSentences ptSentencesLineNums = ParseTreePrettyPrinter.getParseTreeSentences(tree, cp, true); assertThat(ptSentencesLineNums.getSentences().get(3), containsString("SIMPLE:'simple' line:1")); assertThat(ptSentencesLineNums.getSentences().get(9), containsString("BLOCK:'block' line:2")); assertThat(ptSentencesLineNums.getSentences().get(12), containsString("INNER:'inner' line:3")); assertThat( ptSentencesLineNums.getSentences().get(14), containsString("SIMPLE:'simple' line:3)")); assertThat(ptSentencesLineNums.getSentences().get(16), containsString("EOF:<EOF> line:5)")); }
public static ParseTreeSentences getParseTreeSentences( ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers) { ParseTreeWalker walker = new BatfishParseTreeWalker(combinedParser); ParseTreePrettyPrinter printer = new ParseTreePrettyPrinter(ctx, combinedParser, printLineNumbers); walker.walk(printer, ctx); return printer._ptSentences; }
ParseTreePrettyPrinter implements ParseTreeListener { public static ParseTreeSentences getParseTreeSentences( ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers) { ParseTreeWalker walker = new BatfishParseTreeWalker(combinedParser); ParseTreePrettyPrinter printer = new ParseTreePrettyPrinter(ctx, combinedParser, printLineNumbers); walker.walk(printer, ctx); return printer._ptSentences; } }
ParseTreePrettyPrinter implements ParseTreeListener { public static ParseTreeSentences getParseTreeSentences( ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers) { ParseTreeWalker walker = new BatfishParseTreeWalker(combinedParser); ParseTreePrettyPrinter printer = new ParseTreePrettyPrinter(ctx, combinedParser, printLineNumbers); walker.walk(printer, ctx); return printer._ptSentences; } private  ParseTreePrettyPrinter(
      ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers); }
ParseTreePrettyPrinter implements ParseTreeListener { public static ParseTreeSentences getParseTreeSentences( ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers) { ParseTreeWalker walker = new BatfishParseTreeWalker(combinedParser); ParseTreePrettyPrinter printer = new ParseTreePrettyPrinter(ctx, combinedParser, printLineNumbers); walker.walk(printer, ctx); return printer._ptSentences; } private  ParseTreePrettyPrinter(
      ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers); static ParseTreeSentences getParseTreeSentences(
      ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers); static String print(ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser); static String print(
      ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers); @Override void enterEveryRule(ParserRuleContext ctx); @Override void exitEveryRule(ParserRuleContext ctx); @Override void visitErrorNode(ErrorNode ctx); @Override void visitTerminal(TerminalNode ctx); }
ParseTreePrettyPrinter implements ParseTreeListener { public static ParseTreeSentences getParseTreeSentences( ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers) { ParseTreeWalker walker = new BatfishParseTreeWalker(combinedParser); ParseTreePrettyPrinter printer = new ParseTreePrettyPrinter(ctx, combinedParser, printLineNumbers); walker.walk(printer, ctx); return printer._ptSentences; } private  ParseTreePrettyPrinter(
      ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers); static ParseTreeSentences getParseTreeSentences(
      ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers); static String print(ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser); static String print(
      ParserRuleContext ctx, BatfishCombinedParser<?, ?> combinedParser, boolean printLineNumbers); @Override void enterEveryRule(ParserRuleContext ctx); @Override void exitEveryRule(ParserRuleContext ctx); @Override void visitErrorNode(ErrorNode ctx); @Override void visitTerminal(TerminalNode ctx);  }