From 797cf081117f8a02fabc385b3e808e2015b6b005 Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Mon, 7 Sep 2015 11:56:14 +0100 Subject: [PATCH] Delete remaining commented out syncs. These sync calls are truly redundant - when we are in a simple alternative block, we can recover sufficiently with `recoverInline`, and so the syncs do not add anything. --- .../runtime/templates/ParserErrors/Index.stg | 1 + .../SingleTokenDeletionBeforeAlt.stg | 28 +++++++++++++++++++ .../v4/tool/templates/codegen/Java/Java.stg | 3 -- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/SingleTokenDeletionBeforeAlt.stg diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/Index.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/Index.stg index 2e07bc54c..537a7e2c1 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/Index.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/Index.stg @@ -11,6 +11,7 @@ TestTemplates ::= [ "LL2": [], "LL3": [], "LLStar": [], + "SingleTokenDeletionBeforeAlt": [], "SingleTokenDeletionBeforePredict": [], "SingleTokenDeletionBeforeLoop": [], "MultiTokenDeletionBeforeLoop": [], diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/SingleTokenDeletionBeforeAlt.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/SingleTokenDeletionBeforeAlt.stg new file mode 100644 index 000000000..6e1c942b2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/ParserErrors/SingleTokenDeletionBeforeAlt.stg @@ -0,0 +1,28 @@ +TestType() ::= "Parser" + +Options ::= [ + "Debug": false +] + +Grammar ::= [ + "T": {} +] + +Input() ::= "ac" + +Rule() ::= "a" + +Output() ::= << +>> + +Errors() ::= << +line 1:0 extraneous input 'a' expecting {'b', 'c'} +>> + +grammar(grammarName) ::= << +grammar ; +a : ('b' | 'c') +; +q : 'a' +; +>> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg index 6fd94cfed..8bd429a0b 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg @@ -469,7 +469,6 @@ CodeBlockForAlt(currentAltCodeBlock, locals, preamble, ops) ::= << LL1AltBlock(choice, preamble, alts, error) ::= << setState(); - = _input.LT(1); switch (_input.LA(1)) { @@ -483,7 +482,6 @@ default: LL1OptionalBlock(choice, alts, error) ::= << setState(); - switch (_input.LA(1)) { @@ -495,7 +493,6 @@ default: LL1OptionalBlockSingleAlt(choice, expr, alts, preamble, error, followExpr) ::= << setState(); - if () {