From 65bd7548a1fffb035fc85678ba3428e4128a8f0e Mon Sep 17 00:00:00 2001 From: Sebastian Bachem Date: Tue, 19 Mar 2024 16:50:38 +0100 Subject: [PATCH] testcase for https://github.com/antlr/antlr4/pull/4557#issuecomment-2007543770 --- .../expected-tokens/java-ambiguous-parse.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 runtime-testsuite/resources/org/antlr/v4/test/runtime/expected-tokens/java-ambiguous-parse.yml diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/expected-tokens/java-ambiguous-parse.yml b/runtime-testsuite/resources/org/antlr/v4/test/runtime/expected-tokens/java-ambiguous-parse.yml new file mode 100644 index 0000000000..8dc8611cba --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/expected-tokens/java-ambiguous-parse.yml @@ -0,0 +1,18 @@ +# hypothetical complete class A) +# input: "public class Foo { public static boolean myAttribute = 42; }" +# hypothetical complete class B) +# input: "public class Foo { public static class Inner {} }" +# actual partial input (suppose the user has not typed out the full class yet: +input: "public class Foo { public static " +caret: + line: 1 + column: 34 +expected: + - int # expected with context chain: ClassDeclarationContext --parent--> MemberDeclarationContext ... + - class # expected with context chain: PrimitiveTypeContext --parent--> TypeContext --parent--> FieldDeclarationContext ... +# list incomplete, but at least both of the above should be suggested + + +# currently, I get the following instead of the expected tokens and contexts: +# tokens: @, private, static, protected, public, final, abstract, strictfp +# context chain: ClassOrInterfaceModifierContext --parent--> ModifierContext --parent--> ...