From 2729f176b207074207653ddd740b20555a07eca4 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sat, 29 Mar 2014 12:18:53 -0500 Subject: [PATCH] Add option TestPerformance.REPORT_SECOND_STAGE_RETRY --- tool/test/org/antlr/v4/test/TestPerformance.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tool/test/org/antlr/v4/test/TestPerformance.java b/tool/test/org/antlr/v4/test/TestPerformance.java index 099f6be43..4e1cf1671 100644 --- a/tool/test/org/antlr/v4/test/TestPerformance.java +++ b/tool/test/org/antlr/v4/test/TestPerformance.java @@ -292,6 +292,12 @@ public class TestPerformance extends BaseTest { */ private static final boolean TIME_PARSE_ONLY = false; + /** + * When {@code true}, messages will be printed to {@link System#err} when + * the first stage (SLL) parsing resulted in a syntax error. This option is + * ignored when {@link #TWO_STAGE_PARSING} is {@code false}. + */ + private static final boolean REPORT_SECOND_STAGE_RETRY = true; private static final boolean REPORT_SYNTAX_ERRORS = true; private static final boolean REPORT_AMBIGUITIES = false; private static final boolean REPORT_FULL_CONTEXT = false; @@ -1323,7 +1329,9 @@ public class TestPerformance extends BaseTest { String sourceName = tokens.getSourceName(); sourceName = sourceName != null && !sourceName.isEmpty() ? sourceName+": " : ""; - System.err.println(sourceName+"Forced to retry with full context."); + if (REPORT_SECOND_STAGE_RETRY) { + System.err.println(sourceName+"Forced to retry with full context."); + } if (!(ex.getCause() instanceof ParseCancellationException)) { throw ex;