diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelsOnRuleRefStartOfAlt.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelsOnRuleRefStartOfAlt.txt new file mode 100644 index 0000000000..e33de03c85 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelsOnRuleRefStartOfAlt.txt @@ -0,0 +1,24 @@ +[notes] +Checks that this compiles; see https://github.com/antlr/antlr4/issues/2016 + +[type] +Parser + +[grammar] +grammar Test; +expression: op=NOT args+=expression + | args+=expression (op=AND args+=expression)+ + | args+=expression (op=OR args+=expression)+ + | IDENTIFIER + ; +AND : 'and' ; +OR : 'or' ; +NOT : 'not' ; +IDENTIFIER : [a-zA-Z_][a-zA-Z0-9_]* ; +WS : [ \t\r\n]+ -> skip ; + +[start] +expression + +[input] +a and b 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 6ae7057576..c29bcab557 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 @@ -855,7 +855,6 @@ _localctx.