diff --git a/.appveyor/workflow.yml b/.appveyor/workflow.yml index 20020202ba..a33d5cc0a9 100644 --- a/.appveyor/workflow.yml +++ b/.appveyor/workflow.yml @@ -19,7 +19,7 @@ environment: matrix: fast_finish: false -version: '4.9.3-SNAPSHOT+AppVeyor.{build}' +version: '4.9.4-SNAPSHOT+AppVeyor.{build}' cache: - '%USERPROFILE%\.m2' - '%USERPROFILE%\.nuget\packages -> **\project.json' diff --git a/.circleci/config.yml b/.circleci/config.yml index 2ff1fefb66..0cd6ff197f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,6 +61,5 @@ workflows: - test_runtime: matrix: parameters: -# target: [ cpp, dotnet, swift ] - target: [ cpp, dotnet, dart ] - test-group: [ LEXER, PARSER, RECURSION ] + target: [ cpp, dotnet ] + test-group: [ LEXER, PARSER1, PARSER2, RECURSION ] diff --git a/.circleci/scripts/run-tests-cpp.sh b/.circleci/scripts/run-tests-cpp.sh index 4c8c6cea31..ff4ef339aa 100755 --- a/.circleci/scripts/run-tests-cpp.sh +++ b/.circleci/scripts/run-tests-cpp.sh @@ -10,8 +10,10 @@ pushd runtime-testsuite echo "running maven tests..." if [ $GROUP == "LEXER" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=cpp.** test - elif [ $GROUP == "PARSER" ]; then - mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=cpp.** test + elif [ $GROUP == "PARSER1" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup1" -Dtest=cpp.** test + elif [ $GROUP == "PARSER2" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup2" -Dtest=cpp.** test elif [ $GROUP == "RECURSION" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=cpp.** test else diff --git a/.circleci/scripts/run-tests-dotnet.sh b/.circleci/scripts/run-tests-dotnet.sh index 7b2f782058..c8fbceea90 100755 --- a/.circleci/scripts/run-tests-dotnet.sh +++ b/.circleci/scripts/run-tests-dotnet.sh @@ -6,8 +6,8 @@ pushd runtime-testsuite/ echo "running maven tests..." if [ $GROUP == "LEXER" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=csharp.** test - elif [ $GROUP == "PARSER" ]; then - mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=csharp.** test + elif [ $GROUP == "PARSER1" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup1" -Dtest=csharp.** test elif [ $GROUP == "RECURSION" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=csharp.** test else diff --git a/.circleci/scripts/run-tests-swift.sh b/.circleci/scripts/run-tests-swift.sh index 4c456bcb02..beccf04483 100755 --- a/.circleci/scripts/run-tests-swift.sh +++ b/.circleci/scripts/run-tests-swift.sh @@ -16,8 +16,10 @@ if [ $rc == 0 ]; then echo "running maven tests..." if [ $GROUP == "LEXER" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=swift.** test - elif [ $GROUP == "PARSER" ]; then - mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=swift.** test + elif [ $GROUP == "PARSER1" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup1" -Dtest=swift.** test + elif [ $GROUP == "PARSER2" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup2" -Dtest=swift.** test elif [ $GROUP == "RECURSION" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=swift.** test else diff --git a/.github/scripts/run-tests-cpp.sh b/.github/scripts/run-tests-cpp.sh index c246ef9aca..6472c43175 100755 --- a/.github/scripts/run-tests-cpp.sh +++ b/.github/scripts/run-tests-cpp.sh @@ -9,8 +9,10 @@ popd pushd runtime-testsuite if [ $GROUP == "LEXER" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=cpp.** test -elif [ $GROUP == "PARSER" ]; then - mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=cpp.** test +elif [ $GROUP == "PARSER1" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup1" -Dtest=cpp.** test +elif [ $GROUP == "PARSER2" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup2" -Dtest=cpp.** test elif [ $GROUP == "RECURSION" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=cpp.** test else diff --git a/.github/scripts/run-tests-dotnet.sh b/.github/scripts/run-tests-dotnet.sh index 9b9dc3e0b0..8bed61346d 100755 --- a/.github/scripts/run-tests-dotnet.sh +++ b/.github/scripts/run-tests-dotnet.sh @@ -14,8 +14,8 @@ cd runtime-testsuite/ if [ $GROUP == "LEXER" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest=csharp.** test -elif [ $GROUP == "PARSER" ]; then - mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest=csharp.** test +elif [ $GROUP == "PARSER1" ]; then + mvn -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup1" -Dtest=csharp.** test elif [ $GROUP == "RECURSION" ]; then mvn -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest=csharp.** test else diff --git a/.github/scripts/run-tests-swift.sh b/.github/scripts/run-tests-swift.sh index ec125829e5..6f027e55c1 100755 --- a/.github/scripts/run-tests-swift.sh +++ b/.github/scripts/run-tests-swift.sh @@ -37,8 +37,10 @@ if [ $rc == 0 ]; then cd runtime-testsuite/ if [ $GROUP == "LEXER" ]; then mvn -e -q -Dgroups="org.antlr.v4.test.runtime.category.LexerTests" -Dtest="swift.**" test - elif [ $GROUP == "PARSER" ]; then - mvn -e -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTests" -Dtest="swift.**" test + elif [ $GROUP == "PARSER1" ]; then + mvn -e -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup1" -Dtest="swift.**" test + elif [ $GROUP == "PARSER2" ]; then + mvn -e -q -Dgroups="org.antlr.v4.test.runtime.category.ParserTestsGroup2" -Dtest="swift.**" test elif [ $GROUP == "RECURSION" ]; then mvn -e -q -Dgroups="org.antlr.v4.test.runtime.category.LeftRecursionTests" -Dtest="swift.**" test else diff --git a/.github/workflows/macosx.yml b/.github/workflows/macosx.yml index 2f7123bd09..9a7685e327 100644 --- a/.github/workflows/macosx.yml +++ b/.github/workflows/macosx.yml @@ -14,7 +14,7 @@ jobs: matrix: # TARGET: [swift, cpp, dotnet] disabling dotnet which is unstable on M1 TARGET: [swift, cpp] - GROUP: [LEXER, PARSER, RECURSION] + GROUP: [LEXER, PARSER1, PARSER2, RECURSION] steps: - uses: actions/checkout@v2 - name: Set up JDK 1.8 diff --git a/doc/antlr-project-testing.md b/doc/antlr-project-testing.md index 126faf3fd0..4cc23b5f5e 100644 --- a/doc/antlr-project-testing.md +++ b/doc/antlr-project-testing.md @@ -6,37 +6,41 @@ Because ANTLR supports multiple target languages, the unit tests are broken into The runtime tests must be specified in a generic fashion to work across language targets. Furthermore, we must test the various targets from Java. This usually means Java launching processes to compile, say, C++ and run parsers. -As of 4.6, we use [a Java descriptor object](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/RuntimeTestDescriptor.java) to describe each runtime test. Unit tests are grouped together into categories such as [ParserExecDescriptors](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java), which has multiple nested descriptor objects, one per test. For example, here is the start of that file: - -```java -public class ParserExecDescriptors { - public static class APlus extends BaseParserTestDescriptor { - public String input = "a b c"; - public String output = "abc\n"; - public String errors = ""; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ID+ { - - }; - ID : 'a'..'z'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - } +As of 4.9.4, we use a Java descriptor file held as an [UniversalRuntimeTestDescriptor.java object](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/UniversalRuntimeTestDescriptor.java) to represent each runtime test. Each test is described with a text file with various sections and resides in a group directory; see [directories under descriptors dir](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors). Here is a sample test descriptor: + ``` +[notes] +This is a regression test for blah blah blah... + +[type] +Parser + +[grammar] +grammar T; +a : ID* { + +}; +ID : 'a'..'z'+; +WS : (' '|'\n') -> skip; + +[start] +a -The mysterious `@CommentHasStringValue` annotation is a bit of a hack that allows multi-line strings in Java. This kung fu is required so that we can use Java classes rather than StringTemplate group files to specify runtime tests (the legacy system used those and it was hard to get them right). Here are all the [Runtime test descriptors](https://github.com/antlr/antlr4/tree/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors) organized into groups. +[input] +a b c + +[output] +"""abc +""" +``` The grammars are strings representing StringTemplates (`ST` objects) so `` will get replace when the unit test file is generated (`Test.java`, `Test.cs`, ...). The `writeln` template must be defined per target. Here are all of the -[Target templates for runtime tests](https://github.com/antlr/antlr4/tree/master/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates). +[Target templates for runtime tests](https://github.com/antlr/antlr4/tree/master/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates). Use triple-quotes `"""` when whitespace matters (usually input/output sections). ## Requirements +*out of date, at least for mono* + In order to perform the tests on all target languages, you need to have the following languages installed: * `mono` (e.g., `brew install mono`) on non-Windows boxes (on Windows it uses the Microsoft .net stack). Also must [`xbuild` the runtime](https://github.com/antlr/antlr4/blob/master/doc/releasing-antlr.md) before tests will run; see below @@ -44,14 +48,14 @@ In order to perform the tests on all target languages, you need to have the foll * Python 2.7 * Python 3.6 * Go -* Swift 4 (via XCode 10.x) tested currently only osx +* Swift (via XCode) tested currently only osx * clang (for C++ target) -* + To **install into local repository** `~/.m2/repository/org/antlr`, do this: ```bash -$ export MAVEN_OPTS="-Xmx1G" # don't forget this on linux -$ mvn install -DskipTests=true # make sure all artifacts are visible on this machine +$ export MAVEN_OPTS="-Xmx1G" # don't forget this on linux +$ mvn install -DskipTests # make sure all artifacts are visible on this machine ``` Now, make sure C# runtime is built and installed locally. @@ -76,51 +80,6 @@ And the result of testing the entire subdirectory: -From `mvn`, on the commandline, you will see: - -```bash -$ cd antlr4 -$ mvn test -... -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running org.antlr.v4.test.runtime.csharp.TestCompositeLexers -dir /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeLexers-1446068612451 -Starting build /usr/bin/xbuild /p:Configuration=Release /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeLexers-1446068612451/Antlr4.Test.mono.csproj -dir /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeLexers-1446068615081 -Starting build /usr/bin/xbuild /p:Configuration=Release /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeLexers-1446068615081/Antlr4.Test.mono.csproj -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.451 sec -Running org.antlr.v4.test.runtime.csharp.TestCompositeParsers -dir /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeParsers-1446068615864 -antlr reports warnings from [-visitor, -Dlanguage=CSharp, -o, /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeParsers-1446068615864, -lib, /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeParsers-1446068615864, -encoding, UTF-8, /var/folders/s1/h3qgww1x0ks3pb30l8t1wgd80000gn/T/TestCompositeParsers-1446068615864/M.g4] -... -[INFO] ------------------------------------------------------------------------ -[INFO] Reactor Summary: -[INFO] -[INFO] ANTLR 4 ............................................ SUCCESS [ 0.445 s] -[INFO] ANTLR 4 Runtime .................................... SUCCESS [ 3.392 s] -[INFO] ANTLR 4 Tool ....................................... SUCCESS [ 1.373 s] -[INFO] ANTLR 4 Maven plugin ............................... SUCCESS [ 1.519 s] -[INFO] ANTLR 4 Runtime Test Annotations ................... SUCCESS [ 0.086 s] -[INFO] ANTLR 4 Runtime Test Processors .................... SUCCESS [ 0.014 s] -[INFO] ANTLR 4 Runtime Tests (2nd generation) ............. SUCCESS [06:39 min] -[INFO] ANTLR 4 Tool Tests ................................. SUCCESS [ 6.922 s] -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESS -[INFO] ------------------------------------------------------------------------ -[INFO] Total time: 06:53 min -[INFO] Finished at: 2016-11-16T15:36:56-08:00 -[INFO] Final Memory: 44M/458M -[INFO] ------------------------------------------------------------------------ -``` - -Note: That is actually result of running the much faster: - -```bash -mvn -Dparallel=methods -DthreadCount=4 install -``` - ## Running test subsets *From the `runtime-testsuite` dir* @@ -190,12 +149,12 @@ Use this to run tests in parallel: ```bash $ export MAVEN_OPTS="-Xmx1G" -$ mvn -Dparallel=methods -DthreadCount=4 test +$ mvn -Dparallel=classes -DthreadCount=4 test ... ------------------------------------------------------- T E S T S ------------------------------------------------------- -Concurrency config is parallel='methods', perCoreThreadCount=true, threadCount=4, useUnlimitedThreads=false +Concurrency config is parallel='classes', perCoreThreadCount=true, threadCount=4, useUnlimitedThreads=false ... ``` @@ -203,55 +162,42 @@ This can be combined with other `-D` above. ## Adding a runtime test -To add a new runtime test, first determine which [group of tests](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors) it belongs to. Then, add a new [RuntimeTestDescriptor](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/RuntimeTestDescriptor.java) implementation by subclassing one of: - -* [BaseParserTestDescriptor](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseParserTestDescriptor.java); see example [APlus](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java#L7). -* [BaseDiagnosticParserTestDescriptor](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseDiagnosticParserTestDescriptor) if you want to test parser diagnostic output; see [example output](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/FullContextParsingDescriptors.java#L16). -* [BaseCompositeParserTestDescriptor](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeParserTestDescriptor.java); see example [BringInLiteralsFromDelegate](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeParsersDescriptors.java#L11) -* [BaseLexerTestDescriptor](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseLexerTestDescriptor.java); see example [ActionPlacement](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LexerExecDescriptors.java#L12). -* [BaseCompositeLexerTestDescriptor](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeLexerTestDescriptor.java); see example [LexerDelegatorInvokesDelegateRule](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeLexersDescriptors.java#L11) +To add a new runtime test, first determine which [group (dir) of tests](https://github.com/antlr/antlr4/blob/master/runtime-testsuite/descriptors/org/antlr/v4/test/runtime/descriptors) it belongs to. Then, add a new descriptor file implementation by filling in one of these (omitting unused sections): +``` +[notes] + +[type] -Each descriptor object describes the following mandatory elements for the test: +[grammar] - * the test type - * the grammar - * the start rule - * the input text to parse or lex - * the expected output - * the expected errors +[slaveGrammar] -Your best bet is to find a similar test in the appropriate group and then copy and paste the descriptor object, creating a new nested class within the test group class. Modify the field definitions to suit your new problem. +[start] -If you need to create a whole new group of tests, it requires a new descriptor class; call it `XDescriptors`. Then, in each [target subdirectory](https://github.com/antlr/antlr4/tree/master/runtime-testsuite/test/org/antlr/v4/test/runtime), you need to create a new test rig `TestX.java` file: +[input] -```java -package org.antlr.v4.test.runtime.java; +[output] -import org.antlr.v4.test.runtime.BaseRuntimeTest; -import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +[errors] -@RunWith(Parameterized.class) -public class TestX extends BaseRuntimeTest { - public TestX(RuntimeTestDescriptor descriptor) { - super(descriptor,new BaseTest()); - } +[flags] - @Parameterized.Parameters(name="{0}") - public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(XDescriptors.class, ""); - } -} +[skip] ``` -where `` is replaced with Java, Cpp, CSharp, Python2, ... in the various subdirectories. + +Your best bet is to find a similar test in the appropriate group and then copy and paste the descriptor file, creating a new file within the test group dir. Modify the sections to suit your new problem. ### Ignoring tests -In order to turn off a test for a particular target, we need to use the `ignore` method. Given a target name, a descriptor object can decide whether to ignore the test. This is not always convenient but it is fully general and works well for the one case we have now where we have to ignore `Visitor` tests in all targets except JavaScript. +In order to turn off a test for a particular target, we need to use the `skip` section in the descriptor file. For example, the following skips PHP and Dart targets: + +``` +[skip] +PHP +Dart +``` ### Target API/library testing diff --git a/doc/building-antlr.md b/doc/building-antlr.md index 24f4bfe290..7135201624 100644 --- a/doc/building-antlr.md +++ b/doc/building-antlr.md @@ -46,7 +46,7 @@ $ if [[ "$?" != "0" ]]; then sudo apt install -y maven; fi The current maven build seems complicated to me because there is a dependency of the project on itself. The runtime tests naturally depend on the current version being available but it won't compile without the current version. Once you have the generated/installed jar, mvn builds but otherwise there's a dependency on what you are going to build. You will get this error when you try to clean but you can ignore it: ``` -[INFO] ANTLR 4 Runtime Tests (2nd generation) ............. FAILURE [ 0.073 s] +[INFO] ANTLR 4 Runtime Tests (3rd generation) ............. FAILURE [ 0.073 s] ... [ERROR] Plugin org.antlr:antlr4-maven-plugin:4.9.4-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.antlr:antlr4-maven-plugin:jar:4.9.4-SNAPSHOT -> [Help 1] ``` @@ -79,8 +79,6 @@ You should see these jars (when building 4.6-SNAPSHOT): ```bash /Users/parrt/.m2/repository/org/antlr $ find antlr4* -name '*.jar' antlr4-maven-plugin/4.6-SNAPSHOT/antlr4-maven-plugin-4.6-SNAPSHOT.jar -antlr4-runtime-test-annotation-processors/4.6-SNAPSHOT/antlr4-runtime-test-annotation-processors-4.6-SNAPSHOT.jar -antlr4-runtime-test-annotations/4.6-SNAPSHOT/antlr4-runtime-test-annotations-4.6-SNAPSHOT.jar antlr4-runtime-testsuite/4.6-SNAPSHOT/antlr4-runtime-testsuite-4.6-SNAPSHOT-tests.jar antlr4-runtime-testsuite/4.6-SNAPSHOT/antlr4-runtime-testsuite-4.6-SNAPSHOT.jar antlr4-runtime/4.6-SNAPSHOT/antlr4-runtime-4.6-SNAPSHOT.jar diff --git a/doc/releasing-antlr.md b/doc/releasing-antlr.md index db48edec29..5f999f50d3 100644 --- a/doc/releasing-antlr.md +++ b/doc/releasing-antlr.md @@ -178,7 +178,7 @@ Uploaded: https://oss.sonatype.org/content/repositories/snapshots/org/antlr/antl [INFO] ANTLR 4 Maven plugin ............................... SUCCESS [ 6.547 s] [INFO] ANTLR 4 Runtime Test Annotations ................... SUCCESS [ 2.519 s] [INFO] ANTLR 4 Runtime Test Processors .................... SUCCESS [ 2.385 s] -[INFO] ANTLR 4 Runtime Tests (2nd generation) ............. SUCCESS [ 15.276 s] +[INFO] ANTLR 4 Runtime Tests (3rd generation) ............. SUCCESS [ 15.276 s] [INFO] ANTLR 4 Tool Tests ................................. SUCCESS [ 2.233 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS diff --git a/docker/Dockerfile b/docker/Dockerfile index 26229afcba..d783bcae5b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,7 +2,7 @@ FROM adoptopenjdk/openjdk11:alpine AS builder WORKDIR /opt/antlr4 -ARG ANTLR_VERSION="4.9.3" +ARG ANTLR_VERSION="4.9.4" ARG MAVEN_OPTS="-Xmx1G" diff --git a/pom.xml b/pom.xml index 8b54b69196..90a0e656f8 100644 --- a/pom.xml +++ b/pom.xml @@ -91,8 +91,6 @@ tool antlr4-maven-plugin tool-testsuite - runtime-testsuite/annotations - runtime-testsuite/processors runtime-testsuite @@ -100,8 +98,8 @@ UTF-8 UTF-8 true - 1.7 - 1.7 + 1.8 + 1.8 diff --git a/runtime-testsuite/annotations/pom.xml b/runtime-testsuite/annotations/pom.xml deleted file mode 100644 index 0954fedfbd..0000000000 --- a/runtime-testsuite/annotations/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - 4.0.0 - - org.antlr - antlr4-master - 4.9.4-SNAPSHOT - ../../pom.xml - - antlr4-runtime-test-annotations - ANTLR 4 Runtime Test Annotations - The ANTLR 4 Runtime - - - 3.8 - - - - src - - - org.apache.felix - maven-bundle-plugin - 2.5.4 - - - bundle-manifest - process-classes - - - org.antlr.antlr4-runtime-osgi - ANTLR 4 Runtime - ANTLR - org.antlr - ${project.version} - - - - manifest - - - - - - maven-jar-plugin - 2.4 - - - - diff --git a/runtime-testsuite/annotations/src/org/antlr/v4/test/runtime/CommentHasStringValue.java b/runtime-testsuite/annotations/src/org/antlr/v4/test/runtime/CommentHasStringValue.java deleted file mode 100644 index 8b48eb1569..0000000000 --- a/runtime-testsuite/annotations/src/org/antlr/v4/test/runtime/CommentHasStringValue.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** This is just a tag that indicates the javadoc comment has a multi-line string */ -@Retention(RetentionPolicy.SOURCE) -@Target({ElementType.FIELD, ElementType.METHOD}) -@Inherited -public @interface CommentHasStringValue { -} diff --git a/runtime-testsuite/pom.xml b/runtime-testsuite/pom.xml index 9c63282cd8..223e0a7d30 100644 --- a/runtime-testsuite/pom.xml +++ b/runtime-testsuite/pom.xml @@ -13,7 +13,7 @@ 4.9.4-SNAPSHOT antlr4-runtime-testsuite - ANTLR 4 Runtime Tests (2nd generation) + ANTLR 4 Runtime Tests (3rd generation) A collection of tests for ANTLR 4 Runtime libraries. @@ -41,28 +41,16 @@ ${project.version} test - - org.antlr - antlr4-runtime-test-annotations - ${project.version} - test - - - org.antlr - antlr4-runtime-test-annotation-processors - ${project.version} - test - junit junit - 4.13.1 + 4.13.2 test org.glassfish javax.json - 1.0.4 + 1.1.4 test @@ -98,6 +86,7 @@ **/csharp/Test*.java **/java/Test*.java + **/java/api/Test*.java **/go/Test*.java **/javascript/Test*.java **/python2/Test*.java @@ -138,7 +127,11 @@ - + + org.apache.maven.plugins + maven-compiler-plugin + + diff --git a/runtime-testsuite/processors/pom.xml b/runtime-testsuite/processors/pom.xml deleted file mode 100644 index b927d3a686..0000000000 --- a/runtime-testsuite/processors/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - 4.0.0 - - org.antlr - antlr4-master - 4.9.4-SNAPSHOT - ../../pom.xml - - antlr4-runtime-test-annotation-processors - ANTLR 4 Runtime Test Processors - The ANTLR 4 Runtime - - - 3.8 - - - - - com.github.olivergondza - maven-jdk-tools-wrapper - 0.1 - - - org.antlr - antlr4-runtime-test-annotations - ${project.version} - - - - - src - - - resources - - - - - org.apache.maven.plugins - maven-compiler-plugin - - true - ${maven.compiler.source} - ${maven.compiler.target} - - -proc:none - - - - - - diff --git a/runtime-testsuite/processors/resources/META-INF/services/javax.annotation.processing.Processor b/runtime-testsuite/processors/resources/META-INF/services/javax.annotation.processing.Processor deleted file mode 100644 index 95b9a3a03a..0000000000 --- a/runtime-testsuite/processors/resources/META-INF/services/javax.annotation.processing.Processor +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. -# Use of this file is governed by the BSD 3-clause license that -# can be found in the LICENSE.txt file in the project root. -# - -org.antlr.v4.test.runtime.CommentHasStringValueProcessor diff --git a/runtime-testsuite/processors/src/org/antlr/v4/test/runtime/CommentHasStringValueProcessor.java b/runtime-testsuite/processors/src/org/antlr/v4/test/runtime/CommentHasStringValueProcessor.java deleted file mode 100644 index a22ce9fc0d..0000000000 --- a/runtime-testsuite/processors/src/org/antlr/v4/test/runtime/CommentHasStringValueProcessor.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -import com.sun.tools.javac.main.JavaCompiler; -import com.sun.tools.javac.model.JavacElements; -import com.sun.tools.javac.tree.JCTree; -import com.sun.tools.javac.tree.TreeMaker; -import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.List; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.ProcessingEnvironment; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.TypeElement; -import java.lang.reflect.Field; -import java.util.Set; - -/** - I think I figured out how to use annotation processors in maven. It's - more or less automatic and you don't even need to tell maven, with one minor - exception. The idea is to create a project for the annotation and another - for the annotation processor. Then, a project that uses the annotation - can simply set up the dependency on the other projects. You have to turn - off processing, -proc:none on the processor project itself but other than - that, java 6+ more or less tries to apply any processors it finds during - compilation. maven just works. - - Also you need a META-INF/services/javax.annotation.processing.Processor file - with "org.antlr.v4.test.runtime.CommentHasStringValueProcessor" in it. - */ -@SupportedAnnotationTypes({"org.antlr.v4.test.runtime.CommentHasStringValue"}) -@SupportedSourceVersion(SourceVersion.RELEASE_7) -public class CommentHasStringValueProcessor extends AbstractProcessor { - - protected JavacElements utilities; - protected TreeMaker treeMaker; - - @Override - public synchronized void init(ProcessingEnvironment processingEnv) { - super.init(processingEnv); -// Messager messager = processingEnv.getMessager(); -// messager.printMessage(Diagnostic.Kind.NOTE, "WOW INIT--------------------"); - utilities = (JavacElements)processingEnv.getElementUtils(); - treeMaker = TreeMaker.instance(extractContext(utilities)); - } - - private static Context extractContext(JavacElements utilities) { - try { - Field compilerField = JavacElements.class.getDeclaredField("javaCompiler"); - compilerField.setAccessible(true); - JavaCompiler compiler = (JavaCompiler)compilerField.get(utilities); - Field contextField = JavaCompiler.class.getDeclaredField("context"); - contextField.setAccessible(true); - return (Context)contextField.get(compiler); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new IllegalStateException(e); - } - } - - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { -// Messager messager = processingEnv.getMessager(); -// messager.printMessage(Diagnostic.Kind.NOTE, "PROCESS--------------------"); - Set annotatedElements = roundEnv.getElementsAnnotatedWith(CommentHasStringValue.class); - for (Element annotatedElement : annotatedElements) { - String docComment = utilities.getDocComment(annotatedElement); - JCTree.JCLiteral literal = treeMaker.Literal(docComment!=null ? docComment : ""); - JCTree elementTree = utilities.getTree(annotatedElement); - if ( elementTree instanceof JCTree.JCVariableDecl ) { - ((JCTree.JCVariableDecl)elementTree).init = literal; - } - else if ( elementTree instanceof JCTree.JCMethodDecl ) { - JCTree.JCStatement[] statements = new JCTree.JCStatement[1]; - statements[0] = treeMaker.Return(literal); - ((JCTree.JCMethodDecl)elementTree).body = treeMaker.Block(0, List.from(statements)); - } - } - return true; - } - - @Override - public SourceVersion getSupportedSourceVersion() { - return SourceVersion.latestSupported(); - } -} diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/LargeLexer.g4 b/runtime-testsuite/resources/org/antlr/v4/test/runtime/LargeLexer.g4 index 07572dae8e..4d73dc81f9 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/LargeLexer.g4 +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/LargeLexer.g4 @@ -1,5 +1,4 @@ -/** Has to be in separate file; LexerExec group loads this as resource */ -lexer grammar L; +lexer grammar L; // Has to be in separate file; LexerExec group loads this as resource WS : [ \t\r\n]+ -> skip; KW0 : 'KW' '0'; KW1 : 'KW' '1'; diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeLexers/LexerDelegatorInvokesDelegateRule.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeLexers/LexerDelegatorInvokesDelegateRule.txt new file mode 100644 index 0000000000..2113c646f6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeLexers/LexerDelegatorInvokesDelegateRule.txt @@ -0,0 +1,24 @@ +[type] +CompositeLexer + +[grammar] +lexer grammar M; +import S; +B : 'b'; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +lexer grammar S; +A : 'a' {}; +C : 'c' ; + +[input] +abc + +[output] +S.A +[@0,0:0='a',<3>,1:0] +[@1,1:1='b',<1>,1:1] +[@2,2:2='c',<4>,1:2] +[@3,3:2='',<-1>,1:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeLexers/LexerDelegatorRuleOverridesDelegate.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeLexers/LexerDelegatorRuleOverridesDelegate.txt new file mode 100644 index 0000000000..74d6098a7c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeLexers/LexerDelegatorRuleOverridesDelegate.txt @@ -0,0 +1,22 @@ +[type] +CompositeLexer + +[grammar] +lexer grammar M; +import S; +A : 'a' B {} ; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +lexer grammar S; +A : 'a' {} ; +B : 'b' {} ; + +[input] +ab + +[output] +M.A +[@0,0:1='ab',<1>,1:0] +[@1,2:1='',<-1>,1:2] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/BringInLiteralsFromDelegate.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/BringInLiteralsFromDelegate.txt new file mode 100644 index 0000000000..43b6e62243 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/BringInLiteralsFromDelegate.txt @@ -0,0 +1,23 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +s : a ; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +a : '=' 'a' {}; + +[start] +s + +[input] +=a + +[output] +"""S.a +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/CombinedImportsCombined.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/CombinedImportsCombined.txt new file mode 100644 index 0000000000..80a446ac32 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/CombinedImportsCombined.txt @@ -0,0 +1,25 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +s : x INT; + +[slaveGrammar] +parser grammar S; +tokens { A, B, C } +x : 'x' INT {}; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x 34 9 + +[output] +"""S.x +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatesSeeSameTokenType.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatesSeeSameTokenType.txt new file mode 100644 index 0000000000..5e01124c22 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatesSeeSameTokenType.txt @@ -0,0 +1,44 @@ +[notes] +The lexer will create rules to match letters a, b, c. +The associated token types A, B, C must have the same value +and all import'd parsers. Since ANTLR regenerates all imports +for use with the delegator M, it can generate the same token type +mapping in each parser: +public static final int C=6; +public static final int EOF=-1; +public static final int B=5; +public static final int WS=7; +public static final int A=4; + +[type] +CompositeParser + +[grammar] +grammar M; +import S,T; +s : x y ; // matches AA, which should be 'aa' +B : 'b' ; // another order: B, A, C +A : 'a' ; +C : 'c' ; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar T; +tokens { C, B, A } // reverse order +y : A {}; + +[slaveGrammar] +parser grammar S; +tokens { A, B, C } +x : A {}; + +[start] +s + +[input] +aa + +[output] +S.x +T.y + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorAccessesDelegateMembers.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorAccessesDelegateMembers.txt new file mode 100644 index 0000000000..d2dafa4117 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorAccessesDelegateMembers.txt @@ -0,0 +1,26 @@ +[type] +CompositeParser + +[grammar] +grammar M; // uses no rules from the import +import S; +s : 'b' {} ; // gS is import pointer +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +@parser::members { + +} +a : B; + +[start] +s + +[input] +b + +[output] +"""foo +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRule.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRule.txt new file mode 100644 index 0000000000..5b4ad9c2a1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRule.txt @@ -0,0 +1,24 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +s : a ; +B : 'b' ; // defines B from inherited token space +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +a : B {}; + +[start] +s + +[input] +b + +[output] +"""S.a +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRuleWithArgs.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRuleWithArgs.txt new file mode 100644 index 0000000000..96fa718070 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRuleWithArgs.txt @@ -0,0 +1,24 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +s : label=a[3] {} ; +B : 'b' ; // defines B from inherited token space +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +a[int x] returns [int y] : B {} {$y=1000;} ; + +[start] +s + +[input] +b + +[output] +"""S.a1000 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRuleWithReturnStruct.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRuleWithReturnStruct.txt new file mode 100644 index 0000000000..82ba1aec11 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesDelegateRuleWithReturnStruct.txt @@ -0,0 +1,24 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +s : a {} ; +B : 'b' ; // defines B from inherited token space +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +a : B {} ; + +[start] +s + +[input] +b + +[output] +"""S.ab +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesFirstVersionOfDelegateRule.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesFirstVersionOfDelegateRule.txt new file mode 100644 index 0000000000..a0bab0812d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorInvokesFirstVersionOfDelegateRule.txt @@ -0,0 +1,29 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S,T; +s : a ; +B : 'b' ; // defines B from inherited token space +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar T; +a : B {}; + +[slaveGrammar] +parser grammar S; +a : b {}; +b : B; + +[start] +s + +[input] +b + +[output] +"""S.a +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesDelegate.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesDelegate.txt new file mode 100644 index 0000000000..74d90f55bc --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesDelegate.txt @@ -0,0 +1,24 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +b : 'b'|'c'; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +a : b {}; +b : B ; + +[start] +a + +[input] +c + +[output] +"""S.a +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesDelegates.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesDelegates.txt new file mode 100644 index 0000000000..af5da57869 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesDelegates.txt @@ -0,0 +1,29 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S, T; +b : 'b'|'c' {}|B|A; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar T; +tokens { A } +b : 'b' {}; + +[slaveGrammar] +parser grammar S; +a : b {}; +b : 'b' ; + +[start] +a + +[input] +c + +[output] +M.b +S.a + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesLookaheadInDelegate.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesLookaheadInDelegate.txt new file mode 100644 index 0000000000..36725be26d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/DelegatorRuleOverridesLookaheadInDelegate.txt @@ -0,0 +1,29 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +prog : decl ; +type_ : 'int' | 'float' ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip; + +[slaveGrammar] +parser grammar S; +type_ : 'int' ; +decl : type_ ID ';' + | type_ ID init_ ';' {}; +init_ : '=' INT; + +[start] +prog + +[input] +float x = 3; + +[output] +"""JavaDecl: floatx=3; +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportLexerWithOnlyFragmentRules.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportLexerWithOnlyFragmentRules.txt new file mode 100644 index 0000000000..fc1d47f2f2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportLexerWithOnlyFragmentRules.txt @@ -0,0 +1,32 @@ +[notes] +This is a regression test for antlr/antlr4#248 "Including grammar with only +fragments breaks generated lexer". https://github.com/antlr/antlr4/issues/248 + +[type] +CompositeParser + +[grammar] +grammar Test; +import Unicode; + +program : 'test' 'test'; + +WS : (UNICODE_CLASS_Zs)+ -> skip; + +[slaveGrammar] +"""lexer grammar Unicode; + +fragment +UNICODE_CLASS_Zs : ' ' | ' ' | ' ' | '᠎' + | ' '..' ' + | ' ' | ' ' | ' ' + ; + +""" + +[start] +program + +[input] +test test + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportedGrammarWithEmptyOptions.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportedGrammarWithEmptyOptions.txt new file mode 100644 index 0000000000..00c1065461 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportedGrammarWithEmptyOptions.txt @@ -0,0 +1,21 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +s : a ; +B : 'b' ; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +options {} +a : B ; + +[start] +s + +[input] +b + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportedRuleWithAction.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportedRuleWithAction.txt new file mode 100644 index 0000000000..628cb68418 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/ImportedRuleWithAction.txt @@ -0,0 +1,20 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +s : a; +B : 'b'; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +parser grammar S; +a @after {} : B; + +[start] +s + +[input] +b + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/KeywordVSIDOrder.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/KeywordVSIDOrder.txt new file mode 100644 index 0000000000..80794c81fd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/CompositeParsers/KeywordVSIDOrder.txt @@ -0,0 +1,24 @@ +[type] +CompositeParser + +[grammar] +grammar M; +import S; +a : A {}; +A : 'abc' {}; +WS : (' '|'\n') -> skip ; + +[slaveGrammar] +lexer grammar S; +ID : 'a'..'z'+; + +[start] +a + +[input] +abc + +[output] +M.A +M.a: [@0,0:2='abc',<1>,1:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/AmbigYieldsCtxSensitiveDFA.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/AmbigYieldsCtxSensitiveDFA.txt new file mode 100644 index 0000000000..d9ab124449 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/AmbigYieldsCtxSensitiveDFA.txt @@ -0,0 +1,27 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} + : ID | ID {} ; +ID : 'a'..'z'+; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +abc + +[output] +Decision 0: +s0-ID->:s1^=>1 + +[errors] +"""line 1:0 reportAttemptingFullContext d=0 (s), input='abc' +""" + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/AmbiguityNoLoop.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/AmbiguityNoLoop.txt new file mode 100644 index 0000000000..b2c0304a41 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/AmbiguityNoLoop.txt @@ -0,0 +1,36 @@ +[type] +Parser + +[grammar] +grammar T; +prog +@init {} + : expr expr {} + | expr + ; +expr: '@' + | ID '@' + | ID + ; +ID : [a-z]+ ; +WS : [ \r\n\t]+ -> skip ; + +[start] +prog + +[input] +a@ + +[output] +"""alt 1 +""" + +[errors] +line 1:2 reportAttemptingFullContext d=0 (prog), input='a@' +line 1:2 reportAmbiguity d=0 (prog): ambigAlts={1, 2}, input='a@' +line 1:2 reportAttemptingFullContext d=1 (expr), input='a@' +line 1:2 reportContextSensitivity d=1 (expr), input='a@' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFATwoDiffInput.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFATwoDiffInput.txt new file mode 100644 index 0000000000..b07cc5e717 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFATwoDiffInput.txt @@ -0,0 +1,34 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} + : ('$' a | '@' b)+ ; +a : e ID ; +b : e INT ID ; +e : INT | ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +$ 34 abc @ 34 abc + +[output] +Decision 2: +s0-INT->s1 +s1-ID->:s2^=>1 + +[errors] +line 1:5 reportAttemptingFullContext d=2 (e), input='34abc' +line 1:2 reportContextSensitivity d=2 (e), input='34' +line 1:14 reportAttemptingFullContext d=2 (e), input='34abc' +line 1:14 reportContextSensitivity d=2 (e), input='34abc' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFA_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFA_1.txt new file mode 100644 index 0000000000..7f4b51755f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFA_1.txt @@ -0,0 +1,32 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} + : '$' a | '@' b ; +a : e ID ; +b : e INT ID ; +e : INT | ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +$ 34 abc + +[output] +Decision 1: +s0-INT->s1 +s1-ID->:s2^=>1 + +[errors] +line 1:5 reportAttemptingFullContext d=1 (e), input='34abc' +line 1:2 reportContextSensitivity d=1 (e), input='34' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFA_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFA_2.txt new file mode 100644 index 0000000000..f2cfc226b9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/CtxSensitiveDFA_2.txt @@ -0,0 +1,32 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} + : '$' a | '@' b ; +a : e ID ; +b : e INT ID ; +e : INT | ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +@ 34 abc + +[output] +Decision 1: +s0-INT->s1 +s1-ID->:s2^=>1 + +[errors] +line 1:5 reportAttemptingFullContext d=1 (e), input='34abc' +line 1:5 reportContextSensitivity d=1 (e), input='34abc' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/ExprAmbiguity_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/ExprAmbiguity_1.txt new file mode 100644 index 0000000000..291be3b0c2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/ExprAmbiguity_1.txt @@ -0,0 +1,35 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +: expr[0] {}; + expr[int _p] + : ID + ( + {5 >= $_p}? '*' expr[6] + | {4 >= $_p}? '+' expr[5] + )* + ; +ID : [a-zA-Z]+ ; +WS : [ \r\n\t]+ -> skip ; + +[start] +s + +[input] +a+b + +[output] +"""(expr a + (expr b)) +""" + +[errors] +line 1:1 reportAttemptingFullContext d=1 (expr), input='+' +line 1:2 reportContextSensitivity d=1 (expr), input='+b' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/ExprAmbiguity_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/ExprAmbiguity_2.txt new file mode 100644 index 0000000000..fd26dfa50b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/ExprAmbiguity_2.txt @@ -0,0 +1,37 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +: expr[0] {}; + expr[int _p] + : ID + ( + {5 >= $_p}? '*' expr[6] + | {4 >= $_p}? '+' expr[5] + )* + ; +ID : [a-zA-Z]+ ; +WS : [ \r\n\t]+ -> skip ; + +[start] +s + +[input] +a+b*c + +[output] +"""(expr a + (expr b * (expr c))) +""" + +[errors] +line 1:1 reportAttemptingFullContext d=1 (expr), input='+' +line 1:2 reportContextSensitivity d=1 (expr), input='+b' +line 1:3 reportAttemptingFullContext d=1 (expr), input='*' +line 1:5 reportAmbiguity d=1 (expr): ambigAlts={1, 2}, input='*c' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_1.txt new file mode 100644 index 0000000000..ee5a5ff28a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_1.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +@after {} + : '{' stat* '}' ; +stat: 'if' ID 'then' stat ('else' ID)? + | 'return' + ; +ID : 'a'..'z'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +{ if x then return } + +[output] +Decision 1: +s0-'}'->:s1=>2 + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_2.txt new file mode 100644 index 0000000000..741ab3be3a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_2.txt @@ -0,0 +1,32 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +@after {} + : '{' stat* '}' ; +stat: 'if' ID 'then' stat ('else' ID)? + | 'return' + ; +ID : 'a'..'z'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +{ if x then return else foo } + +[output] +Decision 1: +s0-'else'->:s1^=>1 + +[errors] +line 1:19 reportAttemptingFullContext d=1 (stat), input='else' +line 1:19 reportContextSensitivity d=1 (stat), input='else' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_3.txt new file mode 100644 index 0000000000..481a446624 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_3.txt @@ -0,0 +1,33 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +@after {} + : '{' stat* '}' ; +stat: 'if' ID 'then' stat ('else' ID)? + | 'return' + ; +ID : 'a'..'z'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +{ if x then if y then return else foo } + +[output] +Decision 1: +s0-'}'->:s2=>2 +s0-'else'->:s1^=>1 + +[errors] +line 1:29 reportAttemptingFullContext d=1 (stat), input='else' +line 1:38 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_4.txt new file mode 100644 index 0000000000..53278e4fc3 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_4.txt @@ -0,0 +1,34 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +@after {} + : '{' stat* '}' ; +stat: 'if' ID 'then' stat ('else' ID)? + | 'return' + ; +ID : 'a'..'z'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +{ if x then if y then return else foo else bar } + +[output] +Decision 1: +s0-'else'->:s1^=>1 + +[errors] +line 1:29 reportAttemptingFullContext d=1 (stat), input='else' +line 1:38 reportContextSensitivity d=1 (stat), input='elsefooelse' +line 1:38 reportAttemptingFullContext d=1 (stat), input='else' +line 1:38 reportContextSensitivity d=1 (stat), input='else' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_5.txt new file mode 100644 index 0000000000..7a140928fa --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_5.txt @@ -0,0 +1,36 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +@after {} + : '{' stat* '}' ; +stat: 'if' ID 'then' stat ('else' ID)? + | 'return' + ; +ID : 'a'..'z'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +{ if x then return else foo +if x then if y then return else foo } + +[output] +Decision 1: +s0-'}'->:s2=>2 +s0-'else'->:s1^=>1 + +[errors] +line 1:19 reportAttemptingFullContext d=1 (stat), input='else' +line 1:19 reportContextSensitivity d=1 (stat), input='else' +line 2:27 reportAttemptingFullContext d=1 (stat), input='else' +line 2:36 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_6.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_6.txt new file mode 100644 index 0000000000..7a140928fa --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/FullContextIF_THEN_ELSEParse_6.txt @@ -0,0 +1,36 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init {} +@after {} + : '{' stat* '}' ; +stat: 'if' ID 'then' stat ('else' ID)? + | 'return' + ; +ID : 'a'..'z'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +{ if x then return else foo +if x then if y then return else foo } + +[output] +Decision 1: +s0-'}'->:s2=>2 +s0-'else'->:s1^=>1 + +[errors] +line 1:19 reportAttemptingFullContext d=1 (stat), input='else' +line 1:19 reportContextSensitivity d=1 (stat), input='else' +line 2:27 reportAttemptingFullContext d=1 (stat), input='else' +line 2:36 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/LoopsSimulateTailRecursion.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/LoopsSimulateTailRecursion.txt new file mode 100644 index 0000000000..d708221f72 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/LoopsSimulateTailRecursion.txt @@ -0,0 +1,41 @@ +[notes] +Tests predictions for the following case involving closures. +http://www.antlr.org/wiki/display/~admin/2011/12/29/Flaw+in+ANTLR+v3+LL(*)+analysis+algorithm + +[type] +Parser + +[grammar] +grammar T; +prog +@init {} + : expr_or_assign*; +expr_or_assign + : expr '++' {} + | expr {} + ; +expr: expr_primary ('\<-' ID)?; +expr_primary + : '(' ID ')' + | ID '(' ID ')' + | ID + ; +ID : [a-z]+ ; + +[start] +prog + +[input] +a(i)<-x + +[output] +"""pass: a(i)<-x +""" + +[errors] +line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)' +line 1:7 reportAmbiguity d=3 (expr_primary): ambigAlts={2, 3}, input='a(i)<-x' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/SLLSeesEOFInLLGrammar.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/SLLSeesEOFInLLGrammar.txt new file mode 100644 index 0000000000..0908de123d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/FullContextParsing/SLLSeesEOFInLLGrammar.txt @@ -0,0 +1,32 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} + : a; +a : e ID ; +b : e INT ID ; +e : INT | ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\t'|'\n')+ -> skip ; + +[start] +s + +[input] +34 abc + +[output] +Decision 0: +s0-INT->s1 +s1-ID->:s2^=>1 + +[errors] +line 1:3 reportAttemptingFullContext d=0 (e), input='34abc' +line 1:0 reportContextSensitivity d=0 (e), input='34' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_1.txt new file mode 100644 index 0000000000..8dd1e63929 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_1.txt @@ -0,0 +1,33 @@ +[type] +Parser + +[grammar] +grammar Expr; +prog: stat ; +stat: expr NEWLINE # printExpr + | ID '=' expr NEWLINE# assign + | NEWLINE # blank + ; +expr: expr ('*'|'/') expr # MulDiv + | expr ('+'|'-') expr # AddSub + | INT # int + | ID # id + | '(' expr ')' # parens + ; + +MUL : '*' ; // assigns token name to '*' used above in grammar +DIV : '/' ; +ADD : '+' ; +SUB : '-' ; +ID : [a-zA-Z]+ ; // match identifiers +INT : [0-9]+ ;// match integers +NEWLINE:'\r'? '\n' ; // return newlines to parser (is end-statement signal) +WS : [ \t]+ -> skip ; // toss out whitespace + +[start] +prog + +[input] +"""1 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_2.txt new file mode 100644 index 0000000000..a017592e4a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_2.txt @@ -0,0 +1,33 @@ +[type] +Parser + +[grammar] +grammar Expr; +prog: stat ; +stat: expr NEWLINE # printExpr + | ID '=' expr NEWLINE# assign + | NEWLINE # blank + ; +expr: expr ('*'|'/') expr # MulDiv + | expr ('+'|'-') expr # AddSub + | INT # int + | ID # id + | '(' expr ')' # parens + ; + +MUL : '*' ; // assigns token name to '*' used above in grammar +DIV : '/' ; +ADD : '+' ; +SUB : '-' ; +ID : [a-zA-Z]+ ; // match identifiers +INT : [0-9]+ ;// match integers +NEWLINE:'\r'? '\n' ; // return newlines to parser (is end-statement signal) +WS : [ \t]+ -> skip ; // toss out whitespace + +[start] +prog + +[input] +"""a = 5 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_3.txt new file mode 100644 index 0000000000..4fc53bfe85 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_3.txt @@ -0,0 +1,33 @@ +[type] +Parser + +[grammar] +grammar Expr; +prog: stat ; +stat: expr NEWLINE # printExpr + | ID '=' expr NEWLINE# assign + | NEWLINE # blank + ; +expr: expr ('*'|'/') expr # MulDiv + | expr ('+'|'-') expr # AddSub + | INT # int + | ID # id + | '(' expr ')' # parens + ; + +MUL : '*' ; // assigns token name to '*' used above in grammar +DIV : '/' ; +ADD : '+' ; +SUB : '-' ; +ID : [a-zA-Z]+ ; // match identifiers +INT : [0-9]+ ;// match integers +NEWLINE:'\r'? '\n' ; // return newlines to parser (is end-statement signal) +WS : [ \t]+ -> skip ; // toss out whitespace + +[start] +prog + +[input] +"""b = 6 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_4.txt new file mode 100644 index 0000000000..30ee4ed389 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_4.txt @@ -0,0 +1,33 @@ +[type] +Parser + +[grammar] +grammar Expr; +prog: stat ; +stat: expr NEWLINE # printExpr + | ID '=' expr NEWLINE# assign + | NEWLINE # blank + ; +expr: expr ('*'|'/') expr # MulDiv + | expr ('+'|'-') expr # AddSub + | INT # int + | ID # id + | '(' expr ')' # parens + ; + +MUL : '*' ; // assigns token name to '*' used above in grammar +DIV : '/' ; +ADD : '+' ; +SUB : '-' ; +ID : [a-zA-Z]+ ; // match identifiers +INT : [0-9]+ ;// match integers +NEWLINE:'\r'? '\n' ; // return newlines to parser (is end-statement signal) +WS : [ \t]+ -> skip ; // toss out whitespace + +[start] +prog + +[input] +"""a+b*2 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_5.txt new file mode 100644 index 0000000000..98fba28371 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/AmbigLR_5.txt @@ -0,0 +1,33 @@ +[type] +Parser + +[grammar] +grammar Expr; +prog: stat ; +stat: expr NEWLINE # printExpr + | ID '=' expr NEWLINE# assign + | NEWLINE # blank + ; +expr: expr ('*'|'/') expr # MulDiv + | expr ('+'|'-') expr # AddSub + | INT # int + | ID # id + | '(' expr ')' # parens + ; + +MUL : '*' ; // assigns token name to '*' used above in grammar +DIV : '/' ; +ADD : '+' ; +SUB : '-' ; +ID : [a-zA-Z]+ ; // match identifiers +INT : [0-9]+ ;// match integers +NEWLINE:'\r'? '\n' ; // return newlines to parser (is end-statement signal) +WS : [ \t]+ -> skip ; // toss out whitespace + +[start] +prog + +[input] +"""(1+2)*3 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_1.txt new file mode 100644 index 0000000000..ff41bcf1ad --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_1.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a + +[output] +"""(s (declarator a) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_10.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_10.txt new file mode 100644 index 0000000000..de50a048c6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_10.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(*a)[] + +[output] +"""(s (declarator (declarator ( (declarator * (declarator a)) )) [ ]) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_2.txt new file mode 100644 index 0000000000..c1baa1504f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_2.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +*a + +[output] +"""(s (declarator * (declarator a)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_3.txt new file mode 100644 index 0000000000..3b6d324616 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_3.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +**a + +[output] +"""(s (declarator * (declarator * (declarator a))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_4.txt new file mode 100644 index 0000000000..1f642b4d39 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_4.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a[3] + +[output] +"""(s (declarator (declarator a) [ (e 3) ]) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_5.txt new file mode 100644 index 0000000000..a64c3234ec --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_5.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +b[] + +[output] +"""(s (declarator (declarator b) [ ]) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_6.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_6.txt new file mode 100644 index 0000000000..afd017fce5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_6.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(a) + +[output] +"""(s (declarator ( (declarator a) )) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_7.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_7.txt new file mode 100644 index 0000000000..d62df17019 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_7.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a[]() + +[output] +"""(s (declarator (declarator (declarator a) [ ]) ( )) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_8.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_8.txt new file mode 100644 index 0000000000..b76e2fe79b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_8.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a[][] + +[output] +"""(s (declarator (declarator (declarator a) [ ]) [ ]) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_9.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_9.txt new file mode 100644 index 0000000000..9f9a8e40ad --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Declarations_9.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : declarator EOF ; // must indicate EOF can follow +declarator + : declarator '[' e ']' + | declarator '[' ']' + | declarator '(' ')' + | '*' declarator // binds less tight than suffixes + | '(' declarator ')' + | ID + ; +e : INT ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +*a[] + +[output] +"""(s (declarator * (declarator (declarator a) [ ])) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_1.txt new file mode 100644 index 0000000000..9ccf4c3108 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_1.txt @@ -0,0 +1,25 @@ +[notes] +This is a regression test for "Support direct calls to left-recursive +rules". https://github.com/antlr/antlr4/issues/161 + +[type] +Parser + +[grammar] +grammar T; +a @after {} : a ID + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] +x + +[output] +"""(a x) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_2.txt new file mode 100644 index 0000000000..2dccce6352 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_2.txt @@ -0,0 +1,25 @@ +[notes] +This is a regression test for "Support direct calls to left-recursive +rules". https://github.com/antlr/antlr4/issues/161 + +[type] +Parser + +[grammar] +grammar T; +a @after {} : a ID + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] +x y + +[output] +"""(a (a x) y) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_3.txt new file mode 100644 index 0000000000..bc67fab7e8 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/DirectCallToLeftRecursiveRule_3.txt @@ -0,0 +1,25 @@ +[notes] +This is a regression test for "Support direct calls to left-recursive +rules". https://github.com/antlr/antlr4/issues/161 + +[type] +Parser + +[grammar] +grammar T; +a @after {} : a ID + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] +x y z + +[output] +"""(a (a (a x) y) z) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_1.txt new file mode 100644 index 0000000000..c65e2a0265 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_1.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +e : e '.' ID + | e '.' 'this' + | '-' e + | e '*' e + | e ('+'|'-') e + | INT + | ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a + +[output] +"""(s (e a) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_2.txt new file mode 100644 index 0000000000..61490cf815 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_2.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +e : e '.' ID + | e '.' 'this' + | '-' e + | e '*' e + | e ('+'|'-') e + | INT + | ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +1 + +[output] +"""(s (e 1) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_3.txt new file mode 100644 index 0000000000..355cf4ffc3 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_3.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +e : e '.' ID + | e '.' 'this' + | '-' e + | e '*' e + | e ('+'|'-') e + | INT + | ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a-1 + +[output] +"""(s (e (e a) - (e 1)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_4.txt new file mode 100644 index 0000000000..82823bc802 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_4.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +e : e '.' ID + | e '.' 'this' + | '-' e + | e '*' e + | e ('+'|'-') e + | INT + | ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a.b + +[output] +"""(s (e (e a) . b) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_5.txt new file mode 100644 index 0000000000..2fecad1eac --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_5.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +e : e '.' ID + | e '.' 'this' + | '-' e + | e '*' e + | e ('+'|'-') e + | INT + | ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a.this + +[output] +"""(s (e (e a) . this) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_6.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_6.txt new file mode 100644 index 0000000000..f36e03d1f6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_6.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +e : e '.' ID + | e '.' 'this' + | '-' e + | e '*' e + | e ('+'|'-') e + | INT + | ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +-a + +[output] +"""(s (e - (e a)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_7.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_7.txt new file mode 100644 index 0000000000..69c9a28d60 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Expressions_7.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +e : e '.' ID + | e '.' 'this' + | '-' e + | e '*' e + | e ('+'|'-') e + | INT + | ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +-a+b + +[output] +"""(s (e (e - (e a)) + (e b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_1.txt new file mode 100644 index 0000000000..f770f3cbfb --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_1.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a|b&c + +[output] +"""(s (e (e a) | (e (e b) & (e c))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_10.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_10.txt new file mode 100644 index 0000000000..05bf8eb6fc --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_10.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a.f(x)==T.c + +[output] +"""(s (e (e (e (e a) . f) ( (expressionList (e x)) )) == (e (e T) . c)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_11.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_11.txt new file mode 100644 index 0000000000..d6ff972f3f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_11.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a.f().g(x,1) + +[output] +"""(s (e (e (e (e (e a) . f) ( )) . g) ( (expressionList (e x) , (e 1)) )) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_12.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_12.txt new file mode 100644 index 0000000000..4fd312b0fd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_12.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +new T[((n-1) * x) + 1] + +[output] +"""(s (e new (typespec T) [ (e (e ( (e (e ( (e (e n) - (e 1)) )) * (e x)) )) + (e 1)) ]) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_2.txt new file mode 100644 index 0000000000..ae082d450e --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_2.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(a|b)&c + +[output] +"""(s (e (e ( (e (e a) | (e b)) )) & (e c)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_3.txt new file mode 100644 index 0000000000..da0aba1d89 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_3.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a > b + +[output] +"""(s (e (e a) > (e b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_4.txt new file mode 100644 index 0000000000..f0b826c0d5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_4.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a >> b + +[output] +"""(s (e (e a) >> (e b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_5.txt new file mode 100644 index 0000000000..c6b0b80d6e --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_5.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a=b=c + +[output] +"""(s (e (e a) = (e (e b) = (e c))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_6.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_6.txt new file mode 100644 index 0000000000..bff6065322 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_6.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a^b^c + +[output] +"""(s (e (e a) ^ (e (e b) ^ (e c))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_7.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_7.txt new file mode 100644 index 0000000000..4728aa4b50 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_7.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(T)x + +[output] +"""(s (e ( (typespec T) ) (e x)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_8.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_8.txt new file mode 100644 index 0000000000..0a5860edee --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_8.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +new A().b + +[output] +"""(s (e (e new (typespec A) ( )) . b) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_9.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_9.txt new file mode 100644 index 0000000000..1d85d91e86 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/JavaExpressions_9.txt @@ -0,0 +1,72 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow +expressionList + : e (',' e)* + ; +e : '(' e ')' + | 'this' + | 'super' + | INT + | ID + | typespec '.' 'class' + | e '.' ID + | e '.' 'this' + | e '.' 'super' '(' expressionList? ')' + | e '.' 'new' ID '(' expressionList? ')' + | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) + | e '[' e ']' + | '(' typespec ')' e + | e ('++' | '--') + | e '(' expressionList? ')' + | ('+'|'-'|'++'|'--') e + | ('~'|'!') e + | e ('*'|'/'|'%') e + | e ('+'|'-') e + | e ('\<\<' | '>>>' | '>>') e + | e ('\<=' | '>=' | '>' | '\<') e + | e 'instanceof' e + | e ('==' | '!=') e + | e '&' e + |\ e '^' e + | e '|' e + | e '&&' e + | e '||' e + | e '?' e ':' e + |\ + e ('=' + |'+=' + |'-=' + |'*=' + |'/=' + |'&=' + |'|=' + |'^=' + |'>>=' + |'>>>=' + |'\<\<=' + |'%=') e + ; +typespec + : ID + | ID '[' ']' + | 'int' + | 'int' '[' ']' + ; +ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(T)t.f() + +[output] +"""(s (e (e ( (typespec T) ) (e (e t) . f)) ( )) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_1.txt new file mode 100644 index 0000000000..d7fe95127c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_1.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e; +e : a=e op=('*'|'/') b=e {} + | INT {} + | '(' x=e ')' {} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +4 + +[output] +"""(s (e 4)) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_2.txt new file mode 100644 index 0000000000..0ca7d3fd9c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_2.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e; +e : a=e op=('*'|'/') b=e {} + | INT {} + | '(' x=e ')' {} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +1*2/3 + +[output] +"""(s (e (e (e 1) * (e 2)) / (e 3))) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_3.txt new file mode 100644 index 0000000000..20238f95a5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/LabelsOnOpSubrule_3.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e; +e : a=e op=('*'|'/') b=e {} + | INT {} + | '(' x=e ')' {} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(1/2)*3 + +[output] +"""(s (e (e ( (e (e 1) / (e 2)) )) * (e 3))) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_1.txt new file mode 100644 index 0000000000..c67586699b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_1.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#625 "Duplicate action breaks +operator precedence" https://github.com/antlr/antlr4/issues/625 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e ; +e : a=e op=('*'|'/') b=e {}{}? + | a=e op=('+'|'-') b=e {}\{}?\ + | INT {}{} + | '(' x=e ')' {}{} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +4 + +[output] +"""(s (e 4)) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_2.txt new file mode 100644 index 0000000000..61fabe9d85 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_2.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#625 "Duplicate action breaks +operator precedence" https://github.com/antlr/antlr4/issues/625 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e ; +e : a=e op=('*'|'/') b=e {}{}? + | a=e op=('+'|'-') b=e {}\{}?\ + | INT {}{} + | '(' x=e ')' {}{} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +1*2/3 + +[output] +"""(s (e (e (e 1) * (e 2)) / (e 3))) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_3.txt new file mode 100644 index 0000000000..689a65f174 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActionsPredicatesOptions_3.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#625 "Duplicate action breaks +operator precedence" https://github.com/antlr/antlr4/issues/625 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e ; +e : a=e op=('*'|'/') b=e {}{}? + | a=e op=('+'|'-') b=e {}\{}?\ + | INT {}{} + | '(' x=e ')' {}{} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +(1/2)*3 + +[output] +"""(s (e (e ( (e (e 1) / (e 2)) )) * (e 3))) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_1.txt new file mode 100644 index 0000000000..671b11ffda --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_1.txt @@ -0,0 +1,27 @@ +[notes] +This is a regression test for antlr/antlr4#625 "Duplicate action breaks +operator precedence" https://github.com/antlr/antlr4/issues/625 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e ; +e : a=e op=('*'|'/') b=e {}{} + | INT {}{} + | '(' x=e ')' {}{} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +4 + +[output] +"""(s (e 4)) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_2.txt new file mode 100644 index 0000000000..752d000ccc --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_2.txt @@ -0,0 +1,27 @@ +[notes] +This is a regression test for antlr/antlr4#625 "Duplicate action breaks +operator precedence" https://github.com/antlr/antlr4/issues/625 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e ; +e : a=e op=('*'|'/') b=e {}{} + | INT {}{} + | '(' x=e ')' {}{} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +1*2/3 + +[output] +"""(s (e (e (e 1) * (e 2)) / (e 3))) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_3.txt new file mode 100644 index 0000000000..6fc361bce3 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleActions_3.txt @@ -0,0 +1,27 @@ +[notes] +This is a regression test for antlr/antlr4#625 "Duplicate action breaks +operator precedence" https://github.com/antlr/antlr4/issues/625 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e ; +e : a=e op=('*'|'/') b=e {}{} + | INT {}{} + | '(' x=e ')' {}{} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(1/2)*3 + +[output] +"""(s (e (e ( (e (e 1) / (e 2)) )) * (e 3))) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt new file mode 100644 index 0000000000..2b31327fbd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_1.txt @@ -0,0 +1,36 @@ +[notes] +This is a regression test for antlr/antlr4#433 "Not all context accessor +methods are generated when an alternative rule label is used for multiple +alternatives". https://github.com/antlr/antlr4/issues/433 + +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v] + : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary + | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + | INT{$v = $INT.int;} # anInt + | '(' e ')' {$v = $e.v;} # parens + | left=e INC {$v = $left.v + 1;} # unary + | left=e DEC {$v = $left.v - 1;} # unary + | ID {} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +INC : '++' ; +DEC : '--' ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +4 + +[output] +"""4 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt new file mode 100644 index 0000000000..3622327c4e --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_2.txt @@ -0,0 +1,36 @@ +[notes] +This is a regression test for antlr/antlr4#433 "Not all context accessor +methods are generated when an alternative rule label is used for multiple +alternatives". https://github.com/antlr/antlr4/issues/433 + +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v] + : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary + | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + | INT{$v = $INT.int;} # anInt + | '(' e ')' {$v = $e.v;} # parens + | left=e INC {$v = $left.v + 1;} # unary + | left=e DEC {$v = $left.v - 1;} # unary + | ID {} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +INC : '++' ; +DEC : '--' ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +1+2 + +[output] +"""3 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt new file mode 100644 index 0000000000..bf885194eb --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_3.txt @@ -0,0 +1,36 @@ +[notes] +This is a regression test for antlr/antlr4#433 "Not all context accessor +methods are generated when an alternative rule label is used for multiple +alternatives". https://github.com/antlr/antlr4/issues/433 + +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v] + : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary + | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + | INT{$v = $INT.int;} # anInt + | '(' e ')' {$v = $e.v;} # parens + | left=e INC {$v = $left.v + 1;} # unary + | left=e DEC {$v = $left.v - 1;} # unary + | ID {} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +INC : '++' ; +DEC : '--' ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +1+2*3 + +[output] +"""7 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt new file mode 100644 index 0000000000..091b00455a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_4.txt @@ -0,0 +1,36 @@ +[notes] +This is a regression test for antlr/antlr4#433 "Not all context accessor +methods are generated when an alternative rule label is used for multiple +alternatives". https://github.com/antlr/antlr4/issues/433 + +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v] + : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary + | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + | INT{$v = $INT.int;} # anInt + | '(' e ')' {$v = $e.v;} # parens + | left=e INC {$v = $left.v + 1;} # unary + | left=e DEC {$v = $left.v - 1;} # unary + | ID {} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +INC : '++' ; +DEC : '--' ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +i++*3 + +[output] +"""12 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt new file mode 100644 index 0000000000..97c93d7ed1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/MultipleAlternativesWithCommonLabel_5.txt @@ -0,0 +1,36 @@ +[notes] +This is a regression test for antlr/antlr4#433 "Not all context accessor +methods are generated when an alternative rule label is used for multiple +alternatives". https://github.com/antlr/antlr4/issues/433 + +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v] + : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary + | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary + | INT{$v = $INT.int;} # anInt + | '(' e ')' {$v = $e.v;} # parens + | left=e INC {$v = $left.v + 1;} # unary + | left=e DEC {$v = $left.v - 1;} # unary + | ID {} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +INC : '++' ; +DEC : '--' ; +WS : (' '|'\n') -> skip; + +[start] +s + +[input] +(99)+3 + +[output] +"""102 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrecedenceFilterConsidersContext.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrecedenceFilterConsidersContext.txt new file mode 100644 index 0000000000..67d1bdde33 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrecedenceFilterConsidersContext.txt @@ -0,0 +1,25 @@ +[notes] +This is a regression test for antlr/antlr4#509 "Incorrect rule chosen in +unambiguous grammar". https://github.com/antlr/antlr4/issues/509 + +[type] +Parser + +[grammar] +grammar T; +prog +@after {} +: statement* EOF {}; +statement: letterA | statement letterA 'b' ; +letterA: 'a'; + +[start] +prog + +[input] +aa + +[output] +"""(prog (statement (letterA a)) (statement (letterA a)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixAndOtherAlt_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixAndOtherAlt_1.txt new file mode 100644 index 0000000000..30a38f6447 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixAndOtherAlt_1.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF ; +expr : literal + | op expr + | expr op expr + ; +literal : '-'? Integer ; +op : '+' | '-' ; +Integer : [0-9]+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +-1 + +[output] +"""(s (expr (literal - 1)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixAndOtherAlt_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixAndOtherAlt_2.txt new file mode 100644 index 0000000000..8002cdabb9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixAndOtherAlt_2.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF ; +expr : literal + | op expr + | expr op expr + ; +literal : '-'? Integer ; +op : '+' | '-' ; +Integer : [0-9]+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +-1 + -1 + +[output] +"""(s (expr (expr (literal - 1)) (op +) (expr (literal - 1))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_1.txt new file mode 100644 index 0000000000..1395ce3060 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_1.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : e {} ; +e returns [ result] + : ID '=' e1=e {$result = ;} + | ID {$result = $ID.text;} + | e1=e '+' e2=e {$result = ;} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a + +[output] +"""a +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_2.txt new file mode 100644 index 0000000000..54e8d888ff --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_2.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : e {} ; +e returns [ result] + : ID '=' e1=e {$result = ;} + | ID {$result = $ID.text;} + | e1=e '+' e2=e {$result = ;} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a+b + +[output] +"""(a+b) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_3.txt new file mode 100644 index 0000000000..034019f7bc --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/PrefixOpWithActionAndLabel_3.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : e {} ; +e returns [ result] + : ID '=' e1=e {$result = ;} + | ID {$result = $ID.text;} + | e1=e '+' e2=e {$result = ;} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a=b+c + +[output] +"""((a=b)+c) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_1.txt new file mode 100644 index 0000000000..9cf6bb44ee --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_1.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s : q=e {}; +e returns [int v] + : a=e op='*' b=e {$v = $a.v * $b.v;} # mult + | a=e '+' b=e {$v = $a.v + $b.v;} # add + | INT{$v = $INT.int;} # anInt + | '(' x=e ')' {$v = $x.v;} # parens + | x=e '++' {$v = $x.v+1;} # inc + | e '--' # dec + | ID {$v = 3;} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +4 + +[output] +"""4 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_2.txt new file mode 100644 index 0000000000..ba490abc13 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_2.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s : q=e {}; +e returns [int v] + : a=e op='*' b=e {$v = $a.v * $b.v;} # mult + | a=e '+' b=e {$v = $a.v + $b.v;} # add + | INT{$v = $INT.int;} # anInt + | '(' x=e ')' {$v = $x.v;} # parens + | x=e '++' {$v = $x.v+1;} # inc + | e '--' # dec + | ID {$v = 3;} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +1+2 + +[output] +"""3 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_3.txt new file mode 100644 index 0000000000..10b39b825b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_3.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s : q=e {}; +e returns [int v] + : a=e op='*' b=e {$v = $a.v * $b.v;} # mult + | a=e '+' b=e {$v = $a.v + $b.v;} # add + | INT{$v = $INT.int;} # anInt + | '(' x=e ')' {$v = $x.v;} # parens + | x=e '++' {$v = $x.v+1;} # inc + | e '--' # dec + | ID {$v = 3;} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +1+2*3 + +[output] +"""7 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_4.txt new file mode 100644 index 0000000000..0d7f923820 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsAndLabels_4.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +s : q=e {}; +e returns [int v] + : a=e op='*' b=e {$v = $a.v * $b.v;} # mult + | a=e '+' b=e {$v = $a.v + $b.v;} # add + | INT{$v = $INT.int;} # anInt + | '(' x=e ')' {$v = $x.v;} # parens + | x=e '++' {$v = $x.v+1;} # inc + | e '--' # dec + | ID {$v = 3;} # anID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +i++*3 + +[output] +"""12 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_1.txt new file mode 100644 index 0000000000..1cfb886d7d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_1.txt @@ -0,0 +1,34 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr (',' b+=expr)* '>>' c=expr #Send + | ID #JustId //semantic check on modifiers +; + +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; + +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +a*b + +[output] +"""(s (expr (expr a) * (expr b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_2.txt new file mode 100644 index 0000000000..06dc777133 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_2.txt @@ -0,0 +1,34 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr (',' b+=expr)* '>>' c=expr #Send + | ID #JustId //semantic check on modifiers +; + +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; + +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +a,c>>x + +[output] +"""(s (expr (expr a) , (expr c) >> (expr x)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_3.txt new file mode 100644 index 0000000000..55fc5f9d47 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_3.txt @@ -0,0 +1,34 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr (',' b+=expr)* '>>' c=expr #Send + | ID #JustId //semantic check on modifiers +; + +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; + +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +x + +[output] +"""(s (expr x) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_4.txt new file mode 100644 index 0000000000..ac7eddea64 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList1_4.txt @@ -0,0 +1,34 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr (',' b+=expr)* '>>' c=expr #Send + | ID #JustId //semantic check on modifiers +; + +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; + +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +a*b,c,x*y>>r + +[output] +"""(s (expr (expr (expr a) * (expr b)) , (expr c) , (expr (expr x) * (expr y)) >> (expr r)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_1.txt new file mode 100644 index 0000000000..83ca371af9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_1.txt @@ -0,0 +1,33 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr ',' b+=expr #Comma + | b+=expr '>>' c=expr #Send + | ID #JustId //semantic check on modifiers + ; +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +a*b + +[output] +"""(s (expr (expr a) * (expr b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_2.txt new file mode 100644 index 0000000000..e72fc249df --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_2.txt @@ -0,0 +1,33 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr ',' b+=expr #Comma + | b+=expr '>>' c=expr #Send + | ID #JustId //semantic check on modifiers + ; +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +a,c>>x + +[output] +"""(s (expr (expr (expr a) , (expr c)) >> (expr x)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_3.txt new file mode 100644 index 0000000000..0f60f72ea4 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_3.txt @@ -0,0 +1,33 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr ',' b+=expr #Comma + | b+=expr '>>' c=expr #Send + | ID #JustId //semantic check on modifiers + ; +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +x + +[output] +"""(s (expr x) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_4.txt new file mode 100644 index 0000000000..235577bbc7 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActionsList2_4.txt @@ -0,0 +1,33 @@ +[notes] +This is a regression test for antlr/antlr4#677 "labels not working in grammar +file". https://github.com/antlr/antlr4/issues/677 +This test treats `,` and `>>` as part of a single compound operator (similar +to a ternary operator). + +[type] +Parser + +[grammar] +grammar T; +s @after {} : expr EOF; +expr: + a=expr '*' a=expr #Factor + | b+=expr ',' b+=expr #Comma + | b+=expr '>>' c=expr #Send + | ID #JustId //semantic check on modifiers + ; +ID : ('a'..'z'|'A'..'Z'|'_') + ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* +; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +a*b,c,x*y>>r + +[output] +"""(s (expr (expr (expr (expr (expr a) * (expr b)) , (expr c)) , (expr (expr x) * (expr y))) >> (expr r)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_1.txt new file mode 100644 index 0000000000..2bf914ac7d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_1.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v, ignored] + : a=e '*' b=e {$v = $a.v * $b.v;} + | a=e '+' b=e {$v = $a.v + $b.v;} + | INT {$v = $INT.int;} + | '(' x=e ')' {$v = $x.v;} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +4 + +[output] +"""4 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_2.txt new file mode 100644 index 0000000000..268582148a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_2.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v, ignored] + : a=e '*' b=e {$v = $a.v * $b.v;} + | a=e '+' b=e {$v = $a.v + $b.v;} + | INT {$v = $INT.int;} + | '(' x=e ')' {$v = $x.v;} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +1+2 + +[output] +"""3 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_3.txt new file mode 100644 index 0000000000..67b00890d7 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_3.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v, ignored] + : a=e '*' b=e {$v = $a.v * $b.v;} + | a=e '+' b=e {$v = $a.v + $b.v;} + | INT {$v = $INT.int;} + | '(' x=e ')' {$v = $x.v;} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +1+2*3 + +[output] +"""7 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_4.txt new file mode 100644 index 0000000000..9f9fb785e0 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/ReturnValueAndActions_4.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : e {}; +e returns [int v, ignored] + : a=e '*' b=e {$v = $a.v * $b.v;} + | a=e '+' b=e {$v = $a.v + $b.v;} + | INT {$v = $INT.int;} + | '(' x=e ')' {$v = $x.v;} + ; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +(1+2)*3 + +[output] +"""9 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/SemPred.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/SemPred.txt new file mode 100644 index 0000000000..f932b83d85 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/SemPred.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : a ; +a : a {}? ID + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x y z + +[output] +"""(s (a (a (a x) y) z)) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/SemPredFailOption.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/SemPredFailOption.txt new file mode 100644 index 0000000000..5d3008e855 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/SemPredFailOption.txt @@ -0,0 +1,26 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : a ; +a : a ID {}?\ + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x y z + +[output] +"""(s (a (a x) y z)) +""" + +[errors] +"""line 1:4 rule a custom message +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_1.txt new file mode 100644 index 0000000000..16aa2d233d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_1.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : a ; +a : a ID + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x + +[output] +"""(s (a x)) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_2.txt new file mode 100644 index 0000000000..bf9ec64e90 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_2.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : a ; +a : a ID + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x y + +[output] +"""(s (a (a x) y)) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_3.txt new file mode 100644 index 0000000000..3f95b714d9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/Simple_3.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : a ; +a : a ID + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x y z + +[output] +"""(s (a (a (a x) y) z)) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_1.txt new file mode 100644 index 0000000000..d2e0701e9a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_1.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a + +[output] +"""(s (e a) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_2.txt new file mode 100644 index 0000000000..58d81f3c2f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_2.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a+b + +[output] +"""(s (e (e a) + (e b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_3.txt new file mode 100644 index 0000000000..bdb50285a4 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_3.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a*b + +[output] +"""(s (e (e a) * (e b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_4.txt new file mode 100644 index 0000000000..390e126179 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_4.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b:c + +[output] +"""(s (e (e a) ? (e b) : (e c)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_5.txt new file mode 100644 index 0000000000..b9fe9d5aeb --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_5.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a=b=c + +[output] +"""(s (e (e a) = (e (e b) = (e c))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_6.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_6.txt new file mode 100644 index 0000000000..a6ccc3e3ed --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_6.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b+c:d + +[output] +"""(s (e (e a) ? (e (e b) + (e c)) : (e d)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_7.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_7.txt new file mode 100644 index 0000000000..d1c0d16850 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_7.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b=c:d + +[output] +"""(s (e (e a) ? (e (e b) = (e c)) : (e d)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_8.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_8.txt new file mode 100644 index 0000000000..37e9e3d824 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_8.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a? b?c:d : e + +[output] +"""(s (e (e a) ? (e (e b) ? (e c) : (e d)) : (e e)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_9.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_9.txt new file mode 100644 index 0000000000..3f6796a856 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExprExplicitAssociativity_9.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#542 "First alternative cannot +be right-associative". https://github.com/antlr/antlr4/issues/542 + +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match +e :\ e '*' e + |\ e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b: c?d:e + +[output] +"""(s (e (e a) ? (e b) : (e (e c) ? (e d) : (e e))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_1.txt new file mode 100644 index 0000000000..2a6f3017a1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_1.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a + +[output] +"""(s (e a) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_2.txt new file mode 100644 index 0000000000..7922cdb982 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_2.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a+b + +[output] +"""(s (e (e a) + (e b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_3.txt new file mode 100644 index 0000000000..484e8baee3 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_3.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a*b + +[output] +"""(s (e (e a) * (e b)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_4.txt new file mode 100644 index 0000000000..0bc4b86d15 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_4.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b:c + +[output] +"""(s (e (e a) ? (e b) : (e c)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_5.txt new file mode 100644 index 0000000000..1912cc1c2d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_5.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a=b=c + +[output] +"""(s (e (e a) = (e (e b) = (e c))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_6.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_6.txt new file mode 100644 index 0000000000..a4af8ecbd5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_6.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b+c:d + +[output] +"""(s (e (e a) ? (e (e b) + (e c)) : (e d)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_7.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_7.txt new file mode 100644 index 0000000000..673f87858a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_7.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b=c:d + +[output] +"""(s (e (e a) ? (e (e b) = (e c)) : (e d)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_8.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_8.txt new file mode 100644 index 0000000000..84fe9d2b84 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_8.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a? b?c:d : e + +[output] +"""(s (e (e a) ? (e (e b) ? (e c) : (e d)) : (e e)) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_9.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_9.txt new file mode 100644 index 0000000000..661bdefd90 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/TernaryExpr_9.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match +e : e '*' e + | e '+' e + |\ e '?' e ':' e + |\ e '=' e + | ID + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a?b: c?d:e + +[output] +"""(s (e (e a) ? (e b) : (e (e c) ? (e d) : (e e))) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/WhitespaceInfluence_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/WhitespaceInfluence_1.txt new file mode 100644 index 0000000000..afbd927b97 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/WhitespaceInfluence_1.txt @@ -0,0 +1,64 @@ +[notes] +This is a regression test for #239 "recoursive parser using implicit tokens +ignore white space lexer rule". https://github.com/antlr/antlr4/issues/239 + +[type] +Parser + +[grammar] +grammar Expr; +prog : expression EOF; +expression + : ID '(' expression (',' expression)* ')' # doFunction + | '(' expression ')'# doParenthesis + | '!' expression # doNot + | '-' expression # doNegate + | '+' expression # doPositiv + | expression '^' expression # doPower + | expression '*' expression # doMultipy + | expression '/' expression # doDivide + | expression '%' expression # doModulo + | expression '-' expression # doMinus + | expression '+' expression # doPlus + | expression '=' expression # doEqual + | expression '!=' expression # doNotEqual + | expression '>' expression # doGreather + | expression '>=' expression # doGreatherEqual + | expression '\<' expression # doLesser + | expression '\<=' expression # doLesserEqual + | expression K_IN '(' expression (',' expression)* ')' # doIn + | expression ( '&' | K_AND) expression# doAnd + | expression ( '|' | K_OR) expression # doOr + | '[' expression (',' expression)* ']'# newArray + | K_TRUE # newTrueBoolean + | K_FALSE # newFalseBoolean + | NUMBER # newNumber + | DATE # newDateTime + | ID # newIdentifier + | SQ_STRING# newString + | K_NULL # newNull + ; + +// Fragments +fragment DIGIT : '0' .. '9'; +fragment UPPER : 'A' .. 'Z'; +fragment LOWER : 'a' .. 'z'; +fragment LETTER : LOWER | UPPER; +fragment WORD : LETTER | '_' | '$' | '#' | '.'; +fragment ALPHANUM : WORD | DIGIT; + +// Tokens +ID : LETTER ALPHANUM*; +NUMBER : DIGIT+ ('.' DIGIT+)? (('e'|'E')('+'|'-')? DIGIT+)?; +DATE : '\'' DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT (' ' DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT ('.' DIGIT+)?)? '\''; +SQ_STRING : '\'' ('\'\'' | ~'\'')* '\''; +DQ_STRING : '"' ('\\\\"' | ~'"')* '"'; +WS : [ \t\n\r]+ -> skip ; +COMMENTS : ('/*' .*? '*' '/' | '//' ~'\n'* '\n' ) -> skip; + +[start] +prog + +[input] +Test(1,3) + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/WhitespaceInfluence_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/WhitespaceInfluence_2.txt new file mode 100644 index 0000000000..345ae30982 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LeftRecursion/WhitespaceInfluence_2.txt @@ -0,0 +1,64 @@ +[notes] +This is a regression test for #239 "recoursive parser using implicit tokens +ignore white space lexer rule". https://github.com/antlr/antlr4/issues/239 + +[type] +Parser + +[grammar] +grammar Expr; +prog : expression EOF; +expression + : ID '(' expression (',' expression)* ')' # doFunction + | '(' expression ')'# doParenthesis + | '!' expression # doNot + | '-' expression # doNegate + | '+' expression # doPositiv + | expression '^' expression # doPower + | expression '*' expression # doMultipy + | expression '/' expression # doDivide + | expression '%' expression # doModulo + | expression '-' expression # doMinus + | expression '+' expression # doPlus + | expression '=' expression # doEqual + | expression '!=' expression # doNotEqual + | expression '>' expression # doGreather + | expression '>=' expression # doGreatherEqual + | expression '\<' expression # doLesser + | expression '\<=' expression # doLesserEqual + | expression K_IN '(' expression (',' expression)* ')' # doIn + | expression ( '&' | K_AND) expression# doAnd + | expression ( '|' | K_OR) expression # doOr + | '[' expression (',' expression)* ']'# newArray + | K_TRUE # newTrueBoolean + | K_FALSE # newFalseBoolean + | NUMBER # newNumber + | DATE # newDateTime + | ID # newIdentifier + | SQ_STRING# newString + | K_NULL # newNull + ; + +// Fragments +fragment DIGIT : '0' .. '9'; +fragment UPPER : 'A' .. 'Z'; +fragment LOWER : 'a' .. 'z'; +fragment LETTER : LOWER | UPPER; +fragment WORD : LETTER | '_' | '$' | '#' | '.'; +fragment ALPHANUM : WORD | DIGIT; + +// Tokens +ID : LETTER ALPHANUM*; +NUMBER : DIGIT+ ('.' DIGIT+)? (('e'|'E')('+'|'-')? DIGIT+)?; +DATE : '\'' DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT (' ' DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT ('.' DIGIT+)?)? '\''; +SQ_STRING : '\'' ('\'\'' | ~'\'')* '\''; +DQ_STRING : '"' ('\\\\"' | ~'"')* '"'; +WS : [ \t\n\r]+ -> skip ; +COMMENTS : ('/*' .*? '*' '/' | '//' ~'\n'* '\n' ) -> skip; + +[start] +prog + +[input] +Test(1, 3) + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/DFAToATNThatFailsBackToDFA.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/DFAToATNThatFailsBackToDFA.txt new file mode 100644 index 0000000000..ad24098e29 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/DFAToATNThatFailsBackToDFA.txt @@ -0,0 +1,20 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'ab' ; +B : 'abc' ; + +[input] +ababx + +[output] +[@0,0:1='ab',<1>,1:0] +[@1,2:3='ab',<1>,1:2] +[@2,5:4='',<-1>,1:5] + +[errors] +"""line 1:4 token recognition error at: 'x' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/DFAToATNThatMatchesThenFailsInATN.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/DFAToATNThatMatchesThenFailsInATN.txt new file mode 100644 index 0000000000..817f7d4cdc --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/DFAToATNThatMatchesThenFailsInATN.txt @@ -0,0 +1,21 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'ab' ; +B : 'abc' ; +C : 'abcd' ; + +[input] +ababcx + +[output] +[@0,0:1='ab',<1>,1:0] +[@1,2:4='abc',<2>,1:2] +[@2,6:5='',<-1>,1:6] + +[errors] +"""line 1:5 token recognition error at: 'x' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/EnforcedGreedyNestedBraces_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/EnforcedGreedyNestedBraces_1.txt new file mode 100644 index 0000000000..d5edc22ed0 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/EnforcedGreedyNestedBraces_1.txt @@ -0,0 +1,15 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ACTION : '{' (ACTION | ~[{}])* '}'; +WS : [ \r\n\t]+ -> skip; + +[input] +{ { } } + +[output] +[@0,0:6='{ { } }',<1>,1:0] +[@1,7:6='',<-1>,1:7] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/EnforcedGreedyNestedBraces_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/EnforcedGreedyNestedBraces_2.txt new file mode 100644 index 0000000000..aa251242af --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/EnforcedGreedyNestedBraces_2.txt @@ -0,0 +1,19 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ACTION : '{' (ACTION | ~[{}])* '}'; +WS : [ \r\n\t]+ -> skip; + +[input] +{ { } + +[output] +"""[@0,5:4='',<-1>,1:5] +""" + +[errors] +"""line 1:0 token recognition error at: '{ { }' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/ErrorInMiddle.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/ErrorInMiddle.txt new file mode 100644 index 0000000000..e70c91b1a1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/ErrorInMiddle.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'abc' ; + +[input] +abx + +[output] +"""[@0,3:2='',<-1>,1:3] +""" + +[errors] +"""line 1:0 token recognition error at: 'abx' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharAtStart.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharAtStart.txt new file mode 100644 index 0000000000..b8291b8191 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharAtStart.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'a' 'b' ; + +[input] +x + +[output] +"""[@0,1:0='',<-1>,1:1] +""" + +[errors] +"""line 1:0 token recognition error at: 'x' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharAtStartAfterDFACache.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharAtStartAfterDFACache.txt new file mode 100644 index 0000000000..ae21517319 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharAtStartAfterDFACache.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'a' 'b' ; + +[input] +abx + +[output] +[@0,0:1='ab',<1>,1:0] +[@1,3:2='',<-1>,1:3] + +[errors] +"""line 1:2 token recognition error at: 'x' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharInToken.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharInToken.txt new file mode 100644 index 0000000000..3e0b509f07 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharInToken.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'a' 'b' ; + +[input] +ax + +[output] +"""[@0,2:1='',<-1>,1:2] +""" + +[errors] +"""line 1:0 token recognition error at: 'ax' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharInTokenAfterDFACache.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharInTokenAfterDFACache.txt new file mode 100644 index 0000000000..9d014e8d9d --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/InvalidCharInTokenAfterDFACache.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'a' 'b' ; + +[input] +abax + +[output] +[@0,0:1='ab',<1>,1:0] +[@1,4:3='',<-1>,1:4] + +[errors] +"""line 1:2 token recognition error at: 'ax' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/LexerExecDFA.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/LexerExecDFA.txt new file mode 100644 index 0000000000..16aa4fdbd2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/LexerExecDFA.txt @@ -0,0 +1,25 @@ +[notes] +This is a regression test for #45 "NullPointerException in LexerATNSimulator.execDFA". https://github.com/antlr/antlr4/issues/46 + +[type] +Lexer + +[grammar] +lexer grammar L; +COLON : ':' ; +PTR : '->' ; +ID : [a-z]+; + +[input] +x : x + +[output] +[@0,0:0='x',<3>,1:0] +[@1,2:2=':',<1>,1:2] +[@2,4:4='x',<3>,1:4] +[@3,5:4='',<-1>,1:5] + +[errors] +line 1:1 token recognition error at: ' ' +line 1:3 token recognition error at: ' ' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/StringsEmbeddedInActions_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/StringsEmbeddedInActions_1.txt new file mode 100644 index 0000000000..1c2b65214b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/StringsEmbeddedInActions_1.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ACTION2 : '[' (STRING | ~'"')*? ']'; +STRING : '"' ('\\\\' '"' | .)*? '"'; +WS : [ \t\r\n]+ -> skip; + +[input] +["foo"] + +[output] +[@0,0:6='["foo"]',<1>,1:0] +[@1,7:6='',<-1>,1:7] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/StringsEmbeddedInActions_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/StringsEmbeddedInActions_2.txt new file mode 100644 index 0000000000..2ce4047472 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerErrors/StringsEmbeddedInActions_2.txt @@ -0,0 +1,20 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ACTION2 : '[' (STRING | ~'"')*? ']'; +STRING : '"' ('\\\\' '"' | .)*? '"'; +WS : [ \t\r\n]+ -> skip; + +[input] +["foo] + +[output] +"""[@0,6:5='',<-1>,1:6] +""" + +[errors] +"""line 1:0 token recognition error at: '["foo]' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/ActionPlacement.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/ActionPlacement.txt new file mode 100644 index 0000000000..8ec87f8f5a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/ActionPlacement.txt @@ -0,0 +1,24 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : ({} 'a' +| {} + 'a' {} + 'b' {}) + {} ; +WS : (' '|'\n') -> skip ; +J : .; + +[input] +ab + +[output] +stuff0: +stuff1: a +stuff2: ab +ab +[@0,0:1='ab',<1>,1:0] +[@1,2:1='',<-1>,1:2] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSet.txt new file mode 100644 index 0000000000..d4ba73ee7c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSet.txt @@ -0,0 +1,19 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : '0'..'9'+ {} ; +WS : [ \n\\u000D] -> skip ; + +[input] +"""34 + 34""" + +[output] +I +I +[@0,0:1='34',<1>,1:0] +[@1,4:5='34',<1>,2:1] +[@2,6:5='',<-1>,2:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetInSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetInSet.txt new file mode 100644 index 0000000000..84c2bd9fa1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetInSet.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : (~[ab \\n]|'a') {} ; +WS : [ \n\\u000D]+ -> skip ; + +[input] +a x + +[output] +I +I +[@0,0:0='a',<1>,1:0] +[@1,2:2='x',<1>,1:2] +[@2,3:2='',<-1>,1:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetNot.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetNot.txt new file mode 100644 index 0000000000..a68132b4c7 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetNot.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : ~[ab \n] ~[ \ncd]* {} ; +WS : [ \n\\u000D]+ -> skip ; + +[input] +xaf + +[output] +I +[@0,0:2='xaf',<1>,1:0] +[@1,3:2='',<-1>,1:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetPlus.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetPlus.txt new file mode 100644 index 0000000000..24f4585a67 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetPlus.txt @@ -0,0 +1,19 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : '0'..'9'+ {} ; +WS : [ \n\\u000D]+ -> skip ; + +[input] +"""34 + 34""" + +[output] +I +I +[@0,0:1='34',<1>,1:0] +[@1,4:5='34',<1>,2:1] +[@2,6:5='',<-1>,2:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetRange.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetRange.txt new file mode 100644 index 0000000000..b65a50ce60 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetRange.txt @@ -0,0 +1,25 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : [0-9]+ {} ; +ID : [a-zA-Z] [a-zA-Z0-9]* {} ; +WS : [ \n\\u0009\r]+ -> skip ; + +[input] +"""34 + 34 a2 abc + """ + +[output] +I +I +ID +ID +[@0,0:1='34',<1>,1:0] +[@1,4:5='34',<1>,2:1] +[@2,7:8='a2',<2>,2:4] +[@3,10:12='abc',<2>,2:7] +[@4,18:17='',<-1>,3:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithEscapedChar.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithEscapedChar.txt new file mode 100644 index 0000000000..3ed621601f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithEscapedChar.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +DASHBRACK : [\\-\]]+ {} ; +WS : [ \n]+ -> skip ; + +[input] +"""- ] """ + +[output] +DASHBRACK +DASHBRACK +[@0,0:0='-',<1>,1:0] +[@1,2:2=']',<1>,1:2] +[@2,4:3='',<-1>,1:4] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithMissingEscapeChar.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithMissingEscapeChar.txt new file mode 100644 index 0000000000..48ef9bc3f7 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithMissingEscapeChar.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : [0-9]+ {} ; +WS : [ \n]+ -> skip ; + +[input] +"""34 """ + +[output] +I +[@0,0:1='34',<1>,1:0] +[@1,3:2='',<-1>,1:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithQuote1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithQuote1.txt new file mode 100644 index 0000000000..82e1f42a6a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithQuote1.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : ["a-z]+ {} ; +WS : [ \n\t]+ -> skip ; + +[input] +b"a + +[output] +A +[@0,0:2='b"a',<1>,1:0] +[@1,3:2='',<-1>,1:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithQuote2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithQuote2.txt new file mode 100644 index 0000000000..9af4d641d2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/CharSetWithQuote2.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : ["\\\\ab]+ {} ; +WS : [ \n\t]+ -> skip ; + +[input] +b"\a + +[output] +A +[@0,0:3='b"\a',<1>,1:0] +[@1,4:3='',<-1>,1:4] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFByItself.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFByItself.txt new file mode 100644 index 0000000000..08232bd435 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFByItself.txt @@ -0,0 +1,15 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +DONE : EOF ; +A : 'a'; + +[input] + + +[output] +[@0,0:-1='',<1>,1:0] +[@1,0:-1='',<-1>,1:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFSuffixInFirstRule_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFSuffixInFirstRule_1.txt new file mode 100644 index 0000000000..8ad081813e --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFSuffixInFirstRule_1.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'a' EOF ; +B : 'a'; +C : 'c'; + +[input] + + +[output] +"""[@0,0:-1='',<-1>,1:0] +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFSuffixInFirstRule_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFSuffixInFirstRule_2.txt new file mode 100644 index 0000000000..cc9383f7e5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EOFSuffixInFirstRule_2.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : 'a' EOF ; +B : 'a'; +C : 'c'; + +[input] +a + +[output] +[@0,0:0='a',<1>,1:0] +[@1,1:0='',<-1>,1:1] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EscapeTargetStringLiteral.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EscapeTargetStringLiteral.txt new file mode 100644 index 0000000000..33e7de1c43 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/EscapeTargetStringLiteral.txt @@ -0,0 +1,15 @@ +[notes] +This is a regression test for antlr/antlr4#2709 "PHP target generates +invalid output when $ is used as part of the literal in lexer rule" +https://github.com/antlr/antlr4/issues/2709 + +[type] +Lexer + +[grammar] +lexer grammar L; +ACTION_WITH_DOLLAR: '$ACTION'; + +[output] +"""[@0,0:-1='',<-1>,1:0] +""" diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyClosure.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyClosure.txt new file mode 100644 index 0000000000..960b66ca62 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyClosure.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '//' .*? '\n' CMT*; +WS : (' '|'\t')+; + +[input] +//blah +//blah + +[output] +[@0,0:13='//blah\n//blah\n',<1>,1:0] +[@1,14:13='',<-1>,3:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyConfigs.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyConfigs.txt new file mode 100644 index 0000000000..300d97bbcc --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyConfigs.txt @@ -0,0 +1,17 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : ('a' | 'ab') {} ; +WS : (' '|'\n') -> skip ; +J : .; + +[input] +ab + +[output] +ab +[@0,0:1='ab',<1>,1:0] +[@1,2:1='',<-1>,1:2] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyOptional.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyOptional.txt new file mode 100644 index 0000000000..5ece832975 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyOptional.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '//' .*? '\n' CMT?; +WS : (' '|'\t')+; + +[input] +//blah +//blah + +[output] +[@0,0:13='//blah\n//blah\n',<1>,1:0] +[@1,14:13='',<-1>,3:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyPositiveClosure.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyPositiveClosure.txt new file mode 100644 index 0000000000..f031174d83 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/GreedyPositiveClosure.txt @@ -0,0 +1,16 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : ('//' .*? '\n')+; +WS : (' '|'\t')+; + +[input] +//blah +//blah + +[output] +[@0,0:13='//blah\n//blah\n',<1>,1:0] +[@1,14:13='',<-1>,3:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/HexVsID.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/HexVsID.txt new file mode 100644 index 0000000000..024bd4c043 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/HexVsID.txt @@ -0,0 +1,32 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +HexLiteral : '0' ('x'|'X') HexDigit+ ; +DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) ; +FloatingPointLiteral : ('0x' | '0X') HexDigit* ('.' HexDigit*)? ; +DOT : '.' ; +ID : 'a'..'z'+ ; +fragment HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ; +WS : (' '|'\n')+; + +[input] +x 0 1 a.b a.l + +[output] +[@0,0:0='x',<5>,1:0] +[@1,1:1=' ',<6>,1:1] +[@2,2:2='0',<2>,1:2] +[@3,3:3=' ',<6>,1:3] +[@4,4:4='1',<2>,1:4] +[@5,5:5=' ',<6>,1:5] +[@6,6:6='a',<5>,1:6] +[@7,7:7='.',<4>,1:7] +[@8,8:8='b',<5>,1:8] +[@9,9:9=' ',<6>,1:9] +[@10,10:10='a',<5>,1:10] +[@11,11:11='.',<4>,1:11] +[@12,12:12='l',<5>,1:12] +[@13,13:12='',<-1>,1:13] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/KeywordID.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/KeywordID.txt new file mode 100644 index 0000000000..d5dba55a83 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/KeywordID.txt @@ -0,0 +1,22 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +KEND : 'end' ; // has priority +ID : 'a'..'z'+ ; +WS : (' '|'\n')+; + +[input] +end eend ending a + +[output] +[@0,0:2='end',<1>,1:0] +[@1,3:3=' ',<3>,1:3] +[@2,4:7='eend',<2>,1:4] +[@3,8:8=' ',<3>,1:8] +[@4,9:14='ending',<2>,1:9] +[@5,15:15=' ',<3>,1:15] +[@6,16:16='a',<2>,1:16] +[@7,17:16='',<-1>,1:17] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/LargeLexer.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/LargeLexer.txt new file mode 100644 index 0000000000..3f0bf49862 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/LargeLexer.txt @@ -0,0 +1,4018 @@ +[notes] +This is a regression test for antlr/antlr4#76 "Serialized ATN strings +should be split when longer than 2^16 bytes (class file limitation)" +https://github.com/antlr/antlr4/issues/76 + +[type] +Lexer + +[grammar] +lexer grammar L; // Has to be in separate file; LexerExec group loads this as resource +WS : [ \t\r\n]+ -> skip; +KW0 : 'KW' '0'; +KW1 : 'KW' '1'; +KW2 : 'KW' '2'; +KW3 : 'KW' '3'; +KW4 : 'KW' '4'; +KW5 : 'KW' '5'; +KW6 : 'KW' '6'; +KW7 : 'KW' '7'; +KW8 : 'KW' '8'; +KW9 : 'KW' '9'; +KW10 : 'KW' '10'; +KW11 : 'KW' '11'; +KW12 : 'KW' '12'; +KW13 : 'KW' '13'; +KW14 : 'KW' '14'; +KW15 : 'KW' '15'; +KW16 : 'KW' '16'; +KW17 : 'KW' '17'; +KW18 : 'KW' '18'; +KW19 : 'KW' '19'; +KW20 : 'KW' '20'; +KW21 : 'KW' '21'; +KW22 : 'KW' '22'; +KW23 : 'KW' '23'; +KW24 : 'KW' '24'; +KW25 : 'KW' '25'; +KW26 : 'KW' '26'; +KW27 : 'KW' '27'; +KW28 : 'KW' '28'; +KW29 : 'KW' '29'; +KW30 : 'KW' '30'; +KW31 : 'KW' '31'; +KW32 : 'KW' '32'; +KW33 : 'KW' '33'; +KW34 : 'KW' '34'; +KW35 : 'KW' '35'; +KW36 : 'KW' '36'; +KW37 : 'KW' '37'; +KW38 : 'KW' '38'; +KW39 : 'KW' '39'; +KW40 : 'KW' '40'; +KW41 : 'KW' '41'; +KW42 : 'KW' '42'; +KW43 : 'KW' '43'; +KW44 : 'KW' '44'; +KW45 : 'KW' '45'; +KW46 : 'KW' '46'; +KW47 : 'KW' '47'; +KW48 : 'KW' '48'; +KW49 : 'KW' '49'; +KW50 : 'KW' '50'; +KW51 : 'KW' '51'; +KW52 : 'KW' '52'; +KW53 : 'KW' '53'; +KW54 : 'KW' '54'; +KW55 : 'KW' '55'; +KW56 : 'KW' '56'; +KW57 : 'KW' '57'; +KW58 : 'KW' '58'; +KW59 : 'KW' '59'; +KW60 : 'KW' '60'; +KW61 : 'KW' '61'; +KW62 : 'KW' '62'; +KW63 : 'KW' '63'; +KW64 : 'KW' '64'; +KW65 : 'KW' '65'; +KW66 : 'KW' '66'; +KW67 : 'KW' '67'; +KW68 : 'KW' '68'; +KW69 : 'KW' '69'; +KW70 : 'KW' '70'; +KW71 : 'KW' '71'; +KW72 : 'KW' '72'; +KW73 : 'KW' '73'; +KW74 : 'KW' '74'; +KW75 : 'KW' '75'; +KW76 : 'KW' '76'; +KW77 : 'KW' '77'; +KW78 : 'KW' '78'; +KW79 : 'KW' '79'; +KW80 : 'KW' '80'; +KW81 : 'KW' '81'; +KW82 : 'KW' '82'; +KW83 : 'KW' '83'; +KW84 : 'KW' '84'; +KW85 : 'KW' '85'; +KW86 : 'KW' '86'; +KW87 : 'KW' '87'; +KW88 : 'KW' '88'; +KW89 : 'KW' '89'; +KW90 : 'KW' '90'; +KW91 : 'KW' '91'; +KW92 : 'KW' '92'; +KW93 : 'KW' '93'; +KW94 : 'KW' '94'; +KW95 : 'KW' '95'; +KW96 : 'KW' '96'; +KW97 : 'KW' '97'; +KW98 : 'KW' '98'; +KW99 : 'KW' '99'; +KW100 : 'KW' '100'; +KW101 : 'KW' '101'; +KW102 : 'KW' '102'; +KW103 : 'KW' '103'; +KW104 : 'KW' '104'; +KW105 : 'KW' '105'; +KW106 : 'KW' '106'; +KW107 : 'KW' '107'; +KW108 : 'KW' '108'; +KW109 : 'KW' '109'; +KW110 : 'KW' '110'; +KW111 : 'KW' '111'; +KW112 : 'KW' '112'; +KW113 : 'KW' '113'; +KW114 : 'KW' '114'; +KW115 : 'KW' '115'; +KW116 : 'KW' '116'; +KW117 : 'KW' '117'; +KW118 : 'KW' '118'; +KW119 : 'KW' '119'; +KW120 : 'KW' '120'; +KW121 : 'KW' '121'; +KW122 : 'KW' '122'; +KW123 : 'KW' '123'; +KW124 : 'KW' '124'; +KW125 : 'KW' '125'; +KW126 : 'KW' '126'; +KW127 : 'KW' '127'; +KW128 : 'KW' '128'; +KW129 : 'KW' '129'; +KW130 : 'KW' '130'; +KW131 : 'KW' '131'; +KW132 : 'KW' '132'; +KW133 : 'KW' '133'; +KW134 : 'KW' '134'; +KW135 : 'KW' '135'; +KW136 : 'KW' '136'; +KW137 : 'KW' '137'; +KW138 : 'KW' '138'; +KW139 : 'KW' '139'; +KW140 : 'KW' '140'; +KW141 : 'KW' '141'; +KW142 : 'KW' '142'; +KW143 : 'KW' '143'; +KW144 : 'KW' '144'; +KW145 : 'KW' '145'; +KW146 : 'KW' '146'; +KW147 : 'KW' '147'; +KW148 : 'KW' '148'; +KW149 : 'KW' '149'; +KW150 : 'KW' '150'; +KW151 : 'KW' '151'; +KW152 : 'KW' '152'; +KW153 : 'KW' '153'; +KW154 : 'KW' '154'; +KW155 : 'KW' '155'; +KW156 : 'KW' '156'; +KW157 : 'KW' '157'; +KW158 : 'KW' '158'; +KW159 : 'KW' '159'; +KW160 : 'KW' '160'; +KW161 : 'KW' '161'; +KW162 : 'KW' '162'; +KW163 : 'KW' '163'; +KW164 : 'KW' '164'; +KW165 : 'KW' '165'; +KW166 : 'KW' '166'; +KW167 : 'KW' '167'; +KW168 : 'KW' '168'; +KW169 : 'KW' '169'; +KW170 : 'KW' '170'; +KW171 : 'KW' '171'; +KW172 : 'KW' '172'; +KW173 : 'KW' '173'; +KW174 : 'KW' '174'; +KW175 : 'KW' '175'; +KW176 : 'KW' '176'; +KW177 : 'KW' '177'; +KW178 : 'KW' '178'; +KW179 : 'KW' '179'; +KW180 : 'KW' '180'; +KW181 : 'KW' '181'; +KW182 : 'KW' '182'; +KW183 : 'KW' '183'; +KW184 : 'KW' '184'; +KW185 : 'KW' '185'; +KW186 : 'KW' '186'; +KW187 : 'KW' '187'; +KW188 : 'KW' '188'; +KW189 : 'KW' '189'; +KW190 : 'KW' '190'; +KW191 : 'KW' '191'; +KW192 : 'KW' '192'; +KW193 : 'KW' '193'; +KW194 : 'KW' '194'; +KW195 : 'KW' '195'; +KW196 : 'KW' '196'; +KW197 : 'KW' '197'; +KW198 : 'KW' '198'; +KW199 : 'KW' '199'; +KW200 : 'KW' '200'; +KW201 : 'KW' '201'; +KW202 : 'KW' '202'; +KW203 : 'KW' '203'; +KW204 : 'KW' '204'; +KW205 : 'KW' '205'; +KW206 : 'KW' '206'; +KW207 : 'KW' '207'; +KW208 : 'KW' '208'; +KW209 : 'KW' '209'; +KW210 : 'KW' '210'; +KW211 : 'KW' '211'; +KW212 : 'KW' '212'; +KW213 : 'KW' '213'; +KW214 : 'KW' '214'; +KW215 : 'KW' '215'; +KW216 : 'KW' '216'; +KW217 : 'KW' '217'; +KW218 : 'KW' '218'; +KW219 : 'KW' '219'; +KW220 : 'KW' '220'; +KW221 : 'KW' '221'; +KW222 : 'KW' '222'; +KW223 : 'KW' '223'; +KW224 : 'KW' '224'; +KW225 : 'KW' '225'; +KW226 : 'KW' '226'; +KW227 : 'KW' '227'; +KW228 : 'KW' '228'; +KW229 : 'KW' '229'; +KW230 : 'KW' '230'; +KW231 : 'KW' '231'; +KW232 : 'KW' '232'; +KW233 : 'KW' '233'; +KW234 : 'KW' '234'; +KW235 : 'KW' '235'; +KW236 : 'KW' '236'; +KW237 : 'KW' '237'; +KW238 : 'KW' '238'; +KW239 : 'KW' '239'; +KW240 : 'KW' '240'; +KW241 : 'KW' '241'; +KW242 : 'KW' '242'; +KW243 : 'KW' '243'; +KW244 : 'KW' '244'; +KW245 : 'KW' '245'; +KW246 : 'KW' '246'; +KW247 : 'KW' '247'; +KW248 : 'KW' '248'; +KW249 : 'KW' '249'; +KW250 : 'KW' '250'; +KW251 : 'KW' '251'; +KW252 : 'KW' '252'; +KW253 : 'KW' '253'; +KW254 : 'KW' '254'; +KW255 : 'KW' '255'; +KW256 : 'KW' '256'; +KW257 : 'KW' '257'; +KW258 : 'KW' '258'; +KW259 : 'KW' '259'; +KW260 : 'KW' '260'; +KW261 : 'KW' '261'; +KW262 : 'KW' '262'; +KW263 : 'KW' '263'; +KW264 : 'KW' '264'; +KW265 : 'KW' '265'; +KW266 : 'KW' '266'; +KW267 : 'KW' '267'; +KW268 : 'KW' '268'; +KW269 : 'KW' '269'; +KW270 : 'KW' '270'; +KW271 : 'KW' '271'; +KW272 : 'KW' '272'; +KW273 : 'KW' '273'; +KW274 : 'KW' '274'; +KW275 : 'KW' '275'; +KW276 : 'KW' '276'; +KW277 : 'KW' '277'; +KW278 : 'KW' '278'; +KW279 : 'KW' '279'; +KW280 : 'KW' '280'; +KW281 : 'KW' '281'; +KW282 : 'KW' '282'; +KW283 : 'KW' '283'; +KW284 : 'KW' '284'; +KW285 : 'KW' '285'; +KW286 : 'KW' '286'; +KW287 : 'KW' '287'; +KW288 : 'KW' '288'; +KW289 : 'KW' '289'; +KW290 : 'KW' '290'; +KW291 : 'KW' '291'; +KW292 : 'KW' '292'; +KW293 : 'KW' '293'; +KW294 : 'KW' '294'; +KW295 : 'KW' '295'; +KW296 : 'KW' '296'; +KW297 : 'KW' '297'; +KW298 : 'KW' '298'; +KW299 : 'KW' '299'; +KW300 : 'KW' '300'; +KW301 : 'KW' '301'; +KW302 : 'KW' '302'; +KW303 : 'KW' '303'; +KW304 : 'KW' '304'; +KW305 : 'KW' '305'; +KW306 : 'KW' '306'; +KW307 : 'KW' '307'; +KW308 : 'KW' '308'; +KW309 : 'KW' '309'; +KW310 : 'KW' '310'; +KW311 : 'KW' '311'; +KW312 : 'KW' '312'; +KW313 : 'KW' '313'; +KW314 : 'KW' '314'; +KW315 : 'KW' '315'; +KW316 : 'KW' '316'; +KW317 : 'KW' '317'; +KW318 : 'KW' '318'; +KW319 : 'KW' '319'; +KW320 : 'KW' '320'; +KW321 : 'KW' '321'; +KW322 : 'KW' '322'; +KW323 : 'KW' '323'; +KW324 : 'KW' '324'; +KW325 : 'KW' '325'; +KW326 : 'KW' '326'; +KW327 : 'KW' '327'; +KW328 : 'KW' '328'; +KW329 : 'KW' '329'; +KW330 : 'KW' '330'; +KW331 : 'KW' '331'; +KW332 : 'KW' '332'; +KW333 : 'KW' '333'; +KW334 : 'KW' '334'; +KW335 : 'KW' '335'; +KW336 : 'KW' '336'; +KW337 : 'KW' '337'; +KW338 : 'KW' '338'; +KW339 : 'KW' '339'; +KW340 : 'KW' '340'; +KW341 : 'KW' '341'; +KW342 : 'KW' '342'; +KW343 : 'KW' '343'; +KW344 : 'KW' '344'; +KW345 : 'KW' '345'; +KW346 : 'KW' '346'; +KW347 : 'KW' '347'; +KW348 : 'KW' '348'; +KW349 : 'KW' '349'; +KW350 : 'KW' '350'; +KW351 : 'KW' '351'; +KW352 : 'KW' '352'; +KW353 : 'KW' '353'; +KW354 : 'KW' '354'; +KW355 : 'KW' '355'; +KW356 : 'KW' '356'; +KW357 : 'KW' '357'; +KW358 : 'KW' '358'; +KW359 : 'KW' '359'; +KW360 : 'KW' '360'; +KW361 : 'KW' '361'; +KW362 : 'KW' '362'; +KW363 : 'KW' '363'; +KW364 : 'KW' '364'; +KW365 : 'KW' '365'; +KW366 : 'KW' '366'; +KW367 : 'KW' '367'; +KW368 : 'KW' '368'; +KW369 : 'KW' '369'; +KW370 : 'KW' '370'; +KW371 : 'KW' '371'; +KW372 : 'KW' '372'; +KW373 : 'KW' '373'; +KW374 : 'KW' '374'; +KW375 : 'KW' '375'; +KW376 : 'KW' '376'; +KW377 : 'KW' '377'; +KW378 : 'KW' '378'; +KW379 : 'KW' '379'; +KW380 : 'KW' '380'; +KW381 : 'KW' '381'; +KW382 : 'KW' '382'; +KW383 : 'KW' '383'; +KW384 : 'KW' '384'; +KW385 : 'KW' '385'; +KW386 : 'KW' '386'; +KW387 : 'KW' '387'; +KW388 : 'KW' '388'; +KW389 : 'KW' '389'; +KW390 : 'KW' '390'; +KW391 : 'KW' '391'; +KW392 : 'KW' '392'; +KW393 : 'KW' '393'; +KW394 : 'KW' '394'; +KW395 : 'KW' '395'; +KW396 : 'KW' '396'; +KW397 : 'KW' '397'; +KW398 : 'KW' '398'; +KW399 : 'KW' '399'; +KW400 : 'KW' '400'; +KW401 : 'KW' '401'; +KW402 : 'KW' '402'; +KW403 : 'KW' '403'; +KW404 : 'KW' '404'; +KW405 : 'KW' '405'; +KW406 : 'KW' '406'; +KW407 : 'KW' '407'; +KW408 : 'KW' '408'; +KW409 : 'KW' '409'; +KW410 : 'KW' '410'; +KW411 : 'KW' '411'; +KW412 : 'KW' '412'; +KW413 : 'KW' '413'; +KW414 : 'KW' '414'; +KW415 : 'KW' '415'; +KW416 : 'KW' '416'; +KW417 : 'KW' '417'; +KW418 : 'KW' '418'; +KW419 : 'KW' '419'; +KW420 : 'KW' '420'; +KW421 : 'KW' '421'; +KW422 : 'KW' '422'; +KW423 : 'KW' '423'; +KW424 : 'KW' '424'; +KW425 : 'KW' '425'; +KW426 : 'KW' '426'; +KW427 : 'KW' '427'; +KW428 : 'KW' '428'; +KW429 : 'KW' '429'; +KW430 : 'KW' '430'; +KW431 : 'KW' '431'; +KW432 : 'KW' '432'; +KW433 : 'KW' '433'; +KW434 : 'KW' '434'; +KW435 : 'KW' '435'; +KW436 : 'KW' '436'; +KW437 : 'KW' '437'; +KW438 : 'KW' '438'; +KW439 : 'KW' '439'; +KW440 : 'KW' '440'; +KW441 : 'KW' '441'; +KW442 : 'KW' '442'; +KW443 : 'KW' '443'; +KW444 : 'KW' '444'; +KW445 : 'KW' '445'; +KW446 : 'KW' '446'; +KW447 : 'KW' '447'; +KW448 : 'KW' '448'; +KW449 : 'KW' '449'; +KW450 : 'KW' '450'; +KW451 : 'KW' '451'; +KW452 : 'KW' '452'; +KW453 : 'KW' '453'; +KW454 : 'KW' '454'; +KW455 : 'KW' '455'; +KW456 : 'KW' '456'; +KW457 : 'KW' '457'; +KW458 : 'KW' '458'; +KW459 : 'KW' '459'; +KW460 : 'KW' '460'; +KW461 : 'KW' '461'; +KW462 : 'KW' '462'; +KW463 : 'KW' '463'; +KW464 : 'KW' '464'; +KW465 : 'KW' '465'; +KW466 : 'KW' '466'; +KW467 : 'KW' '467'; +KW468 : 'KW' '468'; +KW469 : 'KW' '469'; +KW470 : 'KW' '470'; +KW471 : 'KW' '471'; +KW472 : 'KW' '472'; +KW473 : 'KW' '473'; +KW474 : 'KW' '474'; +KW475 : 'KW' '475'; +KW476 : 'KW' '476'; +KW477 : 'KW' '477'; +KW478 : 'KW' '478'; +KW479 : 'KW' '479'; +KW480 : 'KW' '480'; +KW481 : 'KW' '481'; +KW482 : 'KW' '482'; +KW483 : 'KW' '483'; +KW484 : 'KW' '484'; +KW485 : 'KW' '485'; +KW486 : 'KW' '486'; +KW487 : 'KW' '487'; +KW488 : 'KW' '488'; +KW489 : 'KW' '489'; +KW490 : 'KW' '490'; +KW491 : 'KW' '491'; +KW492 : 'KW' '492'; +KW493 : 'KW' '493'; +KW494 : 'KW' '494'; +KW495 : 'KW' '495'; +KW496 : 'KW' '496'; +KW497 : 'KW' '497'; +KW498 : 'KW' '498'; +KW499 : 'KW' '499'; +KW500 : 'KW' '500'; +KW501 : 'KW' '501'; +KW502 : 'KW' '502'; +KW503 : 'KW' '503'; +KW504 : 'KW' '504'; +KW505 : 'KW' '505'; +KW506 : 'KW' '506'; +KW507 : 'KW' '507'; +KW508 : 'KW' '508'; +KW509 : 'KW' '509'; +KW510 : 'KW' '510'; +KW511 : 'KW' '511'; +KW512 : 'KW' '512'; +KW513 : 'KW' '513'; +KW514 : 'KW' '514'; +KW515 : 'KW' '515'; +KW516 : 'KW' '516'; +KW517 : 'KW' '517'; +KW518 : 'KW' '518'; +KW519 : 'KW' '519'; +KW520 : 'KW' '520'; +KW521 : 'KW' '521'; +KW522 : 'KW' '522'; +KW523 : 'KW' '523'; +KW524 : 'KW' '524'; +KW525 : 'KW' '525'; +KW526 : 'KW' '526'; +KW527 : 'KW' '527'; +KW528 : 'KW' '528'; +KW529 : 'KW' '529'; +KW530 : 'KW' '530'; +KW531 : 'KW' '531'; +KW532 : 'KW' '532'; +KW533 : 'KW' '533'; +KW534 : 'KW' '534'; +KW535 : 'KW' '535'; +KW536 : 'KW' '536'; +KW537 : 'KW' '537'; +KW538 : 'KW' '538'; +KW539 : 'KW' '539'; +KW540 : 'KW' '540'; +KW541 : 'KW' '541'; +KW542 : 'KW' '542'; +KW543 : 'KW' '543'; +KW544 : 'KW' '544'; +KW545 : 'KW' '545'; +KW546 : 'KW' '546'; +KW547 : 'KW' '547'; +KW548 : 'KW' '548'; +KW549 : 'KW' '549'; +KW550 : 'KW' '550'; +KW551 : 'KW' '551'; +KW552 : 'KW' '552'; +KW553 : 'KW' '553'; +KW554 : 'KW' '554'; +KW555 : 'KW' '555'; +KW556 : 'KW' '556'; +KW557 : 'KW' '557'; +KW558 : 'KW' '558'; +KW559 : 'KW' '559'; +KW560 : 'KW' '560'; +KW561 : 'KW' '561'; +KW562 : 'KW' '562'; +KW563 : 'KW' '563'; +KW564 : 'KW' '564'; +KW565 : 'KW' '565'; +KW566 : 'KW' '566'; +KW567 : 'KW' '567'; +KW568 : 'KW' '568'; +KW569 : 'KW' '569'; +KW570 : 'KW' '570'; +KW571 : 'KW' '571'; +KW572 : 'KW' '572'; +KW573 : 'KW' '573'; +KW574 : 'KW' '574'; +KW575 : 'KW' '575'; +KW576 : 'KW' '576'; +KW577 : 'KW' '577'; +KW578 : 'KW' '578'; +KW579 : 'KW' '579'; +KW580 : 'KW' '580'; +KW581 : 'KW' '581'; +KW582 : 'KW' '582'; +KW583 : 'KW' '583'; +KW584 : 'KW' '584'; +KW585 : 'KW' '585'; +KW586 : 'KW' '586'; +KW587 : 'KW' '587'; +KW588 : 'KW' '588'; +KW589 : 'KW' '589'; +KW590 : 'KW' '590'; +KW591 : 'KW' '591'; +KW592 : 'KW' '592'; +KW593 : 'KW' '593'; +KW594 : 'KW' '594'; +KW595 : 'KW' '595'; +KW596 : 'KW' '596'; +KW597 : 'KW' '597'; +KW598 : 'KW' '598'; +KW599 : 'KW' '599'; +KW600 : 'KW' '600'; +KW601 : 'KW' '601'; +KW602 : 'KW' '602'; +KW603 : 'KW' '603'; +KW604 : 'KW' '604'; +KW605 : 'KW' '605'; +KW606 : 'KW' '606'; +KW607 : 'KW' '607'; +KW608 : 'KW' '608'; +KW609 : 'KW' '609'; +KW610 : 'KW' '610'; +KW611 : 'KW' '611'; +KW612 : 'KW' '612'; +KW613 : 'KW' '613'; +KW614 : 'KW' '614'; +KW615 : 'KW' '615'; +KW616 : 'KW' '616'; +KW617 : 'KW' '617'; +KW618 : 'KW' '618'; +KW619 : 'KW' '619'; +KW620 : 'KW' '620'; +KW621 : 'KW' '621'; +KW622 : 'KW' '622'; +KW623 : 'KW' '623'; +KW624 : 'KW' '624'; +KW625 : 'KW' '625'; +KW626 : 'KW' '626'; +KW627 : 'KW' '627'; +KW628 : 'KW' '628'; +KW629 : 'KW' '629'; +KW630 : 'KW' '630'; +KW631 : 'KW' '631'; +KW632 : 'KW' '632'; +KW633 : 'KW' '633'; +KW634 : 'KW' '634'; +KW635 : 'KW' '635'; +KW636 : 'KW' '636'; +KW637 : 'KW' '637'; +KW638 : 'KW' '638'; +KW639 : 'KW' '639'; +KW640 : 'KW' '640'; +KW641 : 'KW' '641'; +KW642 : 'KW' '642'; +KW643 : 'KW' '643'; +KW644 : 'KW' '644'; +KW645 : 'KW' '645'; +KW646 : 'KW' '646'; +KW647 : 'KW' '647'; +KW648 : 'KW' '648'; +KW649 : 'KW' '649'; +KW650 : 'KW' '650'; +KW651 : 'KW' '651'; +KW652 : 'KW' '652'; +KW653 : 'KW' '653'; +KW654 : 'KW' '654'; +KW655 : 'KW' '655'; +KW656 : 'KW' '656'; +KW657 : 'KW' '657'; +KW658 : 'KW' '658'; +KW659 : 'KW' '659'; +KW660 : 'KW' '660'; +KW661 : 'KW' '661'; +KW662 : 'KW' '662'; +KW663 : 'KW' '663'; +KW664 : 'KW' '664'; +KW665 : 'KW' '665'; +KW666 : 'KW' '666'; +KW667 : 'KW' '667'; +KW668 : 'KW' '668'; +KW669 : 'KW' '669'; +KW670 : 'KW' '670'; +KW671 : 'KW' '671'; +KW672 : 'KW' '672'; +KW673 : 'KW' '673'; +KW674 : 'KW' '674'; +KW675 : 'KW' '675'; +KW676 : 'KW' '676'; +KW677 : 'KW' '677'; +KW678 : 'KW' '678'; +KW679 : 'KW' '679'; +KW680 : 'KW' '680'; +KW681 : 'KW' '681'; +KW682 : 'KW' '682'; +KW683 : 'KW' '683'; +KW684 : 'KW' '684'; +KW685 : 'KW' '685'; +KW686 : 'KW' '686'; +KW687 : 'KW' '687'; +KW688 : 'KW' '688'; +KW689 : 'KW' '689'; +KW690 : 'KW' '690'; +KW691 : 'KW' '691'; +KW692 : 'KW' '692'; +KW693 : 'KW' '693'; +KW694 : 'KW' '694'; +KW695 : 'KW' '695'; +KW696 : 'KW' '696'; +KW697 : 'KW' '697'; +KW698 : 'KW' '698'; +KW699 : 'KW' '699'; +KW700 : 'KW' '700'; +KW701 : 'KW' '701'; +KW702 : 'KW' '702'; +KW703 : 'KW' '703'; +KW704 : 'KW' '704'; +KW705 : 'KW' '705'; +KW706 : 'KW' '706'; +KW707 : 'KW' '707'; +KW708 : 'KW' '708'; +KW709 : 'KW' '709'; +KW710 : 'KW' '710'; +KW711 : 'KW' '711'; +KW712 : 'KW' '712'; +KW713 : 'KW' '713'; +KW714 : 'KW' '714'; +KW715 : 'KW' '715'; +KW716 : 'KW' '716'; +KW717 : 'KW' '717'; +KW718 : 'KW' '718'; +KW719 : 'KW' '719'; +KW720 : 'KW' '720'; +KW721 : 'KW' '721'; +KW722 : 'KW' '722'; +KW723 : 'KW' '723'; +KW724 : 'KW' '724'; +KW725 : 'KW' '725'; +KW726 : 'KW' '726'; +KW727 : 'KW' '727'; +KW728 : 'KW' '728'; +KW729 : 'KW' '729'; +KW730 : 'KW' '730'; +KW731 : 'KW' '731'; +KW732 : 'KW' '732'; +KW733 : 'KW' '733'; +KW734 : 'KW' '734'; +KW735 : 'KW' '735'; +KW736 : 'KW' '736'; +KW737 : 'KW' '737'; +KW738 : 'KW' '738'; +KW739 : 'KW' '739'; +KW740 : 'KW' '740'; +KW741 : 'KW' '741'; +KW742 : 'KW' '742'; +KW743 : 'KW' '743'; +KW744 : 'KW' '744'; +KW745 : 'KW' '745'; +KW746 : 'KW' '746'; +KW747 : 'KW' '747'; +KW748 : 'KW' '748'; +KW749 : 'KW' '749'; +KW750 : 'KW' '750'; +KW751 : 'KW' '751'; +KW752 : 'KW' '752'; +KW753 : 'KW' '753'; +KW754 : 'KW' '754'; +KW755 : 'KW' '755'; +KW756 : 'KW' '756'; +KW757 : 'KW' '757'; +KW758 : 'KW' '758'; +KW759 : 'KW' '759'; +KW760 : 'KW' '760'; +KW761 : 'KW' '761'; +KW762 : 'KW' '762'; +KW763 : 'KW' '763'; +KW764 : 'KW' '764'; +KW765 : 'KW' '765'; +KW766 : 'KW' '766'; +KW767 : 'KW' '767'; +KW768 : 'KW' '768'; +KW769 : 'KW' '769'; +KW770 : 'KW' '770'; +KW771 : 'KW' '771'; +KW772 : 'KW' '772'; +KW773 : 'KW' '773'; +KW774 : 'KW' '774'; +KW775 : 'KW' '775'; +KW776 : 'KW' '776'; +KW777 : 'KW' '777'; +KW778 : 'KW' '778'; +KW779 : 'KW' '779'; +KW780 : 'KW' '780'; +KW781 : 'KW' '781'; +KW782 : 'KW' '782'; +KW783 : 'KW' '783'; +KW784 : 'KW' '784'; +KW785 : 'KW' '785'; +KW786 : 'KW' '786'; +KW787 : 'KW' '787'; +KW788 : 'KW' '788'; +KW789 : 'KW' '789'; +KW790 : 'KW' '790'; +KW791 : 'KW' '791'; +KW792 : 'KW' '792'; +KW793 : 'KW' '793'; +KW794 : 'KW' '794'; +KW795 : 'KW' '795'; +KW796 : 'KW' '796'; +KW797 : 'KW' '797'; +KW798 : 'KW' '798'; +KW799 : 'KW' '799'; +KW800 : 'KW' '800'; +KW801 : 'KW' '801'; +KW802 : 'KW' '802'; +KW803 : 'KW' '803'; +KW804 : 'KW' '804'; +KW805 : 'KW' '805'; +KW806 : 'KW' '806'; +KW807 : 'KW' '807'; +KW808 : 'KW' '808'; +KW809 : 'KW' '809'; +KW810 : 'KW' '810'; +KW811 : 'KW' '811'; +KW812 : 'KW' '812'; +KW813 : 'KW' '813'; +KW814 : 'KW' '814'; +KW815 : 'KW' '815'; +KW816 : 'KW' '816'; +KW817 : 'KW' '817'; +KW818 : 'KW' '818'; +KW819 : 'KW' '819'; +KW820 : 'KW' '820'; +KW821 : 'KW' '821'; +KW822 : 'KW' '822'; +KW823 : 'KW' '823'; +KW824 : 'KW' '824'; +KW825 : 'KW' '825'; +KW826 : 'KW' '826'; +KW827 : 'KW' '827'; +KW828 : 'KW' '828'; +KW829 : 'KW' '829'; +KW830 : 'KW' '830'; +KW831 : 'KW' '831'; +KW832 : 'KW' '832'; +KW833 : 'KW' '833'; +KW834 : 'KW' '834'; +KW835 : 'KW' '835'; +KW836 : 'KW' '836'; +KW837 : 'KW' '837'; +KW838 : 'KW' '838'; +KW839 : 'KW' '839'; +KW840 : 'KW' '840'; +KW841 : 'KW' '841'; +KW842 : 'KW' '842'; +KW843 : 'KW' '843'; +KW844 : 'KW' '844'; +KW845 : 'KW' '845'; +KW846 : 'KW' '846'; +KW847 : 'KW' '847'; +KW848 : 'KW' '848'; +KW849 : 'KW' '849'; +KW850 : 'KW' '850'; +KW851 : 'KW' '851'; +KW852 : 'KW' '852'; +KW853 : 'KW' '853'; +KW854 : 'KW' '854'; +KW855 : 'KW' '855'; +KW856 : 'KW' '856'; +KW857 : 'KW' '857'; +KW858 : 'KW' '858'; +KW859 : 'KW' '859'; +KW860 : 'KW' '860'; +KW861 : 'KW' '861'; +KW862 : 'KW' '862'; +KW863 : 'KW' '863'; +KW864 : 'KW' '864'; +KW865 : 'KW' '865'; +KW866 : 'KW' '866'; +KW867 : 'KW' '867'; +KW868 : 'KW' '868'; +KW869 : 'KW' '869'; +KW870 : 'KW' '870'; +KW871 : 'KW' '871'; +KW872 : 'KW' '872'; +KW873 : 'KW' '873'; +KW874 : 'KW' '874'; +KW875 : 'KW' '875'; +KW876 : 'KW' '876'; +KW877 : 'KW' '877'; +KW878 : 'KW' '878'; +KW879 : 'KW' '879'; +KW880 : 'KW' '880'; +KW881 : 'KW' '881'; +KW882 : 'KW' '882'; +KW883 : 'KW' '883'; +KW884 : 'KW' '884'; +KW885 : 'KW' '885'; +KW886 : 'KW' '886'; +KW887 : 'KW' '887'; +KW888 : 'KW' '888'; +KW889 : 'KW' '889'; +KW890 : 'KW' '890'; +KW891 : 'KW' '891'; +KW892 : 'KW' '892'; +KW893 : 'KW' '893'; +KW894 : 'KW' '894'; +KW895 : 'KW' '895'; +KW896 : 'KW' '896'; +KW897 : 'KW' '897'; +KW898 : 'KW' '898'; +KW899 : 'KW' '899'; +KW900 : 'KW' '900'; +KW901 : 'KW' '901'; +KW902 : 'KW' '902'; +KW903 : 'KW' '903'; +KW904 : 'KW' '904'; +KW905 : 'KW' '905'; +KW906 : 'KW' '906'; +KW907 : 'KW' '907'; +KW908 : 'KW' '908'; +KW909 : 'KW' '909'; +KW910 : 'KW' '910'; +KW911 : 'KW' '911'; +KW912 : 'KW' '912'; +KW913 : 'KW' '913'; +KW914 : 'KW' '914'; +KW915 : 'KW' '915'; +KW916 : 'KW' '916'; +KW917 : 'KW' '917'; +KW918 : 'KW' '918'; +KW919 : 'KW' '919'; +KW920 : 'KW' '920'; +KW921 : 'KW' '921'; +KW922 : 'KW' '922'; +KW923 : 'KW' '923'; +KW924 : 'KW' '924'; +KW925 : 'KW' '925'; +KW926 : 'KW' '926'; +KW927 : 'KW' '927'; +KW928 : 'KW' '928'; +KW929 : 'KW' '929'; +KW930 : 'KW' '930'; +KW931 : 'KW' '931'; +KW932 : 'KW' '932'; +KW933 : 'KW' '933'; +KW934 : 'KW' '934'; +KW935 : 'KW' '935'; +KW936 : 'KW' '936'; +KW937 : 'KW' '937'; +KW938 : 'KW' '938'; +KW939 : 'KW' '939'; +KW940 : 'KW' '940'; +KW941 : 'KW' '941'; +KW942 : 'KW' '942'; +KW943 : 'KW' '943'; +KW944 : 'KW' '944'; +KW945 : 'KW' '945'; +KW946 : 'KW' '946'; +KW947 : 'KW' '947'; +KW948 : 'KW' '948'; +KW949 : 'KW' '949'; +KW950 : 'KW' '950'; +KW951 : 'KW' '951'; +KW952 : 'KW' '952'; +KW953 : 'KW' '953'; +KW954 : 'KW' '954'; +KW955 : 'KW' '955'; +KW956 : 'KW' '956'; +KW957 : 'KW' '957'; +KW958 : 'KW' '958'; +KW959 : 'KW' '959'; +KW960 : 'KW' '960'; +KW961 : 'KW' '961'; +KW962 : 'KW' '962'; +KW963 : 'KW' '963'; +KW964 : 'KW' '964'; +KW965 : 'KW' '965'; +KW966 : 'KW' '966'; +KW967 : 'KW' '967'; +KW968 : 'KW' '968'; +KW969 : 'KW' '969'; +KW970 : 'KW' '970'; +KW971 : 'KW' '971'; +KW972 : 'KW' '972'; +KW973 : 'KW' '973'; +KW974 : 'KW' '974'; +KW975 : 'KW' '975'; +KW976 : 'KW' '976'; +KW977 : 'KW' '977'; +KW978 : 'KW' '978'; +KW979 : 'KW' '979'; +KW980 : 'KW' '980'; +KW981 : 'KW' '981'; +KW982 : 'KW' '982'; +KW983 : 'KW' '983'; +KW984 : 'KW' '984'; +KW985 : 'KW' '985'; +KW986 : 'KW' '986'; +KW987 : 'KW' '987'; +KW988 : 'KW' '988'; +KW989 : 'KW' '989'; +KW990 : 'KW' '990'; +KW991 : 'KW' '991'; +KW992 : 'KW' '992'; +KW993 : 'KW' '993'; +KW994 : 'KW' '994'; +KW995 : 'KW' '995'; +KW996 : 'KW' '996'; +KW997 : 'KW' '997'; +KW998 : 'KW' '998'; +KW999 : 'KW' '999'; +KW1000 : 'KW' '1000'; +KW1001 : 'KW' '1001'; +KW1002 : 'KW' '1002'; +KW1003 : 'KW' '1003'; +KW1004 : 'KW' '1004'; +KW1005 : 'KW' '1005'; +KW1006 : 'KW' '1006'; +KW1007 : 'KW' '1007'; +KW1008 : 'KW' '1008'; +KW1009 : 'KW' '1009'; +KW1010 : 'KW' '1010'; +KW1011 : 'KW' '1011'; +KW1012 : 'KW' '1012'; +KW1013 : 'KW' '1013'; +KW1014 : 'KW' '1014'; +KW1015 : 'KW' '1015'; +KW1016 : 'KW' '1016'; +KW1017 : 'KW' '1017'; +KW1018 : 'KW' '1018'; +KW1019 : 'KW' '1019'; +KW1020 : 'KW' '1020'; +KW1021 : 'KW' '1021'; +KW1022 : 'KW' '1022'; +KW1023 : 'KW' '1023'; +KW1024 : 'KW' '1024'; +KW1025 : 'KW' '1025'; +KW1026 : 'KW' '1026'; +KW1027 : 'KW' '1027'; +KW1028 : 'KW' '1028'; +KW1029 : 'KW' '1029'; +KW1030 : 'KW' '1030'; +KW1031 : 'KW' '1031'; +KW1032 : 'KW' '1032'; +KW1033 : 'KW' '1033'; +KW1034 : 'KW' '1034'; +KW1035 : 'KW' '1035'; +KW1036 : 'KW' '1036'; +KW1037 : 'KW' '1037'; +KW1038 : 'KW' '1038'; +KW1039 : 'KW' '1039'; +KW1040 : 'KW' '1040'; +KW1041 : 'KW' '1041'; +KW1042 : 'KW' '1042'; +KW1043 : 'KW' '1043'; +KW1044 : 'KW' '1044'; +KW1045 : 'KW' '1045'; +KW1046 : 'KW' '1046'; +KW1047 : 'KW' '1047'; +KW1048 : 'KW' '1048'; +KW1049 : 'KW' '1049'; +KW1050 : 'KW' '1050'; +KW1051 : 'KW' '1051'; +KW1052 : 'KW' '1052'; +KW1053 : 'KW' '1053'; +KW1054 : 'KW' '1054'; +KW1055 : 'KW' '1055'; +KW1056 : 'KW' '1056'; +KW1057 : 'KW' '1057'; +KW1058 : 'KW' '1058'; +KW1059 : 'KW' '1059'; +KW1060 : 'KW' '1060'; +KW1061 : 'KW' '1061'; +KW1062 : 'KW' '1062'; +KW1063 : 'KW' '1063'; +KW1064 : 'KW' '1064'; +KW1065 : 'KW' '1065'; +KW1066 : 'KW' '1066'; +KW1067 : 'KW' '1067'; +KW1068 : 'KW' '1068'; +KW1069 : 'KW' '1069'; +KW1070 : 'KW' '1070'; +KW1071 : 'KW' '1071'; +KW1072 : 'KW' '1072'; +KW1073 : 'KW' '1073'; +KW1074 : 'KW' '1074'; +KW1075 : 'KW' '1075'; +KW1076 : 'KW' '1076'; +KW1077 : 'KW' '1077'; +KW1078 : 'KW' '1078'; +KW1079 : 'KW' '1079'; +KW1080 : 'KW' '1080'; +KW1081 : 'KW' '1081'; +KW1082 : 'KW' '1082'; +KW1083 : 'KW' '1083'; +KW1084 : 'KW' '1084'; +KW1085 : 'KW' '1085'; +KW1086 : 'KW' '1086'; +KW1087 : 'KW' '1087'; +KW1088 : 'KW' '1088'; +KW1089 : 'KW' '1089'; +KW1090 : 'KW' '1090'; +KW1091 : 'KW' '1091'; +KW1092 : 'KW' '1092'; +KW1093 : 'KW' '1093'; +KW1094 : 'KW' '1094'; +KW1095 : 'KW' '1095'; +KW1096 : 'KW' '1096'; +KW1097 : 'KW' '1097'; +KW1098 : 'KW' '1098'; +KW1099 : 'KW' '1099'; +KW1100 : 'KW' '1100'; +KW1101 : 'KW' '1101'; +KW1102 : 'KW' '1102'; +KW1103 : 'KW' '1103'; +KW1104 : 'KW' '1104'; +KW1105 : 'KW' '1105'; +KW1106 : 'KW' '1106'; +KW1107 : 'KW' '1107'; +KW1108 : 'KW' '1108'; +KW1109 : 'KW' '1109'; +KW1110 : 'KW' '1110'; +KW1111 : 'KW' '1111'; +KW1112 : 'KW' '1112'; +KW1113 : 'KW' '1113'; +KW1114 : 'KW' '1114'; +KW1115 : 'KW' '1115'; +KW1116 : 'KW' '1116'; +KW1117 : 'KW' '1117'; +KW1118 : 'KW' '1118'; +KW1119 : 'KW' '1119'; +KW1120 : 'KW' '1120'; +KW1121 : 'KW' '1121'; +KW1122 : 'KW' '1122'; +KW1123 : 'KW' '1123'; +KW1124 : 'KW' '1124'; +KW1125 : 'KW' '1125'; +KW1126 : 'KW' '1126'; +KW1127 : 'KW' '1127'; +KW1128 : 'KW' '1128'; +KW1129 : 'KW' '1129'; +KW1130 : 'KW' '1130'; +KW1131 : 'KW' '1131'; +KW1132 : 'KW' '1132'; +KW1133 : 'KW' '1133'; +KW1134 : 'KW' '1134'; +KW1135 : 'KW' '1135'; +KW1136 : 'KW' '1136'; +KW1137 : 'KW' '1137'; +KW1138 : 'KW' '1138'; +KW1139 : 'KW' '1139'; +KW1140 : 'KW' '1140'; +KW1141 : 'KW' '1141'; +KW1142 : 'KW' '1142'; +KW1143 : 'KW' '1143'; +KW1144 : 'KW' '1144'; +KW1145 : 'KW' '1145'; +KW1146 : 'KW' '1146'; +KW1147 : 'KW' '1147'; +KW1148 : 'KW' '1148'; +KW1149 : 'KW' '1149'; +KW1150 : 'KW' '1150'; +KW1151 : 'KW' '1151'; +KW1152 : 'KW' '1152'; +KW1153 : 'KW' '1153'; +KW1154 : 'KW' '1154'; +KW1155 : 'KW' '1155'; +KW1156 : 'KW' '1156'; +KW1157 : 'KW' '1157'; +KW1158 : 'KW' '1158'; +KW1159 : 'KW' '1159'; +KW1160 : 'KW' '1160'; +KW1161 : 'KW' '1161'; +KW1162 : 'KW' '1162'; +KW1163 : 'KW' '1163'; +KW1164 : 'KW' '1164'; +KW1165 : 'KW' '1165'; +KW1166 : 'KW' '1166'; +KW1167 : 'KW' '1167'; +KW1168 : 'KW' '1168'; +KW1169 : 'KW' '1169'; +KW1170 : 'KW' '1170'; +KW1171 : 'KW' '1171'; +KW1172 : 'KW' '1172'; +KW1173 : 'KW' '1173'; +KW1174 : 'KW' '1174'; +KW1175 : 'KW' '1175'; +KW1176 : 'KW' '1176'; +KW1177 : 'KW' '1177'; +KW1178 : 'KW' '1178'; +KW1179 : 'KW' '1179'; +KW1180 : 'KW' '1180'; +KW1181 : 'KW' '1181'; +KW1182 : 'KW' '1182'; +KW1183 : 'KW' '1183'; +KW1184 : 'KW' '1184'; +KW1185 : 'KW' '1185'; +KW1186 : 'KW' '1186'; +KW1187 : 'KW' '1187'; +KW1188 : 'KW' '1188'; +KW1189 : 'KW' '1189'; +KW1190 : 'KW' '1190'; +KW1191 : 'KW' '1191'; +KW1192 : 'KW' '1192'; +KW1193 : 'KW' '1193'; +KW1194 : 'KW' '1194'; +KW1195 : 'KW' '1195'; +KW1196 : 'KW' '1196'; +KW1197 : 'KW' '1197'; +KW1198 : 'KW' '1198'; +KW1199 : 'KW' '1199'; +KW1200 : 'KW' '1200'; +KW1201 : 'KW' '1201'; +KW1202 : 'KW' '1202'; +KW1203 : 'KW' '1203'; +KW1204 : 'KW' '1204'; +KW1205 : 'KW' '1205'; +KW1206 : 'KW' '1206'; +KW1207 : 'KW' '1207'; +KW1208 : 'KW' '1208'; +KW1209 : 'KW' '1209'; +KW1210 : 'KW' '1210'; +KW1211 : 'KW' '1211'; +KW1212 : 'KW' '1212'; +KW1213 : 'KW' '1213'; +KW1214 : 'KW' '1214'; +KW1215 : 'KW' '1215'; +KW1216 : 'KW' '1216'; +KW1217 : 'KW' '1217'; +KW1218 : 'KW' '1218'; +KW1219 : 'KW' '1219'; +KW1220 : 'KW' '1220'; +KW1221 : 'KW' '1221'; +KW1222 : 'KW' '1222'; +KW1223 : 'KW' '1223'; +KW1224 : 'KW' '1224'; +KW1225 : 'KW' '1225'; +KW1226 : 'KW' '1226'; +KW1227 : 'KW' '1227'; +KW1228 : 'KW' '1228'; +KW1229 : 'KW' '1229'; +KW1230 : 'KW' '1230'; +KW1231 : 'KW' '1231'; +KW1232 : 'KW' '1232'; +KW1233 : 'KW' '1233'; +KW1234 : 'KW' '1234'; +KW1235 : 'KW' '1235'; +KW1236 : 'KW' '1236'; +KW1237 : 'KW' '1237'; +KW1238 : 'KW' '1238'; +KW1239 : 'KW' '1239'; +KW1240 : 'KW' '1240'; +KW1241 : 'KW' '1241'; +KW1242 : 'KW' '1242'; +KW1243 : 'KW' '1243'; +KW1244 : 'KW' '1244'; +KW1245 : 'KW' '1245'; +KW1246 : 'KW' '1246'; +KW1247 : 'KW' '1247'; +KW1248 : 'KW' '1248'; +KW1249 : 'KW' '1249'; +KW1250 : 'KW' '1250'; +KW1251 : 'KW' '1251'; +KW1252 : 'KW' '1252'; +KW1253 : 'KW' '1253'; +KW1254 : 'KW' '1254'; +KW1255 : 'KW' '1255'; +KW1256 : 'KW' '1256'; +KW1257 : 'KW' '1257'; +KW1258 : 'KW' '1258'; +KW1259 : 'KW' '1259'; +KW1260 : 'KW' '1260'; +KW1261 : 'KW' '1261'; +KW1262 : 'KW' '1262'; +KW1263 : 'KW' '1263'; +KW1264 : 'KW' '1264'; +KW1265 : 'KW' '1265'; +KW1266 : 'KW' '1266'; +KW1267 : 'KW' '1267'; +KW1268 : 'KW' '1268'; +KW1269 : 'KW' '1269'; +KW1270 : 'KW' '1270'; +KW1271 : 'KW' '1271'; +KW1272 : 'KW' '1272'; +KW1273 : 'KW' '1273'; +KW1274 : 'KW' '1274'; +KW1275 : 'KW' '1275'; +KW1276 : 'KW' '1276'; +KW1277 : 'KW' '1277'; +KW1278 : 'KW' '1278'; +KW1279 : 'KW' '1279'; +KW1280 : 'KW' '1280'; +KW1281 : 'KW' '1281'; +KW1282 : 'KW' '1282'; +KW1283 : 'KW' '1283'; +KW1284 : 'KW' '1284'; +KW1285 : 'KW' '1285'; +KW1286 : 'KW' '1286'; +KW1287 : 'KW' '1287'; +KW1288 : 'KW' '1288'; +KW1289 : 'KW' '1289'; +KW1290 : 'KW' '1290'; +KW1291 : 'KW' '1291'; +KW1292 : 'KW' '1292'; +KW1293 : 'KW' '1293'; +KW1294 : 'KW' '1294'; +KW1295 : 'KW' '1295'; +KW1296 : 'KW' '1296'; +KW1297 : 'KW' '1297'; +KW1298 : 'KW' '1298'; +KW1299 : 'KW' '1299'; +KW1300 : 'KW' '1300'; +KW1301 : 'KW' '1301'; +KW1302 : 'KW' '1302'; +KW1303 : 'KW' '1303'; +KW1304 : 'KW' '1304'; +KW1305 : 'KW' '1305'; +KW1306 : 'KW' '1306'; +KW1307 : 'KW' '1307'; +KW1308 : 'KW' '1308'; +KW1309 : 'KW' '1309'; +KW1310 : 'KW' '1310'; +KW1311 : 'KW' '1311'; +KW1312 : 'KW' '1312'; +KW1313 : 'KW' '1313'; +KW1314 : 'KW' '1314'; +KW1315 : 'KW' '1315'; +KW1316 : 'KW' '1316'; +KW1317 : 'KW' '1317'; +KW1318 : 'KW' '1318'; +KW1319 : 'KW' '1319'; +KW1320 : 'KW' '1320'; +KW1321 : 'KW' '1321'; +KW1322 : 'KW' '1322'; +KW1323 : 'KW' '1323'; +KW1324 : 'KW' '1324'; +KW1325 : 'KW' '1325'; +KW1326 : 'KW' '1326'; +KW1327 : 'KW' '1327'; +KW1328 : 'KW' '1328'; +KW1329 : 'KW' '1329'; +KW1330 : 'KW' '1330'; +KW1331 : 'KW' '1331'; +KW1332 : 'KW' '1332'; +KW1333 : 'KW' '1333'; +KW1334 : 'KW' '1334'; +KW1335 : 'KW' '1335'; +KW1336 : 'KW' '1336'; +KW1337 : 'KW' '1337'; +KW1338 : 'KW' '1338'; +KW1339 : 'KW' '1339'; +KW1340 : 'KW' '1340'; +KW1341 : 'KW' '1341'; +KW1342 : 'KW' '1342'; +KW1343 : 'KW' '1343'; +KW1344 : 'KW' '1344'; +KW1345 : 'KW' '1345'; +KW1346 : 'KW' '1346'; +KW1347 : 'KW' '1347'; +KW1348 : 'KW' '1348'; +KW1349 : 'KW' '1349'; +KW1350 : 'KW' '1350'; +KW1351 : 'KW' '1351'; +KW1352 : 'KW' '1352'; +KW1353 : 'KW' '1353'; +KW1354 : 'KW' '1354'; +KW1355 : 'KW' '1355'; +KW1356 : 'KW' '1356'; +KW1357 : 'KW' '1357'; +KW1358 : 'KW' '1358'; +KW1359 : 'KW' '1359'; +KW1360 : 'KW' '1360'; +KW1361 : 'KW' '1361'; +KW1362 : 'KW' '1362'; +KW1363 : 'KW' '1363'; +KW1364 : 'KW' '1364'; +KW1365 : 'KW' '1365'; +KW1366 : 'KW' '1366'; +KW1367 : 'KW' '1367'; +KW1368 : 'KW' '1368'; +KW1369 : 'KW' '1369'; +KW1370 : 'KW' '1370'; +KW1371 : 'KW' '1371'; +KW1372 : 'KW' '1372'; +KW1373 : 'KW' '1373'; +KW1374 : 'KW' '1374'; +KW1375 : 'KW' '1375'; +KW1376 : 'KW' '1376'; +KW1377 : 'KW' '1377'; +KW1378 : 'KW' '1378'; +KW1379 : 'KW' '1379'; +KW1380 : 'KW' '1380'; +KW1381 : 'KW' '1381'; +KW1382 : 'KW' '1382'; +KW1383 : 'KW' '1383'; +KW1384 : 'KW' '1384'; +KW1385 : 'KW' '1385'; +KW1386 : 'KW' '1386'; +KW1387 : 'KW' '1387'; +KW1388 : 'KW' '1388'; +KW1389 : 'KW' '1389'; +KW1390 : 'KW' '1390'; +KW1391 : 'KW' '1391'; +KW1392 : 'KW' '1392'; +KW1393 : 'KW' '1393'; +KW1394 : 'KW' '1394'; +KW1395 : 'KW' '1395'; +KW1396 : 'KW' '1396'; +KW1397 : 'KW' '1397'; +KW1398 : 'KW' '1398'; +KW1399 : 'KW' '1399'; +KW1400 : 'KW' '1400'; +KW1401 : 'KW' '1401'; +KW1402 : 'KW' '1402'; +KW1403 : 'KW' '1403'; +KW1404 : 'KW' '1404'; +KW1405 : 'KW' '1405'; +KW1406 : 'KW' '1406'; +KW1407 : 'KW' '1407'; +KW1408 : 'KW' '1408'; +KW1409 : 'KW' '1409'; +KW1410 : 'KW' '1410'; +KW1411 : 'KW' '1411'; +KW1412 : 'KW' '1412'; +KW1413 : 'KW' '1413'; +KW1414 : 'KW' '1414'; +KW1415 : 'KW' '1415'; +KW1416 : 'KW' '1416'; +KW1417 : 'KW' '1417'; +KW1418 : 'KW' '1418'; +KW1419 : 'KW' '1419'; +KW1420 : 'KW' '1420'; +KW1421 : 'KW' '1421'; +KW1422 : 'KW' '1422'; +KW1423 : 'KW' '1423'; +KW1424 : 'KW' '1424'; +KW1425 : 'KW' '1425'; +KW1426 : 'KW' '1426'; +KW1427 : 'KW' '1427'; +KW1428 : 'KW' '1428'; +KW1429 : 'KW' '1429'; +KW1430 : 'KW' '1430'; +KW1431 : 'KW' '1431'; +KW1432 : 'KW' '1432'; +KW1433 : 'KW' '1433'; +KW1434 : 'KW' '1434'; +KW1435 : 'KW' '1435'; +KW1436 : 'KW' '1436'; +KW1437 : 'KW' '1437'; +KW1438 : 'KW' '1438'; +KW1439 : 'KW' '1439'; +KW1440 : 'KW' '1440'; +KW1441 : 'KW' '1441'; +KW1442 : 'KW' '1442'; +KW1443 : 'KW' '1443'; +KW1444 : 'KW' '1444'; +KW1445 : 'KW' '1445'; +KW1446 : 'KW' '1446'; +KW1447 : 'KW' '1447'; +KW1448 : 'KW' '1448'; +KW1449 : 'KW' '1449'; +KW1450 : 'KW' '1450'; +KW1451 : 'KW' '1451'; +KW1452 : 'KW' '1452'; +KW1453 : 'KW' '1453'; +KW1454 : 'KW' '1454'; +KW1455 : 'KW' '1455'; +KW1456 : 'KW' '1456'; +KW1457 : 'KW' '1457'; +KW1458 : 'KW' '1458'; +KW1459 : 'KW' '1459'; +KW1460 : 'KW' '1460'; +KW1461 : 'KW' '1461'; +KW1462 : 'KW' '1462'; +KW1463 : 'KW' '1463'; +KW1464 : 'KW' '1464'; +KW1465 : 'KW' '1465'; +KW1466 : 'KW' '1466'; +KW1467 : 'KW' '1467'; +KW1468 : 'KW' '1468'; +KW1469 : 'KW' '1469'; +KW1470 : 'KW' '1470'; +KW1471 : 'KW' '1471'; +KW1472 : 'KW' '1472'; +KW1473 : 'KW' '1473'; +KW1474 : 'KW' '1474'; +KW1475 : 'KW' '1475'; +KW1476 : 'KW' '1476'; +KW1477 : 'KW' '1477'; +KW1478 : 'KW' '1478'; +KW1479 : 'KW' '1479'; +KW1480 : 'KW' '1480'; +KW1481 : 'KW' '1481'; +KW1482 : 'KW' '1482'; +KW1483 : 'KW' '1483'; +KW1484 : 'KW' '1484'; +KW1485 : 'KW' '1485'; +KW1486 : 'KW' '1486'; +KW1487 : 'KW' '1487'; +KW1488 : 'KW' '1488'; +KW1489 : 'KW' '1489'; +KW1490 : 'KW' '1490'; +KW1491 : 'KW' '1491'; +KW1492 : 'KW' '1492'; +KW1493 : 'KW' '1493'; +KW1494 : 'KW' '1494'; +KW1495 : 'KW' '1495'; +KW1496 : 'KW' '1496'; +KW1497 : 'KW' '1497'; +KW1498 : 'KW' '1498'; +KW1499 : 'KW' '1499'; +KW1500 : 'KW' '1500'; +KW1501 : 'KW' '1501'; +KW1502 : 'KW' '1502'; +KW1503 : 'KW' '1503'; +KW1504 : 'KW' '1504'; +KW1505 : 'KW' '1505'; +KW1506 : 'KW' '1506'; +KW1507 : 'KW' '1507'; +KW1508 : 'KW' '1508'; +KW1509 : 'KW' '1509'; +KW1510 : 'KW' '1510'; +KW1511 : 'KW' '1511'; +KW1512 : 'KW' '1512'; +KW1513 : 'KW' '1513'; +KW1514 : 'KW' '1514'; +KW1515 : 'KW' '1515'; +KW1516 : 'KW' '1516'; +KW1517 : 'KW' '1517'; +KW1518 : 'KW' '1518'; +KW1519 : 'KW' '1519'; +KW1520 : 'KW' '1520'; +KW1521 : 'KW' '1521'; +KW1522 : 'KW' '1522'; +KW1523 : 'KW' '1523'; +KW1524 : 'KW' '1524'; +KW1525 : 'KW' '1525'; +KW1526 : 'KW' '1526'; +KW1527 : 'KW' '1527'; +KW1528 : 'KW' '1528'; +KW1529 : 'KW' '1529'; +KW1530 : 'KW' '1530'; +KW1531 : 'KW' '1531'; +KW1532 : 'KW' '1532'; +KW1533 : 'KW' '1533'; +KW1534 : 'KW' '1534'; +KW1535 : 'KW' '1535'; +KW1536 : 'KW' '1536'; +KW1537 : 'KW' '1537'; +KW1538 : 'KW' '1538'; +KW1539 : 'KW' '1539'; +KW1540 : 'KW' '1540'; +KW1541 : 'KW' '1541'; +KW1542 : 'KW' '1542'; +KW1543 : 'KW' '1543'; +KW1544 : 'KW' '1544'; +KW1545 : 'KW' '1545'; +KW1546 : 'KW' '1546'; +KW1547 : 'KW' '1547'; +KW1548 : 'KW' '1548'; +KW1549 : 'KW' '1549'; +KW1550 : 'KW' '1550'; +KW1551 : 'KW' '1551'; +KW1552 : 'KW' '1552'; +KW1553 : 'KW' '1553'; +KW1554 : 'KW' '1554'; +KW1555 : 'KW' '1555'; +KW1556 : 'KW' '1556'; +KW1557 : 'KW' '1557'; +KW1558 : 'KW' '1558'; +KW1559 : 'KW' '1559'; +KW1560 : 'KW' '1560'; +KW1561 : 'KW' '1561'; +KW1562 : 'KW' '1562'; +KW1563 : 'KW' '1563'; +KW1564 : 'KW' '1564'; +KW1565 : 'KW' '1565'; +KW1566 : 'KW' '1566'; +KW1567 : 'KW' '1567'; +KW1568 : 'KW' '1568'; +KW1569 : 'KW' '1569'; +KW1570 : 'KW' '1570'; +KW1571 : 'KW' '1571'; +KW1572 : 'KW' '1572'; +KW1573 : 'KW' '1573'; +KW1574 : 'KW' '1574'; +KW1575 : 'KW' '1575'; +KW1576 : 'KW' '1576'; +KW1577 : 'KW' '1577'; +KW1578 : 'KW' '1578'; +KW1579 : 'KW' '1579'; +KW1580 : 'KW' '1580'; +KW1581 : 'KW' '1581'; +KW1582 : 'KW' '1582'; +KW1583 : 'KW' '1583'; +KW1584 : 'KW' '1584'; +KW1585 : 'KW' '1585'; +KW1586 : 'KW' '1586'; +KW1587 : 'KW' '1587'; +KW1588 : 'KW' '1588'; +KW1589 : 'KW' '1589'; +KW1590 : 'KW' '1590'; +KW1591 : 'KW' '1591'; +KW1592 : 'KW' '1592'; +KW1593 : 'KW' '1593'; +KW1594 : 'KW' '1594'; +KW1595 : 'KW' '1595'; +KW1596 : 'KW' '1596'; +KW1597 : 'KW' '1597'; +KW1598 : 'KW' '1598'; +KW1599 : 'KW' '1599'; +KW1600 : 'KW' '1600'; +KW1601 : 'KW' '1601'; +KW1602 : 'KW' '1602'; +KW1603 : 'KW' '1603'; +KW1604 : 'KW' '1604'; +KW1605 : 'KW' '1605'; +KW1606 : 'KW' '1606'; +KW1607 : 'KW' '1607'; +KW1608 : 'KW' '1608'; +KW1609 : 'KW' '1609'; +KW1610 : 'KW' '1610'; +KW1611 : 'KW' '1611'; +KW1612 : 'KW' '1612'; +KW1613 : 'KW' '1613'; +KW1614 : 'KW' '1614'; +KW1615 : 'KW' '1615'; +KW1616 : 'KW' '1616'; +KW1617 : 'KW' '1617'; +KW1618 : 'KW' '1618'; +KW1619 : 'KW' '1619'; +KW1620 : 'KW' '1620'; +KW1621 : 'KW' '1621'; +KW1622 : 'KW' '1622'; +KW1623 : 'KW' '1623'; +KW1624 : 'KW' '1624'; +KW1625 : 'KW' '1625'; +KW1626 : 'KW' '1626'; +KW1627 : 'KW' '1627'; +KW1628 : 'KW' '1628'; +KW1629 : 'KW' '1629'; +KW1630 : 'KW' '1630'; +KW1631 : 'KW' '1631'; +KW1632 : 'KW' '1632'; +KW1633 : 'KW' '1633'; +KW1634 : 'KW' '1634'; +KW1635 : 'KW' '1635'; +KW1636 : 'KW' '1636'; +KW1637 : 'KW' '1637'; +KW1638 : 'KW' '1638'; +KW1639 : 'KW' '1639'; +KW1640 : 'KW' '1640'; +KW1641 : 'KW' '1641'; +KW1642 : 'KW' '1642'; +KW1643 : 'KW' '1643'; +KW1644 : 'KW' '1644'; +KW1645 : 'KW' '1645'; +KW1646 : 'KW' '1646'; +KW1647 : 'KW' '1647'; +KW1648 : 'KW' '1648'; +KW1649 : 'KW' '1649'; +KW1650 : 'KW' '1650'; +KW1651 : 'KW' '1651'; +KW1652 : 'KW' '1652'; +KW1653 : 'KW' '1653'; +KW1654 : 'KW' '1654'; +KW1655 : 'KW' '1655'; +KW1656 : 'KW' '1656'; +KW1657 : 'KW' '1657'; +KW1658 : 'KW' '1658'; +KW1659 : 'KW' '1659'; +KW1660 : 'KW' '1660'; +KW1661 : 'KW' '1661'; +KW1662 : 'KW' '1662'; +KW1663 : 'KW' '1663'; +KW1664 : 'KW' '1664'; +KW1665 : 'KW' '1665'; +KW1666 : 'KW' '1666'; +KW1667 : 'KW' '1667'; +KW1668 : 'KW' '1668'; +KW1669 : 'KW' '1669'; +KW1670 : 'KW' '1670'; +KW1671 : 'KW' '1671'; +KW1672 : 'KW' '1672'; +KW1673 : 'KW' '1673'; +KW1674 : 'KW' '1674'; +KW1675 : 'KW' '1675'; +KW1676 : 'KW' '1676'; +KW1677 : 'KW' '1677'; +KW1678 : 'KW' '1678'; +KW1679 : 'KW' '1679'; +KW1680 : 'KW' '1680'; +KW1681 : 'KW' '1681'; +KW1682 : 'KW' '1682'; +KW1683 : 'KW' '1683'; +KW1684 : 'KW' '1684'; +KW1685 : 'KW' '1685'; +KW1686 : 'KW' '1686'; +KW1687 : 'KW' '1687'; +KW1688 : 'KW' '1688'; +KW1689 : 'KW' '1689'; +KW1690 : 'KW' '1690'; +KW1691 : 'KW' '1691'; +KW1692 : 'KW' '1692'; +KW1693 : 'KW' '1693'; +KW1694 : 'KW' '1694'; +KW1695 : 'KW' '1695'; +KW1696 : 'KW' '1696'; +KW1697 : 'KW' '1697'; +KW1698 : 'KW' '1698'; +KW1699 : 'KW' '1699'; +KW1700 : 'KW' '1700'; +KW1701 : 'KW' '1701'; +KW1702 : 'KW' '1702'; +KW1703 : 'KW' '1703'; +KW1704 : 'KW' '1704'; +KW1705 : 'KW' '1705'; +KW1706 : 'KW' '1706'; +KW1707 : 'KW' '1707'; +KW1708 : 'KW' '1708'; +KW1709 : 'KW' '1709'; +KW1710 : 'KW' '1710'; +KW1711 : 'KW' '1711'; +KW1712 : 'KW' '1712'; +KW1713 : 'KW' '1713'; +KW1714 : 'KW' '1714'; +KW1715 : 'KW' '1715'; +KW1716 : 'KW' '1716'; +KW1717 : 'KW' '1717'; +KW1718 : 'KW' '1718'; +KW1719 : 'KW' '1719'; +KW1720 : 'KW' '1720'; +KW1721 : 'KW' '1721'; +KW1722 : 'KW' '1722'; +KW1723 : 'KW' '1723'; +KW1724 : 'KW' '1724'; +KW1725 : 'KW' '1725'; +KW1726 : 'KW' '1726'; +KW1727 : 'KW' '1727'; +KW1728 : 'KW' '1728'; +KW1729 : 'KW' '1729'; +KW1730 : 'KW' '1730'; +KW1731 : 'KW' '1731'; +KW1732 : 'KW' '1732'; +KW1733 : 'KW' '1733'; +KW1734 : 'KW' '1734'; +KW1735 : 'KW' '1735'; +KW1736 : 'KW' '1736'; +KW1737 : 'KW' '1737'; +KW1738 : 'KW' '1738'; +KW1739 : 'KW' '1739'; +KW1740 : 'KW' '1740'; +KW1741 : 'KW' '1741'; +KW1742 : 'KW' '1742'; +KW1743 : 'KW' '1743'; +KW1744 : 'KW' '1744'; +KW1745 : 'KW' '1745'; +KW1746 : 'KW' '1746'; +KW1747 : 'KW' '1747'; +KW1748 : 'KW' '1748'; +KW1749 : 'KW' '1749'; +KW1750 : 'KW' '1750'; +KW1751 : 'KW' '1751'; +KW1752 : 'KW' '1752'; +KW1753 : 'KW' '1753'; +KW1754 : 'KW' '1754'; +KW1755 : 'KW' '1755'; +KW1756 : 'KW' '1756'; +KW1757 : 'KW' '1757'; +KW1758 : 'KW' '1758'; +KW1759 : 'KW' '1759'; +KW1760 : 'KW' '1760'; +KW1761 : 'KW' '1761'; +KW1762 : 'KW' '1762'; +KW1763 : 'KW' '1763'; +KW1764 : 'KW' '1764'; +KW1765 : 'KW' '1765'; +KW1766 : 'KW' '1766'; +KW1767 : 'KW' '1767'; +KW1768 : 'KW' '1768'; +KW1769 : 'KW' '1769'; +KW1770 : 'KW' '1770'; +KW1771 : 'KW' '1771'; +KW1772 : 'KW' '1772'; +KW1773 : 'KW' '1773'; +KW1774 : 'KW' '1774'; +KW1775 : 'KW' '1775'; +KW1776 : 'KW' '1776'; +KW1777 : 'KW' '1777'; +KW1778 : 'KW' '1778'; +KW1779 : 'KW' '1779'; +KW1780 : 'KW' '1780'; +KW1781 : 'KW' '1781'; +KW1782 : 'KW' '1782'; +KW1783 : 'KW' '1783'; +KW1784 : 'KW' '1784'; +KW1785 : 'KW' '1785'; +KW1786 : 'KW' '1786'; +KW1787 : 'KW' '1787'; +KW1788 : 'KW' '1788'; +KW1789 : 'KW' '1789'; +KW1790 : 'KW' '1790'; +KW1791 : 'KW' '1791'; +KW1792 : 'KW' '1792'; +KW1793 : 'KW' '1793'; +KW1794 : 'KW' '1794'; +KW1795 : 'KW' '1795'; +KW1796 : 'KW' '1796'; +KW1797 : 'KW' '1797'; +KW1798 : 'KW' '1798'; +KW1799 : 'KW' '1799'; +KW1800 : 'KW' '1800'; +KW1801 : 'KW' '1801'; +KW1802 : 'KW' '1802'; +KW1803 : 'KW' '1803'; +KW1804 : 'KW' '1804'; +KW1805 : 'KW' '1805'; +KW1806 : 'KW' '1806'; +KW1807 : 'KW' '1807'; +KW1808 : 'KW' '1808'; +KW1809 : 'KW' '1809'; +KW1810 : 'KW' '1810'; +KW1811 : 'KW' '1811'; +KW1812 : 'KW' '1812'; +KW1813 : 'KW' '1813'; +KW1814 : 'KW' '1814'; +KW1815 : 'KW' '1815'; +KW1816 : 'KW' '1816'; +KW1817 : 'KW' '1817'; +KW1818 : 'KW' '1818'; +KW1819 : 'KW' '1819'; +KW1820 : 'KW' '1820'; +KW1821 : 'KW' '1821'; +KW1822 : 'KW' '1822'; +KW1823 : 'KW' '1823'; +KW1824 : 'KW' '1824'; +KW1825 : 'KW' '1825'; +KW1826 : 'KW' '1826'; +KW1827 : 'KW' '1827'; +KW1828 : 'KW' '1828'; +KW1829 : 'KW' '1829'; +KW1830 : 'KW' '1830'; +KW1831 : 'KW' '1831'; +KW1832 : 'KW' '1832'; +KW1833 : 'KW' '1833'; +KW1834 : 'KW' '1834'; +KW1835 : 'KW' '1835'; +KW1836 : 'KW' '1836'; +KW1837 : 'KW' '1837'; +KW1838 : 'KW' '1838'; +KW1839 : 'KW' '1839'; +KW1840 : 'KW' '1840'; +KW1841 : 'KW' '1841'; +KW1842 : 'KW' '1842'; +KW1843 : 'KW' '1843'; +KW1844 : 'KW' '1844'; +KW1845 : 'KW' '1845'; +KW1846 : 'KW' '1846'; +KW1847 : 'KW' '1847'; +KW1848 : 'KW' '1848'; +KW1849 : 'KW' '1849'; +KW1850 : 'KW' '1850'; +KW1851 : 'KW' '1851'; +KW1852 : 'KW' '1852'; +KW1853 : 'KW' '1853'; +KW1854 : 'KW' '1854'; +KW1855 : 'KW' '1855'; +KW1856 : 'KW' '1856'; +KW1857 : 'KW' '1857'; +KW1858 : 'KW' '1858'; +KW1859 : 'KW' '1859'; +KW1860 : 'KW' '1860'; +KW1861 : 'KW' '1861'; +KW1862 : 'KW' '1862'; +KW1863 : 'KW' '1863'; +KW1864 : 'KW' '1864'; +KW1865 : 'KW' '1865'; +KW1866 : 'KW' '1866'; +KW1867 : 'KW' '1867'; +KW1868 : 'KW' '1868'; +KW1869 : 'KW' '1869'; +KW1870 : 'KW' '1870'; +KW1871 : 'KW' '1871'; +KW1872 : 'KW' '1872'; +KW1873 : 'KW' '1873'; +KW1874 : 'KW' '1874'; +KW1875 : 'KW' '1875'; +KW1876 : 'KW' '1876'; +KW1877 : 'KW' '1877'; +KW1878 : 'KW' '1878'; +KW1879 : 'KW' '1879'; +KW1880 : 'KW' '1880'; +KW1881 : 'KW' '1881'; +KW1882 : 'KW' '1882'; +KW1883 : 'KW' '1883'; +KW1884 : 'KW' '1884'; +KW1885 : 'KW' '1885'; +KW1886 : 'KW' '1886'; +KW1887 : 'KW' '1887'; +KW1888 : 'KW' '1888'; +KW1889 : 'KW' '1889'; +KW1890 : 'KW' '1890'; +KW1891 : 'KW' '1891'; +KW1892 : 'KW' '1892'; +KW1893 : 'KW' '1893'; +KW1894 : 'KW' '1894'; +KW1895 : 'KW' '1895'; +KW1896 : 'KW' '1896'; +KW1897 : 'KW' '1897'; +KW1898 : 'KW' '1898'; +KW1899 : 'KW' '1899'; +KW1900 : 'KW' '1900'; +KW1901 : 'KW' '1901'; +KW1902 : 'KW' '1902'; +KW1903 : 'KW' '1903'; +KW1904 : 'KW' '1904'; +KW1905 : 'KW' '1905'; +KW1906 : 'KW' '1906'; +KW1907 : 'KW' '1907'; +KW1908 : 'KW' '1908'; +KW1909 : 'KW' '1909'; +KW1910 : 'KW' '1910'; +KW1911 : 'KW' '1911'; +KW1912 : 'KW' '1912'; +KW1913 : 'KW' '1913'; +KW1914 : 'KW' '1914'; +KW1915 : 'KW' '1915'; +KW1916 : 'KW' '1916'; +KW1917 : 'KW' '1917'; +KW1918 : 'KW' '1918'; +KW1919 : 'KW' '1919'; +KW1920 : 'KW' '1920'; +KW1921 : 'KW' '1921'; +KW1922 : 'KW' '1922'; +KW1923 : 'KW' '1923'; +KW1924 : 'KW' '1924'; +KW1925 : 'KW' '1925'; +KW1926 : 'KW' '1926'; +KW1927 : 'KW' '1927'; +KW1928 : 'KW' '1928'; +KW1929 : 'KW' '1929'; +KW1930 : 'KW' '1930'; +KW1931 : 'KW' '1931'; +KW1932 : 'KW' '1932'; +KW1933 : 'KW' '1933'; +KW1934 : 'KW' '1934'; +KW1935 : 'KW' '1935'; +KW1936 : 'KW' '1936'; +KW1937 : 'KW' '1937'; +KW1938 : 'KW' '1938'; +KW1939 : 'KW' '1939'; +KW1940 : 'KW' '1940'; +KW1941 : 'KW' '1941'; +KW1942 : 'KW' '1942'; +KW1943 : 'KW' '1943'; +KW1944 : 'KW' '1944'; +KW1945 : 'KW' '1945'; +KW1946 : 'KW' '1946'; +KW1947 : 'KW' '1947'; +KW1948 : 'KW' '1948'; +KW1949 : 'KW' '1949'; +KW1950 : 'KW' '1950'; +KW1951 : 'KW' '1951'; +KW1952 : 'KW' '1952'; +KW1953 : 'KW' '1953'; +KW1954 : 'KW' '1954'; +KW1955 : 'KW' '1955'; +KW1956 : 'KW' '1956'; +KW1957 : 'KW' '1957'; +KW1958 : 'KW' '1958'; +KW1959 : 'KW' '1959'; +KW1960 : 'KW' '1960'; +KW1961 : 'KW' '1961'; +KW1962 : 'KW' '1962'; +KW1963 : 'KW' '1963'; +KW1964 : 'KW' '1964'; +KW1965 : 'KW' '1965'; +KW1966 : 'KW' '1966'; +KW1967 : 'KW' '1967'; +KW1968 : 'KW' '1968'; +KW1969 : 'KW' '1969'; +KW1970 : 'KW' '1970'; +KW1971 : 'KW' '1971'; +KW1972 : 'KW' '1972'; +KW1973 : 'KW' '1973'; +KW1974 : 'KW' '1974'; +KW1975 : 'KW' '1975'; +KW1976 : 'KW' '1976'; +KW1977 : 'KW' '1977'; +KW1978 : 'KW' '1978'; +KW1979 : 'KW' '1979'; +KW1980 : 'KW' '1980'; +KW1981 : 'KW' '1981'; +KW1982 : 'KW' '1982'; +KW1983 : 'KW' '1983'; +KW1984 : 'KW' '1984'; +KW1985 : 'KW' '1985'; +KW1986 : 'KW' '1986'; +KW1987 : 'KW' '1987'; +KW1988 : 'KW' '1988'; +KW1989 : 'KW' '1989'; +KW1990 : 'KW' '1990'; +KW1991 : 'KW' '1991'; +KW1992 : 'KW' '1992'; +KW1993 : 'KW' '1993'; +KW1994 : 'KW' '1994'; +KW1995 : 'KW' '1995'; +KW1996 : 'KW' '1996'; +KW1997 : 'KW' '1997'; +KW1998 : 'KW' '1998'; +KW1999 : 'KW' '1999'; +KW2000 : 'KW' '2000'; +KW2001 : 'KW' '2001'; +KW2002 : 'KW' '2002'; +KW2003 : 'KW' '2003'; +KW2004 : 'KW' '2004'; +KW2005 : 'KW' '2005'; +KW2006 : 'KW' '2006'; +KW2007 : 'KW' '2007'; +KW2008 : 'KW' '2008'; +KW2009 : 'KW' '2009'; +KW2010 : 'KW' '2010'; +KW2011 : 'KW' '2011'; +KW2012 : 'KW' '2012'; +KW2013 : 'KW' '2013'; +KW2014 : 'KW' '2014'; +KW2015 : 'KW' '2015'; +KW2016 : 'KW' '2016'; +KW2017 : 'KW' '2017'; +KW2018 : 'KW' '2018'; +KW2019 : 'KW' '2019'; +KW2020 : 'KW' '2020'; +KW2021 : 'KW' '2021'; +KW2022 : 'KW' '2022'; +KW2023 : 'KW' '2023'; +KW2024 : 'KW' '2024'; +KW2025 : 'KW' '2025'; +KW2026 : 'KW' '2026'; +KW2027 : 'KW' '2027'; +KW2028 : 'KW' '2028'; +KW2029 : 'KW' '2029'; +KW2030 : 'KW' '2030'; +KW2031 : 'KW' '2031'; +KW2032 : 'KW' '2032'; +KW2033 : 'KW' '2033'; +KW2034 : 'KW' '2034'; +KW2035 : 'KW' '2035'; +KW2036 : 'KW' '2036'; +KW2037 : 'KW' '2037'; +KW2038 : 'KW' '2038'; +KW2039 : 'KW' '2039'; +KW2040 : 'KW' '2040'; +KW2041 : 'KW' '2041'; +KW2042 : 'KW' '2042'; +KW2043 : 'KW' '2043'; +KW2044 : 'KW' '2044'; +KW2045 : 'KW' '2045'; +KW2046 : 'KW' '2046'; +KW2047 : 'KW' '2047'; +KW2048 : 'KW' '2048'; +KW2049 : 'KW' '2049'; +KW2050 : 'KW' '2050'; +KW2051 : 'KW' '2051'; +KW2052 : 'KW' '2052'; +KW2053 : 'KW' '2053'; +KW2054 : 'KW' '2054'; +KW2055 : 'KW' '2055'; +KW2056 : 'KW' '2056'; +KW2057 : 'KW' '2057'; +KW2058 : 'KW' '2058'; +KW2059 : 'KW' '2059'; +KW2060 : 'KW' '2060'; +KW2061 : 'KW' '2061'; +KW2062 : 'KW' '2062'; +KW2063 : 'KW' '2063'; +KW2064 : 'KW' '2064'; +KW2065 : 'KW' '2065'; +KW2066 : 'KW' '2066'; +KW2067 : 'KW' '2067'; +KW2068 : 'KW' '2068'; +KW2069 : 'KW' '2069'; +KW2070 : 'KW' '2070'; +KW2071 : 'KW' '2071'; +KW2072 : 'KW' '2072'; +KW2073 : 'KW' '2073'; +KW2074 : 'KW' '2074'; +KW2075 : 'KW' '2075'; +KW2076 : 'KW' '2076'; +KW2077 : 'KW' '2077'; +KW2078 : 'KW' '2078'; +KW2079 : 'KW' '2079'; +KW2080 : 'KW' '2080'; +KW2081 : 'KW' '2081'; +KW2082 : 'KW' '2082'; +KW2083 : 'KW' '2083'; +KW2084 : 'KW' '2084'; +KW2085 : 'KW' '2085'; +KW2086 : 'KW' '2086'; +KW2087 : 'KW' '2087'; +KW2088 : 'KW' '2088'; +KW2089 : 'KW' '2089'; +KW2090 : 'KW' '2090'; +KW2091 : 'KW' '2091'; +KW2092 : 'KW' '2092'; +KW2093 : 'KW' '2093'; +KW2094 : 'KW' '2094'; +KW2095 : 'KW' '2095'; +KW2096 : 'KW' '2096'; +KW2097 : 'KW' '2097'; +KW2098 : 'KW' '2098'; +KW2099 : 'KW' '2099'; +KW2100 : 'KW' '2100'; +KW2101 : 'KW' '2101'; +KW2102 : 'KW' '2102'; +KW2103 : 'KW' '2103'; +KW2104 : 'KW' '2104'; +KW2105 : 'KW' '2105'; +KW2106 : 'KW' '2106'; +KW2107 : 'KW' '2107'; +KW2108 : 'KW' '2108'; +KW2109 : 'KW' '2109'; +KW2110 : 'KW' '2110'; +KW2111 : 'KW' '2111'; +KW2112 : 'KW' '2112'; +KW2113 : 'KW' '2113'; +KW2114 : 'KW' '2114'; +KW2115 : 'KW' '2115'; +KW2116 : 'KW' '2116'; +KW2117 : 'KW' '2117'; +KW2118 : 'KW' '2118'; +KW2119 : 'KW' '2119'; +KW2120 : 'KW' '2120'; +KW2121 : 'KW' '2121'; +KW2122 : 'KW' '2122'; +KW2123 : 'KW' '2123'; +KW2124 : 'KW' '2124'; +KW2125 : 'KW' '2125'; +KW2126 : 'KW' '2126'; +KW2127 : 'KW' '2127'; +KW2128 : 'KW' '2128'; +KW2129 : 'KW' '2129'; +KW2130 : 'KW' '2130'; +KW2131 : 'KW' '2131'; +KW2132 : 'KW' '2132'; +KW2133 : 'KW' '2133'; +KW2134 : 'KW' '2134'; +KW2135 : 'KW' '2135'; +KW2136 : 'KW' '2136'; +KW2137 : 'KW' '2137'; +KW2138 : 'KW' '2138'; +KW2139 : 'KW' '2139'; +KW2140 : 'KW' '2140'; +KW2141 : 'KW' '2141'; +KW2142 : 'KW' '2142'; +KW2143 : 'KW' '2143'; +KW2144 : 'KW' '2144'; +KW2145 : 'KW' '2145'; +KW2146 : 'KW' '2146'; +KW2147 : 'KW' '2147'; +KW2148 : 'KW' '2148'; +KW2149 : 'KW' '2149'; +KW2150 : 'KW' '2150'; +KW2151 : 'KW' '2151'; +KW2152 : 'KW' '2152'; +KW2153 : 'KW' '2153'; +KW2154 : 'KW' '2154'; +KW2155 : 'KW' '2155'; +KW2156 : 'KW' '2156'; +KW2157 : 'KW' '2157'; +KW2158 : 'KW' '2158'; +KW2159 : 'KW' '2159'; +KW2160 : 'KW' '2160'; +KW2161 : 'KW' '2161'; +KW2162 : 'KW' '2162'; +KW2163 : 'KW' '2163'; +KW2164 : 'KW' '2164'; +KW2165 : 'KW' '2165'; +KW2166 : 'KW' '2166'; +KW2167 : 'KW' '2167'; +KW2168 : 'KW' '2168'; +KW2169 : 'KW' '2169'; +KW2170 : 'KW' '2170'; +KW2171 : 'KW' '2171'; +KW2172 : 'KW' '2172'; +KW2173 : 'KW' '2173'; +KW2174 : 'KW' '2174'; +KW2175 : 'KW' '2175'; +KW2176 : 'KW' '2176'; +KW2177 : 'KW' '2177'; +KW2178 : 'KW' '2178'; +KW2179 : 'KW' '2179'; +KW2180 : 'KW' '2180'; +KW2181 : 'KW' '2181'; +KW2182 : 'KW' '2182'; +KW2183 : 'KW' '2183'; +KW2184 : 'KW' '2184'; +KW2185 : 'KW' '2185'; +KW2186 : 'KW' '2186'; +KW2187 : 'KW' '2187'; +KW2188 : 'KW' '2188'; +KW2189 : 'KW' '2189'; +KW2190 : 'KW' '2190'; +KW2191 : 'KW' '2191'; +KW2192 : 'KW' '2192'; +KW2193 : 'KW' '2193'; +KW2194 : 'KW' '2194'; +KW2195 : 'KW' '2195'; +KW2196 : 'KW' '2196'; +KW2197 : 'KW' '2197'; +KW2198 : 'KW' '2198'; +KW2199 : 'KW' '2199'; +KW2200 : 'KW' '2200'; +KW2201 : 'KW' '2201'; +KW2202 : 'KW' '2202'; +KW2203 : 'KW' '2203'; +KW2204 : 'KW' '2204'; +KW2205 : 'KW' '2205'; +KW2206 : 'KW' '2206'; +KW2207 : 'KW' '2207'; +KW2208 : 'KW' '2208'; +KW2209 : 'KW' '2209'; +KW2210 : 'KW' '2210'; +KW2211 : 'KW' '2211'; +KW2212 : 'KW' '2212'; +KW2213 : 'KW' '2213'; +KW2214 : 'KW' '2214'; +KW2215 : 'KW' '2215'; +KW2216 : 'KW' '2216'; +KW2217 : 'KW' '2217'; +KW2218 : 'KW' '2218'; +KW2219 : 'KW' '2219'; +KW2220 : 'KW' '2220'; +KW2221 : 'KW' '2221'; +KW2222 : 'KW' '2222'; +KW2223 : 'KW' '2223'; +KW2224 : 'KW' '2224'; +KW2225 : 'KW' '2225'; +KW2226 : 'KW' '2226'; +KW2227 : 'KW' '2227'; +KW2228 : 'KW' '2228'; +KW2229 : 'KW' '2229'; +KW2230 : 'KW' '2230'; +KW2231 : 'KW' '2231'; +KW2232 : 'KW' '2232'; +KW2233 : 'KW' '2233'; +KW2234 : 'KW' '2234'; +KW2235 : 'KW' '2235'; +KW2236 : 'KW' '2236'; +KW2237 : 'KW' '2237'; +KW2238 : 'KW' '2238'; +KW2239 : 'KW' '2239'; +KW2240 : 'KW' '2240'; +KW2241 : 'KW' '2241'; +KW2242 : 'KW' '2242'; +KW2243 : 'KW' '2243'; +KW2244 : 'KW' '2244'; +KW2245 : 'KW' '2245'; +KW2246 : 'KW' '2246'; +KW2247 : 'KW' '2247'; +KW2248 : 'KW' '2248'; +KW2249 : 'KW' '2249'; +KW2250 : 'KW' '2250'; +KW2251 : 'KW' '2251'; +KW2252 : 'KW' '2252'; +KW2253 : 'KW' '2253'; +KW2254 : 'KW' '2254'; +KW2255 : 'KW' '2255'; +KW2256 : 'KW' '2256'; +KW2257 : 'KW' '2257'; +KW2258 : 'KW' '2258'; +KW2259 : 'KW' '2259'; +KW2260 : 'KW' '2260'; +KW2261 : 'KW' '2261'; +KW2262 : 'KW' '2262'; +KW2263 : 'KW' '2263'; +KW2264 : 'KW' '2264'; +KW2265 : 'KW' '2265'; +KW2266 : 'KW' '2266'; +KW2267 : 'KW' '2267'; +KW2268 : 'KW' '2268'; +KW2269 : 'KW' '2269'; +KW2270 : 'KW' '2270'; +KW2271 : 'KW' '2271'; +KW2272 : 'KW' '2272'; +KW2273 : 'KW' '2273'; +KW2274 : 'KW' '2274'; +KW2275 : 'KW' '2275'; +KW2276 : 'KW' '2276'; +KW2277 : 'KW' '2277'; +KW2278 : 'KW' '2278'; +KW2279 : 'KW' '2279'; +KW2280 : 'KW' '2280'; +KW2281 : 'KW' '2281'; +KW2282 : 'KW' '2282'; +KW2283 : 'KW' '2283'; +KW2284 : 'KW' '2284'; +KW2285 : 'KW' '2285'; +KW2286 : 'KW' '2286'; +KW2287 : 'KW' '2287'; +KW2288 : 'KW' '2288'; +KW2289 : 'KW' '2289'; +KW2290 : 'KW' '2290'; +KW2291 : 'KW' '2291'; +KW2292 : 'KW' '2292'; +KW2293 : 'KW' '2293'; +KW2294 : 'KW' '2294'; +KW2295 : 'KW' '2295'; +KW2296 : 'KW' '2296'; +KW2297 : 'KW' '2297'; +KW2298 : 'KW' '2298'; +KW2299 : 'KW' '2299'; +KW2300 : 'KW' '2300'; +KW2301 : 'KW' '2301'; +KW2302 : 'KW' '2302'; +KW2303 : 'KW' '2303'; +KW2304 : 'KW' '2304'; +KW2305 : 'KW' '2305'; +KW2306 : 'KW' '2306'; +KW2307 : 'KW' '2307'; +KW2308 : 'KW' '2308'; +KW2309 : 'KW' '2309'; +KW2310 : 'KW' '2310'; +KW2311 : 'KW' '2311'; +KW2312 : 'KW' '2312'; +KW2313 : 'KW' '2313'; +KW2314 : 'KW' '2314'; +KW2315 : 'KW' '2315'; +KW2316 : 'KW' '2316'; +KW2317 : 'KW' '2317'; +KW2318 : 'KW' '2318'; +KW2319 : 'KW' '2319'; +KW2320 : 'KW' '2320'; +KW2321 : 'KW' '2321'; +KW2322 : 'KW' '2322'; +KW2323 : 'KW' '2323'; +KW2324 : 'KW' '2324'; +KW2325 : 'KW' '2325'; +KW2326 : 'KW' '2326'; +KW2327 : 'KW' '2327'; +KW2328 : 'KW' '2328'; +KW2329 : 'KW' '2329'; +KW2330 : 'KW' '2330'; +KW2331 : 'KW' '2331'; +KW2332 : 'KW' '2332'; +KW2333 : 'KW' '2333'; +KW2334 : 'KW' '2334'; +KW2335 : 'KW' '2335'; +KW2336 : 'KW' '2336'; +KW2337 : 'KW' '2337'; +KW2338 : 'KW' '2338'; +KW2339 : 'KW' '2339'; +KW2340 : 'KW' '2340'; +KW2341 : 'KW' '2341'; +KW2342 : 'KW' '2342'; +KW2343 : 'KW' '2343'; +KW2344 : 'KW' '2344'; +KW2345 : 'KW' '2345'; +KW2346 : 'KW' '2346'; +KW2347 : 'KW' '2347'; +KW2348 : 'KW' '2348'; +KW2349 : 'KW' '2349'; +KW2350 : 'KW' '2350'; +KW2351 : 'KW' '2351'; +KW2352 : 'KW' '2352'; +KW2353 : 'KW' '2353'; +KW2354 : 'KW' '2354'; +KW2355 : 'KW' '2355'; +KW2356 : 'KW' '2356'; +KW2357 : 'KW' '2357'; +KW2358 : 'KW' '2358'; +KW2359 : 'KW' '2359'; +KW2360 : 'KW' '2360'; +KW2361 : 'KW' '2361'; +KW2362 : 'KW' '2362'; +KW2363 : 'KW' '2363'; +KW2364 : 'KW' '2364'; +KW2365 : 'KW' '2365'; +KW2366 : 'KW' '2366'; +KW2367 : 'KW' '2367'; +KW2368 : 'KW' '2368'; +KW2369 : 'KW' '2369'; +KW2370 : 'KW' '2370'; +KW2371 : 'KW' '2371'; +KW2372 : 'KW' '2372'; +KW2373 : 'KW' '2373'; +KW2374 : 'KW' '2374'; +KW2375 : 'KW' '2375'; +KW2376 : 'KW' '2376'; +KW2377 : 'KW' '2377'; +KW2378 : 'KW' '2378'; +KW2379 : 'KW' '2379'; +KW2380 : 'KW' '2380'; +KW2381 : 'KW' '2381'; +KW2382 : 'KW' '2382'; +KW2383 : 'KW' '2383'; +KW2384 : 'KW' '2384'; +KW2385 : 'KW' '2385'; +KW2386 : 'KW' '2386'; +KW2387 : 'KW' '2387'; +KW2388 : 'KW' '2388'; +KW2389 : 'KW' '2389'; +KW2390 : 'KW' '2390'; +KW2391 : 'KW' '2391'; +KW2392 : 'KW' '2392'; +KW2393 : 'KW' '2393'; +KW2394 : 'KW' '2394'; +KW2395 : 'KW' '2395'; +KW2396 : 'KW' '2396'; +KW2397 : 'KW' '2397'; +KW2398 : 'KW' '2398'; +KW2399 : 'KW' '2399'; +KW2400 : 'KW' '2400'; +KW2401 : 'KW' '2401'; +KW2402 : 'KW' '2402'; +KW2403 : 'KW' '2403'; +KW2404 : 'KW' '2404'; +KW2405 : 'KW' '2405'; +KW2406 : 'KW' '2406'; +KW2407 : 'KW' '2407'; +KW2408 : 'KW' '2408'; +KW2409 : 'KW' '2409'; +KW2410 : 'KW' '2410'; +KW2411 : 'KW' '2411'; +KW2412 : 'KW' '2412'; +KW2413 : 'KW' '2413'; +KW2414 : 'KW' '2414'; +KW2415 : 'KW' '2415'; +KW2416 : 'KW' '2416'; +KW2417 : 'KW' '2417'; +KW2418 : 'KW' '2418'; +KW2419 : 'KW' '2419'; +KW2420 : 'KW' '2420'; +KW2421 : 'KW' '2421'; +KW2422 : 'KW' '2422'; +KW2423 : 'KW' '2423'; +KW2424 : 'KW' '2424'; +KW2425 : 'KW' '2425'; +KW2426 : 'KW' '2426'; +KW2427 : 'KW' '2427'; +KW2428 : 'KW' '2428'; +KW2429 : 'KW' '2429'; +KW2430 : 'KW' '2430'; +KW2431 : 'KW' '2431'; +KW2432 : 'KW' '2432'; +KW2433 : 'KW' '2433'; +KW2434 : 'KW' '2434'; +KW2435 : 'KW' '2435'; +KW2436 : 'KW' '2436'; +KW2437 : 'KW' '2437'; +KW2438 : 'KW' '2438'; +KW2439 : 'KW' '2439'; +KW2440 : 'KW' '2440'; +KW2441 : 'KW' '2441'; +KW2442 : 'KW' '2442'; +KW2443 : 'KW' '2443'; +KW2444 : 'KW' '2444'; +KW2445 : 'KW' '2445'; +KW2446 : 'KW' '2446'; +KW2447 : 'KW' '2447'; +KW2448 : 'KW' '2448'; +KW2449 : 'KW' '2449'; +KW2450 : 'KW' '2450'; +KW2451 : 'KW' '2451'; +KW2452 : 'KW' '2452'; +KW2453 : 'KW' '2453'; +KW2454 : 'KW' '2454'; +KW2455 : 'KW' '2455'; +KW2456 : 'KW' '2456'; +KW2457 : 'KW' '2457'; +KW2458 : 'KW' '2458'; +KW2459 : 'KW' '2459'; +KW2460 : 'KW' '2460'; +KW2461 : 'KW' '2461'; +KW2462 : 'KW' '2462'; +KW2463 : 'KW' '2463'; +KW2464 : 'KW' '2464'; +KW2465 : 'KW' '2465'; +KW2466 : 'KW' '2466'; +KW2467 : 'KW' '2467'; +KW2468 : 'KW' '2468'; +KW2469 : 'KW' '2469'; +KW2470 : 'KW' '2470'; +KW2471 : 'KW' '2471'; +KW2472 : 'KW' '2472'; +KW2473 : 'KW' '2473'; +KW2474 : 'KW' '2474'; +KW2475 : 'KW' '2475'; +KW2476 : 'KW' '2476'; +KW2477 : 'KW' '2477'; +KW2478 : 'KW' '2478'; +KW2479 : 'KW' '2479'; +KW2480 : 'KW' '2480'; +KW2481 : 'KW' '2481'; +KW2482 : 'KW' '2482'; +KW2483 : 'KW' '2483'; +KW2484 : 'KW' '2484'; +KW2485 : 'KW' '2485'; +KW2486 : 'KW' '2486'; +KW2487 : 'KW' '2487'; +KW2488 : 'KW' '2488'; +KW2489 : 'KW' '2489'; +KW2490 : 'KW' '2490'; +KW2491 : 'KW' '2491'; +KW2492 : 'KW' '2492'; +KW2493 : 'KW' '2493'; +KW2494 : 'KW' '2494'; +KW2495 : 'KW' '2495'; +KW2496 : 'KW' '2496'; +KW2497 : 'KW' '2497'; +KW2498 : 'KW' '2498'; +KW2499 : 'KW' '2499'; +KW2500 : 'KW' '2500'; +KW2501 : 'KW' '2501'; +KW2502 : 'KW' '2502'; +KW2503 : 'KW' '2503'; +KW2504 : 'KW' '2504'; +KW2505 : 'KW' '2505'; +KW2506 : 'KW' '2506'; +KW2507 : 'KW' '2507'; +KW2508 : 'KW' '2508'; +KW2509 : 'KW' '2509'; +KW2510 : 'KW' '2510'; +KW2511 : 'KW' '2511'; +KW2512 : 'KW' '2512'; +KW2513 : 'KW' '2513'; +KW2514 : 'KW' '2514'; +KW2515 : 'KW' '2515'; +KW2516 : 'KW' '2516'; +KW2517 : 'KW' '2517'; +KW2518 : 'KW' '2518'; +KW2519 : 'KW' '2519'; +KW2520 : 'KW' '2520'; +KW2521 : 'KW' '2521'; +KW2522 : 'KW' '2522'; +KW2523 : 'KW' '2523'; +KW2524 : 'KW' '2524'; +KW2525 : 'KW' '2525'; +KW2526 : 'KW' '2526'; +KW2527 : 'KW' '2527'; +KW2528 : 'KW' '2528'; +KW2529 : 'KW' '2529'; +KW2530 : 'KW' '2530'; +KW2531 : 'KW' '2531'; +KW2532 : 'KW' '2532'; +KW2533 : 'KW' '2533'; +KW2534 : 'KW' '2534'; +KW2535 : 'KW' '2535'; +KW2536 : 'KW' '2536'; +KW2537 : 'KW' '2537'; +KW2538 : 'KW' '2538'; +KW2539 : 'KW' '2539'; +KW2540 : 'KW' '2540'; +KW2541 : 'KW' '2541'; +KW2542 : 'KW' '2542'; +KW2543 : 'KW' '2543'; +KW2544 : 'KW' '2544'; +KW2545 : 'KW' '2545'; +KW2546 : 'KW' '2546'; +KW2547 : 'KW' '2547'; +KW2548 : 'KW' '2548'; +KW2549 : 'KW' '2549'; +KW2550 : 'KW' '2550'; +KW2551 : 'KW' '2551'; +KW2552 : 'KW' '2552'; +KW2553 : 'KW' '2553'; +KW2554 : 'KW' '2554'; +KW2555 : 'KW' '2555'; +KW2556 : 'KW' '2556'; +KW2557 : 'KW' '2557'; +KW2558 : 'KW' '2558'; +KW2559 : 'KW' '2559'; +KW2560 : 'KW' '2560'; +KW2561 : 'KW' '2561'; +KW2562 : 'KW' '2562'; +KW2563 : 'KW' '2563'; +KW2564 : 'KW' '2564'; +KW2565 : 'KW' '2565'; +KW2566 : 'KW' '2566'; +KW2567 : 'KW' '2567'; +KW2568 : 'KW' '2568'; +KW2569 : 'KW' '2569'; +KW2570 : 'KW' '2570'; +KW2571 : 'KW' '2571'; +KW2572 : 'KW' '2572'; +KW2573 : 'KW' '2573'; +KW2574 : 'KW' '2574'; +KW2575 : 'KW' '2575'; +KW2576 : 'KW' '2576'; +KW2577 : 'KW' '2577'; +KW2578 : 'KW' '2578'; +KW2579 : 'KW' '2579'; +KW2580 : 'KW' '2580'; +KW2581 : 'KW' '2581'; +KW2582 : 'KW' '2582'; +KW2583 : 'KW' '2583'; +KW2584 : 'KW' '2584'; +KW2585 : 'KW' '2585'; +KW2586 : 'KW' '2586'; +KW2587 : 'KW' '2587'; +KW2588 : 'KW' '2588'; +KW2589 : 'KW' '2589'; +KW2590 : 'KW' '2590'; +KW2591 : 'KW' '2591'; +KW2592 : 'KW' '2592'; +KW2593 : 'KW' '2593'; +KW2594 : 'KW' '2594'; +KW2595 : 'KW' '2595'; +KW2596 : 'KW' '2596'; +KW2597 : 'KW' '2597'; +KW2598 : 'KW' '2598'; +KW2599 : 'KW' '2599'; +KW2600 : 'KW' '2600'; +KW2601 : 'KW' '2601'; +KW2602 : 'KW' '2602'; +KW2603 : 'KW' '2603'; +KW2604 : 'KW' '2604'; +KW2605 : 'KW' '2605'; +KW2606 : 'KW' '2606'; +KW2607 : 'KW' '2607'; +KW2608 : 'KW' '2608'; +KW2609 : 'KW' '2609'; +KW2610 : 'KW' '2610'; +KW2611 : 'KW' '2611'; +KW2612 : 'KW' '2612'; +KW2613 : 'KW' '2613'; +KW2614 : 'KW' '2614'; +KW2615 : 'KW' '2615'; +KW2616 : 'KW' '2616'; +KW2617 : 'KW' '2617'; +KW2618 : 'KW' '2618'; +KW2619 : 'KW' '2619'; +KW2620 : 'KW' '2620'; +KW2621 : 'KW' '2621'; +KW2622 : 'KW' '2622'; +KW2623 : 'KW' '2623'; +KW2624 : 'KW' '2624'; +KW2625 : 'KW' '2625'; +KW2626 : 'KW' '2626'; +KW2627 : 'KW' '2627'; +KW2628 : 'KW' '2628'; +KW2629 : 'KW' '2629'; +KW2630 : 'KW' '2630'; +KW2631 : 'KW' '2631'; +KW2632 : 'KW' '2632'; +KW2633 : 'KW' '2633'; +KW2634 : 'KW' '2634'; +KW2635 : 'KW' '2635'; +KW2636 : 'KW' '2636'; +KW2637 : 'KW' '2637'; +KW2638 : 'KW' '2638'; +KW2639 : 'KW' '2639'; +KW2640 : 'KW' '2640'; +KW2641 : 'KW' '2641'; +KW2642 : 'KW' '2642'; +KW2643 : 'KW' '2643'; +KW2644 : 'KW' '2644'; +KW2645 : 'KW' '2645'; +KW2646 : 'KW' '2646'; +KW2647 : 'KW' '2647'; +KW2648 : 'KW' '2648'; +KW2649 : 'KW' '2649'; +KW2650 : 'KW' '2650'; +KW2651 : 'KW' '2651'; +KW2652 : 'KW' '2652'; +KW2653 : 'KW' '2653'; +KW2654 : 'KW' '2654'; +KW2655 : 'KW' '2655'; +KW2656 : 'KW' '2656'; +KW2657 : 'KW' '2657'; +KW2658 : 'KW' '2658'; +KW2659 : 'KW' '2659'; +KW2660 : 'KW' '2660'; +KW2661 : 'KW' '2661'; +KW2662 : 'KW' '2662'; +KW2663 : 'KW' '2663'; +KW2664 : 'KW' '2664'; +KW2665 : 'KW' '2665'; +KW2666 : 'KW' '2666'; +KW2667 : 'KW' '2667'; +KW2668 : 'KW' '2668'; +KW2669 : 'KW' '2669'; +KW2670 : 'KW' '2670'; +KW2671 : 'KW' '2671'; +KW2672 : 'KW' '2672'; +KW2673 : 'KW' '2673'; +KW2674 : 'KW' '2674'; +KW2675 : 'KW' '2675'; +KW2676 : 'KW' '2676'; +KW2677 : 'KW' '2677'; +KW2678 : 'KW' '2678'; +KW2679 : 'KW' '2679'; +KW2680 : 'KW' '2680'; +KW2681 : 'KW' '2681'; +KW2682 : 'KW' '2682'; +KW2683 : 'KW' '2683'; +KW2684 : 'KW' '2684'; +KW2685 : 'KW' '2685'; +KW2686 : 'KW' '2686'; +KW2687 : 'KW' '2687'; +KW2688 : 'KW' '2688'; +KW2689 : 'KW' '2689'; +KW2690 : 'KW' '2690'; +KW2691 : 'KW' '2691'; +KW2692 : 'KW' '2692'; +KW2693 : 'KW' '2693'; +KW2694 : 'KW' '2694'; +KW2695 : 'KW' '2695'; +KW2696 : 'KW' '2696'; +KW2697 : 'KW' '2697'; +KW2698 : 'KW' '2698'; +KW2699 : 'KW' '2699'; +KW2700 : 'KW' '2700'; +KW2701 : 'KW' '2701'; +KW2702 : 'KW' '2702'; +KW2703 : 'KW' '2703'; +KW2704 : 'KW' '2704'; +KW2705 : 'KW' '2705'; +KW2706 : 'KW' '2706'; +KW2707 : 'KW' '2707'; +KW2708 : 'KW' '2708'; +KW2709 : 'KW' '2709'; +KW2710 : 'KW' '2710'; +KW2711 : 'KW' '2711'; +KW2712 : 'KW' '2712'; +KW2713 : 'KW' '2713'; +KW2714 : 'KW' '2714'; +KW2715 : 'KW' '2715'; +KW2716 : 'KW' '2716'; +KW2717 : 'KW' '2717'; +KW2718 : 'KW' '2718'; +KW2719 : 'KW' '2719'; +KW2720 : 'KW' '2720'; +KW2721 : 'KW' '2721'; +KW2722 : 'KW' '2722'; +KW2723 : 'KW' '2723'; +KW2724 : 'KW' '2724'; +KW2725 : 'KW' '2725'; +KW2726 : 'KW' '2726'; +KW2727 : 'KW' '2727'; +KW2728 : 'KW' '2728'; +KW2729 : 'KW' '2729'; +KW2730 : 'KW' '2730'; +KW2731 : 'KW' '2731'; +KW2732 : 'KW' '2732'; +KW2733 : 'KW' '2733'; +KW2734 : 'KW' '2734'; +KW2735 : 'KW' '2735'; +KW2736 : 'KW' '2736'; +KW2737 : 'KW' '2737'; +KW2738 : 'KW' '2738'; +KW2739 : 'KW' '2739'; +KW2740 : 'KW' '2740'; +KW2741 : 'KW' '2741'; +KW2742 : 'KW' '2742'; +KW2743 : 'KW' '2743'; +KW2744 : 'KW' '2744'; +KW2745 : 'KW' '2745'; +KW2746 : 'KW' '2746'; +KW2747 : 'KW' '2747'; +KW2748 : 'KW' '2748'; +KW2749 : 'KW' '2749'; +KW2750 : 'KW' '2750'; +KW2751 : 'KW' '2751'; +KW2752 : 'KW' '2752'; +KW2753 : 'KW' '2753'; +KW2754 : 'KW' '2754'; +KW2755 : 'KW' '2755'; +KW2756 : 'KW' '2756'; +KW2757 : 'KW' '2757'; +KW2758 : 'KW' '2758'; +KW2759 : 'KW' '2759'; +KW2760 : 'KW' '2760'; +KW2761 : 'KW' '2761'; +KW2762 : 'KW' '2762'; +KW2763 : 'KW' '2763'; +KW2764 : 'KW' '2764'; +KW2765 : 'KW' '2765'; +KW2766 : 'KW' '2766'; +KW2767 : 'KW' '2767'; +KW2768 : 'KW' '2768'; +KW2769 : 'KW' '2769'; +KW2770 : 'KW' '2770'; +KW2771 : 'KW' '2771'; +KW2772 : 'KW' '2772'; +KW2773 : 'KW' '2773'; +KW2774 : 'KW' '2774'; +KW2775 : 'KW' '2775'; +KW2776 : 'KW' '2776'; +KW2777 : 'KW' '2777'; +KW2778 : 'KW' '2778'; +KW2779 : 'KW' '2779'; +KW2780 : 'KW' '2780'; +KW2781 : 'KW' '2781'; +KW2782 : 'KW' '2782'; +KW2783 : 'KW' '2783'; +KW2784 : 'KW' '2784'; +KW2785 : 'KW' '2785'; +KW2786 : 'KW' '2786'; +KW2787 : 'KW' '2787'; +KW2788 : 'KW' '2788'; +KW2789 : 'KW' '2789'; +KW2790 : 'KW' '2790'; +KW2791 : 'KW' '2791'; +KW2792 : 'KW' '2792'; +KW2793 : 'KW' '2793'; +KW2794 : 'KW' '2794'; +KW2795 : 'KW' '2795'; +KW2796 : 'KW' '2796'; +KW2797 : 'KW' '2797'; +KW2798 : 'KW' '2798'; +KW2799 : 'KW' '2799'; +KW2800 : 'KW' '2800'; +KW2801 : 'KW' '2801'; +KW2802 : 'KW' '2802'; +KW2803 : 'KW' '2803'; +KW2804 : 'KW' '2804'; +KW2805 : 'KW' '2805'; +KW2806 : 'KW' '2806'; +KW2807 : 'KW' '2807'; +KW2808 : 'KW' '2808'; +KW2809 : 'KW' '2809'; +KW2810 : 'KW' '2810'; +KW2811 : 'KW' '2811'; +KW2812 : 'KW' '2812'; +KW2813 : 'KW' '2813'; +KW2814 : 'KW' '2814'; +KW2815 : 'KW' '2815'; +KW2816 : 'KW' '2816'; +KW2817 : 'KW' '2817'; +KW2818 : 'KW' '2818'; +KW2819 : 'KW' '2819'; +KW2820 : 'KW' '2820'; +KW2821 : 'KW' '2821'; +KW2822 : 'KW' '2822'; +KW2823 : 'KW' '2823'; +KW2824 : 'KW' '2824'; +KW2825 : 'KW' '2825'; +KW2826 : 'KW' '2826'; +KW2827 : 'KW' '2827'; +KW2828 : 'KW' '2828'; +KW2829 : 'KW' '2829'; +KW2830 : 'KW' '2830'; +KW2831 : 'KW' '2831'; +KW2832 : 'KW' '2832'; +KW2833 : 'KW' '2833'; +KW2834 : 'KW' '2834'; +KW2835 : 'KW' '2835'; +KW2836 : 'KW' '2836'; +KW2837 : 'KW' '2837'; +KW2838 : 'KW' '2838'; +KW2839 : 'KW' '2839'; +KW2840 : 'KW' '2840'; +KW2841 : 'KW' '2841'; +KW2842 : 'KW' '2842'; +KW2843 : 'KW' '2843'; +KW2844 : 'KW' '2844'; +KW2845 : 'KW' '2845'; +KW2846 : 'KW' '2846'; +KW2847 : 'KW' '2847'; +KW2848 : 'KW' '2848'; +KW2849 : 'KW' '2849'; +KW2850 : 'KW' '2850'; +KW2851 : 'KW' '2851'; +KW2852 : 'KW' '2852'; +KW2853 : 'KW' '2853'; +KW2854 : 'KW' '2854'; +KW2855 : 'KW' '2855'; +KW2856 : 'KW' '2856'; +KW2857 : 'KW' '2857'; +KW2858 : 'KW' '2858'; +KW2859 : 'KW' '2859'; +KW2860 : 'KW' '2860'; +KW2861 : 'KW' '2861'; +KW2862 : 'KW' '2862'; +KW2863 : 'KW' '2863'; +KW2864 : 'KW' '2864'; +KW2865 : 'KW' '2865'; +KW2866 : 'KW' '2866'; +KW2867 : 'KW' '2867'; +KW2868 : 'KW' '2868'; +KW2869 : 'KW' '2869'; +KW2870 : 'KW' '2870'; +KW2871 : 'KW' '2871'; +KW2872 : 'KW' '2872'; +KW2873 : 'KW' '2873'; +KW2874 : 'KW' '2874'; +KW2875 : 'KW' '2875'; +KW2876 : 'KW' '2876'; +KW2877 : 'KW' '2877'; +KW2878 : 'KW' '2878'; +KW2879 : 'KW' '2879'; +KW2880 : 'KW' '2880'; +KW2881 : 'KW' '2881'; +KW2882 : 'KW' '2882'; +KW2883 : 'KW' '2883'; +KW2884 : 'KW' '2884'; +KW2885 : 'KW' '2885'; +KW2886 : 'KW' '2886'; +KW2887 : 'KW' '2887'; +KW2888 : 'KW' '2888'; +KW2889 : 'KW' '2889'; +KW2890 : 'KW' '2890'; +KW2891 : 'KW' '2891'; +KW2892 : 'KW' '2892'; +KW2893 : 'KW' '2893'; +KW2894 : 'KW' '2894'; +KW2895 : 'KW' '2895'; +KW2896 : 'KW' '2896'; +KW2897 : 'KW' '2897'; +KW2898 : 'KW' '2898'; +KW2899 : 'KW' '2899'; +KW2900 : 'KW' '2900'; +KW2901 : 'KW' '2901'; +KW2902 : 'KW' '2902'; +KW2903 : 'KW' '2903'; +KW2904 : 'KW' '2904'; +KW2905 : 'KW' '2905'; +KW2906 : 'KW' '2906'; +KW2907 : 'KW' '2907'; +KW2908 : 'KW' '2908'; +KW2909 : 'KW' '2909'; +KW2910 : 'KW' '2910'; +KW2911 : 'KW' '2911'; +KW2912 : 'KW' '2912'; +KW2913 : 'KW' '2913'; +KW2914 : 'KW' '2914'; +KW2915 : 'KW' '2915'; +KW2916 : 'KW' '2916'; +KW2917 : 'KW' '2917'; +KW2918 : 'KW' '2918'; +KW2919 : 'KW' '2919'; +KW2920 : 'KW' '2920'; +KW2921 : 'KW' '2921'; +KW2922 : 'KW' '2922'; +KW2923 : 'KW' '2923'; +KW2924 : 'KW' '2924'; +KW2925 : 'KW' '2925'; +KW2926 : 'KW' '2926'; +KW2927 : 'KW' '2927'; +KW2928 : 'KW' '2928'; +KW2929 : 'KW' '2929'; +KW2930 : 'KW' '2930'; +KW2931 : 'KW' '2931'; +KW2932 : 'KW' '2932'; +KW2933 : 'KW' '2933'; +KW2934 : 'KW' '2934'; +KW2935 : 'KW' '2935'; +KW2936 : 'KW' '2936'; +KW2937 : 'KW' '2937'; +KW2938 : 'KW' '2938'; +KW2939 : 'KW' '2939'; +KW2940 : 'KW' '2940'; +KW2941 : 'KW' '2941'; +KW2942 : 'KW' '2942'; +KW2943 : 'KW' '2943'; +KW2944 : 'KW' '2944'; +KW2945 : 'KW' '2945'; +KW2946 : 'KW' '2946'; +KW2947 : 'KW' '2947'; +KW2948 : 'KW' '2948'; +KW2949 : 'KW' '2949'; +KW2950 : 'KW' '2950'; +KW2951 : 'KW' '2951'; +KW2952 : 'KW' '2952'; +KW2953 : 'KW' '2953'; +KW2954 : 'KW' '2954'; +KW2955 : 'KW' '2955'; +KW2956 : 'KW' '2956'; +KW2957 : 'KW' '2957'; +KW2958 : 'KW' '2958'; +KW2959 : 'KW' '2959'; +KW2960 : 'KW' '2960'; +KW2961 : 'KW' '2961'; +KW2962 : 'KW' '2962'; +KW2963 : 'KW' '2963'; +KW2964 : 'KW' '2964'; +KW2965 : 'KW' '2965'; +KW2966 : 'KW' '2966'; +KW2967 : 'KW' '2967'; +KW2968 : 'KW' '2968'; +KW2969 : 'KW' '2969'; +KW2970 : 'KW' '2970'; +KW2971 : 'KW' '2971'; +KW2972 : 'KW' '2972'; +KW2973 : 'KW' '2973'; +KW2974 : 'KW' '2974'; +KW2975 : 'KW' '2975'; +KW2976 : 'KW' '2976'; +KW2977 : 'KW' '2977'; +KW2978 : 'KW' '2978'; +KW2979 : 'KW' '2979'; +KW2980 : 'KW' '2980'; +KW2981 : 'KW' '2981'; +KW2982 : 'KW' '2982'; +KW2983 : 'KW' '2983'; +KW2984 : 'KW' '2984'; +KW2985 : 'KW' '2985'; +KW2986 : 'KW' '2986'; +KW2987 : 'KW' '2987'; +KW2988 : 'KW' '2988'; +KW2989 : 'KW' '2989'; +KW2990 : 'KW' '2990'; +KW2991 : 'KW' '2991'; +KW2992 : 'KW' '2992'; +KW2993 : 'KW' '2993'; +KW2994 : 'KW' '2994'; +KW2995 : 'KW' '2995'; +KW2996 : 'KW' '2996'; +KW2997 : 'KW' '2997'; +KW2998 : 'KW' '2998'; +KW2999 : 'KW' '2999'; +KW3000 : 'KW' '3000'; +KW3001 : 'KW' '3001'; +KW3002 : 'KW' '3002'; +KW3003 : 'KW' '3003'; +KW3004 : 'KW' '3004'; +KW3005 : 'KW' '3005'; +KW3006 : 'KW' '3006'; +KW3007 : 'KW' '3007'; +KW3008 : 'KW' '3008'; +KW3009 : 'KW' '3009'; +KW3010 : 'KW' '3010'; +KW3011 : 'KW' '3011'; +KW3012 : 'KW' '3012'; +KW3013 : 'KW' '3013'; +KW3014 : 'KW' '3014'; +KW3015 : 'KW' '3015'; +KW3016 : 'KW' '3016'; +KW3017 : 'KW' '3017'; +KW3018 : 'KW' '3018'; +KW3019 : 'KW' '3019'; +KW3020 : 'KW' '3020'; +KW3021 : 'KW' '3021'; +KW3022 : 'KW' '3022'; +KW3023 : 'KW' '3023'; +KW3024 : 'KW' '3024'; +KW3025 : 'KW' '3025'; +KW3026 : 'KW' '3026'; +KW3027 : 'KW' '3027'; +KW3028 : 'KW' '3028'; +KW3029 : 'KW' '3029'; +KW3030 : 'KW' '3030'; +KW3031 : 'KW' '3031'; +KW3032 : 'KW' '3032'; +KW3033 : 'KW' '3033'; +KW3034 : 'KW' '3034'; +KW3035 : 'KW' '3035'; +KW3036 : 'KW' '3036'; +KW3037 : 'KW' '3037'; +KW3038 : 'KW' '3038'; +KW3039 : 'KW' '3039'; +KW3040 : 'KW' '3040'; +KW3041 : 'KW' '3041'; +KW3042 : 'KW' '3042'; +KW3043 : 'KW' '3043'; +KW3044 : 'KW' '3044'; +KW3045 : 'KW' '3045'; +KW3046 : 'KW' '3046'; +KW3047 : 'KW' '3047'; +KW3048 : 'KW' '3048'; +KW3049 : 'KW' '3049'; +KW3050 : 'KW' '3050'; +KW3051 : 'KW' '3051'; +KW3052 : 'KW' '3052'; +KW3053 : 'KW' '3053'; +KW3054 : 'KW' '3054'; +KW3055 : 'KW' '3055'; +KW3056 : 'KW' '3056'; +KW3057 : 'KW' '3057'; +KW3058 : 'KW' '3058'; +KW3059 : 'KW' '3059'; +KW3060 : 'KW' '3060'; +KW3061 : 'KW' '3061'; +KW3062 : 'KW' '3062'; +KW3063 : 'KW' '3063'; +KW3064 : 'KW' '3064'; +KW3065 : 'KW' '3065'; +KW3066 : 'KW' '3066'; +KW3067 : 'KW' '3067'; +KW3068 : 'KW' '3068'; +KW3069 : 'KW' '3069'; +KW3070 : 'KW' '3070'; +KW3071 : 'KW' '3071'; +KW3072 : 'KW' '3072'; +KW3073 : 'KW' '3073'; +KW3074 : 'KW' '3074'; +KW3075 : 'KW' '3075'; +KW3076 : 'KW' '3076'; +KW3077 : 'KW' '3077'; +KW3078 : 'KW' '3078'; +KW3079 : 'KW' '3079'; +KW3080 : 'KW' '3080'; +KW3081 : 'KW' '3081'; +KW3082 : 'KW' '3082'; +KW3083 : 'KW' '3083'; +KW3084 : 'KW' '3084'; +KW3085 : 'KW' '3085'; +KW3086 : 'KW' '3086'; +KW3087 : 'KW' '3087'; +KW3088 : 'KW' '3088'; +KW3089 : 'KW' '3089'; +KW3090 : 'KW' '3090'; +KW3091 : 'KW' '3091'; +KW3092 : 'KW' '3092'; +KW3093 : 'KW' '3093'; +KW3094 : 'KW' '3094'; +KW3095 : 'KW' '3095'; +KW3096 : 'KW' '3096'; +KW3097 : 'KW' '3097'; +KW3098 : 'KW' '3098'; +KW3099 : 'KW' '3099'; +KW3100 : 'KW' '3100'; +KW3101 : 'KW' '3101'; +KW3102 : 'KW' '3102'; +KW3103 : 'KW' '3103'; +KW3104 : 'KW' '3104'; +KW3105 : 'KW' '3105'; +KW3106 : 'KW' '3106'; +KW3107 : 'KW' '3107'; +KW3108 : 'KW' '3108'; +KW3109 : 'KW' '3109'; +KW3110 : 'KW' '3110'; +KW3111 : 'KW' '3111'; +KW3112 : 'KW' '3112'; +KW3113 : 'KW' '3113'; +KW3114 : 'KW' '3114'; +KW3115 : 'KW' '3115'; +KW3116 : 'KW' '3116'; +KW3117 : 'KW' '3117'; +KW3118 : 'KW' '3118'; +KW3119 : 'KW' '3119'; +KW3120 : 'KW' '3120'; +KW3121 : 'KW' '3121'; +KW3122 : 'KW' '3122'; +KW3123 : 'KW' '3123'; +KW3124 : 'KW' '3124'; +KW3125 : 'KW' '3125'; +KW3126 : 'KW' '3126'; +KW3127 : 'KW' '3127'; +KW3128 : 'KW' '3128'; +KW3129 : 'KW' '3129'; +KW3130 : 'KW' '3130'; +KW3131 : 'KW' '3131'; +KW3132 : 'KW' '3132'; +KW3133 : 'KW' '3133'; +KW3134 : 'KW' '3134'; +KW3135 : 'KW' '3135'; +KW3136 : 'KW' '3136'; +KW3137 : 'KW' '3137'; +KW3138 : 'KW' '3138'; +KW3139 : 'KW' '3139'; +KW3140 : 'KW' '3140'; +KW3141 : 'KW' '3141'; +KW3142 : 'KW' '3142'; +KW3143 : 'KW' '3143'; +KW3144 : 'KW' '3144'; +KW3145 : 'KW' '3145'; +KW3146 : 'KW' '3146'; +KW3147 : 'KW' '3147'; +KW3148 : 'KW' '3148'; +KW3149 : 'KW' '3149'; +KW3150 : 'KW' '3150'; +KW3151 : 'KW' '3151'; +KW3152 : 'KW' '3152'; +KW3153 : 'KW' '3153'; +KW3154 : 'KW' '3154'; +KW3155 : 'KW' '3155'; +KW3156 : 'KW' '3156'; +KW3157 : 'KW' '3157'; +KW3158 : 'KW' '3158'; +KW3159 : 'KW' '3159'; +KW3160 : 'KW' '3160'; +KW3161 : 'KW' '3161'; +KW3162 : 'KW' '3162'; +KW3163 : 'KW' '3163'; +KW3164 : 'KW' '3164'; +KW3165 : 'KW' '3165'; +KW3166 : 'KW' '3166'; +KW3167 : 'KW' '3167'; +KW3168 : 'KW' '3168'; +KW3169 : 'KW' '3169'; +KW3170 : 'KW' '3170'; +KW3171 : 'KW' '3171'; +KW3172 : 'KW' '3172'; +KW3173 : 'KW' '3173'; +KW3174 : 'KW' '3174'; +KW3175 : 'KW' '3175'; +KW3176 : 'KW' '3176'; +KW3177 : 'KW' '3177'; +KW3178 : 'KW' '3178'; +KW3179 : 'KW' '3179'; +KW3180 : 'KW' '3180'; +KW3181 : 'KW' '3181'; +KW3182 : 'KW' '3182'; +KW3183 : 'KW' '3183'; +KW3184 : 'KW' '3184'; +KW3185 : 'KW' '3185'; +KW3186 : 'KW' '3186'; +KW3187 : 'KW' '3187'; +KW3188 : 'KW' '3188'; +KW3189 : 'KW' '3189'; +KW3190 : 'KW' '3190'; +KW3191 : 'KW' '3191'; +KW3192 : 'KW' '3192'; +KW3193 : 'KW' '3193'; +KW3194 : 'KW' '3194'; +KW3195 : 'KW' '3195'; +KW3196 : 'KW' '3196'; +KW3197 : 'KW' '3197'; +KW3198 : 'KW' '3198'; +KW3199 : 'KW' '3199'; +KW3200 : 'KW' '3200'; +KW3201 : 'KW' '3201'; +KW3202 : 'KW' '3202'; +KW3203 : 'KW' '3203'; +KW3204 : 'KW' '3204'; +KW3205 : 'KW' '3205'; +KW3206 : 'KW' '3206'; +KW3207 : 'KW' '3207'; +KW3208 : 'KW' '3208'; +KW3209 : 'KW' '3209'; +KW3210 : 'KW' '3210'; +KW3211 : 'KW' '3211'; +KW3212 : 'KW' '3212'; +KW3213 : 'KW' '3213'; +KW3214 : 'KW' '3214'; +KW3215 : 'KW' '3215'; +KW3216 : 'KW' '3216'; +KW3217 : 'KW' '3217'; +KW3218 : 'KW' '3218'; +KW3219 : 'KW' '3219'; +KW3220 : 'KW' '3220'; +KW3221 : 'KW' '3221'; +KW3222 : 'KW' '3222'; +KW3223 : 'KW' '3223'; +KW3224 : 'KW' '3224'; +KW3225 : 'KW' '3225'; +KW3226 : 'KW' '3226'; +KW3227 : 'KW' '3227'; +KW3228 : 'KW' '3228'; +KW3229 : 'KW' '3229'; +KW3230 : 'KW' '3230'; +KW3231 : 'KW' '3231'; +KW3232 : 'KW' '3232'; +KW3233 : 'KW' '3233'; +KW3234 : 'KW' '3234'; +KW3235 : 'KW' '3235'; +KW3236 : 'KW' '3236'; +KW3237 : 'KW' '3237'; +KW3238 : 'KW' '3238'; +KW3239 : 'KW' '3239'; +KW3240 : 'KW' '3240'; +KW3241 : 'KW' '3241'; +KW3242 : 'KW' '3242'; +KW3243 : 'KW' '3243'; +KW3244 : 'KW' '3244'; +KW3245 : 'KW' '3245'; +KW3246 : 'KW' '3246'; +KW3247 : 'KW' '3247'; +KW3248 : 'KW' '3248'; +KW3249 : 'KW' '3249'; +KW3250 : 'KW' '3250'; +KW3251 : 'KW' '3251'; +KW3252 : 'KW' '3252'; +KW3253 : 'KW' '3253'; +KW3254 : 'KW' '3254'; +KW3255 : 'KW' '3255'; +KW3256 : 'KW' '3256'; +KW3257 : 'KW' '3257'; +KW3258 : 'KW' '3258'; +KW3259 : 'KW' '3259'; +KW3260 : 'KW' '3260'; +KW3261 : 'KW' '3261'; +KW3262 : 'KW' '3262'; +KW3263 : 'KW' '3263'; +KW3264 : 'KW' '3264'; +KW3265 : 'KW' '3265'; +KW3266 : 'KW' '3266'; +KW3267 : 'KW' '3267'; +KW3268 : 'KW' '3268'; +KW3269 : 'KW' '3269'; +KW3270 : 'KW' '3270'; +KW3271 : 'KW' '3271'; +KW3272 : 'KW' '3272'; +KW3273 : 'KW' '3273'; +KW3274 : 'KW' '3274'; +KW3275 : 'KW' '3275'; +KW3276 : 'KW' '3276'; +KW3277 : 'KW' '3277'; +KW3278 : 'KW' '3278'; +KW3279 : 'KW' '3279'; +KW3280 : 'KW' '3280'; +KW3281 : 'KW' '3281'; +KW3282 : 'KW' '3282'; +KW3283 : 'KW' '3283'; +KW3284 : 'KW' '3284'; +KW3285 : 'KW' '3285'; +KW3286 : 'KW' '3286'; +KW3287 : 'KW' '3287'; +KW3288 : 'KW' '3288'; +KW3289 : 'KW' '3289'; +KW3290 : 'KW' '3290'; +KW3291 : 'KW' '3291'; +KW3292 : 'KW' '3292'; +KW3293 : 'KW' '3293'; +KW3294 : 'KW' '3294'; +KW3295 : 'KW' '3295'; +KW3296 : 'KW' '3296'; +KW3297 : 'KW' '3297'; +KW3298 : 'KW' '3298'; +KW3299 : 'KW' '3299'; +KW3300 : 'KW' '3300'; +KW3301 : 'KW' '3301'; +KW3302 : 'KW' '3302'; +KW3303 : 'KW' '3303'; +KW3304 : 'KW' '3304'; +KW3305 : 'KW' '3305'; +KW3306 : 'KW' '3306'; +KW3307 : 'KW' '3307'; +KW3308 : 'KW' '3308'; +KW3309 : 'KW' '3309'; +KW3310 : 'KW' '3310'; +KW3311 : 'KW' '3311'; +KW3312 : 'KW' '3312'; +KW3313 : 'KW' '3313'; +KW3314 : 'KW' '3314'; +KW3315 : 'KW' '3315'; +KW3316 : 'KW' '3316'; +KW3317 : 'KW' '3317'; +KW3318 : 'KW' '3318'; +KW3319 : 'KW' '3319'; +KW3320 : 'KW' '3320'; +KW3321 : 'KW' '3321'; +KW3322 : 'KW' '3322'; +KW3323 : 'KW' '3323'; +KW3324 : 'KW' '3324'; +KW3325 : 'KW' '3325'; +KW3326 : 'KW' '3326'; +KW3327 : 'KW' '3327'; +KW3328 : 'KW' '3328'; +KW3329 : 'KW' '3329'; +KW3330 : 'KW' '3330'; +KW3331 : 'KW' '3331'; +KW3332 : 'KW' '3332'; +KW3333 : 'KW' '3333'; +KW3334 : 'KW' '3334'; +KW3335 : 'KW' '3335'; +KW3336 : 'KW' '3336'; +KW3337 : 'KW' '3337'; +KW3338 : 'KW' '3338'; +KW3339 : 'KW' '3339'; +KW3340 : 'KW' '3340'; +KW3341 : 'KW' '3341'; +KW3342 : 'KW' '3342'; +KW3343 : 'KW' '3343'; +KW3344 : 'KW' '3344'; +KW3345 : 'KW' '3345'; +KW3346 : 'KW' '3346'; +KW3347 : 'KW' '3347'; +KW3348 : 'KW' '3348'; +KW3349 : 'KW' '3349'; +KW3350 : 'KW' '3350'; +KW3351 : 'KW' '3351'; +KW3352 : 'KW' '3352'; +KW3353 : 'KW' '3353'; +KW3354 : 'KW' '3354'; +KW3355 : 'KW' '3355'; +KW3356 : 'KW' '3356'; +KW3357 : 'KW' '3357'; +KW3358 : 'KW' '3358'; +KW3359 : 'KW' '3359'; +KW3360 : 'KW' '3360'; +KW3361 : 'KW' '3361'; +KW3362 : 'KW' '3362'; +KW3363 : 'KW' '3363'; +KW3364 : 'KW' '3364'; +KW3365 : 'KW' '3365'; +KW3366 : 'KW' '3366'; +KW3367 : 'KW' '3367'; +KW3368 : 'KW' '3368'; +KW3369 : 'KW' '3369'; +KW3370 : 'KW' '3370'; +KW3371 : 'KW' '3371'; +KW3372 : 'KW' '3372'; +KW3373 : 'KW' '3373'; +KW3374 : 'KW' '3374'; +KW3375 : 'KW' '3375'; +KW3376 : 'KW' '3376'; +KW3377 : 'KW' '3377'; +KW3378 : 'KW' '3378'; +KW3379 : 'KW' '3379'; +KW3380 : 'KW' '3380'; +KW3381 : 'KW' '3381'; +KW3382 : 'KW' '3382'; +KW3383 : 'KW' '3383'; +KW3384 : 'KW' '3384'; +KW3385 : 'KW' '3385'; +KW3386 : 'KW' '3386'; +KW3387 : 'KW' '3387'; +KW3388 : 'KW' '3388'; +KW3389 : 'KW' '3389'; +KW3390 : 'KW' '3390'; +KW3391 : 'KW' '3391'; +KW3392 : 'KW' '3392'; +KW3393 : 'KW' '3393'; +KW3394 : 'KW' '3394'; +KW3395 : 'KW' '3395'; +KW3396 : 'KW' '3396'; +KW3397 : 'KW' '3397'; +KW3398 : 'KW' '3398'; +KW3399 : 'KW' '3399'; +KW3400 : 'KW' '3400'; +KW3401 : 'KW' '3401'; +KW3402 : 'KW' '3402'; +KW3403 : 'KW' '3403'; +KW3404 : 'KW' '3404'; +KW3405 : 'KW' '3405'; +KW3406 : 'KW' '3406'; +KW3407 : 'KW' '3407'; +KW3408 : 'KW' '3408'; +KW3409 : 'KW' '3409'; +KW3410 : 'KW' '3410'; +KW3411 : 'KW' '3411'; +KW3412 : 'KW' '3412'; +KW3413 : 'KW' '3413'; +KW3414 : 'KW' '3414'; +KW3415 : 'KW' '3415'; +KW3416 : 'KW' '3416'; +KW3417 : 'KW' '3417'; +KW3418 : 'KW' '3418'; +KW3419 : 'KW' '3419'; +KW3420 : 'KW' '3420'; +KW3421 : 'KW' '3421'; +KW3422 : 'KW' '3422'; +KW3423 : 'KW' '3423'; +KW3424 : 'KW' '3424'; +KW3425 : 'KW' '3425'; +KW3426 : 'KW' '3426'; +KW3427 : 'KW' '3427'; +KW3428 : 'KW' '3428'; +KW3429 : 'KW' '3429'; +KW3430 : 'KW' '3430'; +KW3431 : 'KW' '3431'; +KW3432 : 'KW' '3432'; +KW3433 : 'KW' '3433'; +KW3434 : 'KW' '3434'; +KW3435 : 'KW' '3435'; +KW3436 : 'KW' '3436'; +KW3437 : 'KW' '3437'; +KW3438 : 'KW' '3438'; +KW3439 : 'KW' '3439'; +KW3440 : 'KW' '3440'; +KW3441 : 'KW' '3441'; +KW3442 : 'KW' '3442'; +KW3443 : 'KW' '3443'; +KW3444 : 'KW' '3444'; +KW3445 : 'KW' '3445'; +KW3446 : 'KW' '3446'; +KW3447 : 'KW' '3447'; +KW3448 : 'KW' '3448'; +KW3449 : 'KW' '3449'; +KW3450 : 'KW' '3450'; +KW3451 : 'KW' '3451'; +KW3452 : 'KW' '3452'; +KW3453 : 'KW' '3453'; +KW3454 : 'KW' '3454'; +KW3455 : 'KW' '3455'; +KW3456 : 'KW' '3456'; +KW3457 : 'KW' '3457'; +KW3458 : 'KW' '3458'; +KW3459 : 'KW' '3459'; +KW3460 : 'KW' '3460'; +KW3461 : 'KW' '3461'; +KW3462 : 'KW' '3462'; +KW3463 : 'KW' '3463'; +KW3464 : 'KW' '3464'; +KW3465 : 'KW' '3465'; +KW3466 : 'KW' '3466'; +KW3467 : 'KW' '3467'; +KW3468 : 'KW' '3468'; +KW3469 : 'KW' '3469'; +KW3470 : 'KW' '3470'; +KW3471 : 'KW' '3471'; +KW3472 : 'KW' '3472'; +KW3473 : 'KW' '3473'; +KW3474 : 'KW' '3474'; +KW3475 : 'KW' '3475'; +KW3476 : 'KW' '3476'; +KW3477 : 'KW' '3477'; +KW3478 : 'KW' '3478'; +KW3479 : 'KW' '3479'; +KW3480 : 'KW' '3480'; +KW3481 : 'KW' '3481'; +KW3482 : 'KW' '3482'; +KW3483 : 'KW' '3483'; +KW3484 : 'KW' '3484'; +KW3485 : 'KW' '3485'; +KW3486 : 'KW' '3486'; +KW3487 : 'KW' '3487'; +KW3488 : 'KW' '3488'; +KW3489 : 'KW' '3489'; +KW3490 : 'KW' '3490'; +KW3491 : 'KW' '3491'; +KW3492 : 'KW' '3492'; +KW3493 : 'KW' '3493'; +KW3494 : 'KW' '3494'; +KW3495 : 'KW' '3495'; +KW3496 : 'KW' '3496'; +KW3497 : 'KW' '3497'; +KW3498 : 'KW' '3498'; +KW3499 : 'KW' '3499'; +KW3500 : 'KW' '3500'; +KW3501 : 'KW' '3501'; +KW3502 : 'KW' '3502'; +KW3503 : 'KW' '3503'; +KW3504 : 'KW' '3504'; +KW3505 : 'KW' '3505'; +KW3506 : 'KW' '3506'; +KW3507 : 'KW' '3507'; +KW3508 : 'KW' '3508'; +KW3509 : 'KW' '3509'; +KW3510 : 'KW' '3510'; +KW3511 : 'KW' '3511'; +KW3512 : 'KW' '3512'; +KW3513 : 'KW' '3513'; +KW3514 : 'KW' '3514'; +KW3515 : 'KW' '3515'; +KW3516 : 'KW' '3516'; +KW3517 : 'KW' '3517'; +KW3518 : 'KW' '3518'; +KW3519 : 'KW' '3519'; +KW3520 : 'KW' '3520'; +KW3521 : 'KW' '3521'; +KW3522 : 'KW' '3522'; +KW3523 : 'KW' '3523'; +KW3524 : 'KW' '3524'; +KW3525 : 'KW' '3525'; +KW3526 : 'KW' '3526'; +KW3527 : 'KW' '3527'; +KW3528 : 'KW' '3528'; +KW3529 : 'KW' '3529'; +KW3530 : 'KW' '3530'; +KW3531 : 'KW' '3531'; +KW3532 : 'KW' '3532'; +KW3533 : 'KW' '3533'; +KW3534 : 'KW' '3534'; +KW3535 : 'KW' '3535'; +KW3536 : 'KW' '3536'; +KW3537 : 'KW' '3537'; +KW3538 : 'KW' '3538'; +KW3539 : 'KW' '3539'; +KW3540 : 'KW' '3540'; +KW3541 : 'KW' '3541'; +KW3542 : 'KW' '3542'; +KW3543 : 'KW' '3543'; +KW3544 : 'KW' '3544'; +KW3545 : 'KW' '3545'; +KW3546 : 'KW' '3546'; +KW3547 : 'KW' '3547'; +KW3548 : 'KW' '3548'; +KW3549 : 'KW' '3549'; +KW3550 : 'KW' '3550'; +KW3551 : 'KW' '3551'; +KW3552 : 'KW' '3552'; +KW3553 : 'KW' '3553'; +KW3554 : 'KW' '3554'; +KW3555 : 'KW' '3555'; +KW3556 : 'KW' '3556'; +KW3557 : 'KW' '3557'; +KW3558 : 'KW' '3558'; +KW3559 : 'KW' '3559'; +KW3560 : 'KW' '3560'; +KW3561 : 'KW' '3561'; +KW3562 : 'KW' '3562'; +KW3563 : 'KW' '3563'; +KW3564 : 'KW' '3564'; +KW3565 : 'KW' '3565'; +KW3566 : 'KW' '3566'; +KW3567 : 'KW' '3567'; +KW3568 : 'KW' '3568'; +KW3569 : 'KW' '3569'; +KW3570 : 'KW' '3570'; +KW3571 : 'KW' '3571'; +KW3572 : 'KW' '3572'; +KW3573 : 'KW' '3573'; +KW3574 : 'KW' '3574'; +KW3575 : 'KW' '3575'; +KW3576 : 'KW' '3576'; +KW3577 : 'KW' '3577'; +KW3578 : 'KW' '3578'; +KW3579 : 'KW' '3579'; +KW3580 : 'KW' '3580'; +KW3581 : 'KW' '3581'; +KW3582 : 'KW' '3582'; +KW3583 : 'KW' '3583'; +KW3584 : 'KW' '3584'; +KW3585 : 'KW' '3585'; +KW3586 : 'KW' '3586'; +KW3587 : 'KW' '3587'; +KW3588 : 'KW' '3588'; +KW3589 : 'KW' '3589'; +KW3590 : 'KW' '3590'; +KW3591 : 'KW' '3591'; +KW3592 : 'KW' '3592'; +KW3593 : 'KW' '3593'; +KW3594 : 'KW' '3594'; +KW3595 : 'KW' '3595'; +KW3596 : 'KW' '3596'; +KW3597 : 'KW' '3597'; +KW3598 : 'KW' '3598'; +KW3599 : 'KW' '3599'; +KW3600 : 'KW' '3600'; +KW3601 : 'KW' '3601'; +KW3602 : 'KW' '3602'; +KW3603 : 'KW' '3603'; +KW3604 : 'KW' '3604'; +KW3605 : 'KW' '3605'; +KW3606 : 'KW' '3606'; +KW3607 : 'KW' '3607'; +KW3608 : 'KW' '3608'; +KW3609 : 'KW' '3609'; +KW3610 : 'KW' '3610'; +KW3611 : 'KW' '3611'; +KW3612 : 'KW' '3612'; +KW3613 : 'KW' '3613'; +KW3614 : 'KW' '3614'; +KW3615 : 'KW' '3615'; +KW3616 : 'KW' '3616'; +KW3617 : 'KW' '3617'; +KW3618 : 'KW' '3618'; +KW3619 : 'KW' '3619'; +KW3620 : 'KW' '3620'; +KW3621 : 'KW' '3621'; +KW3622 : 'KW' '3622'; +KW3623 : 'KW' '3623'; +KW3624 : 'KW' '3624'; +KW3625 : 'KW' '3625'; +KW3626 : 'KW' '3626'; +KW3627 : 'KW' '3627'; +KW3628 : 'KW' '3628'; +KW3629 : 'KW' '3629'; +KW3630 : 'KW' '3630'; +KW3631 : 'KW' '3631'; +KW3632 : 'KW' '3632'; +KW3633 : 'KW' '3633'; +KW3634 : 'KW' '3634'; +KW3635 : 'KW' '3635'; +KW3636 : 'KW' '3636'; +KW3637 : 'KW' '3637'; +KW3638 : 'KW' '3638'; +KW3639 : 'KW' '3639'; +KW3640 : 'KW' '3640'; +KW3641 : 'KW' '3641'; +KW3642 : 'KW' '3642'; +KW3643 : 'KW' '3643'; +KW3644 : 'KW' '3644'; +KW3645 : 'KW' '3645'; +KW3646 : 'KW' '3646'; +KW3647 : 'KW' '3647'; +KW3648 : 'KW' '3648'; +KW3649 : 'KW' '3649'; +KW3650 : 'KW' '3650'; +KW3651 : 'KW' '3651'; +KW3652 : 'KW' '3652'; +KW3653 : 'KW' '3653'; +KW3654 : 'KW' '3654'; +KW3655 : 'KW' '3655'; +KW3656 : 'KW' '3656'; +KW3657 : 'KW' '3657'; +KW3658 : 'KW' '3658'; +KW3659 : 'KW' '3659'; +KW3660 : 'KW' '3660'; +KW3661 : 'KW' '3661'; +KW3662 : 'KW' '3662'; +KW3663 : 'KW' '3663'; +KW3664 : 'KW' '3664'; +KW3665 : 'KW' '3665'; +KW3666 : 'KW' '3666'; +KW3667 : 'KW' '3667'; +KW3668 : 'KW' '3668'; +KW3669 : 'KW' '3669'; +KW3670 : 'KW' '3670'; +KW3671 : 'KW' '3671'; +KW3672 : 'KW' '3672'; +KW3673 : 'KW' '3673'; +KW3674 : 'KW' '3674'; +KW3675 : 'KW' '3675'; +KW3676 : 'KW' '3676'; +KW3677 : 'KW' '3677'; +KW3678 : 'KW' '3678'; +KW3679 : 'KW' '3679'; +KW3680 : 'KW' '3680'; +KW3681 : 'KW' '3681'; +KW3682 : 'KW' '3682'; +KW3683 : 'KW' '3683'; +KW3684 : 'KW' '3684'; +KW3685 : 'KW' '3685'; +KW3686 : 'KW' '3686'; +KW3687 : 'KW' '3687'; +KW3688 : 'KW' '3688'; +KW3689 : 'KW' '3689'; +KW3690 : 'KW' '3690'; +KW3691 : 'KW' '3691'; +KW3692 : 'KW' '3692'; +KW3693 : 'KW' '3693'; +KW3694 : 'KW' '3694'; +KW3695 : 'KW' '3695'; +KW3696 : 'KW' '3696'; +KW3697 : 'KW' '3697'; +KW3698 : 'KW' '3698'; +KW3699 : 'KW' '3699'; +KW3700 : 'KW' '3700'; +KW3701 : 'KW' '3701'; +KW3702 : 'KW' '3702'; +KW3703 : 'KW' '3703'; +KW3704 : 'KW' '3704'; +KW3705 : 'KW' '3705'; +KW3706 : 'KW' '3706'; +KW3707 : 'KW' '3707'; +KW3708 : 'KW' '3708'; +KW3709 : 'KW' '3709'; +KW3710 : 'KW' '3710'; +KW3711 : 'KW' '3711'; +KW3712 : 'KW' '3712'; +KW3713 : 'KW' '3713'; +KW3714 : 'KW' '3714'; +KW3715 : 'KW' '3715'; +KW3716 : 'KW' '3716'; +KW3717 : 'KW' '3717'; +KW3718 : 'KW' '3718'; +KW3719 : 'KW' '3719'; +KW3720 : 'KW' '3720'; +KW3721 : 'KW' '3721'; +KW3722 : 'KW' '3722'; +KW3723 : 'KW' '3723'; +KW3724 : 'KW' '3724'; +KW3725 : 'KW' '3725'; +KW3726 : 'KW' '3726'; +KW3727 : 'KW' '3727'; +KW3728 : 'KW' '3728'; +KW3729 : 'KW' '3729'; +KW3730 : 'KW' '3730'; +KW3731 : 'KW' '3731'; +KW3732 : 'KW' '3732'; +KW3733 : 'KW' '3733'; +KW3734 : 'KW' '3734'; +KW3735 : 'KW' '3735'; +KW3736 : 'KW' '3736'; +KW3737 : 'KW' '3737'; +KW3738 : 'KW' '3738'; +KW3739 : 'KW' '3739'; +KW3740 : 'KW' '3740'; +KW3741 : 'KW' '3741'; +KW3742 : 'KW' '3742'; +KW3743 : 'KW' '3743'; +KW3744 : 'KW' '3744'; +KW3745 : 'KW' '3745'; +KW3746 : 'KW' '3746'; +KW3747 : 'KW' '3747'; +KW3748 : 'KW' '3748'; +KW3749 : 'KW' '3749'; +KW3750 : 'KW' '3750'; +KW3751 : 'KW' '3751'; +KW3752 : 'KW' '3752'; +KW3753 : 'KW' '3753'; +KW3754 : 'KW' '3754'; +KW3755 : 'KW' '3755'; +KW3756 : 'KW' '3756'; +KW3757 : 'KW' '3757'; +KW3758 : 'KW' '3758'; +KW3759 : 'KW' '3759'; +KW3760 : 'KW' '3760'; +KW3761 : 'KW' '3761'; +KW3762 : 'KW' '3762'; +KW3763 : 'KW' '3763'; +KW3764 : 'KW' '3764'; +KW3765 : 'KW' '3765'; +KW3766 : 'KW' '3766'; +KW3767 : 'KW' '3767'; +KW3768 : 'KW' '3768'; +KW3769 : 'KW' '3769'; +KW3770 : 'KW' '3770'; +KW3771 : 'KW' '3771'; +KW3772 : 'KW' '3772'; +KW3773 : 'KW' '3773'; +KW3774 : 'KW' '3774'; +KW3775 : 'KW' '3775'; +KW3776 : 'KW' '3776'; +KW3777 : 'KW' '3777'; +KW3778 : 'KW' '3778'; +KW3779 : 'KW' '3779'; +KW3780 : 'KW' '3780'; +KW3781 : 'KW' '3781'; +KW3782 : 'KW' '3782'; +KW3783 : 'KW' '3783'; +KW3784 : 'KW' '3784'; +KW3785 : 'KW' '3785'; +KW3786 : 'KW' '3786'; +KW3787 : 'KW' '3787'; +KW3788 : 'KW' '3788'; +KW3789 : 'KW' '3789'; +KW3790 : 'KW' '3790'; +KW3791 : 'KW' '3791'; +KW3792 : 'KW' '3792'; +KW3793 : 'KW' '3793'; +KW3794 : 'KW' '3794'; +KW3795 : 'KW' '3795'; +KW3796 : 'KW' '3796'; +KW3797 : 'KW' '3797'; +KW3798 : 'KW' '3798'; +KW3799 : 'KW' '3799'; +KW3800 : 'KW' '3800'; +KW3801 : 'KW' '3801'; +KW3802 : 'KW' '3802'; +KW3803 : 'KW' '3803'; +KW3804 : 'KW' '3804'; +KW3805 : 'KW' '3805'; +KW3806 : 'KW' '3806'; +KW3807 : 'KW' '3807'; +KW3808 : 'KW' '3808'; +KW3809 : 'KW' '3809'; +KW3810 : 'KW' '3810'; +KW3811 : 'KW' '3811'; +KW3812 : 'KW' '3812'; +KW3813 : 'KW' '3813'; +KW3814 : 'KW' '3814'; +KW3815 : 'KW' '3815'; +KW3816 : 'KW' '3816'; +KW3817 : 'KW' '3817'; +KW3818 : 'KW' '3818'; +KW3819 : 'KW' '3819'; +KW3820 : 'KW' '3820'; +KW3821 : 'KW' '3821'; +KW3822 : 'KW' '3822'; +KW3823 : 'KW' '3823'; +KW3824 : 'KW' '3824'; +KW3825 : 'KW' '3825'; +KW3826 : 'KW' '3826'; +KW3827 : 'KW' '3827'; +KW3828 : 'KW' '3828'; +KW3829 : 'KW' '3829'; +KW3830 : 'KW' '3830'; +KW3831 : 'KW' '3831'; +KW3832 : 'KW' '3832'; +KW3833 : 'KW' '3833'; +KW3834 : 'KW' '3834'; +KW3835 : 'KW' '3835'; +KW3836 : 'KW' '3836'; +KW3837 : 'KW' '3837'; +KW3838 : 'KW' '3838'; +KW3839 : 'KW' '3839'; +KW3840 : 'KW' '3840'; +KW3841 : 'KW' '3841'; +KW3842 : 'KW' '3842'; +KW3843 : 'KW' '3843'; +KW3844 : 'KW' '3844'; +KW3845 : 'KW' '3845'; +KW3846 : 'KW' '3846'; +KW3847 : 'KW' '3847'; +KW3848 : 'KW' '3848'; +KW3849 : 'KW' '3849'; +KW3850 : 'KW' '3850'; +KW3851 : 'KW' '3851'; +KW3852 : 'KW' '3852'; +KW3853 : 'KW' '3853'; +KW3854 : 'KW' '3854'; +KW3855 : 'KW' '3855'; +KW3856 : 'KW' '3856'; +KW3857 : 'KW' '3857'; +KW3858 : 'KW' '3858'; +KW3859 : 'KW' '3859'; +KW3860 : 'KW' '3860'; +KW3861 : 'KW' '3861'; +KW3862 : 'KW' '3862'; +KW3863 : 'KW' '3863'; +KW3864 : 'KW' '3864'; +KW3865 : 'KW' '3865'; +KW3866 : 'KW' '3866'; +KW3867 : 'KW' '3867'; +KW3868 : 'KW' '3868'; +KW3869 : 'KW' '3869'; +KW3870 : 'KW' '3870'; +KW3871 : 'KW' '3871'; +KW3872 : 'KW' '3872'; +KW3873 : 'KW' '3873'; +KW3874 : 'KW' '3874'; +KW3875 : 'KW' '3875'; +KW3876 : 'KW' '3876'; +KW3877 : 'KW' '3877'; +KW3878 : 'KW' '3878'; +KW3879 : 'KW' '3879'; +KW3880 : 'KW' '3880'; +KW3881 : 'KW' '3881'; +KW3882 : 'KW' '3882'; +KW3883 : 'KW' '3883'; +KW3884 : 'KW' '3884'; +KW3885 : 'KW' '3885'; +KW3886 : 'KW' '3886'; +KW3887 : 'KW' '3887'; +KW3888 : 'KW' '3888'; +KW3889 : 'KW' '3889'; +KW3890 : 'KW' '3890'; +KW3891 : 'KW' '3891'; +KW3892 : 'KW' '3892'; +KW3893 : 'KW' '3893'; +KW3894 : 'KW' '3894'; +KW3895 : 'KW' '3895'; +KW3896 : 'KW' '3896'; +KW3897 : 'KW' '3897'; +KW3898 : 'KW' '3898'; +KW3899 : 'KW' '3899'; +KW3900 : 'KW' '3900'; +KW3901 : 'KW' '3901'; +KW3902 : 'KW' '3902'; +KW3903 : 'KW' '3903'; +KW3904 : 'KW' '3904'; +KW3905 : 'KW' '3905'; +KW3906 : 'KW' '3906'; +KW3907 : 'KW' '3907'; +KW3908 : 'KW' '3908'; +KW3909 : 'KW' '3909'; +KW3910 : 'KW' '3910'; +KW3911 : 'KW' '3911'; +KW3912 : 'KW' '3912'; +KW3913 : 'KW' '3913'; +KW3914 : 'KW' '3914'; +KW3915 : 'KW' '3915'; +KW3916 : 'KW' '3916'; +KW3917 : 'KW' '3917'; +KW3918 : 'KW' '3918'; +KW3919 : 'KW' '3919'; +KW3920 : 'KW' '3920'; +KW3921 : 'KW' '3921'; +KW3922 : 'KW' '3922'; +KW3923 : 'KW' '3923'; +KW3924 : 'KW' '3924'; +KW3925 : 'KW' '3925'; +KW3926 : 'KW' '3926'; +KW3927 : 'KW' '3927'; +KW3928 : 'KW' '3928'; +KW3929 : 'KW' '3929'; +KW3930 : 'KW' '3930'; +KW3931 : 'KW' '3931'; +KW3932 : 'KW' '3932'; +KW3933 : 'KW' '3933'; +KW3934 : 'KW' '3934'; +KW3935 : 'KW' '3935'; +KW3936 : 'KW' '3936'; +KW3937 : 'KW' '3937'; +KW3938 : 'KW' '3938'; +KW3939 : 'KW' '3939'; +KW3940 : 'KW' '3940'; +KW3941 : 'KW' '3941'; +KW3942 : 'KW' '3942'; +KW3943 : 'KW' '3943'; +KW3944 : 'KW' '3944'; +KW3945 : 'KW' '3945'; +KW3946 : 'KW' '3946'; +KW3947 : 'KW' '3947'; +KW3948 : 'KW' '3948'; +KW3949 : 'KW' '3949'; +KW3950 : 'KW' '3950'; +KW3951 : 'KW' '3951'; +KW3952 : 'KW' '3952'; +KW3953 : 'KW' '3953'; +KW3954 : 'KW' '3954'; +KW3955 : 'KW' '3955'; +KW3956 : 'KW' '3956'; +KW3957 : 'KW' '3957'; +KW3958 : 'KW' '3958'; +KW3959 : 'KW' '3959'; +KW3960 : 'KW' '3960'; +KW3961 : 'KW' '3961'; +KW3962 : 'KW' '3962'; +KW3963 : 'KW' '3963'; +KW3964 : 'KW' '3964'; +KW3965 : 'KW' '3965'; +KW3966 : 'KW' '3966'; +KW3967 : 'KW' '3967'; +KW3968 : 'KW' '3968'; +KW3969 : 'KW' '3969'; +KW3970 : 'KW' '3970'; +KW3971 : 'KW' '3971'; +KW3972 : 'KW' '3972'; +KW3973 : 'KW' '3973'; +KW3974 : 'KW' '3974'; +KW3975 : 'KW' '3975'; +KW3976 : 'KW' '3976'; +KW3977 : 'KW' '3977'; +KW3978 : 'KW' '3978'; +KW3979 : 'KW' '3979'; +KW3980 : 'KW' '3980'; +KW3981 : 'KW' '3981'; +KW3982 : 'KW' '3982'; +KW3983 : 'KW' '3983'; +KW3984 : 'KW' '3984'; +KW3985 : 'KW' '3985'; +KW3986 : 'KW' '3986'; +KW3987 : 'KW' '3987'; +KW3988 : 'KW' '3988'; +KW3989 : 'KW' '3989'; +KW3990 : 'KW' '3990'; +KW3991 : 'KW' '3991'; +KW3992 : 'KW' '3992'; +KW3993 : 'KW' '3993'; +KW3994 : 'KW' '3994'; +KW3995 : 'KW' '3995'; +KW3996 : 'KW' '3996'; +KW3997 : 'KW' '3997'; +KW3998 : 'KW' '3998'; +KW3999 : 'KW' '3999'; +[input] +KW400 + +[output] +[@0,0:4='KW400',<402>,1:0] +[@1,5:4='',<-1>,1:5] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyClosure.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyClosure.txt new file mode 100644 index 0000000000..11a30c874f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyClosure.txt @@ -0,0 +1,17 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '//' .*? '\n' CMT*?; +WS : (' '|'\t')+; + +[input] +//blah +//blah + +[output] +[@0,0:6='//blah\n',<1>,1:0] +[@1,7:13='//blah\n',<1>,2:0] +[@2,14:13='',<-1>,3:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyConfigs.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyConfigs.txt new file mode 100644 index 0000000000..316c5e9c25 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyConfigs.txt @@ -0,0 +1,19 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +I : .*? ('a' | 'ab') {} ; +WS : (' '|'\n') -> skip ; +J : . {}; + +[input] +ab + +[output] +a +b +[@0,0:0='a',<1>,1:0] +[@1,1:1='b',<3>,1:1] +[@2,2:1='',<-1>,1:2] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyOptional.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyOptional.txt new file mode 100644 index 0000000000..21dd16b944 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyOptional.txt @@ -0,0 +1,17 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '//' .*? '\n' CMT??; +WS : (' '|'\t')+; + +[input] +//blah +//blah + +[output] +[@0,0:6='//blah\n',<1>,1:0] +[@1,7:13='//blah\n',<1>,2:0] +[@2,14:13='',<-1>,3:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyPositiveClosure.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyPositiveClosure.txt new file mode 100644 index 0000000000..670dc33e7f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyPositiveClosure.txt @@ -0,0 +1,17 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : ('//' .*? '\n')+?; +WS : (' '|'\t')+; + +[input] +//blah +//blah + +[output] +[@0,0:6='//blah\n',<1>,1:0] +[@1,7:13='//blah\n',<1>,2:0] +[@2,14:13='',<-1>,3:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyTermination1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyTermination1.txt new file mode 100644 index 0000000000..1791cdaca2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyTermination1.txt @@ -0,0 +1,15 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +STRING : '!' ('!!' | .)*? '!'; + +[input] +!hi!!mom! + +[output] +[@0,0:3='!hi!',<1>,1:0] +[@1,4:8='!mom!',<1>,1:4] +[@2,9:8='',<-1>,1:9] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyTermination2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyTermination2.txt new file mode 100644 index 0000000000..23aa2ad78c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/NonGreedyTermination2.txt @@ -0,0 +1,14 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +STRING : '!' ('!!' | .)+? '!'; + +[input] +!!!mom! + +[output] +[@0,0:6='!!!mom!',<1>,1:0] +[@1,7:6='',<-1>,1:7] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/Parentheses.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/Parentheses.txt new file mode 100644 index 0000000000..be6a7f00ac --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/Parentheses.txt @@ -0,0 +1,25 @@ +[notes] +This is a regression test for antlr/antlr4#224: "Parentheses without +quantifier in lexer rules have unclear effect". +https://github.com/antlr/antlr4/issues/224 + +[type] +Lexer + +[grammar] +lexer grammar L; +START_BLOCK: '-.-.-'; +ID : (LETTER SEPARATOR) (LETTER SEPARATOR)+; +fragment LETTER: L_A|L_K; +fragment L_A: '.-'; +fragment L_K: '-.-'; +SEPARATOR: '!'; + +[input] +-.-.-! + +[output] +[@0,0:4='-.-.-',<1>,1:0] +[@1,5:5='!',<3>,1:5] +[@2,6:5='',<-1>,1:6] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/PositionAdjustingLexer.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/PositionAdjustingLexer.txt new file mode 100644 index 0000000000..f6fa740232 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/PositionAdjustingLexer.txt @@ -0,0 +1,63 @@ +[type] +Lexer + +[grammar] +lexer grammar PositionAdjustingLexer; + +@definitions { + +} + +@members { + +} + +ASSIGN : '=' ; +PLUS_ASSIGN : '+=' ; +LCURLY: '{'; + +// 'tokens' followed by '{' +TOKENS : 'tokens' IGNORED '{'; + +// IDENTIFIER followed by '+=' or '=' +LABEL + : IDENTIFIER IGNORED '+'? '=' + ; + +IDENTIFIER + : [a-zA-Z_] [a-zA-Z0-9_]* + ; + +fragment +IGNORED + : [ \t\r\n]* + ; + +NEWLINE + : [\r\n]+ -> skip + ; + +WS + : [ \t]+ -> skip + ; + +[input] +tokens +tokens { +notLabel +label1 = +label2 += +notLabel + +[output] +[@0,0:5='tokens',<6>,1:0] +[@1,7:12='tokens',<4>,2:0] +[@2,14:14='{',<3>,2:7] +[@3,16:23='notLabel',<6>,3:0] +[@4,25:30='label1',<5>,4:0] +[@5,32:32='=',<1>,4:7] +[@6,34:39='label2',<5>,5:0] +[@7,41:42='+=',<2>,5:7] +[@8,44:51='notLabel',<6>,6:0] +[@9,53:52='',<-1>,7:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/QuoteTranslation.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/QuoteTranslation.txt new file mode 100644 index 0000000000..7053bfe34b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/QuoteTranslation.txt @@ -0,0 +1,14 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +QUOTE : '"' ; // make sure this compiles + +[input] +" + +[output] +[@0,0:0='"',<1>,1:0] +[@1,1:0='',<-1>,1:1] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardPlus_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardPlus_1.txt new file mode 100644 index 0000000000..e617727d6a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardPlus_1.txt @@ -0,0 +1,20 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '/*' (CMT | .)+? '*' '/' ; +WS : (' '|'\n')+; + +[input] +/* ick */ +/* /* */ +/* /*nested*/ */ + +[output] +[@0,0:8='/* ick */',<1>,1:0] +[@1,9:9='\n',<2>,1:9] +[@2,10:34='/* /* */\n/* /*nested*/ */',<1>,2:0] +[@3,35:35='\n',<2>,3:16] +[@4,36:35='',<-1>,4:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardPlus_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardPlus_2.txt new file mode 100644 index 0000000000..cdcab0efd6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardPlus_2.txt @@ -0,0 +1,24 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '/*' (CMT | .)+? '*' '/' ; +WS : (' '|'\n')+; + +[input] +/* ick */x +/* /* */x +/* /*nested*/ */x + +[output] +[@0,0:8='/* ick */',<1>,1:0] +[@1,10:10='\n',<2>,1:10] +[@2,11:36='/* /* */x\n/* /*nested*/ */',<1>,2:0] +[@3,38:38='\n',<2>,3:17] +[@4,39:38='',<-1>,4:0] + +[errors] +line 1:9 token recognition error at: 'x' +line 3:16 token recognition error at: 'x' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardStar_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardStar_1.txt new file mode 100644 index 0000000000..c3dfca374f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardStar_1.txt @@ -0,0 +1,20 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '/*' (CMT | .)*? '*' '/' ; +WS : (' '|'\n')+; + +[input] +/* ick */ +/* /* */ +/* /*nested*/ */ + +[output] +[@0,0:8='/* ick */',<1>,1:0] +[@1,9:9='\n',<2>,1:9] +[@2,10:34='/* /* */\n/* /*nested*/ */',<1>,2:0] +[@3,35:35='\n',<2>,3:16] +[@4,36:35='',<-1>,4:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardStar_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardStar_2.txt new file mode 100644 index 0000000000..7e218562f5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RecursiveLexerRuleRefWithWildcardStar_2.txt @@ -0,0 +1,24 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +CMT : '/*' (CMT | .)*? '*' '/' ; +WS : (' '|'\n')+; + +[input] +/* ick */x +/* /* */x +/* /*nested*/ */x + +[output] +[@0,0:8='/* ick */',<1>,1:0] +[@1,10:10='\n',<2>,1:10] +[@2,11:36='/* /* */x\n/* /*nested*/ */',<1>,2:0] +[@3,38:38='\n',<2>,3:17] +[@4,39:38='',<-1>,4:0] + +[errors] +line 1:9 token recognition error at: 'x' +line 3:16 token recognition error at: 'x' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RefToRuleDoesNotSetTokenNorEmitAnother.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RefToRuleDoesNotSetTokenNorEmitAnother.txt new file mode 100644 index 0000000000..ce8e67392f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/RefToRuleDoesNotSetTokenNorEmitAnother.txt @@ -0,0 +1,18 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +A : '-' I ; +I : '0'..'9'+ ; +WS : (' '|'\n') -> skip ; + +[input] +34 -21 3 + +[output] +[@0,0:1='34',<2>,1:0] +[@1,3:5='-21',<1>,1:3] +[@2,7:7='3',<2>,1:7] +[@3,8:7='',<-1>,1:8] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/Slashes.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/Slashes.txt new file mode 100644 index 0000000000..c11711b96c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/Slashes.txt @@ -0,0 +1,21 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +Backslash : '\\\\'; +Slash : '/'; +Vee : '\\\\/'; +Wedge : '/\\\\'; +WS : [ \t] -> skip; + +[input] +\ / \/ /\ + +[output] +[@0,0:0='\',<1>,1:0] +[@1,2:2='/',<2>,1:2] +[@2,4:5='\/',<3>,1:4] +[@3,7:8='/\',<4>,1:7] +[@4,9:8='',<-1>,1:9] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/StackoverflowDueToNotEscapedHyphen.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/StackoverflowDueToNotEscapedHyphen.txt new file mode 100644 index 0000000000..56f7e5e1a0 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/StackoverflowDueToNotEscapedHyphen.txt @@ -0,0 +1,17 @@ +[notes] +https://github.com/antlr/antlr4/issues/1943 + +[type] +Lexer + +[grammar] +lexer grammar L; +WORD : [a-z-+]+; + +[input] +word + +[output] +[@0,0:3='word',<1>,1:0] +[@1,4:3='',<-1>,1:4] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/UnicodeCharSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/UnicodeCharSet.txt new file mode 100644 index 0000000000..e9918ad741 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/UnicodeCharSet.txt @@ -0,0 +1,17 @@ +[notes] +regression test for antlr/antlr4#1925 + +[type] +Lexer + +[grammar] +lexer grammar L; +ID : ([A-Z_]|'Ā'..'￾') ([A-Z_0-9]|'Ā'..'￾')*; + +[input] +均 + +[output] +[@0,0:0='均',<1>,1:0] +[@1,1:0='',<-1>,1:1] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/ZeroLengthToken.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/ZeroLengthToken.txt new file mode 100644 index 0000000000..f83d14a4e6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/LexerExec/ZeroLengthToken.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#687 "Empty zero-length tokens +cannot have lexer commands" and antlr/antlr4#688 "Lexer cannot match +zero-length tokens" +https://github.com/antlr/antlr4/issues/687 +https://github.com/antlr/antlr4/issues/688 + +[type] +Lexer + +[grammar] +lexer grammar L; +BeginString + : '\'' -> more, pushMode(StringMode) + ; +mode StringMode; + StringMode_X : 'x' -> more; + StringMode_Done : -> more, mode(EndStringMode); +mode EndStringMode; + EndString : '\'' -> popMode; + +[input] +'xxx' + +[output] +[@0,0:4=''xxx'',<1>,1:0] +[@1,5:4='',<-1>,1:5] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/Basic.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/Basic.txt new file mode 100644 index 0000000000..e9f4efdbdd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/Basic.txt @@ -0,0 +1,35 @@ +[type] +Parser + +[grammar] +grammar T; + + + + +s +@after { + + +} + : r=a ; +a : INT INT + | ID + ; +MULT: '*' ; +ADD : '+' ; +INT : [0-9]+ ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +1 2 + +[output] +(a 1 2) +1 +2 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/LR.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/LR.txt new file mode 100644 index 0000000000..8871c42145 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/LR.txt @@ -0,0 +1,39 @@ +[type] +Parser + +[grammar] +grammar T; + + + + +s +@after { + + +} + : r=e ; +e : e op='*' e + | e op='+' e + | INT + ; +MULT: '*' ; +ADD : '+' ; +INT : [0-9]+ ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +1+2*3 + +[output] +(e (e 1) + (e (e 2) * (e 3))) +1 +2 +3 +2 3 2 +1 2 1 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/LRWithLabels.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/LRWithLabels.txt new file mode 100644 index 0000000000..f5e2035e4c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/LRWithLabels.txt @@ -0,0 +1,38 @@ +[type] +Parser + +[grammar] +grammar T; + + + + +s +@after { + + +} + : r=e ; +e : e '(' eList ')' # Call + | INT # Int + ; +eList : e (',' e)* ; +MULT: '*' ; +ADD : '+' ; +INT : [0-9]+ ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +1(2,3) + +[output] +(e (e 1) ( (eList (e 2) , (e 3)) )) +1 +2 +3 +1 [13 6] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/RuleGetters_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/RuleGetters_1.txt new file mode 100644 index 0000000000..0993e38629 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/RuleGetters_1.txt @@ -0,0 +1,35 @@ +[type] +Parser + +[grammar] +grammar T; + + + + +s +@after { + + +} + : r=a ; +a : b b // forces list + | b // a list still + ; +b : ID | INT; +MULT: '*' ; +ADD : '+' ; +INT : [0-9]+ ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +1 2 + +[output] +(a (b 1) (b 2)) +1 2 1 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/RuleGetters_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/RuleGetters_2.txt new file mode 100644 index 0000000000..81cffff70e --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/RuleGetters_2.txt @@ -0,0 +1,35 @@ +[type] +Parser + +[grammar] +grammar T; + + + + +s +@after { + + +} + : r=a ; +a : b b // forces list + | b // a list still + ; +b : ID | INT; +MULT: '*' ; +ADD : '+' ; +INT : [0-9]+ ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +abc + +[output] +(a (b abc)) +abc + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/TokenGetters_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/TokenGetters_1.txt new file mode 100644 index 0000000000..96657bb41a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/TokenGetters_1.txt @@ -0,0 +1,34 @@ +[type] +Parser + +[grammar] +grammar T; + + + + +s +@after { + + +} + : r=a ; +a : INT INT + | ID + ; +MULT: '*' ; +ADD : '+' ; +INT : [0-9]+ ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +1 2 + +[output] +(a 1 2) +1 2 [1, 2] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/TokenGetters_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/TokenGetters_2.txt new file mode 100644 index 0000000000..008e7a7c56 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Listeners/TokenGetters_2.txt @@ -0,0 +1,34 @@ +[type] +Parser + +[grammar] +grammar T; + + + + +s +@after { + + +} + : r=a ; +a : INT INT + | ID + ; +MULT: '*' ; +ADD : '+' ; +INT : [0-9]+ ; +ID : [a-z]+ ; +WS : [ \t\n]+ -> skip ; + +[start] +s + +[input] +abc + +[output] +(a abc) +[@0,0:2='abc',<4>,1:0] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/AltNum.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/AltNum.txt new file mode 100644 index 0000000000..fa81083bf5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/AltNum.txt @@ -0,0 +1,37 @@ +[type] +Parser + +[grammar] +grammar T; + +options { contextSuperClass=MyRuleNode; } + + + + +s +@init { + +} +@after { + +} + : r=a ; + +a : 'f' + | 'g' + | 'x' b 'z' + ; +b : 'e' {} | 'y' + ; + +[start] +s + +[input] +xyz + +[output] +"""(a:3 x (b:2 y) z) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/ExtraToken.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/ExtraToken.txt new file mode 100644 index 0000000000..172d14a692 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/ExtraToken.txt @@ -0,0 +1,32 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : 'x' 'y' + ; +Z : 'z' + ; + +[start] +s + +[input] +xzy + +[output] +"""(a x z y) +""" + +[errors] +"""line 1:1 extraneous input 'z' expecting 'y' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/ExtraTokensAndAltLabels.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/ExtraTokensAndAltLabels.txt new file mode 100644 index 0000000000..75a49d3333 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/ExtraTokensAndAltLabels.txt @@ -0,0 +1,46 @@ +[type] +Parser + +[grammar] +grammar T; + +s +@init { + +} +@after { + +} + : '${' v '}' + ; + +v : A #altA + | B #altB + ; + +A : 'a' ; +B : 'b' ; + +WHITESPACE : [ \n\t\r]+ -> channel(HIDDEN) ; + +ERROR : . ; + +[start] +s + +[input] +${ ? a ?} + +[output] +"""(s ${ (v ? a) ? }) +""" + +[errors] +line 1:3 extraneous input '?' expecting {'a', 'b'} +line 1:7 extraneous input '?' expecting '}' + +[skip] +Cpp +Go +PHP + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/NoViableAlt.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/NoViableAlt.txt new file mode 100644 index 0000000000..24932bcab4 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/NoViableAlt.txt @@ -0,0 +1,32 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : 'x' | 'y' + ; +Z : 'z' + ; + +[start] +s + +[input] +z + +[output] +"""(a z) +""" + +[errors] +"""line 1:0 mismatched input 'z' expecting {'x', 'y'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/RuleRef.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/RuleRef.txt new file mode 100644 index 0000000000..880749f7b1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/RuleRef.txt @@ -0,0 +1,28 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : b 'x' + ; +b : 'y' + ; + +[start] +s + +[input] +yx + +[output] +"""(a (b y) x) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/Sync.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/Sync.txt new file mode 100644 index 0000000000..e64edff226 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/Sync.txt @@ -0,0 +1,32 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : 'x' 'y'* '!' + ; +Z : 'z' + ; + +[start] +s + +[input] +xzyy! + +[output] +"""(a x z y y !) +""" + +[errors] +"""line 1:1 extraneous input 'z' expecting {'y', '!'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/Token2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/Token2.txt new file mode 100644 index 0000000000..53eb9fa3ca --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/Token2.txt @@ -0,0 +1,26 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : 'x' 'y' + ; + +[start] +s + +[input] +xy + +[output] +"""(a x y) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TokenAndRuleContextString.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TokenAndRuleContextString.txt new file mode 100644 index 0000000000..4bedcc7aee --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TokenAndRuleContextString.txt @@ -0,0 +1,27 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : 'x' { + +} ; + +[start] +s + +[input] +x + +[output] +[a, s] +(a x) + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TwoAltLoop.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TwoAltLoop.txt new file mode 100644 index 0000000000..0c71e39420 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TwoAltLoop.txt @@ -0,0 +1,26 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : ('x' | 'y')* 'z' + ; + +[start] +s + +[input] +xyyxyxz + +[output] +"""(a x y y x y x z) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TwoAlts.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TwoAlts.txt new file mode 100644 index 0000000000..a91cf76ba2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParseTrees/TwoAlts.txt @@ -0,0 +1,26 @@ +[type] +Parser + +[grammar] +grammar T; +s +@init { + +} +@after { + +} + : r=a ; +a : 'x' | 'y' + ; + +[start] +s + +[input] +y + +[output] +"""(a y) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ConjuringUpToken.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ConjuringUpToken.txt new file mode 100644 index 0000000000..ec932d59b0 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ConjuringUpToken.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' x='b' {} 'c' ; + +[start] +a + +[input] +ac + +[output] +"""conjured=[@-1,-1:-1='',<2>,1:1] +""" + +[errors] +"""line 1:1 missing 'b' at 'c' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ConjuringUpTokenFromSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ConjuringUpTokenFromSet.txt new file mode 100644 index 0000000000..59e9286204 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ConjuringUpTokenFromSet.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' x=('b'|'c') {} 'd' ; + +[start] +a + +[input] +ad + +[output] +"""conjured=[@-1,-1:-1='',<2>,1:1] +""" + +[errors] +"""line 1:1 missing {'b', 'c'} at 'd' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ContextListGetters.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ContextListGetters.txt new file mode 100644 index 0000000000..ce9f4ab7fb --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ContextListGetters.txt @@ -0,0 +1,26 @@ +[notes] +Regression test for "Getter for context is not a list when it should be". +https://github.com/antlr/antlr4/issues/19 + +[type] +Parser + +[grammar] +grammar T; +@parser::members{ + +} +s : (a | b)+; +a : 'a' {}; +b : 'b' {}; + +[start] +s + +[input] +abab + +[output] +"""abab +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_1.txt new file mode 100644 index 0000000000..c1ec872a5b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_1.txt @@ -0,0 +1,16 @@ +[type] +Parser + +[grammar] +grammar T; +start : expr EOF; +expr : 'x' + | expr expr + ; + +[start] +start + +[input] +x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_2.txt new file mode 100644 index 0000000000..a6b4a7a4f7 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_2.txt @@ -0,0 +1,16 @@ +[type] +Parser + +[grammar] +grammar T; +start : expr EOF; +expr : 'x' + | expr expr + ; + +[start] +start + +[input] +xx + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_3.txt new file mode 100644 index 0000000000..46738d3e24 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_3.txt @@ -0,0 +1,16 @@ +[type] +Parser + +[grammar] +grammar T; +start : expr EOF; +expr : 'x' + | expr expr + ; + +[start] +start + +[input] +xxx + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_4.txt new file mode 100644 index 0000000000..e5b8bddc5c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/DuplicatedLeftRecursiveCall_4.txt @@ -0,0 +1,16 @@ +[type] +Parser + +[grammar] +grammar T; +start : expr EOF; +expr : 'x' + | expr expr + ; + +[start] +start + +[input] +xxxx + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ExtraneousInput.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ExtraneousInput.txt new file mode 100644 index 0000000000..7db6198596 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/ExtraneousInput.txt @@ -0,0 +1,31 @@ +[type] +Parser + +[grammar] +grammar T; + +member : 'a'; +body : member*; +file : body EOF; +B : 'b'; + +[start] +file + +[input] +baa + +[output] + +[errors] +"""line 1:0 mismatched input 'b' expecting {, 'a'} +""" + +[skip] +Cpp +CSharp +Go +Node +PHP +Python2 +Python3 diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/InvalidATNStateRemoval.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/InvalidATNStateRemoval.txt new file mode 100644 index 0000000000..f843359231 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/InvalidATNStateRemoval.txt @@ -0,0 +1,23 @@ +[notes] +This is a regression test for #45 "NullPointerException in ATNConfig.hashCode". +https://github.com/antlr/antlr4/issues/45 +The original cause of this issue was an error in the tool's ATN state optimization, +which is now detected early in {@link ATNSerializer} by ensuring that all +serialized transitions point to states which were not removed. + +[type] +Parser + +[grammar] +grammar T; +start : ID ':' expr; +expr : primary expr? {} | expr '->' ID; +primary : ID; +ID : [a-z]+; + +[start] +start + +[input] +x:x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/InvalidEmptyInput.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/InvalidEmptyInput.txt new file mode 100644 index 0000000000..4a149b2d3b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/InvalidEmptyInput.txt @@ -0,0 +1,22 @@ +[notes] +This is a regression test for #6 "NullPointerException in getMissingSymbol". +https://github.com/antlr/antlr4/issues/6 + +[type] +Parser + +[grammar] +grammar T; +start : ID+; +ID : [a-z]+; + +[start] +start + +[input] + + +[errors] +"""line 1:0 mismatched input '' expecting ID +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL1ErrorInfo.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL1ErrorInfo.txt new file mode 100644 index 0000000000..958cabc892 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL1ErrorInfo.txt @@ -0,0 +1,29 @@ +[type] +Parser + +[grammar] +grammar T; +start : animal (AND acClass)? service EOF; +animal : (DOG | CAT ); +service : (HARDWARE | SOFTWARE) ; +AND : 'and'; +DOG : 'dog'; +CAT : 'cat'; +HARDWARE: 'hardware'; +SOFTWARE: 'software'; +WS : ' ' -> skip ; +acClass +@init +{} + : ; + +[start] +start + +[input] +dog and software + +[output] +"""{'hardware', 'software'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL2.txt new file mode 100644 index 0000000000..a75c2c9322 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL2.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b' + | 'a' 'c' +; +q : 'e' ; + +[start] +a + +[input] +ae + +[errors] +"""line 1:1 no viable alternative at input 'ae' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL3.txt new file mode 100644 index 0000000000..0d41bb0ce1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LL3.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b'* 'c' + | 'a' 'b' 'd' +; +q : 'e' ; + +[start] +a + +[input] +abe + +[errors] +"""line 1:2 no viable alternative at input 'abe' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LLStar.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LLStar.txt new file mode 100644 index 0000000000..65ebf91fea --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/LLStar.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a'+ 'b' + | 'a'+ 'c' +; +q : 'e' ; + +[start] +a + +[input] +aaae + +[errors] +"""line 1:3 no viable alternative at input 'aaae' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionBeforeLoop.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionBeforeLoop.txt new file mode 100644 index 0000000000..18791af00b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionBeforeLoop.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b'* 'c'; + +[start] +a + +[input] +aacabc + +[errors] +"""line 1:1 extraneous input 'a' expecting {'b', 'c'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionBeforeLoop2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionBeforeLoop2.txt new file mode 100644 index 0000000000..85cded2dfe --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionBeforeLoop2.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' ('b'|'z'{})* 'c'; + +[start] +a + +[input] +aacabc + +[errors] +"""line 1:1 extraneous input 'a' expecting {'b', 'z', 'c'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionDuringLoop.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionDuringLoop.txt new file mode 100644 index 0000000000..faba53c978 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionDuringLoop.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b'* 'c' ; + +[start] +a + +[input] +abaaababc + +[errors] +line 1:2 extraneous input 'a' expecting {'b', 'c'} +line 1:6 extraneous input 'a' expecting {'b', 'c'} + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionDuringLoop2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionDuringLoop2.txt new file mode 100644 index 0000000000..cf08e3c996 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/MultiTokenDeletionDuringLoop2.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' ('b'|'z'{})* 'c' ; + +[start] +a + +[input] +abaaababc + +[errors] +line 1:2 extraneous input 'a' expecting {'b', 'z', 'c'} +line 1:6 extraneous input 'a' expecting {'b', 'z', 'c'} + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/NoViableAltAvoidance.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/NoViableAltAvoidance.txt new file mode 100644 index 0000000000..3347ec820c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/NoViableAltAvoidance.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +s : e '!' ; +e : 'a' 'b' + | 'a' + ; +DOT : '.' ; +WS : [ \t\r\n]+ -> skip; + +[start] +s + +[input] +a. + +[errors] +"""line 1:1 mismatched input '.' expecting '!' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleSetInsertion.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleSetInsertion.txt new file mode 100644 index 0000000000..ce1b18a09f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleSetInsertion.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' ('b'|'c') 'd' ; + +[start] +a + +[input] +ad + +[errors] +"""line 1:1 missing {'b', 'c'} at 'd' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleSetInsertionConsumption.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleSetInsertionConsumption.txt new file mode 100644 index 0000000000..8c93a644e3 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleSetInsertionConsumption.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +myset: ('b'|'c') ; +a: 'a' myset 'd' {} ; + +[start] +a + +[input] +ad + +[output] +"""[@0,0:0='a',<3>,1:0] +""" + +[errors] +"""line 1:1 missing {'b', 'c'} at 'd' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletion.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletion.txt new file mode 100644 index 0000000000..8ec847bf61 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletion.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b' ; + +[start] +a + +[input] +aab + +[errors] +"""line 1:1 extraneous input 'a' expecting 'b' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeAlt.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeAlt.txt new file mode 100644 index 0000000000..900ac4d8b9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeAlt.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : ('b' | 'c') +; +q : 'a' +; + +[start] +a + +[input] +ac + +[errors] +"""line 1:0 extraneous input 'a' expecting {'b', 'c'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeLoop.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeLoop.txt new file mode 100644 index 0000000000..5d6b7958bb --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeLoop.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b'* EOF ; + +[start] +a + +[input] +aabc + +[errors] +line 1:1 extraneous input 'a' expecting {, 'b'} +line 1:3 token recognition error at: 'c' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeLoop2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeLoop2.txt new file mode 100644 index 0000000000..aef8200492 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforeLoop2.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' ('b'|'z'{})* EOF ; + +[start] +a + +[input] +aabc + +[errors] +line 1:1 extraneous input 'a' expecting {, 'b', 'z'} +line 1:3 token recognition error at: 'c' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforePredict.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforePredict.txt new file mode 100644 index 0000000000..826697e877 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionBeforePredict.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a'+ 'b' + | 'a'+ 'c' +; +q : 'e' ; + +[start] +a + +[input] +caaab + +[errors] +"""line 1:0 extraneous input 'c' expecting 'a' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionConsumption.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionConsumption.txt new file mode 100644 index 0000000000..c9f1b4a1db --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionConsumption.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +myset: ('b'|'c') ; +a: 'a' myset 'd' {} ; + +[start] +a + +[input] +aabd + +[output] +"""[@2,2:2='b',<1>,1:2] +""" + +[errors] +"""line 1:1 extraneous input 'a' expecting {'b', 'c'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionDuringLoop.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionDuringLoop.txt new file mode 100644 index 0000000000..c0d99d5aa2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionDuringLoop.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b'* 'c' ; + +[start] +a + +[input] +ababbc + +[errors] +"""line 1:2 extraneous input 'a' expecting {'b', 'c'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionDuringLoop2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionDuringLoop2.txt new file mode 100644 index 0000000000..aad9f70524 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionDuringLoop2.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' ('b'|'z'{})* 'c' ; + +[start] +a + +[input] +ababbc + +[errors] +"""line 1:2 extraneous input 'a' expecting {'b', 'z', 'c'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionExpectingSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionExpectingSet.txt new file mode 100644 index 0000000000..6715ab68c8 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenDeletionExpectingSet.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' ('b'|'c') ; + +[start] +a + +[input] +aab + +[errors] +"""line 1:1 extraneous input 'a' expecting {'b', 'c'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenInsertion.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenInsertion.txt new file mode 100644 index 0000000000..4e40faf8d3 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/SingleTokenInsertion.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b' 'c' ; + +[start] +a + +[input] +ac + +[errors] +"""line 1:1 missing 'b' at 'c' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch.txt new file mode 100644 index 0000000000..2469359247 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : 'a' 'b' ; + +[start] +a + +[input] +aa + +[errors] +"""line 1:1 mismatched input 'a' expecting 'b' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch2.txt new file mode 100644 index 0000000000..7163ec7cef --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch2.txt @@ -0,0 +1,24 @@ +[type] +Parser + +[grammar] +grammar T; + +stat: ( '(' expr? ')' )? EOF ; +expr: ID '=' STR ; + +ERR : '~FORCE_ERROR~' ; +ID : [a-zA-Z]+ ; +STR : '"' ~["]* '"' ; +WS : [ \t\r\n]+ -> skip ; + +[start] +stat + +[input] +"""( ~FORCE_ERROR~ """ + +[errors] +"""line 1:2 mismatched input '~FORCE_ERROR~' expecting {')', ID} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch3.txt new file mode 100644 index 0000000000..afe6fdfe72 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserErrors/TokenMismatch3.txt @@ -0,0 +1,38 @@ +[type] +Parser + +[grammar] +grammar T; + +expression +: value +| expression op=AND expression +| expression op=OR expression +; +value +: BOOLEAN_LITERAL +| ID +| ID1 +| '(' expression ')' +; + +AND : '&&'; +OR : '||'; + +BOOLEAN_LITERAL : 'true' | 'false'; + +ID : [a-z]+; +ID1 : '$'; + +WS : [ \t\r\n]+ -> skip ; + +[start] +expression + +[input] + + +[errors] +"""line 1:0 mismatched input '' expecting {'(', BOOLEAN_LITERAL, ID, '$'} +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/APlus.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/APlus.txt new file mode 100644 index 0000000000..58941a2780 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/APlus.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : ID+ { + +}; +ID : 'a'..'z'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +a b c + +[output] +"""abc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AStar_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AStar_1.txt new file mode 100644 index 0000000000..5a398756c3 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AStar_1.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : ID* { + +}; +ID : 'a'..'z'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] + + +[output] +""" +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AStar_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AStar_2.txt new file mode 100644 index 0000000000..a6f3796568 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AStar_2.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : ID* { + +}; +ID : 'a'..'z'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +a b c + +[output] +"""abc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAPlus.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAPlus.txt new file mode 100644 index 0000000000..1b5ceddc25 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAPlus.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|ID)+ { + +}; +ID : 'a'..'z'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +a b c + +[output] +"""abc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAStar_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAStar_1.txt new file mode 100644 index 0000000000..4f325d695f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAStar_1.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|ID)* { + +}; +ID : 'a'..'z'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] + + +[output] +""" +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAStar_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAStar_2.txt new file mode 100644 index 0000000000..24d74cb079 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorAStar_2.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|ID)* { + +}; +ID : 'a'..'z'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +a b c + +[output] +"""abc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorB.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorB.txt new file mode 100644 index 0000000000..f32b5e6ccd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorB.txt @@ -0,0 +1,24 @@ +[type] +Parser + +[grammar] +grammar T; +a : ID { + +} | INT { + +}; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\\n') -> skip ; + +[start] +a + +[input] +34 + +[output] +"""alt 2 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBPlus.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBPlus.txt new file mode 100644 index 0000000000..3837de3b49 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBPlus.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|INT{ +})+ { + +}; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\\n') -> skip ; + +[start] +a + +[input] +a 34 c + +[output] +"""a34c +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBStar_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBStar_1.txt new file mode 100644 index 0000000000..3fc94004c6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBStar_1.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|INT{ +})* { + +}; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\\n') -> skip ; + +[start] +a + +[input] + + +[output] +""" +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBStar_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBStar_2.txt new file mode 100644 index 0000000000..4d854cb691 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/AorBStar_2.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|INT{ +})* { + +}; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\\n') -> skip ; + +[start] +a + +[input] +a 34 c + +[output] +"""a34c +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Basic.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Basic.txt new file mode 100644 index 0000000000..3683a22f4c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Basic.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +a : ID INT { + +}; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +abc 34 + +[output] +"""abc34 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/EOFInClosure.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/EOFInClosure.txt new file mode 100644 index 0000000000..c592fbfe65 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/EOFInClosure.txt @@ -0,0 +1,19 @@ +[notes] +This test ensures that {@link org.antlr.v4.runtime.atn.ParserATNSimulator} does not produce a +{@link StackOverflowError} when it encounters an {@code EOF} transition +inside a closure. + +[type] +Parser + +[grammar] +grammar T; +prog : stat EOF; +stat : 'x' ('y' | EOF)*?; + +[start] +prog + +[input] +x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseGreedyBinding1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseGreedyBinding1.txt new file mode 100644 index 0000000000..b29138d048 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseGreedyBinding1.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +start : statement+ ; +statement : 'x' | ifStatement; +ifStatement : 'if' 'y' statement ('else' statement)? { + +}; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> channel(HIDDEN); + +[start] +start + +[input] +if y if y x else x + +[output] +if y x else x +if y if y x else x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseGreedyBinding2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseGreedyBinding2.txt new file mode 100644 index 0000000000..3d5b342fbb --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseGreedyBinding2.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +start : statement+ ; +statement : 'x' | ifStatement; +ifStatement : 'if' 'y' statement ('else' statement|) { + +}; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> channel(HIDDEN); + +[start] +start + +[input] +if y if y x else x + +[output] +if y x else x +if y if y x else x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseNonGreedyBinding1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseNonGreedyBinding1.txt new file mode 100644 index 0000000000..da1583410c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseNonGreedyBinding1.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +start : statement+ ; +statement : 'x' | ifStatement; +ifStatement : 'if' 'y' statement ('else' statement)?? { + +}; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> channel(HIDDEN); + +[start] +start + +[input] +if y if y x else x + +[output] +if y x +if y if y x else x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseNonGreedyBinding2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseNonGreedyBinding2.txt new file mode 100644 index 0000000000..ca8d7826a5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/IfIfElseNonGreedyBinding2.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +start : statement+ ; +statement : 'x' | ifStatement; +ifStatement : 'if' 'y' statement (|'else' statement) { + +}; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> channel(HIDDEN); + +[start] +start + +[input] +if y if y x else x + +[output] +if y x +if y if y x else x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LL1OptionalBlock_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LL1OptionalBlock_1.txt new file mode 100644 index 0000000000..e33efa3aba --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LL1OptionalBlock_1.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|{}INT)? { + +}; +ID : 'a'..'z'+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] + + +[output] +""" +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LL1OptionalBlock_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LL1OptionalBlock_2.txt new file mode 100644 index 0000000000..319abe22d4 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LL1OptionalBlock_2.txt @@ -0,0 +1,22 @@ +[type] +Parser + +[grammar] +grammar T; +a : (ID|{}INT)? { + +}; +ID : 'a'..'z'+; +INT : '0'..'9'+ ; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +a + +[output] +"""a +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LabelAliasingAcrossLabeledAlternatives.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LabelAliasingAcrossLabeledAlternatives.txt new file mode 100644 index 0000000000..88145142c4 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/LabelAliasingAcrossLabeledAlternatives.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#195 "label 'label' type +mismatch with previous definition: TOKEN_LABEL!=RULE_LABEL" +https://github.com/antlr/antlr4/issues/195 + +[type] +Parser + +[grammar] +grammar T; +start : a* EOF; +a + : label=subrule {} #One + | label='y' {} #Two + ; +subrule : 'x'; +WS : (' '|'\n') -> skip ; + +[start] +start + +[input] +xy + +[output] +x +y + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Labels.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Labels.txt new file mode 100644 index 0000000000..3b4a534a43 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Labels.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : b1=b b2+=b* b3+=';' ; +b : id_=ID val+=INT*; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] +abc 34; + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelForClosureContext.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelForClosureContext.txt new file mode 100644 index 0000000000..6b964f0a9c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelForClosureContext.txt @@ -0,0 +1,35 @@ +[notes] +This is a regression test for antlr/antlr4#299 "Repeating subtree not +accessible in visitor". https://github.com/antlr/antlr4/issues/299 + +[type] +Parser + +[grammar] +grammar T; +ifStatement +@after { +})> +} + : 'if' expression + ( ( 'then' + executableStatement* + elseIfStatement* // \<--- problem is here; should yield a list not node + elseStatement? + 'end' 'if' + ) | executableStatement ) + ; + +elseIfStatement + : 'else' 'if' expression 'then' executableStatement* + ; +expression : 'a' ; +executableStatement : 'a' ; +elseStatement : 'a' ; + +[start] +expression + +[input] +a + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelsOnSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelsOnSet.txt new file mode 100644 index 0000000000..cf4d8dbced --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ListLabelsOnSet.txt @@ -0,0 +1,22 @@ +[notes] +This is a regression test for #270 "Fix operator += applied to a set of +tokens". https://github.com/antlr/antlr4/issues/270 + +[type] +Parser + +[grammar] +grammar T; +a : b b* ';' ; +b : ID val+=(INT | FLOAT)*; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +FLOAT : [0-9]+ '.' [0-9]+; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] +abc 34; + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/MultipleEOFHandling.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/MultipleEOFHandling.txt new file mode 100644 index 0000000000..3d400f415a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/MultipleEOFHandling.txt @@ -0,0 +1,18 @@ +[notes] +This test ensures that {@link ParserATNSimulator} produces a correct +result when the grammar contains multiple explicit references to +{@code EOF} inside of parser rules. + +[type] +Parser + +[grammar] +grammar T; +prog : ('x' | 'x' 'y') EOF EOF; + +[start] +prog + +[input] +x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case1.txt new file mode 100644 index 0000000000..f7d7f92713 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case1.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#1545, case 1. + +[type] +Parser + +[grammar] +grammar OpenDeviceStatement; +program : statement+ '.' ; + +statement : 'OPEN' ( 'DEVICE' ( OPT1 | OPT2 | OPT3 )? )+ {} ; + +OPT1 : 'OPT-1'; +OPT2 : 'OPT-2'; +OPT3 : 'OPT-3'; + +WS : (' '|'\n')+ -> channel(HIDDEN); + +[start] +statement + +[input] +OPEN DEVICE DEVICE + +[output] +"""OPEN DEVICE DEVICE +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case2.txt new file mode 100644 index 0000000000..ee46983ec9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case2.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#1545, case 2. + +[type] +Parser + +[grammar] +grammar OpenDeviceStatement; +program : statement+ '.' ; + +statement : 'OPEN' ( 'DEVICE' ( (OPT1) | OPT2 | OPT3 )? )+ {} ; + +OPT1 : 'OPT-1'; +OPT2 : 'OPT-2'; +OPT3 : 'OPT-3'; + +WS : (' '|'\n')+ -> channel(HIDDEN); + +[start] +statement + +[input] +OPEN DEVICE DEVICE + +[output] +"""OPEN DEVICE DEVICE +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case3.txt new file mode 100644 index 0000000000..bb64b10973 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OpenDeviceStatement_Case3.txt @@ -0,0 +1,28 @@ +[notes] +This is a regression test for antlr/antlr4#1545, case 3. + +[type] +Parser + +[grammar] +grammar OpenDeviceStatement; +program : statement+ '.' ; + +statement : 'OPEN' ( 'DEVICE' ( (OPT1) | OPT2 | OPT3 )? )+ {} ; + +OPT1 : 'OPT-1'; +OPT2 : 'OPT-2'; +OPT3 : 'OPT-3'; + +WS : (' '|'\n')+ -> channel(HIDDEN); + +[start] +statement + +[input] +OPEN DEVICE DEVICE. + +[output] +"""OPEN DEVICE DEVICE +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_1.txt new file mode 100644 index 0000000000..15bc560a4c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_1.txt @@ -0,0 +1,19 @@ +[notes] +This test is meant to detect regressions of bug antlr/antlr4#41. +https://github.com/antlr/antlr4/issues/41 + +[type] +Parser + +[grammar] +grammar T; +stat : ifstat | 'x'; +ifstat : 'if' stat ('else' stat)?; +WS : [ \n\t]+ -> skip ; + +[start] +stat + +[input] +x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_2.txt new file mode 100644 index 0000000000..e12700202a --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_2.txt @@ -0,0 +1,19 @@ +[notes] +This test is meant to detect regressions of bug antlr/antlr4#41. +https://github.com/antlr/antlr4/issues/41 + +[type] +Parser + +[grammar] +grammar T; +stat : ifstat | 'x'; +ifstat : 'if' stat ('else' stat)?; +WS : [ \n\t]+ -> skip ; + +[start] +stat + +[input] +if x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_3.txt new file mode 100644 index 0000000000..f6f1a2e691 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_3.txt @@ -0,0 +1,19 @@ +[notes] +This test is meant to detect regressions of bug antlr/antlr4#41. +https://github.com/antlr/antlr4/issues/41 + +[type] +Parser + +[grammar] +grammar T; +stat : ifstat | 'x'; +ifstat : 'if' stat ('else' stat)?; +WS : [ \n\t]+ -> skip ; + +[start] +stat + +[input] +if x else x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_4.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_4.txt new file mode 100644 index 0000000000..257940d939 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Optional_4.txt @@ -0,0 +1,19 @@ +[notes] +This test is meant to detect regressions of bug antlr/antlr4#41. +https://github.com/antlr/antlr4/issues/41 + +[type] +Parser + +[grammar] +grammar T; +stat : ifstat | 'x'; +ifstat : 'if' stat ('else' stat)?; +WS : [ \n\t]+ -> skip ; + +[start] +stat + +[input] +if if x else x + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OrderingPredicates.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OrderingPredicates.txt new file mode 100644 index 0000000000..bc238266b7 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/OrderingPredicates.txt @@ -0,0 +1,33 @@ +[notes] +This is a regression test for antlr/antlr4#2301. + +[type] +Parser + +[grammar] +grammar Issue2301; + +SPACES: [ \t\r\n]+ -> skip; + +AT: 'AT'; +X : 'X'; +Y : 'Y'; + +ID: [A-Z]+; + +constant +: 'DUMMY' +; + +expr +: ID constant? +| expr AT X +| expr AT Y +; + +[start] +expr + +[input] +POINT AT X + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ParserProperty.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ParserProperty.txt new file mode 100644 index 0000000000..6dcc3975dd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ParserProperty.txt @@ -0,0 +1,25 @@ +[notes] +This is a regression test for antlr/antlr4#561 "Issue with parser +generation in 4.2.2" https://github.com/antlr/antlr4/issues/561 + +[type] +Parser + +[grammar] +grammar T; + +a : {}? ID {} + ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] +abc + +[output] +"""valid +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/PredicatedIfIfElse.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/PredicatedIfIfElse.txt new file mode 100644 index 0000000000..b131fbe9de --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/PredicatedIfIfElse.txt @@ -0,0 +1,22 @@ +[notes] +This test is meant to test the expected solution to antlr/antlr4#42. +https://github.com/antlr/antlr4/issues/42 + +[type] +Parser + +[grammar] +grammar T; +s : stmt EOF ; +stmt : ifStmt | ID; +ifStmt : 'if' ID stmt ('else' stmt | { })> }?); +ELSE : 'else'; +ID : [a-zA-Z]+; +WS : [ \\n\\t]+ -> skip; + +[start] +s + +[input] +if x if x a else b + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/PredictionIssue334.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/PredictionIssue334.txt new file mode 100644 index 0000000000..4ec1088bc6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/PredictionIssue334.txt @@ -0,0 +1,32 @@ +[notes] +This is a regression test for antlr/antlr4#334 "BailErrorStrategy: bails +on proper input". https://github.com/antlr/antlr4/issues/334 + +[type] +Parser + +[grammar] +grammar T; +file_ @init{ + +} +@after { + +} + : item (SEMICOLON item)* SEMICOLON? EOF ; +item : A B?; +SEMICOLON: ';'; +A : 'a'|'A'; +B : 'b'|'B'; +WS : [ \r\t\n]+ -> skip; + +[start] +file_ + +[input] +a + +[output] +"""(file_ (item a) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ReferenceToATN_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ReferenceToATN_1.txt new file mode 100644 index 0000000000..db1855b1ee --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ReferenceToATN_1.txt @@ -0,0 +1,24 @@ +[notes] +This is a regression test for antlr/antlr4#561 "Issue with parser +generation in 4.2.2" https://github.com/antlr/antlr4/issues/561 + +[type] +Parser + +[grammar] +grammar T; +a : (ID|ATN)* ATN? {} ; +ID : 'a'..'z'+ ; +ATN : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] + + +[output] +""" +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ReferenceToATN_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ReferenceToATN_2.txt new file mode 100644 index 0000000000..9e12a9ea3c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/ReferenceToATN_2.txt @@ -0,0 +1,24 @@ +[notes] +This is a regression test for antlr/antlr4#561 "Issue with parser +generation in 4.2.2" https://github.com/antlr/antlr4/issues/561 + +[type] +Parser + +[grammar] +grammar T; +a : (ID|ATN)* ATN? {} ; +ID : 'a'..'z'+ ; +ATN : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +a + +[input] +a 34 c + +[output] +"""a34c +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/TokenOffset.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/TokenOffset.txt new file mode 100644 index 0000000000..e80800b594 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/TokenOffset.txt @@ -0,0 +1,29 @@ +[notes] +This is a regression test for antlr/antlr4#2728 +It should generate correct code for grammars with more than 65 tokens. +https://github.com/antlr/antlr4/pull/2728#issuecomment-622940562 + +[type] +Parser + +[grammar] +grammar L; +a : ('1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'10'|'11'|'12'|'13'|'14'|'15'|'16' +|'17'|'18'|'19'|'20'|'21'|'22'|'23'|'24'|'25'|'26'|'27'|'28'|'29'|'30'|'31'|'32' +|'33'|'34'|'35'|'36'|'37'|'38'|'39'|'40'|'41'|'42'|'43'|'44'|'45'|'46'|'47'|'48' +|'49'|'50'|'51'|'52'|'53'|'54'|'55'|'56'|'57'|'58'|'59'|'60'|'61'|'62'|'63'|'64' +|'65'|'66')+ { + +}; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +12 34 56 66 + +[output] +"""12345666 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Wildcard.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Wildcard.txt new file mode 100644 index 0000000000..f84bbd8a64 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/ParserExec/Wildcard.txt @@ -0,0 +1,26 @@ +[notes] +Match assignments, ignore other tokens with wildcard. + +[type] +Parser + +[grammar] +grammar T; +a : (assign|.)+ EOF ; +assign : ID '=' INT ';' { + +} ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip; + +[start] +a + +[input] +x=10; abc;;;; y=99; + +[output] +x=10; +y=99; + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_1.txt new file mode 100644 index 0000000000..b229115771 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_1.txt @@ -0,0 +1,46 @@ +[notes] +for https://github.com/antlr/antlr4/issues/1398. +Seeing through a large expression takes 5 _minutes_ on +my fast box to complete. After fix, it's instantaneous. + +[type] +Parser + +[grammar] +grammar Expr; + +stat : expr ';' + | expr '.' + ; + +expr + : ID + | 'not' expr + | expr 'and' expr + | expr 'or' expr + | '(' ID ')' expr + | expr '?' expr ':' expr + | 'between' expr 'and' expr + ; + +ID: [a-zA-Z_][a-zA-Z_0-9]*; +WS: [ \t\n\r\f]+ -> skip; + +[start] +stat + +[input] +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 +; + +[skip] +Go +PHP + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_2.txt new file mode 100644 index 0000000000..3f03c3880c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_2.txt @@ -0,0 +1,45 @@ +[notes] +for https://github.com/antlr/antlr4/issues/1398. +Seeing through a large expression takes 5 _minutes_ on +my fast box to complete. After fix, it's instantaneous. + +[type] +Parser + +[grammar] +grammar Expr; + +stat : expr ';' + | expr '.' + ; + +expr + : ID + | 'not' expr + | expr 'and' expr + | expr 'or' expr + | '(' ID ')' expr + | expr '?' expr ':' expr + | 'between' expr 'and' expr + ; + +ID: [a-zA-Z_][a-zA-Z_0-9]*; +WS: [ \t\n\r\f]+ -> skip; + +[start] +stat + +[input] +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 or +X1 and X2 and X3 and X4 and X5 and X6 and X7 +. + +[skip] +Go +PHP + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_3.txt new file mode 100644 index 0000000000..6a9c3c1934 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_3.txt @@ -0,0 +1,56 @@ +[notes] +for https://github.com/antlr/antlr4/issues/1398. +Seeing through a large expression takes 5 _minutes_ on +my fast box to complete. After fix, it's instantaneous. + +[type] +Parser + +[grammar] +grammar Expr; + +stat : expr ';' + | expr '.' + ; + +expr + : ID + | 'not' expr + | expr 'and' expr + | expr 'or' expr + | '(' ID ')' expr + | expr '?' expr ':' expr + | 'between' expr 'and' expr + ; + +ID: [a-zA-Z_][a-zA-Z_0-9]*; +WS: [ \t\n\r\f]+ -> skip; + +[start] +stat + +[input] +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 +; + +[skip] +Go +PHP + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_5.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_5.txt new file mode 100644 index 0000000000..acd66709a4 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/DropLoopEntryBranchInLRRule_5.txt @@ -0,0 +1,67 @@ +[notes] +for https://github.com/antlr/antlr4/issues/1398. +Seeing through a large expression takes 5 _minutes_ on +my fast box to complete. After fix, it's instantaneous. + +[type] +Parser + +[grammar] +grammar Expr; + +stat : expr ';' + | expr '.' + ; + +expr + : ID + | 'not' expr + | expr 'and' expr + | expr 'or' expr + | '(' ID ')' expr + | expr '?' expr ':' expr + | 'between' expr 'and' expr + ; + +ID: [a-zA-Z_][a-zA-Z_0-9]*; +WS: [ \t\n\r\f]+ -> skip; + +[start] +stat + +[input] +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z or +X ? Y : Z +; + +[skip] +Go +PHP + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/ExpressionGrammar_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/ExpressionGrammar_1.txt new file mode 100644 index 0000000000..9c1ea39d66 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/ExpressionGrammar_1.txt @@ -0,0 +1,41 @@ +[notes] +This is a regression test for antlr/antlr4#192 "Poor performance of +expression parsing". https://github.com/antlr/antlr4/issues/192 + +[type] +Parser + +[grammar] +grammar Expr; + +program: expr EOF; + +expr + : ID + | 'not' expr + | expr 'and' expr + | expr 'or' expr + ; + +ID: [a-zA-Z_][a-zA-Z_0-9]*; +WS: [ \t\n\r\f]+ -> skip; +ERROR: .; + +[start] +program + +[input] +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or + X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/ExpressionGrammar_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/ExpressionGrammar_2.txt new file mode 100644 index 0000000000..2d2056fceb --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Performance/ExpressionGrammar_2.txt @@ -0,0 +1,38 @@ +[notes] +This is a regression test for antlr/antlr4#192 "Poor performance of +expression parsing". https://github.com/antlr/antlr4/issues/192 + +[type] +Parser + +[grammar] +grammar Expr; + +program: expr EOF; + +expr + : ID + | 'not' expr + | expr 'and' expr + | expr 'or' expr + ; + +ID: [a-zA-Z_][a-zA-Z_0-9]*; +WS: [ \t\n\r\f]+ -> skip; +ERROR: .; + +[start] +program + +[input] +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or +not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/DisableRule.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/DisableRule.txt new file mode 100644 index 0000000000..52a358b371 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/DisableRule.txt @@ -0,0 +1,28 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +E1 : 'enum' { }? ; +E2 : 'enum' { }? ; // winner not E1 or ID +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip; + +[input] +enum abc + +[output] +[@0,0:3='enum',<2>,1:0] +[@1,5:7='abc',<3>,1:5] +[@2,8:7='',<-1>,1:8] +s0-' '->:s5=>4 +s0-'a'->:s6=>3 +s0-'e'->:s1=>3 +:s1=>3-'n'->:s2=>3 +:s2=>3-'u'->:s3=>3 +:s6=>3-'b'->:s6=>3 +:s6=>3-'c'->:s6=>3 + +[flags] +showDFA + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/EnumNotID.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/EnumNotID.txt new file mode 100644 index 0000000000..7be85967d1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/EnumNotID.txt @@ -0,0 +1,22 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ENUM : [a-z]+ { }? ; +ID : [a-z]+ ; +WS : (' '|'\n') -> skip; + +[input] +enum abc enum + +[output] +[@0,0:3='enum',<1>,1:0] +[@1,5:7='abc',<2>,1:5] +[@2,9:12='enum',<1>,1:9] +[@3,13:12='',<-1>,1:13] +s0-' '->:s3=>3 + +[flags] +showDFA + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/IDnotEnum.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/IDnotEnum.txt new file mode 100644 index 0000000000..dd0e871319 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/IDnotEnum.txt @@ -0,0 +1,22 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ENUM : [a-z]+ { }? ; +ID : [a-z]+ ; +WS : (' '|'\n') -> skip; + +[input] +enum abc enum + +[output] +[@0,0:3='enum',<2>,1:0] +[@1,5:7='abc',<2>,1:5] +[@2,9:12='enum',<2>,1:9] +[@3,13:12='',<-1>,1:13] +s0-' '->:s2=>3 + +[flags] +showDFA + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/IDvsEnum.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/IDvsEnum.txt new file mode 100644 index 0000000000..91a825e6ef --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/IDvsEnum.txt @@ -0,0 +1,28 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ENUM : 'enum' { }? ; +ID : 'a'..'z'+ ; +WS : (' '|'\n') -> skip; + +[input] +enum abc enum + +[output] +[@0,0:3='enum',<2>,1:0] +[@1,5:7='abc',<2>,1:5] +[@2,9:12='enum',<2>,1:9] +[@3,13:12='',<-1>,1:13] +s0-' '->:s5=>3 +s0-'a'->:s4=>2 +s0-'e'->:s1=>2 +:s1=>2-'n'->:s2=>2 +:s2=>2-'u'->:s3=>2 +:s4=>2-'b'->:s4=>2 +:s4=>2-'c'->:s4=>2 + +[flags] +showDFA + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/Indent.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/Indent.txt new file mode 100644 index 0000000000..dfa5077fed --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/Indent.txt @@ -0,0 +1,37 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ID : [a-z]+ ; +INDENT : [ \t]+ { }? +{ } ; +NL : '\n'; +WS : [ \t]+ ; + +[input] +"""abc + def +""" + +[output] +INDENT +[@0,0:2='abc',<1>,1:0] +[@1,3:3='\n',<3>,1:3] +[@2,4:5=' ',<2>,2:0] +[@3,6:8='def',<1>,2:2] +[@4,9:10=' ',<4>,2:5] +[@5,11:11='\n',<3>,2:7] +[@6,12:11='',<-1>,3:0] +s0-' +'->:s2=>3 +s0-'a'->:s1=>1 +s0-'d'->:s1=>1 +:s1=>1-'b'->:s1=>1 +:s1=>1-'c'->:s1=>1 +:s1=>1-'e'->:s1=>1 +:s1=>1-'f'->:s1=>1 + +[flags] +showDFA + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/LexerInputPositionSensitivePredicates.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/LexerInputPositionSensitivePredicates.txt new file mode 100644 index 0000000000..5b68133691 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/LexerInputPositionSensitivePredicates.txt @@ -0,0 +1,29 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +WORD1 : ID1+ { } ; +WORD2 : ID2+ { } ; +fragment ID1 : { \< 2 }? [a-zA-Z]; +fragment ID2 : { >= 2 }? [a-zA-Z]; +WS : (' '|'\n') -> skip; + +[input] +a cde +abcde + +[output] +a +cde +ab +cde +[@0,0:0='a',<1>,1:0] +[@1,2:4='cde',<2>,1:2] +[@2,6:7='ab',<1>,2:0] +[@3,8:10='cde',<2>,2:2] +[@4,12:11='',<-1>,3:0] + +[flags] +showDFA + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/PredicatedKeywords.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/PredicatedKeywords.txt new file mode 100644 index 0000000000..9e0eba556b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/PredicatedKeywords.txt @@ -0,0 +1,21 @@ +[type] +Lexer + +[grammar] +lexer grammar L; +ENUM : [a-z]+ { }? { } ; +ID : [a-z]+ { } ; +WS : [ \n] -> skip ; + +[input] +enum enu a + +[output] +enum! +ID enu +ID a +[@0,0:3='enum',<1>,1:0] +[@1,5:7='enu',<2>,1:5] +[@2,9:9='a',<2>,1:9] +[@3,10:9='',<-1>,1:10] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/RuleSempredFunction.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/RuleSempredFunction.txt new file mode 100644 index 0000000000..a86f9077fd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexer/RuleSempredFunction.txt @@ -0,0 +1,19 @@ +[notes] +Test for https://github.com/antlr/antlr4/issues/958 + +[type] +Lexer + +[grammar] +lexer grammar L; +T : 'a' {}? ; + +[input] +aaa + +[output] +[@0,0:0='a',<1>,1:0] +[@1,1:1='a',<1>,1:1] +[@2,2:2='a',<1>,1:2] +[@3,3:2='',<-1>,1:3] + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ActionHidesPreds.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ActionHidesPreds.txt new file mode 100644 index 0000000000..d3ec008891 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ActionHidesPreds.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +@parser::members {} +s : a+ ; +a : {} ID {}? {} + | {} ID {}? {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x x y + +[output] +alt 1 +alt 1 +alt 1 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ActionsHidePredsInGlobalFOLLOW.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ActionsHidePredsInGlobalFOLLOW.txt new file mode 100644 index 0000000000..151f382988 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ActionsHidePredsInGlobalFOLLOW.txt @@ -0,0 +1,31 @@ +[notes] +Regular non-forced actions can create side effects used by semantic +predicates and so we cannot evaluate any semantic predicate +encountered after having seen a regular action. This includes +during global follow operations. + +[type] +Parser + +[grammar] +grammar T; +@parser::members { + +} +s : e {} {}? {} '!' ; +t : e {} {}? ID ; +e : ID | ; // non-LL(1) so we use ATN +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a! + +[output] +eval=true +parse + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/AtomWithClosureInTranslatedLRRule.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/AtomWithClosureInTranslatedLRRule.txt new file mode 100644 index 0000000000..408cf8a3ca --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/AtomWithClosureInTranslatedLRRule.txt @@ -0,0 +1,21 @@ +[notes] +This is a regression test for antlr/antlr4#196 +"element+ in expression grammar doesn't parse properly" +https://github.com/antlr/antlr4/issues/196 + +[type] +Parser + +[grammar] +grammar T; +start : e[0] EOF; +e[int _p] + : ( 'a' | 'b'+ ) ( {3 >= $_p}? '+' e[4] )* + ; + +[start] +start + +[input] +a+b+a + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DepedentPredsInGlobalFOLLOW.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DepedentPredsInGlobalFOLLOW.txt new file mode 100644 index 0000000000..4694a11182 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DepedentPredsInGlobalFOLLOW.txt @@ -0,0 +1,30 @@ +[notes] +We cannot collect predicates that are dependent on local context if +we are doing a global follow. They appear as if they were not there at all. + +[type] +Parser + +[grammar] +grammar T; +@parser::members { + +} +s : a[99] ; +a[int i] : e {}? {} '!' ; +b[int i] : e {}? ID ; +e : ID | ; // non-LL(1) so we use ATN +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a! + +[output] +eval=true +parse + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DependentPredNotInOuterCtxShouldBeIgnored.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DependentPredNotInOuterCtxShouldBeIgnored.txt new file mode 100644 index 0000000000..56a7e216b4 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DependentPredNotInOuterCtxShouldBeIgnored.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : b[2] ';' | b[2] '.' ; // decision in s drills down to ctx-dependent pred in a; +b[] : a[] ; +a[] + : {}? ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a; + +[output] +"""alt 2 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DisabledAlternative.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DisabledAlternative.txt new file mode 100644 index 0000000000..9325f07d9f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/DisabledAlternative.txt @@ -0,0 +1,20 @@ +[notes] +This is a regression test for antlr/antlr4#218 "ANTLR4 EOF Related Bug". +https://github.com/antlr/antlr4/issues/218 + +[type] +Parser + +[grammar] +grammar T; +cppCompilationUnit : content+ EOF; +content: anything | {}? .; +anything: ANY_CHAR; +ANY_CHAR: [_a-zA-Z0-9]; + +[start] +cppCompilationUnit + +[input] +hello + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/IndependentPredNotPassedOuterCtxToAvoidCastException.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/IndependentPredNotPassedOuterCtxToAvoidCastException.txt new file mode 100644 index 0000000000..607e990030 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/IndependentPredNotPassedOuterCtxToAvoidCastException.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : b ';' | b '.' ; +b : a ; +a + : {}? ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a; + +[output] +"""alt 2 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/NoTruePredsThrowsNoViableAlt.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/NoTruePredsThrowsNoViableAlt.txt new file mode 100644 index 0000000000..0105c71521 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/NoTruePredsThrowsNoViableAlt.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +s : a a; +a : {}? ID INT {} + | {}? ID INT {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +y 3 x 4 + +[errors] +"""line 1:0 no viable alternative at input 'y' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/Order.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/Order.txt new file mode 100644 index 0000000000..fba98c8ffd --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/Order.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : a {} a; // do 2x: once in ATN, next in DFA; +// action blocks lookahead from falling off of 'a' +// and looking into 2nd 'a' ref. !ctx dependent pred +a : ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x y + +[output] +alt 1 +alt 1 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredFromAltTestedInLoopBack_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredFromAltTestedInLoopBack_2.txt new file mode 100644 index 0000000000..ec2e626591 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredFromAltTestedInLoopBack_2.txt @@ -0,0 +1,32 @@ +[notes] +Loopback doesn't eval predicate at start of alt + +[type] +Parser + +[grammar] +grammar T; +file_ +@after {} + : para para EOF ; +para: paraContent NL NL ; +paraContent : ('s'|'x'|{})>}? NL)+ ; +NL : '\n' ; +s : 's' ; +X : 'x' ; + +[start] +file_ + +[input] +"""s + + +x + +""" + +[output] +"""(file_ (para (paraContent s) \n \n) (para (paraContent \n x) \n \n) ) +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredTestedEvenWhenUnAmbig_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredTestedEvenWhenUnAmbig_1.txt new file mode 100644 index 0000000000..72974d2b9f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredTestedEvenWhenUnAmbig_1.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +@parser::members {} +primary + : ID {} + | {}? 'enum' {} + ; +ID : [a-z]+ ; +WS : [ \t\n\r]+ -> skip ; + +[start] +primary + +[input] +abc + +[output] +"""ID abc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredTestedEvenWhenUnAmbig_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredTestedEvenWhenUnAmbig_2.txt new file mode 100644 index 0000000000..f6a4d5c9b9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredTestedEvenWhenUnAmbig_2.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +@parser::members {} +primary + : ID {} + | {}? 'enum' {} + ; +ID : [a-z]+ ; +WS : [ \t\n\r]+ -> skip ; + +[start] +primary + +[input] +enum + +[errors] +"""line 1:0 no viable alternative at input 'enum' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredicateDependentOnArg.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredicateDependentOnArg.txt new file mode 100644 index 0000000000..168bdbf924 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredicateDependentOnArg.txt @@ -0,0 +1,31 @@ +[notes] +In this case, we're passing a parameter into a rule that uses that +information to predict the alternatives. This is the special case +where we know exactly which context we are in. The context stack +is empty and we have not dipped into the outer context to make a decision. + +[type] +Parser + +[grammar] +grammar T; +@parser::members {} +s : a[2] a[1]; +a[int i] + : {}? ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a b + +[output] +alt 2 +alt 1 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredicateDependentOnArg2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredicateDependentOnArg2.txt new file mode 100644 index 0000000000..b8fa75d735 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredicateDependentOnArg2.txt @@ -0,0 +1,31 @@ +[notes] +In this case, we have to ensure that the predicates are not tested +during the closure after recognizing the 1st ID. The closure will +fall off the end of 'a' 1st time and reach into the a[1] rule +invocation. It should not execute predicates because it does not know +what the parameter is. The context stack will not be empty and so +they should be ignored. It will not affect recognition, however. We +are really making sure the ATN simulation doesn't crash with context +object issues when it encounters preds during FOLLOW. + +[type] +Parser + +[grammar] +grammar T; +@parser::members {} +s : a[2] a[1]; +a[int i] + : {}? ID + | {}? ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a b + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredsInGlobalFOLLOW.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredsInGlobalFOLLOW.txt new file mode 100644 index 0000000000..bf16fe3826 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/PredsInGlobalFOLLOW.txt @@ -0,0 +1,29 @@ +[notes] +During a global follow operation, we still collect semantic +predicates as long as they are not dependent on local context + +[type] +Parser + +[grammar] +grammar T; +@parser::members { + +} +s : e {}? {} '!' ; +t : e {}? ID ; +e : ID | ; // non-LL(1) so we use ATN +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +a! + +[output] +eval=true +parse + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/RewindBeforePredEval.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/RewindBeforePredEval.txt new file mode 100644 index 0000000000..436583f395 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/RewindBeforePredEval.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +s : a a; +a : {}? ID INT {} + | {}? ID INT {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +y 3 x 4 + +[output] +alt 2 +alt 1 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/Simple.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/Simple.txt new file mode 100644 index 0000000000..4301cdeee6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/Simple.txt @@ -0,0 +1,25 @@ +[type] +Parser + +[grammar] +grammar T; +s : a a a; // do 3x: once in ATN, next in DFA then INT in ATN +a : {}? ID {} + | {}? ID {} + | INT{} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x y 3 + +[output] +alt 2 +alt 2 +alt 3 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/SimpleValidate.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/SimpleValidate.txt new file mode 100644 index 0000000000..99d7702984 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/SimpleValidate.txt @@ -0,0 +1,23 @@ +[type] +Parser + +[grammar] +grammar T; +s : a ; +a : {}? ID {} + | {}? INT {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x + +[errors] +"""line 1:0 no viable alternative at input 'x' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/SimpleValidate2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/SimpleValidate2.txt new file mode 100644 index 0000000000..46c678a0db --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/SimpleValidate2.txt @@ -0,0 +1,27 @@ +[type] +Parser + +[grammar] +grammar T; +s : a a a; +a : {}? ID {} + | {}? INT {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +3 4 x + +[output] +alt 2 +alt 2 + +[errors] +"""line 1:4 no viable alternative at input 'x' +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ToLeft.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ToLeft.txt new file mode 100644 index 0000000000..5d7dba78c9 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ToLeft.txt @@ -0,0 +1,24 @@ +[type] +Parser + +[grammar] +grammar T; + s : a+ ; +a : {}? ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x x y + +[output] +alt 2 +alt 2 +alt 2 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ToLeftWithVaryingPredicate.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ToLeftWithVaryingPredicate.txt new file mode 100644 index 0000000000..2746c2535e --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ToLeftWithVaryingPredicate.txt @@ -0,0 +1,36 @@ +[notes] +In this case, we use predicates that depend on global information +like we would do for a symbol table. We simply execute +the predicates assuming that all necessary information is available. +The i++ action is done outside of the prediction and so it is executed. + +[type] +Parser + +[grammar] +grammar T; +@parser::members {} +s : ({ + +} a)+ ; +a : {}? ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x x y + +[output] +i=1 +alt 2 +i=2 +alt 1 +i=3 +alt 2 + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/TwoUnpredicatedAlts.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/TwoUnpredicatedAlts.txt new file mode 100644 index 0000000000..a45cd9a319 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/TwoUnpredicatedAlts.txt @@ -0,0 +1,33 @@ +[type] +Parser + +[grammar] +grammar T; +s : {} a ';' a; // do 2x: once in ATN, next in DFA +a : ID {} + | ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x; y + +[output] +alt 1 +alt 1 + +[errors] +line 1:0 reportAttemptingFullContext d=0 (a), input='x' +line 1:0 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='x' +line 1:3 reportAttemptingFullContext d=0 (a), input='y' +line 1:3 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='y' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/TwoUnpredicatedAltsAndOneOrthogonalAlt.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/TwoUnpredicatedAltsAndOneOrthogonalAlt.txt new file mode 100644 index 0000000000..88f0d73435 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/TwoUnpredicatedAltsAndOneOrthogonalAlt.txt @@ -0,0 +1,35 @@ +[type] +Parser + +[grammar] +grammar T; +s : {} a ';' a ';' a; +a : INT {} + | ID {} // must pick this one for ID since pred is false + | ID {} + | {}? ID {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +34; x; y + +[output] +alt 1 +alt 2 +alt 2 + +[errors] +line 1:4 reportAttemptingFullContext d=0 (a), input='x' +line 1:4 reportAmbiguity d=0 (a): ambigAlts={2, 3}, input='x' +line 1:7 reportAttemptingFullContext d=0 (a), input='y' +line 1:7 reportAmbiguity d=0 (a): ambigAlts={2, 3}, input='y' + +[flags] +showDiagnosticErrors + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/UnpredicatedPathsInAlt.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/UnpredicatedPathsInAlt.txt new file mode 100644 index 0000000000..f788d880c2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/UnpredicatedPathsInAlt.txt @@ -0,0 +1,27 @@ +[type] +Parser + +[grammar] +grammar T; +s : a {} + | b {} + ; +a : {}? ID INT + | ID INT + ; +b : ID ID + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x 4 + +[output] +"""alt 1 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ValidateInDFA.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ValidateInDFA.txt new file mode 100644 index 0000000000..eefaa1fb90 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/SemPredEvalParser/ValidateInDFA.txt @@ -0,0 +1,26 @@ +[type] +Parser + +[grammar] +grammar T; +s : a ';' a; +// ';' helps us to resynchronize without consuming +// 2nd 'a' reference. We our testing that the DFA also +// throws an exception if the validating predicate fails +a : {}? ID {} + | {}? INT {} + ; +ID : 'a'..'z'+ ; +INT : '0'..'9'+; +WS : (' '|'\n') -> skip ; + +[start] +s + +[input] +x ; y + +[errors] +line 1:0 no viable alternative at input 'x' +line 1:4 no viable alternative at input 'y' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/CharSetLiteral.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/CharSetLiteral.txt new file mode 100644 index 0000000000..fc7febd648 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/CharSetLiteral.txt @@ -0,0 +1,21 @@ +[type] +Parser + +[grammar] +grammar T; +a : (A {})+ ; +A : [AaBb] ; +WS : (' '|'\n')+ -> skip ; + +[start] +a + +[input] +A a B b + +[output] +A +a +B +b + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ComplementSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ComplementSet.txt new file mode 100644 index 0000000000..5b3e10c544 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ComplementSet.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +parse : ~NEW_LINE; +NEW_LINE: '\\r'? '\\n'; + +[start] +parse + +[input] +a + +[errors] +line 1:0 token recognition error at: 'a' +line 1:1 missing {} at '' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerOptionalSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerOptionalSet.txt new file mode 100644 index 0000000000..fb2c9f317b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerOptionalSet.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : ('a'|'b')? 'c' ; + +[start] +a + +[input] +ac + +[output] +"""ac +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerPlusSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerPlusSet.txt new file mode 100644 index 0000000000..351b380c39 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerPlusSet.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : ('a'|'b')+ 'c' ; + +[start] +a + +[input] +abaac + +[output] +"""abaac +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerStarSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerStarSet.txt new file mode 100644 index 0000000000..1eccbcb059 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/LexerStarSet.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : ('a'|'b')* 'c' ; + +[start] +a + +[input] +abaac + +[output] +"""abaac +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotChar.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotChar.txt new file mode 100644 index 0000000000..fa23e88d27 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotChar.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : ~'b' ; + +[start] +a + +[input] +x + +[output] +"""x +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSet.txt new file mode 100644 index 0000000000..fc39a5b19c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSet.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : ~('b'|'c') ; + +[start] +a + +[input] +x + +[output] +"""x +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSetWithLabel.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSetWithLabel.txt new file mode 100644 index 0000000000..02f0760f43 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSetWithLabel.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : h=~('b'|'c') ; + +[start] +a + +[input] +x + +[output] +"""x +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSetWithRuleRef3.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSetWithRuleRef3.txt new file mode 100644 index 0000000000..9963097d02 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/NotCharSetWithRuleRef3.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : ('a'|B) ; // this doesn't collapse to set but works +fragment +B : ~('a'|'c') ; + +[start] +a + +[input] +x + +[output] +"""x +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalLexerSingleElement.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalLexerSingleElement.txt new file mode 100644 index 0000000000..c51c17277c --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalLexerSingleElement.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : 'b'? 'c' ; + +[start] +a + +[input] +bc + +[output] +"""bc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalSet.txt new file mode 100644 index 0000000000..f13145e6af --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalSet.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : ('a'|'b')? 'c' {} ; + +[start] +a + +[input] +ac + +[output] +"""ac +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalSingleElement.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalSingleElement.txt new file mode 100644 index 0000000000..1daa7bcaff --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/OptionalSingleElement.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A? 'c' {} ; +A : 'b' ; + +[start] +a + +[input] +bc + +[output] +"""bc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotSet.txt new file mode 100644 index 0000000000..194cbfb3a1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotSet.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : t=~('x'|'y') 'z' {} ; + +[start] +a + +[input] +zz + +[output] +"""z +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotToken.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotToken.txt new file mode 100644 index 0000000000..55e41be4aa --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotToken.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : ~'x' 'z' {} ; + +[start] +a + +[input] +zz + +[output] +"""zz +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotTokenWithLabel.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotTokenWithLabel.txt new file mode 100644 index 0000000000..d1f7292736 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserNotTokenWithLabel.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : t=~'x' 'z' {} ; + +[start] +a + +[input] +zz + +[output] +"""z +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserSet.txt new file mode 100644 index 0000000000..14d4e75030 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/ParserSet.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : t=('x'|'y') {} ; + +[start] +a + +[input] +x + +[output] +"""x +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/PlusLexerSingleElement.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/PlusLexerSingleElement.txt new file mode 100644 index 0000000000..3227f5b5c6 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/PlusLexerSingleElement.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : 'b'+ 'c' ; + +[start] +a + +[input] +bbbbc + +[output] +"""bbbbc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/PlusSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/PlusSet.txt new file mode 100644 index 0000000000..7a082936e8 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/PlusSet.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : ('a'|'b')+ 'c' {} ; + +[start] +a + +[input] +abaac + +[output] +"""abaac +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/RuleAsSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/RuleAsSet.txt new file mode 100644 index 0000000000..fdfd6d36c1 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/RuleAsSet.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a @after {} : 'a' | 'b' |'c' ; + +[start] +a + +[input] +b + +[output] +"""b +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/SeqDoesNotBecomeSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/SeqDoesNotBecomeSet.txt new file mode 100644 index 0000000000..63dfdbc101 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/SeqDoesNotBecomeSet.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : C {} ; +fragment A : '1' | '2'; +fragment B : '3' '4'; +C : A | B; + +[start] +a + +[input] +34 + +[output] +"""34 +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarLexerSingleElement_1.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarLexerSingleElement_1.txt new file mode 100644 index 0000000000..57a4f847aa --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarLexerSingleElement_1.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : 'b'* 'c' ; + +[start] +a + +[input] +bbbbc + +[output] +"""bbbbc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarLexerSingleElement_2.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarLexerSingleElement_2.txt new file mode 100644 index 0000000000..fa54688c38 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarLexerSingleElement_2.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : A {} ; +A : 'b'* 'c' ; + +[start] +a + +[input] +c + +[output] +"""c +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarSet.txt new file mode 100644 index 0000000000..5656509c05 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/StarSet.txt @@ -0,0 +1,17 @@ +[type] +Parser + +[grammar] +grammar T; +a : ('a'|'b')* 'c' {} ; + +[start] +a + +[input] +abaac + +[output] +"""abaac +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedBMPRangeSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedBMPRangeSet.txt new file mode 100644 index 0000000000..f8a591be09 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedBMPRangeSet.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS* 'd' {} ; +// Note the double-backslash to avoid Java passing +// unescaped values as part of the grammar. +LETTERS : ('a'|'\\u00E0'..'\\u00E5'); + +[start] +a + +[input] +aáäáâåd + +[output] +"""aáäáâåd +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedBMPSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedBMPSet.txt new file mode 100644 index 0000000000..8f057e46dc --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedBMPSet.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS {} ; +// Note the double-backslash to avoid Java passing +// unescaped values as part of the grammar. +LETTERS : ('a'|'\\u00E4'|'\\u4E9C'|'\\u3042')* 'c'; + +[start] +a + +[input] +aäあ亜c + +[output] +"""aäあ亜c +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPRangeSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPRangeSet.txt new file mode 100644 index 0000000000..ab51d94c6f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPRangeSet.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS* 'd' {} ; +// Note the double-backslash to avoid Java passing +// unescaped values as part of the grammar. +LETTERS : ('a'|'\\u{1F600}'..'\\u{1F943}'); + +[start] +a + +[input] +a😉🥂🜀d + +[output] +"""a😉🥂🜀d +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPRangeSetMismatch.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPRangeSetMismatch.txt new file mode 100644 index 0000000000..33e6f0a5a5 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPRangeSetMismatch.txt @@ -0,0 +1,24 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS* 'd' {} ; +// Note the double-backslash to avoid Java passing +// unescaped values as part of the grammar. +LETTERS : ('a'|'\\u{1F600}'..'\\u{1F943}'); + +[start] +a + +[input] +a🗿🥄d + +[output] +"""ad +""" + +[errors] +line 1:1 token recognition error at: '🗿' +line 1:2 token recognition error at: '🥄' + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPSet.txt new file mode 100644 index 0000000000..a00b690c0b --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeEscapedSMPSet.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS {} ; +// Note the double-backslash to avoid Java passing +// unescaped values as part of the grammar. +LETTERS : ('a'|'\\u{1D5BA}'|'\\u{1D5BE}'|'\\u{1D5C2}'|'\\u{1D5C8}'|'\\u{1D5CE}')* 'c'; + +[start] +a + +[input] +a𝗂𝗎𝖺c + +[output] +"""a𝗂𝗎𝖺c +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeNegatedBMPSetIncludesSMPCodePoints.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeNegatedBMPSetIncludesSMPCodePoints.txt new file mode 100644 index 0000000000..5b1f8ba919 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeNegatedBMPSetIncludesSMPCodePoints.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS {} ; +LETTERS : 'a' ~('b')+ 'c'; + +[start] +a + +[input] +a😳😡😝🤓c + +[output] +"""a😳😡😝🤓c +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeNegatedSMPSetIncludesBMPCodePoints.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeNegatedSMPSetIncludesBMPCodePoints.txt new file mode 100644 index 0000000000..fc8990a04f --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeNegatedSMPSetIncludesBMPCodePoints.txt @@ -0,0 +1,18 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS {} ; +LETTERS : 'a' ~('\\u{1F600}'..'\\u{1F943}')+ 'c'; + +[start] +a + +[input] +abc + +[output] +"""abc +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeUnescapedBMPRangeSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeUnescapedBMPRangeSet.txt new file mode 100644 index 0000000000..e8745b35c8 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeUnescapedBMPRangeSet.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS* 'd' {} ; +// These are actually not escaped -- Java passes the +// raw unescaped Unicode values to the grammar compiler. +LETTERS : ('a'|'à'..'å'); + +[start] +a + +[input] +aáäáâåd + +[output] +"""aáäáâåd +""" + diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeUnescapedBMPSet.txt b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeUnescapedBMPSet.txt new file mode 100644 index 0000000000..4d919419f2 --- /dev/null +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/descriptors/Sets/UnicodeUnescapedBMPSet.txt @@ -0,0 +1,20 @@ +[type] +Parser + +[grammar] +grammar T; +a : LETTERS {} ; +// These are actually not escaped -- Java passes the +// raw unescaped Unicode values to the grammar compiler. +LETTERS : ('a'|'ä'|'亜'|'あ')* 'c'; + +[start] +a + +[input] +aäあ亜c + +[output] +"""aäあ亜c +""" + diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeLexerTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeLexerTestDescriptor.java deleted file mode 100644 index c9f603a542..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeLexerTestDescriptor.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -public class BaseCompositeLexerTestDescriptor extends BaseRuntimeTestDescriptor { - @Override - public String getTestType() { - return "CompositeLexer"; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeParserTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeParserTestDescriptor.java deleted file mode 100644 index 2b5f0ac3c6..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseCompositeParserTestDescriptor.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -public class BaseCompositeParserTestDescriptor extends BaseRuntimeTestDescriptor { - @Override - public String getTestType() { - return "CompositeParser"; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseDiagnosticParserTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseDiagnosticParserTestDescriptor.java deleted file mode 100644 index 95bcaf7956..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseDiagnosticParserTestDescriptor.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -public abstract class BaseDiagnosticParserTestDescriptor extends BaseParserTestDescriptor { - @Override - public boolean showDiagnosticErrors() { - return true; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseLexerTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseLexerTestDescriptor.java deleted file mode 100644 index cf215a5d8e..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseLexerTestDescriptor.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -public class BaseLexerTestDescriptor extends BaseRuntimeTestDescriptor { - @Override - public String getTestType() { - return "Lexer"; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseParserTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseParserTestDescriptor.java deleted file mode 100644 index cb7f7d297b..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseParserTestDescriptor.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -public class BaseParserTestDescriptor extends BaseRuntimeTestDescriptor { - @Override - public String getTestType() { - return "Parser"; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseRuntimeTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseRuntimeTest.java index 2c060ba42c..d3c0ad5764 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseRuntimeTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseRuntimeTest.java @@ -22,13 +22,13 @@ import java.io.File; import java.io.IOException; -import java.lang.reflect.Modifier; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.*; -import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.fail; import static junit.framework.TestCase.failNotEquals; import static org.junit.Assume.assumeFalse; @@ -64,7 +64,7 @@ public static void startHeartbeatToAvoidTimeout() { private static boolean requiresHeartbeat() { return isTravisCI() || isAppVeyorCI() - || (isCPP() && isRecursion()) + || (isCPP() && isRecursion()) || (isCircleCI() && isGo()) || (isCircleCI() && isDotNet() && isRecursion()); } @@ -155,8 +155,9 @@ public void setUp() throws Exception { public boolean checkIgnored() { boolean ignored = !TestContext.isSupportedTarget(descriptor.getTarget()) || descriptor.ignore(descriptor.getTarget()); - if(ignored) + if (ignored) { System.out.println("Ignore " + descriptor); + } return ignored; } @@ -187,7 +188,7 @@ public void testOne() throws Exception { delegate.afterTest(descriptor); } - public void testParser(RuntimeTestDescriptor descriptor) throws Exception { + public void testParser(RuntimeTestDescriptor descriptor) { RuntimeTestUtils.mkdir(delegate.getTempParserDirPath()); Pair pair = descriptor.getGrammar(); @@ -335,28 +336,200 @@ public static ErrorQueue antlrOnString(String workdir, // ---- support ---- - public static RuntimeTestDescriptor[] getRuntimeTestDescriptors(Class clazz, String targetName) { - if(!TestContext.isSupportedTarget(targetName)) - return new RuntimeTestDescriptor[0]; - Class[] nestedClasses = clazz.getClasses(); - List descriptors = new ArrayList(); - for (Class nestedClass : nestedClasses) { - int modifiers = nestedClass.getModifiers(); - if ( RuntimeTestDescriptor.class.isAssignableFrom(nestedClass) && !Modifier.isAbstract(modifiers) ) { + public static RuntimeTestDescriptor[] getRuntimeTestDescriptors(String group, String targetName) { + final ClassLoader loader = Thread.currentThread().getContextClassLoader(); + final URL descrURL = loader.getResource("org/antlr/v4/test/runtime/descriptors/" +group); + String[] descriptorFilenames = null; + try { + descriptorFilenames = new File(descrURL.toURI()).list(); + } + catch (URISyntaxException e) { + System.err.println("Bad URL:"+descrURL); + } + +// String[] descriptorFilenames = new File("/tmp/descriptors/"+group).list(); + List descriptors = new ArrayList<>(); + for (String fname : descriptorFilenames) { + try { +// String dtext = Files.readString(Path.of("/tmp/descriptors",group,fname)); + final URL dURL = loader.getResource("org/antlr/v4/test/runtime/descriptors/" +group+"/"+fname); + String dtext = null; try { - RuntimeTestDescriptor d = (RuntimeTestDescriptor) nestedClass.newInstance(); - if(!d.ignore(targetName)) { - d.setTarget(targetName); - descriptors.add(d); - } - } catch (Exception e) { - e.printStackTrace(System.err); + URI uri = dURL.toURI(); + dtext = new String(Files.readAllBytes(Paths.get(uri))); } + catch (URISyntaxException e) { + System.err.println("Bad URL:"+dURL); + } + UniversalRuntimeTestDescriptor d = readDescriptor(dtext); + if ( !d.ignore(targetName) ) { + d.name = fname.replace(".txt", ""); + d.targetName = targetName; + descriptors.add(d); + } + } + catch (IOException ioe) { + System.err.println("Can't read descriptor file "+fname); } } return descriptors.toArray(new RuntimeTestDescriptor[0]); } + /** Read stuff like: + [grammar] + grammar T; + s @after {} + : ID | ID {} ; + ID : 'a'..'z'+; + WS : (' '|'\t'|'\n')+ -> skip ; + + [grammarName] + T + + [start] + s + + [input] + abc + + [output] + Decision 0: + s0-ID->:s1^=>1 + + [errors] + """line 1:0 reportAttemptingFullContext d=0 (s), input='abc' + """ + + Some can be missing like [errors]. + + Get gr names automatically "lexer grammar Unicode;" "grammar T;" "parser grammar S;" + + Also handle slave grammars: + + [grammar] + grammar M; + import S,T; + s : a ; + B : 'b' ; // defines B from inherited token space + WS : (' '|'\n') -> skip ; + + [slaveGrammar] + parser grammar T; + a : B {}; + + [slaveGrammar] + parser grammar S; + a : b {}; + b : B; + */ + public static UniversalRuntimeTestDescriptor readDescriptor(String dtext) + throws RuntimeException + { + String[] fileSections = { + "notes","type","grammar","slaveGrammar","start","input","output","errors", + "flags","skip"}; + Set sections = new HashSet<>(Arrays.asList(fileSections)); + String currentField = null; + String currentValue = null; + + List> pairs = new ArrayList<>(); + String[] lines = dtext.split("\n"); + for (String line : lines) { + if ( line.startsWith("[") && line.length()>2 && + sections.contains(line.substring(1, line.length() - 1)) ) { + if ( currentField!=null ) { + pairs.add(new Pair<>(currentField,currentValue)); + } + currentField = line.substring(1, line.length() - 1); + currentValue = null; + } + else { + if ( currentValue==null ) { + currentValue = ""; + } + currentValue += line + "\n"; + } + } + // save last section + pairs.add(new Pair<>(currentField,currentValue)); + +// System.out.println(pairs); + + UniversalRuntimeTestDescriptor d = new UniversalRuntimeTestDescriptor(); + for (Pair p : pairs) { + String section = p.a; + String value = ""; + if ( p.b!=null ) { + value = p.b.trim(); + } + if ( value.startsWith("\"\"\"") ) { + value = value.replace("\"\"\"", ""); + } + else if ( value.indexOf('\n')>=0 ) { + value = value + "\n"; // if multi line and not quoted, leave \n on end. + } + switch (section) { + case "notes": + d.notes = value; + break; + case "type": + d.testType = value; + break; + case "grammar": + d.grammarName = getGrammarName(value.split("\n")[0]); + d.grammar = value; + break; + case "slaveGrammar": + String gname = getGrammarName(value.split("\n")[0]); + d.slaveGrammars.add(new Pair<>(gname, value)); + case "start": + d.startRule = value; + break; + case "input": + d.input = value; + break; + case "output": + d.output = value; + break; + case "errors": + d.errors = value; + break; + case "flags": + String[] flags = value.split("\n"); + for (String f : flags) { + switch (f) { + case "showDFA": + d.showDFA = true; + break; + case "showDiagnosticErrors": + d.showDiagnosticErrors = true; + break; + } + } + break; + case "skip": + d.skipTargets = Arrays.asList(value.split("\n")); + break; + default: + throw new RuntimeException("Unknown descriptor section ignored: "+section); + } + } + return d; + } + + /** Get A, B, or C from: + * "lexer grammar A;" "grammar B;" "parser grammar C;" + */ + public static String getGrammarName(String grammarDeclLine) { + int gi = grammarDeclLine.indexOf("grammar "); + if ( gi<0 ) { + return ""; + } + gi += "grammar ".length(); + int gsemi = grammarDeclLine.indexOf(';'); + return grammarDeclLine.substring(gi, gsemi); + } + public static void writeFile(String dir, String fileName, String content) { try { Utils.writeFile(dir+"/"+fileName, content, "UTF-8"); @@ -438,4 +611,174 @@ protected static void assertCorrectOutput(RuntimeTestDescriptor descriptor, Runt ">."); } } + + // ---------------------------------------------------------------------------- + // stuff used during conversion that I don't want to throw away yet and we might lose if + // I squash this branch unless I keep it around in a comment or something + // ---------------------------------------------------------------------------- + +// public static RuntimeTestDescriptor[] OLD_getRuntimeTestDescriptors(Class clazz, String targetName) { +// if(!TestContext.isSupportedTarget(targetName)) +// return new RuntimeTestDescriptor[0]; +// Class[] nestedClasses = clazz.getClasses(); +// List descriptors = new ArrayList(); +// for (Class nestedClass : nestedClasses) { +// int modifiers = nestedClass.getModifiers(); +// if ( RuntimeTestDescriptor.class.isAssignableFrom(nestedClass) && !Modifier.isAbstract(modifiers) ) { +// try { +// RuntimeTestDescriptor d = (RuntimeTestDescriptor) nestedClass.newInstance(); +// if(!d.ignore(targetName)) { +// d.setTarget(targetName); +// descriptors.add(d); +// } +// } catch (Exception e) { +// e.printStackTrace(System.err); +// } +// } +// } +// writeDescriptors(clazz, descriptors); +// return descriptors.toArray(new RuntimeTestDescriptor[0]); +// } + + + /** Write descriptor files. */ +// private static void writeDescriptors(Class clazz, List descriptors) { +// String descrRootDir = "/Users/parrt/antlr/code/antlr4/runtime-testsuite/resources/org/antlr/v4/test/runtime/new_descriptors"; +// new File(descrRootDir).mkdir(); +// String groupName = clazz.getSimpleName(); +// groupName = groupName.replace("Descriptors", ""); +// String groupDir = descrRootDir + "/" + groupName; +// new File(groupDir).mkdir(); +// +// for (RuntimeTestDescriptor d : descriptors) { +// try { +// Pair g = d.getGrammar(); +// String gname = g.a; +// String grammar = g.b; +// String filename = d.getTestName()+".txt"; +// String content = ""; +// String input = quoteForDescriptorFile(d.getInput()); +// String output = quoteForDescriptorFile(d.getOutput()); +// String errors = quoteForDescriptorFile(d.getErrors()); +// content += "[type]\n"; +// content += d.getTestType(); +// content += "\n\n"; +// content += "[grammar]\n"; +// content += grammar; +// if ( !content.endsWith("\n\n") ) content += "\n"; +// if ( d.getSlaveGrammars()!=null ) { +// for (Pair slaveG : d.getSlaveGrammars()) { +// String sg = quoteForDescriptorFile(slaveG.b); +// content += "[slaveGrammar]\n"; +// content += sg; +// content += "\n"; +// } +// } +// if ( d.getStartRule()!=null && d.getStartRule().length()>0 ) { +// content += "[start]\n"; +// content += d.getStartRule(); +// content += "\n\n"; +// } +// if ( input!=null ) { +// content += "[input]\n"; +// content += input; +// content += "\n"; +// } +// if ( output!=null ) { +// content += "[output]\n"; +// content += output; +// content += "\n"; +// } +// if ( errors!=null ) { +// content += "[errors]\n"; +// content += errors; +// content += "\n"; +// } +// if ( d.showDFA() || d.showDiagnosticErrors() ) { +// content += "[flags]\n"; +// if (d.showDFA()) { +// content += "showDFA\n"; +// } +// if (d.showDiagnosticErrors()) { +// content += "showDiagnosticErrors\n"; +// } +// content += '\n'; +// } +// List skip = new ArrayList<>(); +// for (String target : Targets) { +// if ( d.ignore(target) ) { +// skip.add(target); +// } +// } +// if ( skip.size()>0 ) { +// content += "[skip]\n"; +// for (String sk : skip) { +// content += sk+"\n"; +// } +// content += '\n'; +// } +// Files.write(Paths.get(groupDir + "/" + filename), content.getBytes()); +// } +// catch (IOException e) { +// //exception handling left as an exercise for the reader +// System.err.println(e.getMessage()); +// } +// } +// } +// +// /** Rules for strings look like this: +// * +// * [input] if one line, remove all WS before/after +// * a b +// * +// * [input] need whitespace +// * """34 +// * 34""" +// * +// * [input] single quote char, remove all WS before/after +// * " +// * +// * [input] same as "b = 6\n" in java +// * """b = 6 +// * """ +// * +// * [input] +// * """a """ space and no newline inside +// * +// * [input] same as java string "\"aaa" +// * "aaa +// * +// * [input] ignore front/back \n except leave last \n +// * a +// * b +// * c +// * d +// */ +// private static String quoteForDescriptorFile(String s) { +// if ( s==null ) { +// return null; +// } +// long nnl = s.chars().filter(ch -> ch == '\n').count(); +// +// if ( s.endsWith(" ") || // whitespace matters +// (nnl==1&&s.endsWith("\n")) || // "b = 6\n" +// s.startsWith("\n") ) { // whitespace matters +// return "\"\"\"" + s + "\"\"\"\n"; +// } +// if ( s.endsWith(" \n") || s.endsWith("\n\n") ) { +// return "\"\"\"" + s + "\"\"\"\n"; +// } +// if ( nnl==0 ) { // one line input +// return s + "\n"; +// } +// if ( nnl>1 && s.endsWith("\n") ) { +// return s; +// } +// if ( !s.endsWith("\n") ) { // "a\n b" +// return "\"\"\"" + s + "\"\"\"\n"; +// } +// +// return s; +// } + } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseRuntimeTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseRuntimeTestDescriptor.java deleted file mode 100644 index 0447c78b47..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/BaseRuntimeTestDescriptor.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime; - -import org.antlr.v4.runtime.misc.Pair; -import org.antlr.v4.runtime.misc.Utils; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** An abstract but mostly complete test descriptor that pulls values - * for the various runtime test descriptor methods such as {@link #getInput()} - * from fields using reflection. - * - * @since 4.6 - */ -public abstract class BaseRuntimeTestDescriptor implements RuntimeTestDescriptor { - protected String targetName; - - @Override - public String getTestName() { - return this.getClass().getSimpleName(); - } - - @Override - public String getInput() { - try { - Field f = this.getClass().getField("input"); - return stringIndentation((String)f.get(this)); - } - catch (Exception nsfe) { - ; // we are optional - } - return ""; - } - - @Override - public String getOutput() { - try { - Field f = this.getClass().getField("output"); - String s = stringIndentation((String)f.get(this)); - if ( s.length()==0 ) return null; - return s; - } - catch (Exception nsfe) { - ; // we are optional - } - return null; - } - - @Override - public String getErrors() { - try { - Field f = this.getClass().getField("errors"); - String s = stringIndentation((String)f.get(this)); - if ( s.length()==0 ) return null; - return s; - } - catch (Exception nsfe) { - ; // we are optional - } - return null; - } - - @Override - public String getANTLRToolErrors() { - try { - Field f = this.getClass().getField("toolErrors"); - String s = stringIndentation((String)f.get(this)); - if ( s.length()==0 ) return null; - return s; - } - catch (Exception nsfe) { - ; // we are optional - } - return null; - } - - @Override - public String getStartRule() { - try { - Field f = this.getClass().getField("startRule"); - return (String)f.get(this); - } - catch (Exception nsfe) { - System.err.println("No start rule specified for test "+getTestName()); - } - return null; - } - - @Override - public Pair getGrammar() { - String grammarName = null; - try { - Field f = this.getClass().getField("grammarName"); - grammarName = (String)f.get(this); - } - catch (Exception nsfe) { - System.err.println("No grammar name specified for test "+getTestName()); - } - String grammar = rawGetGrammar(); - return new Pair(grammarName,grammar); - } - - private String rawGetGrammar() { - String grammar = null; - try { - Field f = this.getClass().getField("grammar"); - grammar = (String)f.get(this); - } - catch (Exception nsfe) { - System.err.println("No start rule specified for test "+getTestName()); - } - grammar = stringIndentation(grammar); - return grammar; - } - - /** strip indentation; use first line's indent as prefix to strip */ - public static String stringIndentation(String s) { - if ( s==null ) return ""; - if ( s.equals("\n") ) return s; - s = Utils.expandTabs(s, 4); - String lines[] = s.split("\\r?\\n"); - String first = lines[0]; - Pattern wspat = Pattern.compile("^\\s+"); - Matcher matcher = wspat.matcher(first); - if ( matcher.find() ) { - String indent = matcher.group(0); - s = s.replace(indent, ""); // wack first indent - s = s.replaceAll("\\n"+indent, "\n"); // wack the others - } - return s; - } - - @Override - public List> getSlaveGrammars() { - return null; - } - - @Override - public String getTarget() { - return targetName; - } - - @Override - public void setTarget(String targetName) { - this.targetName = targetName; - } - - @Override - public boolean showDFA() { - return false; - } - - @Override - public boolean showDiagnosticErrors() { - return false; - } - - @Override - public boolean ignore(String targetName) { - return false; - } - - @Override - public String toString() { - return getTarget()+":"+getTestName(); - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/RuntimeTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/RuntimeTestDescriptor.java index faaaaba932..be4cf26e9f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/RuntimeTestDescriptor.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/RuntimeTestDescriptor.java @@ -12,16 +12,13 @@ /** This interface describes everything that a runtime test * descriptor can specify. Most testing descriptors will - * subclass {@link BaseRuntimeTestDescriptor} rather than + * subclass {@link UniversalRuntimeTestDescriptor} rather than * implement this directly. The {@link BaseRuntimeTest} * class pulls data from descriptors to execute tests. * * @since 4.6 */ public interface RuntimeTestDescriptor { - /** The name of this test such as TokenAndRuleContextString (see - * {@link org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors.TokenAndRuleContextString}) - */ String getTestName(); /** A type in {"Lexer", "Parser", "CompositeLexer", "CompositeParser"} */ @@ -40,7 +37,7 @@ public interface RuntimeTestDescriptor { String getANTLRToolErrors(); /** The rule at which parsing should start */ - String getStartRule(); // TODO: alter tests to use same default start rule? + String getStartRule(); /** For lexical tests, dump the DFA of the default lexer mode to stdout */ boolean showDFA(); diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/UniversalRuntimeTestDescriptor.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/UniversalRuntimeTestDescriptor.java new file mode 100644 index 0000000000..617a0230bc --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/UniversalRuntimeTestDescriptor.java @@ -0,0 +1,104 @@ +package org.antlr.v4.test.runtime; + +import org.antlr.v4.runtime.misc.Pair; + +import java.util.ArrayList; +import java.util.List; + +/** This object represents all the information we need about a single test and is the + * in-memory representation of a descriptor file + */ +public class UniversalRuntimeTestDescriptor implements RuntimeTestDescriptor { + public String testType; + public String targetName; + public String name; + public String notes; + public String input = ""; + public String output; + public String errors; + public String startRule; + public String grammarName; + public String grammar; + public List> slaveGrammars = new ArrayList<>(); + public boolean showDFA = false; + public boolean showDiagnosticErrors = false; + + public List skipTargets = new ArrayList<>(); + + @Override + public String getTestName() { + return name; + } + + @Override + public String getTestType() { + return testType; + } + + @Override + public String getInput() { + return input; + } + + @Override + public String getOutput() { + return output; + } + + @Override + public String getErrors() { + return errors; + } + + @Override + public String getANTLRToolErrors() { + return null; + } + + @Override + public String getStartRule() { + return startRule; + } + + @Override + public List> getSlaveGrammars() { + if ( slaveGrammars.size()==0 ) return null; + return slaveGrammars; + } + + @Override + public String getTarget() { + return targetName; + } + + @Override + public void setTarget(String targetName) { + this.targetName = targetName; + } + + @Override + public boolean showDFA() { + return showDFA; + } + + @Override + public boolean showDiagnosticErrors() { + return showDiagnosticErrors; + } + + @Override + public Pair getGrammar() { + return new Pair<>(grammarName,grammar); + } + + @Override + public boolean ignore(String targetName) { + return skipTargets.contains(targetName); + } + + + @Override + public String toString() { + return getTarget()+":"+getTestName(); + } +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTests.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTestsGroup1.java similarity index 74% rename from runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTests.java rename to runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTestsGroup1.java index 7ad7cd9578..c996c6c010 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTests.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTestsGroup1.java @@ -3,5 +3,5 @@ /** * Created by ericvergnaud on 27/06/2017. */ -public class ParserTests { +public class ParserTestsGroup1 { } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTestsGroup2.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTestsGroup2.java new file mode 100644 index 0000000000..da41d46700 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/category/ParserTestsGroup2.java @@ -0,0 +1,4 @@ +package org.antlr.v4.test.runtime.category; + +public class ParserTestsGroup2 { +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java index dd7d7f5519..4b4abf231f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java @@ -21,10 +21,6 @@ import static org.antlr.v4.test.runtime.BaseRuntimeTest.antlrOnString; import static org.antlr.v4.test.runtime.BaseRuntimeTest.writeFile; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class BaseCppTest extends BaseRuntimeTestSupport implements RuntimeTestSupport { @@ -168,8 +164,8 @@ public List allCppFiles(String path) { ArrayList files = new ArrayList(); File folder = new File(path); File[] listOfFiles = folder.listFiles(); - for (int i = 0; i < listOfFiles.length; i++) { - String file = listOfFiles[i].getAbsolutePath(); + for (File listOfFile : listOfFiles) { + String file = listOfFile.getAbsolutePath(); if (file.endsWith(".cpp")) { files.add(file); } @@ -205,7 +201,7 @@ private String runProcess(ProcessBuilder builder, String description, boolean sh return output; } - private String runCommand(String command[], String workPath, String description, boolean showStderr) throws Exception { + private String runCommand(String[] command, String workPath, String description, boolean showStderr) throws Exception { ProcessBuilder builder = new ProcessBuilder(command); builder.directory(new File(workPath)); @@ -218,7 +214,7 @@ private boolean buildRuntime() { System.out.println("Building ANTLR4 C++ runtime (if necessary) at "+ runtimePath); try { - String command[] = { "cmake", ".", /*"-DCMAKE_CXX_COMPILER=clang++",*/ "-DCMAKE_BUILD_TYPE=release" }; + String[] command = { "cmake", ".", /*"-DCMAKE_CXX_COMPILER=clang++",*/ "-DCMAKE_BUILD_TYPE=release" }; if (runCommand(command, runtimePath, "antlr runtime cmake", false) == null) { return false; } @@ -228,7 +224,7 @@ private boolean buildRuntime() { } try { - String command[] = { "make", "-j", "8" }; // Assuming a reasonable amount of available CPU cores. + String[] command = { "make", "-j", "8" }; // Assuming a reasonable amount of available CPU cores. if (runCommand(command, runtimePath, "building antlr runtime", true) == null) return false; } @@ -236,7 +232,7 @@ private boolean buildRuntime() { System.err.println("can't compile antlr cpp runtime"); e.printStackTrace(System.err); try { - String command[] = { "ls", "-la" }; + String[] command = { "ls", "-la" }; String output = runCommand(command, runtimePath + "/dist/", "printing library folder content", true); System.out.println(output); } @@ -272,7 +268,7 @@ public String execModule(String fileName) { synchronized (runtimeBuiltOnce) { if ( !runtimeBuiltOnce ) { try { - String command[] = {"clang++", "--version"}; + String[] command = {"clang++", "--version"}; String output = runCommand(command, getTempDirPath(), "printing compiler version", false); System.out.println("Compiler version is: "+output); } @@ -292,7 +288,7 @@ public String execModule(String fileName) { // Create symlink to the runtime. Currently only used on OSX. String libExtension = (getOS().equals("mac")) ? "dylib" : "so"; try { - String command[] = { "ln", "-s", runtimePath + "/dist/libantlr4-runtime." + libExtension }; + String[] command = { "ln", "-s", runtimePath + "/dist/libantlr4-runtime." + libExtension }; if (runCommand(command, getTempDirPath(), "sym linking C++ runtime", true) == null) return null; } @@ -356,7 +352,7 @@ protected String locateRuntime() { p = Paths.get(runtimeURL.toURI()).toFile().toString(); } catch (URISyntaxException use) { - p = "Can't find runtime at " + runtimeURL.toString(); + p = "Can't find runtime at " + runtimeURL; } return p; } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeLexers.java index 182d2536ce..acd2269839 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeLexers.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeParsers.java index 98dfbc79a5..f68186c685 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestCompositeParsers.java @@ -6,16 +6,14 @@ package org.antlr.v4.test.runtime.cpp; -import org.antlr.v4.codegen.model.Parser; import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestCompositeParsers extends BaseRuntimeTest { public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @@ -24,6 +22,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestFullContextParsing.java index 96d1d5b637..359dd1f65e 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestFullContextParsing.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestFullContextParsing extends BaseRuntimeTest { public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLeftRecursion.java index 962be4bbec..29c1026dba 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLeftRecursion.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LeftRecursionTests; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerErrors.java index 05307d6f7c..d501bd0a6f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerErrors.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerExec.java index 9c5cc89a96..fcb8cefb0c 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestLexerExec.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestListeners.java index 75a6d1000c..08a020efa2 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestListeners.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestListeners extends BaseRuntimeTest { public TestListeners(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParseTrees.java index ca333afc5c..9dbc91582f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParseTrees.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestParseTrees extends BaseRuntimeTest { public TestParseTrees(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserErrors.java index aa8fc80fd4..4fd2193b26 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserErrors.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestParserErrors extends BaseRuntimeTest { public TestParserErrors(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserExec.java index 999f3116fa..c8072e2556 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestParserExec.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestParserExec extends BaseRuntimeTest { public TestParserExec(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestPerformance.java index 7ab384ce56..fcbd899b46 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestPerformance.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestPerformance extends BaseRuntimeTest { public TestPerformance(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalLexer.java index 23f90bd83a..91168969fb 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalLexer.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalParser.java index 3b3eb5ca1a..fe748e0586 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSemPredEvalParser.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestSemPredEvalParser extends BaseRuntimeTest { public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSets.java index a1345ae177..65d5b0f872 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/TestSets.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Cpp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Cpp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java index 918ed0e405..d1f741872d 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java @@ -282,7 +282,7 @@ private boolean runProcess(String[] args, String path, int retries) throws Excep setParseErrors(stderrVacuum.toString()); System.err.println("runProcess command: " + Utils.join(args, " ")); System.err.println("runProcess exitValue: " + exitValue); - System.err.println("runProcess stdoutVacuum: " + stdoutVacuum.toString()); + System.err.println("runProcess stdoutVacuum: " + stdoutVacuum); System.err.println("runProcess stderrVacuum: " + getParseErrors()); } if (exitValue == 132) { diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeLexers.java index 69ca0ca0f5..c048c5e580 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeLexers.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeParsers.java index 930d408d5d..682a5a2737 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestCompositeParsers.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestCompositeParsers extends BaseRuntimeTest { public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestFullContextParsing.java index 543674a978..6e0cabf0cd 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestFullContextParsing.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestFullContextParsing extends BaseRuntimeTest { public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLeftRecursion.java index b5e9994bc5..be2d81ec5d 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLeftRecursion.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LeftRecursionTests; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerErrors.java index a49ec51e9c..5c45ef228c 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerErrors.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerExec.java index 7ba1801190..926270a241 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestLexerExec.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestListeners.java index e8d5999981..256ed42ac3 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestListeners.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestListeners extends BaseRuntimeTest { public TestListeners(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParseTrees.java index 22110fa23a..04d97a39fd 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParseTrees.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestParseTrees extends BaseRuntimeTest { public TestParseTrees(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserErrors.java index b7a2463f05..095695306a 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserErrors.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestParserErrors extends BaseRuntimeTest { public TestParserErrors(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserExec.java index 2561dbf107..86d06521fe 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestParserExec.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestParserExec extends BaseRuntimeTest { public TestParserExec(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestPerformance.java index 108ea1878d..837439c264 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestPerformance.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestPerformance extends BaseRuntimeTest { public TestPerformance(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalLexer.java index f2fa2d2a33..b62f99e0af 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalLexer.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalParser.java index 5ecab67c89..f103c5e2ca 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSemPredEvalParser.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestSemPredEvalParser extends BaseRuntimeTest { public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @@ -23,6 +22,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSets.java index 1b970e30b4..7da753f216 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestSets.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,6 +22,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "CSharp"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "CSharp"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/BaseDartTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/BaseDartTest.java index dd54c2027b..61fd1c5c23 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/BaseDartTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/BaseDartTest.java @@ -8,8 +8,6 @@ import org.antlr.v4.misc.Utils; import org.antlr.v4.test.runtime.*; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; import org.stringtemplate.v4.ST; import java.io.*; @@ -23,11 +21,6 @@ public class BaseDartTest extends BaseRuntimeTestSupport implements RuntimeTestSupport { - private static final List AOT_COMPILE_TESTS = Arrays.asList( - new PerformanceDescriptors.DropLoopEntryBranchInLRRule_4().input, - new LexerExecDescriptors.LargeLexer().input - ); - private static String cacheDartPackages; private static String cacheDartPackageConfig; @@ -48,7 +41,7 @@ public String execLexer(String grammarFileName, assertTrue(success); writeFile(getTempDirPath(), "input", input); writeLexerTestFile(lexerName, showDFA); - String output = execClass("Test", AOT_COMPILE_TESTS.contains(input)); + String output = execClass("Test", false); return output; } @@ -88,7 +81,7 @@ public String execParser(String grammarFileName, startRuleName, showDiagnosticErrors, profile, - AOT_COMPILE_TESTS.contains(input)); + true); } /** @@ -167,7 +160,7 @@ public void run() { stderrVacuum.join(); String stderrDuringPubGet = stderrVacuum.toString(); if (!stderrDuringPubGet.isEmpty()) { - System.out.println("Pub Get error: " + stderrVacuum.toString()); + System.out.println("Pub Get error: " + stderrVacuum); } } catch (IOException | InterruptedException e) { e.printStackTrace(); @@ -193,7 +186,8 @@ protected String rawExecRecognizer(String parserName, setParseErrors(null); if (parserName == null) { writeLexerTestFile(lexerName, false); - } else { + } + else { writeTestFile(parserName, lexerName, parserStartRuleName, @@ -232,7 +226,7 @@ public void run() { timer.cancel(); if (result != 0) { stderrVacuum.join(); - System.err.print("Error compiling dart file: " + stderrVacuum.toString()); + System.err.print("Error compiling dart file: " + stderrVacuum); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeLexers.java index 60aa4a35ae..175dc1b17f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeLexers.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeParsers.java index 638413f9a5..72c3d87293 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestCompositeParsers.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestFullContextParsing.java index a0d7f9c1a6..0a70bf3055 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestFullContextParsing.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLeftRecursion.java index e92f1b306a..ca9d492710 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLeftRecursion.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerErrors.java index b95cd59bf1..d101be42c5 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerErrors.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerExec.java index 1ed1d84caa..7b163044b9 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestLexerExec.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestListeners.java index e15dee9ae7..6a18c49277 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestListeners.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParseTrees.java index 0115e384d5..9dbb59f53e 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParseTrees.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserErrors.java index 87b850fb90..246a952139 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserErrors.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserExec.java index c22aa8cebb..5de5e00f02 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestParserExec.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestPerformance.java index 78e6942ac6..f45b1bdda1 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestPerformance.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalLexer.java index 8825042cf6..789ef6b972 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalLexer.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalParser.java index 87d6a9deab..6a3ad3f080 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSemPredEvalParser.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSets.java index 4fe603fd4f..dabdac91ff 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/dart/TestSets.java @@ -8,8 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; -import org.antlr.v4.test.runtime.dart.BaseDartTest; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -21,6 +19,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Dart"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Dart"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeLexersDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeLexersDescriptors.java deleted file mode 100644 index 878b9e1f2b..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeLexersDescriptors.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.runtime.misc.Pair; -import org.antlr.v4.test.runtime.BaseCompositeLexerTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -import java.util.ArrayList; -import java.util.List; - -public class CompositeLexersDescriptors { - public static class LexerDelegatorInvokesDelegateRule extends BaseCompositeLexerTestDescriptor { - public String input = "abc"; - /** - S.A - [@0,0:0='a',<3>,1:0] - [@1,1:1='b',<1>,1:1] - [@2,2:2='c',<4>,1:2] - [@3,3:2='',<-1>,1:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "M"; - - /** - lexer grammar M; - import S; - B : 'b'; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - lexer grammar S; - A : 'a' {}; - C : 'c' ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",slaveGrammarS)); - - return slaves; - } - } - - public static class LexerDelegatorRuleOverridesDelegate extends BaseCompositeLexerTestDescriptor { - public String input = "ab"; - /** - M.A - [@0,0:1='ab',<1>,1:0] - [@1,2:1='',<-1>,1:2] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "M"; - - /** - lexer grammar M; - import S; - A : 'a' B {} ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - lexer grammar S; - A : 'a' {} ; - B : 'b' {} ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",slaveGrammarS)); - - return slaves; - } - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeParsersDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeParsersDescriptors.java deleted file mode 100644 index 6134b265b9..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/CompositeParsersDescriptors.java +++ /dev/null @@ -1,587 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.runtime.misc.Pair; -import org.antlr.v4.test.runtime.BaseCompositeParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -import java.util.ArrayList; -import java.util.List; - -public class CompositeParsersDescriptors { - public static class BringInLiteralsFromDelegate extends BaseCompositeParserTestDescriptor { - public String input = "=a"; - public String output = "S.a\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S; - s : a ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - a : '=' 'a' {}; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class CombinedImportsCombined extends BaseCompositeParserTestDescriptor { - public String input = "x 34 9"; - public String output = "S.x\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S; - s : x INT; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - tokens { A, B, C } - x : 'x' INT {}; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatesSeeSameTokenType extends BaseCompositeParserTestDescriptor { - public String input = "aa"; - /** - S.x - T.y - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - // The lexer will create rules to match letters a, b, c. - // The associated token types A, B, C must have the same value - // and all import'd parsers. Since ANTLR regenerates all imports - // for use with the delegator M, it can generate the same token type - // mapping in each parser: - // public static final int C=6; - // public static final int EOF=-1; - // public static final int B=5; - // public static final int WS=7; - // public static final int A=4; - grammar M; - import S,T; - s : x y ; // matches AA, which should be 'aa' - B : 'b' ; // another order: B, A, C - A : 'a' ; - C : 'c' ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar T; - tokens { C, B, A } // reverse order - y : A {}; - */ - @CommentHasStringValue - public String slaveGrammarT; - /** - parser grammar S; - tokens { A, B, C } - x : A {}; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("T",stringIndentation(slaveGrammarT))); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorAccessesDelegateMembers extends BaseCompositeParserTestDescriptor { - public String input = "b"; - public String output = "foo\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; // uses no rules from the import - import S; - s : 'b' {} ; // gS is import pointer - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - @parser::members { - - } - a : B; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorInvokesDelegateRule extends BaseCompositeParserTestDescriptor { - public String input = "b"; - public String output = "S.a\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S; - s : a ; - B : 'b' ; // defines B from inherited token space - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - a : B {}; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorInvokesDelegateRuleWithArgs extends BaseCompositeParserTestDescriptor { - public String input = "b"; - public String output = "S.a1000\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S; - s : label=a[3] {} ; - B : 'b' ; // defines B from inherited token space - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - a[int x] returns [int y] : B {} {$y=1000;} ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorInvokesDelegateRuleWithReturnStruct extends BaseCompositeParserTestDescriptor { - public String input = "b"; - public String output = "S.ab\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S; - s : a {} ; - B : 'b' ; // defines B from inherited token space - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - a : B {} ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorInvokesFirstVersionOfDelegateRule extends BaseCompositeParserTestDescriptor { - public String input = "b"; - public String output = "S.a\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S,T; - s : a ; - B : 'b' ; // defines B from inherited token space - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar T; - a : B {}; - */ - @CommentHasStringValue - public String slaveGrammarT; - /** - parser grammar S; - a : b {}; - b : B; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("T",stringIndentation(slaveGrammarT))); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorRuleOverridesDelegate extends BaseCompositeParserTestDescriptor { - public String input = "c"; - public String output = "S.a\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "M"; - - /** - grammar M; - import S; - b : 'b'|'c'; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - a : b {}; - b : B ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorRuleOverridesDelegates extends BaseCompositeParserTestDescriptor { - public String input = "c"; - /** - M.b - S.a - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "a"; - public String grammarName = "M"; - - /** - grammar M; - import S, T; - b : 'b'|'c' {}|B|A; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar T; - tokens { A } - b : 'b' {}; - */ - @CommentHasStringValue - public String slaveGrammarT; - /** - parser grammar S; - a : b {}; - b : 'b' ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("T",stringIndentation(slaveGrammarT))); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class DelegatorRuleOverridesLookaheadInDelegate extends BaseCompositeParserTestDescriptor { - public String input = "float x = 3;"; - public String output = "JavaDecl: floatx=3;\n"; - public String errors = null; - public String startRule = "prog"; - public String grammarName = "M"; - - /** - grammar M; - import S; - prog : decl ; - type_ : 'int' | 'float' ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - type_ : 'int' ; - decl : type_ ID ';' - | type_ ID init_ ';' {}; - init_ : '=' INT; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - /* - * This is a regression test for antlr/antlr4#248 "Including grammar with only - * fragments breaks generated lexer". - * https://github.com/antlr/antlr4/issues/248 - */ - public static class ImportLexerWithOnlyFragmentRules extends BaseCompositeParserTestDescriptor { - public String input = "test test"; - public String output = null; - public String errors = null; - public String startRule = "program"; - public String grammarName = "Test"; - - /** - grammar Test; - import Unicode; - - program : 'test' 'test'; - - WS : (UNICODE_CLASS_Zs)+ -> skip; - - */ - @CommentHasStringValue - public String grammar; - - /** - lexer grammar Unicode; - - fragment - UNICODE_CLASS_Zs : '\u0020' | '\u00A0' | '\u1680' | '\u180E' - | '\u2000'..'\u200A' - | '\u202F' | '\u205F' | '\u3000' - ; - - */ - @CommentHasStringValue - public String slaveGrammarUnicode; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("Unicode",stringIndentation(slaveGrammarUnicode))); - - return slaves; - } - } - - public static class ImportedGrammarWithEmptyOptions extends BaseCompositeParserTestDescriptor { - public String input = "b"; - public String output = null; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S; - s : a ; - B : 'b' ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - options {} - a : B ; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class ImportedRuleWithAction extends BaseCompositeParserTestDescriptor { - public String input = "b"; - public String output = null; - public String errors = null; - public String startRule = "s"; - public String grammarName = "M"; - - /** - grammar M; - import S; - s : a; - B : 'b'; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - parser grammar S; - a @after {} : B; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } - - public static class KeywordVSIDOrder extends BaseCompositeParserTestDescriptor { - public String input = "abc"; - /** - M.A - M.a: [@0,0:2='abc',<1>,1:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "a"; - public String grammarName = "M"; - - /** - grammar M; - import S; - a : A {}; - A : 'abc' {}; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - /** - lexer grammar S; - ID : 'a'..'z'+; - */ - @CommentHasStringValue - public String slaveGrammarS; - - @Override - public List> getSlaveGrammars() { - List> slaves = new ArrayList>(); - slaves.add(new Pair("S",stringIndentation(slaveGrammarS))); - - return slaves; - } - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/FullContextParsingDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/FullContextParsingDescriptors.java deleted file mode 100644 index fb71b38632..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/FullContextParsingDescriptors.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseDiagnosticParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class FullContextParsingDescriptors { - public static class AmbigYieldsCtxSensitiveDFA extends BaseDiagnosticParserTestDescriptor { - public String input = "abc"; - /** - Decision 0: - s0-ID->:s1^=>1 - */ - @CommentHasStringValue - public String output; - - public String errors = "line 1:0 reportAttemptingFullContext d=0 (s), input='abc'\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} - : ID | ID {} ; - ID : 'a'..'z'+; - WS : (' '|'\t'|'\n')+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - } - - public static class AmbiguityNoLoop extends BaseDiagnosticParserTestDescriptor { - public String input = "a@"; - public String output = "alt 1\n"; - /** - line 1:2 reportAttemptingFullContext d=0 (prog), input='a@' - line 1:2 reportAmbiguity d=0 (prog): ambigAlts={1, 2}, input='a@' - line 1:2 reportAttemptingFullContext d=1 (expr), input='a@' - line 1:2 reportContextSensitivity d=1 (expr), input='a@' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "prog"; - public String grammarName = "T"; - - /** - grammar T; - prog - @init {} - : expr expr {} - | expr - ; - expr: '@' - | ID '@' - | ID - ; - ID : [a-z]+ ; - WS : [ \r\n\t]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - } - - public static class CtxSensitiveDFATwoDiffInput extends BaseDiagnosticParserTestDescriptor { - public String input = "$ 34 abc @ 34 abc"; - /** - Decision 2: - s0-INT->s1 - s1-ID->:s2^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:5 reportAttemptingFullContext d=2 (e), input='34abc' - line 1:2 reportContextSensitivity d=2 (e), input='34' - line 1:14 reportAttemptingFullContext d=2 (e), input='34abc' - line 1:14 reportContextSensitivity d=2 (e), input='34abc' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} - : ('$' a | '@' b)+ ; - a : e ID ; - b : e INT ID ; - e : INT | ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\t'|'\n')+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class CtxSensitiveDFA extends BaseDiagnosticParserTestDescriptor { - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} - : '$' a | '@' b ; - a : e ID ; - b : e INT ID ; - e : INT | ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\t'|'\n')+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class CtxSensitiveDFA_1 extends CtxSensitiveDFA { - public String input = "$ 34 abc"; - /** - Decision 1: - s0-INT->s1 - s1-ID->:s2^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:5 reportAttemptingFullContext d=1 (e), input='34abc' - line 1:2 reportContextSensitivity d=1 (e), input='34' - */ - @CommentHasStringValue - public String errors; - - } - - public static class CtxSensitiveDFA_2 extends CtxSensitiveDFA { - public String input = "@ 34 abc"; - /** - Decision 1: - s0-INT->s1 - s1-ID->:s2^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:5 reportAttemptingFullContext d=1 (e), input='34abc' - line 1:5 reportContextSensitivity d=1 (e), input='34abc' - */ - @CommentHasStringValue - public String errors; - } - - public static abstract class ExprAmbiguity extends BaseDiagnosticParserTestDescriptor { - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init {} - : expr[0] {}; - expr[int _p] - : ID - ( - {5 >= $_p}? '*' expr[6] - | {4 >= $_p}? '+' expr[5] - )* - ; - ID : [a-zA-Z]+ ; - WS : [ \r\n\t]+ -> skip ; - - */ - @CommentHasStringValue - public String grammar; - } - - public static class ExprAmbiguity_1 extends ExprAmbiguity { - public String input = "a+b"; - public String output = "(expr a + (expr b))\n"; - /** - line 1:1 reportAttemptingFullContext d=1 (expr), input='+' - line 1:2 reportContextSensitivity d=1 (expr), input='+b' - */ - @CommentHasStringValue - public String errors; - } - - public static class ExprAmbiguity_2 extends ExprAmbiguity { - public String input = "a+b*c"; - public String output = "(expr a + (expr b * (expr c)))\n"; - /** - line 1:1 reportAttemptingFullContext d=1 (expr), input='+' - line 1:2 reportContextSensitivity d=1 (expr), input='+b' - line 1:3 reportAttemptingFullContext d=1 (expr), input='*' - line 1:5 reportAmbiguity d=1 (expr): ambigAlts={1, 2}, input='*c' - */ - @CommentHasStringValue - public String errors; - } - - public static abstract class FullContextIF_THEN_ELSEParse extends BaseDiagnosticParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init {} - @after {} - : '{' stat* '}' ; - stat: 'if' ID 'then' stat ('else' ID)? - | 'return' - ; - ID : 'a'..'z'+ ; - WS : (' '|'\t'|'\n')+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class FullContextIF_THEN_ELSEParse_1 extends FullContextIF_THEN_ELSEParse { - public String input = "{ if x then return }"; - /** - Decision 1: - s0-'}'->:s1=>2 - */ - @CommentHasStringValue - public String output; - } - - public static class FullContextIF_THEN_ELSEParse_2 extends FullContextIF_THEN_ELSEParse { - public String input = "{ if x then return else foo }"; - /** - Decision 1: - s0-'else'->:s1^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:19 reportAttemptingFullContext d=1 (stat), input='else' - line 1:19 reportContextSensitivity d=1 (stat), input='else' - */ - @CommentHasStringValue - public String errors; - } - - public static class FullContextIF_THEN_ELSEParse_3 extends FullContextIF_THEN_ELSEParse { - public String input = "{ if x then if y then return else foo }"; - /** - Decision 1: - s0-'}'->:s2=>2 - s0-'else'->:s1^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:29 reportAttemptingFullContext d=1 (stat), input='else' - line 1:38 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}' - */ - @CommentHasStringValue - public String errors; - } - - public static class FullContextIF_THEN_ELSEParse_4 extends FullContextIF_THEN_ELSEParse { - public String input = "{ if x then if y then return else foo else bar }"; - /** - Decision 1: - s0-'else'->:s1^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:29 reportAttemptingFullContext d=1 (stat), input='else' - line 1:38 reportContextSensitivity d=1 (stat), input='elsefooelse' - line 1:38 reportAttemptingFullContext d=1 (stat), input='else' - line 1:38 reportContextSensitivity d=1 (stat), input='else' - */ - @CommentHasStringValue - public String errors; - } - - public static class FullContextIF_THEN_ELSEParse_5 extends FullContextIF_THEN_ELSEParse { - /** - { if x then return else foo - if x then if y then return else foo } - */ - @CommentHasStringValue - public String input; - - /** - Decision 1: - s0-'}'->:s2=>2 - s0-'else'->:s1^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:19 reportAttemptingFullContext d=1 (stat), input='else' - line 1:19 reportContextSensitivity d=1 (stat), input='else' - line 2:27 reportAttemptingFullContext d=1 (stat), input='else' - line 2:36 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}' - */ - @CommentHasStringValue - public String errors; - } - - public static class FullContextIF_THEN_ELSEParse_6 extends FullContextIF_THEN_ELSEParse { - /** - { if x then return else foo - if x then if y then return else foo } - */ - @CommentHasStringValue - public String input; - - /** - Decision 1: - s0-'}'->:s2=>2 - s0-'else'->:s1^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:19 reportAttemptingFullContext d=1 (stat), input='else' - line 1:19 reportContextSensitivity d=1 (stat), input='else' - line 2:27 reportAttemptingFullContext d=1 (stat), input='else' - line 2:36 reportAmbiguity d=1 (stat): ambigAlts={1, 2}, input='elsefoo}' - */ - @CommentHasStringValue - public String errors; - } - - /* - * Tests predictions for the following case involving closures. - * http://www.antlr.org/wiki/display/~admin/2011/12/29/Flaw+in+ANTLR+v3+LL(*)+analysis+algorithm - */ - public static class LoopsSimulateTailRecursion extends BaseDiagnosticParserTestDescriptor { - public String input = "a(i)<-x"; - public String output = "pass: a(i)<-x\n"; - /** - line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)' - line 1:7 reportAmbiguity d=3 (expr_primary): ambigAlts={2, 3}, input='a(i)<-x' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "prog"; - public String grammarName = "T"; - - /** - grammar T; - prog - @init {} - : expr_or_assign*; - expr_or_assign - : expr '++' {} - | expr {} - ; - expr: expr_primary ('\<-' ID)?; - expr_primary - : '(' ID ')' - | ID '(' ID ')' - | ID - ; - ID : [a-z]+ ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SLLSeesEOFInLLGrammar extends BaseDiagnosticParserTestDescriptor { - public String input = "34 abc"; - /** - Decision 0: - s0-INT->s1 - s1-ID->:s2^=>1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:3 reportAttemptingFullContext d=0 (e), input='34abc' - line 1:0 reportContextSensitivity d=0 (e), input='34' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} - : a; - a : e ID ; - b : e INT ID ; - e : INT | ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\t'|'\n')+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LeftRecursionDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LeftRecursionDescriptors.java deleted file mode 100644 index 01e868d6e1..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LeftRecursionDescriptors.java +++ /dev/null @@ -1,1151 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class LeftRecursionDescriptors { - public static abstract class AmbigLR extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "prog"; - public String grammarName = "Expr"; - - /** - grammar Expr; - prog: stat ; - stat: expr NEWLINE # printExpr - | ID '=' expr NEWLINE # assign - | NEWLINE # blank - ; - expr: expr ('*'|'/') expr # MulDiv - | expr ('+'|'-') expr # AddSub - | INT # int - | ID # id - | '(' expr ')' # parens - ; - - MUL : '*' ; // assigns token name to '*' used above in grammar - DIV : '/' ; - ADD : '+' ; - SUB : '-' ; - ID : [a-zA-Z]+ ; // match identifiers - INT : [0-9]+ ; // match integers - NEWLINE:'\r'? '\n' ; // return newlines to parser (is end-statement signal) - WS : [ \t]+ -> skip ; // toss out whitespace - */ - @CommentHasStringValue - public String grammar; - } - - public static class AmbigLR_1 extends AmbigLR { - public String input = "1\n"; - public String output = null; - } - - public static class AmbigLR_2 extends AmbigLR { - public String input = "a = 5\n"; - public String output = null; - } - - public static class AmbigLR_3 extends AmbigLR { - public String input = "b = 6\n"; - public String output = null; - } - - public static class AmbigLR_4 extends AmbigLR { - public String input = "a+b*2\n"; - public String output = null; - } - - public static class AmbigLR_5 extends AmbigLR { - public String input = "(1+2)*3\n"; - public String output = null; - } - - public static abstract class Declarations extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : declarator EOF ; // must indicate EOF can follow - declarator - : declarator '[' e ']' - | declarator '[' ']' - | declarator '(' ')' - | '*' declarator // binds less tight than suffixes - | '(' declarator ')' - | ID - ; - e : INT ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Declarations_1 extends Declarations { - public String input = "a"; - public String output = "(s (declarator a) )\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : declarator EOF ; // must indicate EOF can follow - declarator - : declarator '[' e ']' - | declarator '[' ']' - | declarator '(' ')' - | '*' declarator // binds less tight than suffixes - | '(' declarator ')' - | ID - ; - e : INT ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Declarations_2 extends Declarations { - public String input = "*a"; - public String output = "(s (declarator * (declarator a)) )\n"; - } - - public static class Declarations_3 extends Declarations { - public String input = "**a"; - public String output = "(s (declarator * (declarator * (declarator a))) )\n"; - } - - public static class Declarations_4 extends Declarations { - public String input = "a[3]"; - public String output = "(s (declarator (declarator a) [ (e 3) ]) )\n"; - } - - public static class Declarations_5 extends Declarations { - public String input = "b[]"; - public String output = "(s (declarator (declarator b) [ ]) )\n"; - } - - public static class Declarations_6 extends Declarations { - public String input = "(a)"; - public String output = "(s (declarator ( (declarator a) )) )\n"; - } - - public static class Declarations_7 extends Declarations { - public String input = "a[]()"; - public String output = "(s (declarator (declarator (declarator a) [ ]) ( )) )\n"; - } - - public static class Declarations_8 extends Declarations { - public String input = "a[][]"; - public String output = "(s (declarator (declarator (declarator a) [ ]) [ ]) )\n"; - } - - public static class Declarations_9 extends Declarations { - public String input = "*a[]"; - public String output = "(s (declarator * (declarator (declarator a) [ ])) )\n"; - } - - public static class Declarations_10 extends Declarations { - public String input = "(*a)[]"; - public String output = "(s (declarator (declarator ( (declarator * (declarator a)) )) [ ]) )\n"; - } - - /* - * This is a regression test for "Support direct calls to left-recursive - * rules". - * https://github.com/antlr/antlr4/issues/161 - */ - public static abstract class DirectCallToLeftRecursiveRule extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a @after {} : a ID - | ID - ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class DirectCallToLeftRecursiveRule_1 extends DirectCallToLeftRecursiveRule { - public String input = "x"; - public String output = "(a x)\n"; - } - - public static class DirectCallToLeftRecursiveRule_2 extends DirectCallToLeftRecursiveRule { - public String input = "x y"; - public String output = "(a (a x) y)\n"; - } - - public static class DirectCallToLeftRecursiveRule_3 extends DirectCallToLeftRecursiveRule { - public String input = "x y z"; - public String output = "(a (a (a x) y) z)\n"; - } - - public static abstract class Expressions extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : e EOF ; // must indicate EOF can follow - e : e '.' ID - | e '.' 'this' - | '-' e - | e '*' e - | e ('+'|'-') e - | INT - | ID - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Expressions_1 extends Expressions { - public String input = "a"; - public String output = "(s (e a) )\n"; - } - - public static class Expressions_2 extends Expressions { - public String input = "1"; - public String output = "(s (e 1) )\n"; - } - - public static class Expressions_3 extends Expressions { - public String input = "a-1"; - public String output = "(s (e (e a) - (e 1)) )\n"; - } - - public static class Expressions_4 extends Expressions { - public String input = "a.b"; - public String output = "(s (e (e a) . b) )\n"; - } - - public static class Expressions_5 extends Expressions { - public String input = "a.this"; - public String output = "(s (e (e a) . this) )\n"; - } - - public static class Expressions_6 extends Expressions { - public String input = "-a"; - public String output = "(s (e - (e a)) )\n"; - } - - public static class Expressions_7 extends Expressions { - public String input = "-a+b"; - public String output = "(s (e (e - (e a)) + (e b)) )\n"; - } - - public static abstract class JavaExpressions extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : e EOF ; // must indicate EOF can follow - expressionList - : e (',' e)* - ; - e : '(' e ')' - | 'this' - | 'super' - | INT - | ID - | typespec '.' 'class' - | e '.' ID - | e '.' 'this' - | e '.' 'super' '(' expressionList? ')' - | e '.' 'new' ID '(' expressionList? ')' - | 'new' typespec ( '(' expressionList? ')' | ('[' e ']')+) - | e '[' e ']' - | '(' typespec ')' e - | e ('++' | '--') - | e '(' expressionList? ')' - | ('+'|'-'|'++'|'--') e - | ('~'|'!') e - | e ('*'|'/'|'%') e - | e ('+'|'-') e - | e ('\<\<' | '>>>' | '>>') e - | e ('\<=' | '>=' | '>' | '\<') e - | e 'instanceof' e - | e ('==' | '!=') e - | e '&' e - |\ e '^' e - | e '|' e - | e '&&' e - | e '||' e - | e '?' e ':' e - |\ - e ('=' - |'+=' - |'-=' - |'*=' - |'/=' - |'&=' - |'|=' - |'^=' - |'>>=' - |'>>>=' - |'\<\<=' - |'%=') e - ; - typespec - : ID - | ID '[' ']' - | 'int' - | 'int' '[' ']' - ; - ID : ('a'..'z'|'A'..'Z'|'_'|'$')+; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class JavaExpressions_1 extends JavaExpressions { - public String input = "a|b&c"; - public String output = "(s (e (e a) | (e (e b) & (e c))) )\n"; - } - - public static class JavaExpressions_2 extends JavaExpressions { - public String input = "(a|b)&c"; - public String output = "(s (e (e ( (e (e a) | (e b)) )) & (e c)) )\n"; - } - - public static class JavaExpressions_3 extends JavaExpressions { - public String input = "a > b"; - public String output = "(s (e (e a) > (e b)) )\n"; - } - - public static class JavaExpressions_4 extends JavaExpressions { - public String input = "a >> b"; - public String output = "(s (e (e a) >> (e b)) )\n"; - } - - public static class JavaExpressions_5 extends JavaExpressions { - public String input = "a=b=c"; - public String output = "(s (e (e a) = (e (e b) = (e c))) )\n"; - } - - public static class JavaExpressions_6 extends JavaExpressions { - public String input = "a^b^c"; - public String output = "(s (e (e a) ^ (e (e b) ^ (e c))) )\n"; - } - - public static class JavaExpressions_7 extends JavaExpressions { - public String input = "(T)x"; - public String output = "(s (e ( (typespec T) ) (e x)) )\n"; - } - - public static class JavaExpressions_8 extends JavaExpressions { - public String input = "new A().b"; - public String output = "(s (e (e new (typespec A) ( )) . b) )\n"; - } - - public static class JavaExpressions_9 extends JavaExpressions { - public String input = "(T)t.f()"; - public String output = "(s (e (e ( (typespec T) ) (e (e t) . f)) ( )) )\n"; - } - - public static class JavaExpressions_10 extends JavaExpressions { - public String input = "a.f(x)==T.c"; - public String output = "(s (e (e (e (e a) . f) ( (expressionList (e x)) )) == (e (e T) . c)) )\n"; - } - - public static class JavaExpressions_11 extends JavaExpressions { - public String input = "a.f().g(x,1)"; - public String output = "(s (e (e (e (e (e a) . f) ( )) . g) ( (expressionList (e x) , (e 1)) )) )\n"; - } - - public static class JavaExpressions_12 extends JavaExpressions { - public String input = "new T[((n-1) * x) + 1]"; - public String output = "(s (e new (typespec T) [ (e (e ( (e (e ( (e (e n) - (e 1)) )) * (e x)) )) + (e 1)) ]) )\n"; - } - - public static abstract class LabelsOnOpSubrule extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : e; - e : a=e op=('*'|'/') b=e {} - | INT {} - | '(' x=e ')' {} - ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LabelsOnOpSubrule_1 extends LabelsOnOpSubrule { - public String input = "4"; - public String output = "(s (e 4))\n"; - } - - public static class LabelsOnOpSubrule_2 extends LabelsOnOpSubrule { - public String input = "1*2/3"; - public String output = "(s (e (e (e 1) * (e 2)) / (e 3)))\n"; - } - - public static class LabelsOnOpSubrule_3 extends LabelsOnOpSubrule { - public String input = "(1/2)*3"; - public String output = "(s (e (e ( (e (e 1) / (e 2)) )) * (e 3)))\n"; - } - - /* - * This is a regression test for antlr/antlr4#625 "Duplicate action breaks - * operator precedence" - * https://github.com/antlr/antlr4/issues/625 - */ - public static abstract class MultipleActionsPredicatesOptions extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : e ; - e : a=e op=('*'|'/') b=e {}{}? - | a=e op=('+'|'-') b=e {}\{}?\ - | INT {}{} - | '(' x=e ')' {}{} - ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class MultipleActionsPredicatesOptions_1 extends MultipleActionsPredicatesOptions { - public String input = "4"; - public String output = "(s (e 4))\n"; - } - - public static class MultipleActionsPredicatesOptions_2 extends MultipleActionsPredicatesOptions { - public String input = "1*2/3"; - public String output = "(s (e (e (e 1) * (e 2)) / (e 3)))\n"; - } - - public static class MultipleActionsPredicatesOptions_3 extends MultipleActionsPredicatesOptions { - public String input = "(1/2)*3"; - public String output = "(s (e (e ( (e (e 1) / (e 2)) )) * (e 3)))\n"; - } - - /* - * This is a regression test for antlr/antlr4#625 "Duplicate action breaks - * operator precedence" - * https://github.com/antlr/antlr4/issues/625 - */ - public static abstract class MultipleActions extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : e ; - e : a=e op=('*'|'/') b=e {}{} - | INT {}{} - | '(' x=e ')' {}{} - ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class MultipleActions_1 extends MultipleActions { - public String input = "4"; - public String output = "(s (e 4))\n"; - public String errors = null; - } - - public static class MultipleActions_2 extends MultipleActions { - public String input = "1*2/3"; - public String output = "(s (e (e (e 1) * (e 2)) / (e 3)))\n"; - } - - public static class MultipleActions_3 extends MultipleActions { - public String input = "(1/2)*3"; - public String output = "(s (e (e ( (e (e 1) / (e 2)) )) * (e 3)))\n"; - } - - /* - * This is a regression test for antlr/antlr4#433 "Not all context accessor - * methods are generated when an alternative rule label is used for multiple - * alternatives". - * https://github.com/antlr/antlr4/issues/433 - */ - public static abstract class MultipleAlternativesWithCommonLabel extends BaseParserTestDescriptor { - public String startRule = "s"; - public String grammarName = "T"; - public String errors = null; - - /** - grammar T; - s : e {}; - e returns [int v] - : e '*' e {$v = (0)}, {})> * (1)}, {})>;} # binary - | e '+' e {$v = (0)}, {})> + (1)}, {})>;} # binary - | INT {$v = $INT.int;} # anInt - | '(' e ')' {$v = $e.v;} # parens - | left=e INC {$v = $left.v + 1;} # unary - | left=e DEC {$v = $left.v - 1;} # unary - | ID {} # anID - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - INC : '++' ; - DEC : '--' ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class MultipleAlternativesWithCommonLabel_1 extends MultipleAlternativesWithCommonLabel { - public String input = "4"; - public String output = "4\n"; - } - - public static class MultipleAlternativesWithCommonLabel_2 extends MultipleAlternativesWithCommonLabel { - public String input = "1+2"; - public String output = "3\n"; - } - - public static class MultipleAlternativesWithCommonLabel_3 extends MultipleAlternativesWithCommonLabel { - public String input = "1+2*3"; - public String output = "7\n"; - } - - public static class MultipleAlternativesWithCommonLabel_4 extends MultipleAlternativesWithCommonLabel { - public String input = "i++*3"; - public String output = "12\n"; - } - - /** Test for https://github.com/antlr/antlr4/issues/1295 in addition to #433. */ - public static class MultipleAlternativesWithCommonLabel_5 extends MultipleAlternativesWithCommonLabel { - public String input = "(99)+3"; - public String output = "102\n"; - } - - /** - * This is a regression test for antlr/antlr4#509 "Incorrect rule chosen in - * unambiguous grammar". - * https://github.com/antlr/antlr4/issues/509 - */ - public static class PrecedenceFilterConsidersContext extends BaseParserTestDescriptor { - public String input = "aa"; - public String output = "(prog (statement (letterA a)) (statement (letterA a)) )\n"; - public String errors = null; - public String startRule = "prog"; - public String grammarName = "T"; - - /** - grammar T; - prog - @after {} - : statement* EOF {}; - statement: letterA | statement letterA 'b' ; - letterA: 'a'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class PrefixAndOtherAlt extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : expr EOF ; - expr : literal - | op expr - | expr op expr - ; - literal : '-'? Integer ; - op : '+' | '-' ; - Integer : [0-9]+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class PrefixAndOtherAlt_1 extends PrefixAndOtherAlt { - public String input = "-1"; - public String output = "(s (expr (literal - 1)) )\n"; - } - - public static class PrefixAndOtherAlt_2 extends PrefixAndOtherAlt { - public String input = "-1 + -1"; - public String output = "(s (expr (expr (literal - 1)) (op +) (expr (literal - 1))) )\n"; - } - - public static abstract class PrefixOpWithActionAndLabel extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : e {} ; - e returns [ result] - : ID '=' e1=e {$result = ;} - | ID {$result = $ID.text;} - | e1=e '+' e2=e {$result = ;} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class PrefixOpWithActionAndLabel_1 extends PrefixOpWithActionAndLabel { - public String input = "a"; - public String output = "a\n"; - } - - public static class PrefixOpWithActionAndLabel_2 extends PrefixOpWithActionAndLabel { - public String input = "a+b"; - public String output = "(a+b)\n"; - } - - public static class PrefixOpWithActionAndLabel_3 extends PrefixOpWithActionAndLabel { - public String input = "a=b+c"; - public String output = "((a=b)+c)\n"; - } - - public static abstract class ReturnValueAndActionsAndLabels extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : q=e {}; - e returns [int v] - : a=e op='*' b=e {$v = $a.v * $b.v;} # mult - | a=e '+' b=e {$v = $a.v + $b.v;} # add - | INT {$v = $INT.int;} # anInt - | '(' x=e ')' {$v = $x.v;} # parens - | x=e '++' {$v = $x.v+1;} # inc - | e '--' # dec - | ID {$v = 3;} # anID - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ReturnValueAndActionsAndLabels_1 extends ReturnValueAndActionsAndLabels { - public String input = "4"; - public String output = "4\n"; - } - - public static class ReturnValueAndActionsAndLabels_2 extends ReturnValueAndActionsAndLabels { - public String input = "1+2"; - public String output = "3\n"; - } - - public static class ReturnValueAndActionsAndLabels_3 extends ReturnValueAndActionsAndLabels { - public String input = "1+2*3"; - public String output = "7\n"; - } - - public static class ReturnValueAndActionsAndLabels_4 extends ReturnValueAndActionsAndLabels { - public String input = "i++*3"; - public String output = "12\n"; - } - - /* - * This is a regression test for antlr/antlr4#677 "labels not working in grammar - * file". - * https://github.com/antlr/antlr4/issues/677 - * - * This test treats `,` and `>>` as part of a single compound operator (similar - * to a ternary operator). - */ - public static abstract class ReturnValueAndActionsList extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : expr EOF; - expr: - a=expr '*' a=expr #Factor - | b+=expr (',' b+=expr)* '>>' c=expr #Send - | ID #JustId //semantic check on modifiers - ; - - ID : ('a'..'z'|'A'..'Z'|'_') - ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* - ; - - WS : [ \t\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ReturnValueAndActionsList1_1 extends ReturnValueAndActionsList { - public String input = "a*b"; - public String output = "(s (expr (expr a) * (expr b)) )\n"; - } - - public static class ReturnValueAndActionsList1_2 extends ReturnValueAndActionsList { - public String input = "a,c>>x"; - public String output = "(s (expr (expr a) , (expr c) >> (expr x)) )\n"; - } - - public static class ReturnValueAndActionsList1_3 extends ReturnValueAndActionsList { - public String input = "x"; - public String output = "(s (expr x) )\n"; - } - - public static class ReturnValueAndActionsList1_4 extends ReturnValueAndActionsList { - public String input = "a*b,c,x*y>>r"; - public String output = "(s (expr (expr (expr a) * (expr b)) , (expr c) , (expr (expr x) * (expr y)) >> (expr r)) )\n"; - } - - /* - * This is a regression test for antlr/antlr4#677 "labels not working in grammar - * file". - * https://github.com/antlr/antlr4/issues/677 - * - * This test treats the `,` and `>>` operators separately. - */ - public static abstract class ReturnValueAndActionsList2 extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : expr EOF; - expr: - a=expr '*' a=expr #Factor - | b+=expr ',' b+=expr #Comma - | b+=expr '>>' c=expr #Send - | ID #JustId //semantic check on modifiers - ; - ID : ('a'..'z'|'A'..'Z'|'_') - ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* - ; - WS : [ \t\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ReturnValueAndActionsList2_1 extends ReturnValueAndActionsList2 { - public String input = "a*b"; - public String output = "(s (expr (expr a) * (expr b)) )\n"; - } - - public static class ReturnValueAndActionsList2_2 extends ReturnValueAndActionsList2 { - public String input = "a,c>>x"; - public String output = "(s (expr (expr (expr a) , (expr c)) >> (expr x)) )\n"; - } - - public static class ReturnValueAndActionsList2_3 extends ReturnValueAndActionsList2 { - public String input = "x"; - public String output = "(s (expr x) )\n"; - } - - public static class ReturnValueAndActionsList2_4 extends ReturnValueAndActionsList2 { - public String input = "a*b,c,x*y>>r"; - public String output = "(s (expr (expr (expr (expr (expr a) * (expr b)) , (expr c)) , (expr (expr x) * (expr y))) >> (expr r)) )\n"; - } - - public static abstract class ReturnValueAndActions extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : e {}; - e returns [int v, ignored] - : a=e '*' b=e {$v = $a.v * $b.v;} - | a=e '+' b=e {$v = $a.v + $b.v;} - | INT {$v = $INT.int;} - | '(' x=e ')' {$v = $x.v;} - ; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ReturnValueAndActions_1 extends ReturnValueAndActions { - public String input = "4"; - public String output = "4\n"; - } - - public static class ReturnValueAndActions_2 extends ReturnValueAndActions { - public String input = "1+2"; - public String output = "3\n"; - } - - public static class ReturnValueAndActions_3 extends ReturnValueAndActions { - public String input = "1+2*3"; - public String output = "7\n"; - } - - public static class ReturnValueAndActions_4 extends ReturnValueAndActions { - public String input = "(1+2)*3"; - public String output = "9\n"; - } - - public static class SemPred extends BaseParserTestDescriptor { - public String input = "x y z"; - public String output = "(s (a (a (a x) y) z))\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : a ; - a : a {}? ID - | ID - ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SemPredFailOption extends BaseParserTestDescriptor { - public String input = "x y z"; - public String output = "(s (a (a x) y z))\n"; - public String errors = "line 1:4 rule a custom message\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : a ; - a : a ID {}?\ - | ID - ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class Simple extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : a ; - a : a ID - | ID - ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Simple_1 extends Simple { - public String input = "x"; - public String output = "(s (a x))\n"; - } - - public static class Simple_2 extends Simple { - public String input = "x y"; - public String output = "(s (a (a x) y))\n"; - } - - public static class Simple_3 extends Simple { - public String input = "x y z"; - public String output = "(s (a (a (a x) y) z))\n"; - } - - /** - * This is a regression test for antlr/antlr4#542 "First alternative cannot - * be right-associative". - * https://github.com/antlr/antlr4/issues/542 - */ - public static abstract class TernaryExprExplicitAssociativity extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : e EOF; // must indicate EOF can follow or 'a\' won't match - e :\ e '*' e - |\ e '+' e - |\ e '?' e ':' e - |\ e '=' e - | ID - ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TernaryExprExplicitAssociativity_1 extends TernaryExprExplicitAssociativity { - public String input = "a"; - public String output = "(s (e a) )\n"; - } - - public static class TernaryExprExplicitAssociativity_2 extends TernaryExprExplicitAssociativity { - public String input = "a+b"; - public String output = "(s (e (e a) + (e b)) )\n"; - } - - public static class TernaryExprExplicitAssociativity_3 extends TernaryExprExplicitAssociativity { - public String input = "a*b"; - public String output = "(s (e (e a) * (e b)) )\n"; - } - - public static class TernaryExprExplicitAssociativity_4 extends TernaryExprExplicitAssociativity { - public String input = "a?b:c"; - public String output = "(s (e (e a) ? (e b) : (e c)) )\n"; - } - - public static class TernaryExprExplicitAssociativity_5 extends TernaryExprExplicitAssociativity { - public String input = "a=b=c"; - public String output = "(s (e (e a) = (e (e b) = (e c))) )\n"; - } - - public static class TernaryExprExplicitAssociativity_6 extends TernaryExprExplicitAssociativity { - public String input = "a?b+c:d"; - public String output = "(s (e (e a) ? (e (e b) + (e c)) : (e d)) )\n"; - } - - public static class TernaryExprExplicitAssociativity_7 extends TernaryExprExplicitAssociativity { - public String input = "a?b=c:d"; - public String output = "(s (e (e a) ? (e (e b) = (e c)) : (e d)) )\n"; - } - - public static class TernaryExprExplicitAssociativity_8 extends TernaryExprExplicitAssociativity { - public String input = "a? b?c:d : e"; - public String output = "(s (e (e a) ? (e (e b) ? (e c) : (e d)) : (e e)) )\n"; - } - - public static class TernaryExprExplicitAssociativity_9 extends TernaryExprExplicitAssociativity { - public String input = "a?b: c?d:e"; - public String output = "(s (e (e a) ? (e b) : (e (e c) ? (e d) : (e e))) )\n"; - } - - public static abstract class TernaryExpr extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s @after {} : e EOF ; // must indicate EOF can follow or 'a\' won't match - e : e '*' e - | e '+' e - |\ e '?' e ':' e - |\ e '=' e - | ID - ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TernaryExpr_1 extends TernaryExpr { - public String input = "a"; - public String output = "(s (e a) )\n"; - } - - public static class TernaryExpr_2 extends TernaryExpr { - public String input = "a+b"; - public String output = "(s (e (e a) + (e b)) )\n"; - } - - public static class TernaryExpr_3 extends TernaryExpr { - public String input = "a*b"; - public String output = "(s (e (e a) * (e b)) )\n"; - } - - public static class TernaryExpr_4 extends TernaryExpr { - public String input = "a?b:c"; - public String output = "(s (e (e a) ? (e b) : (e c)) )\n"; - } - - public static class TernaryExpr_5 extends TernaryExpr { - public String input = "a=b=c"; - public String output = "(s (e (e a) = (e (e b) = (e c))) )\n"; - } - - public static class TernaryExpr_6 extends TernaryExpr { - public String input = "a?b+c:d"; - public String output = "(s (e (e a) ? (e (e b) + (e c)) : (e d)) )\n"; - } - - public static class TernaryExpr_7 extends TernaryExpr { - public String input = "a?b=c:d"; - public String output = "(s (e (e a) ? (e (e b) = (e c)) : (e d)) )\n"; - } - - public static class TernaryExpr_8 extends TernaryExpr { - public String input = "a? b?c:d : e"; - public String output = "(s (e (e a) ? (e (e b) ? (e c) : (e d)) : (e e)) )\n"; - } - - public static class TernaryExpr_9 extends TernaryExpr { - public String input = "a?b: c?d:e"; - public String output = "(s (e (e a) ? (e b) : (e (e c) ? (e d) : (e e))) )\n"; - } - - /* - * This is a regression test for #239 "recoursive parser using implicit tokens - * ignore white space lexer rule". - * https://github.com/antlr/antlr4/issues/239 - */ - public static abstract class WhitespaceInfluence extends BaseParserTestDescriptor { - public String input = "Test(1,3)"; - public String output = null; - public String errors = null; - public String startRule = "prog"; - public String grammarName = "Expr"; - - /** - grammar Expr; - prog : expression EOF; - expression - : ID '(' expression (',' expression)* ')' # doFunction - | '(' expression ')' # doParenthesis - | '!' expression # doNot - | '-' expression # doNegate - | '+' expression # doPositiv - | expression '^' expression # doPower - | expression '*' expression # doMultipy - | expression '/' expression # doDivide - | expression '%' expression # doModulo - | expression '-' expression # doMinus - | expression '+' expression # doPlus - | expression '=' expression # doEqual - | expression '!=' expression # doNotEqual - | expression '>' expression # doGreather - | expression '>=' expression # doGreatherEqual - | expression '\<' expression # doLesser - | expression '\<=' expression # doLesserEqual - | expression K_IN '(' expression (',' expression)* ')' # doIn - | expression ( '&' | K_AND) expression # doAnd - | expression ( '|' | K_OR) expression # doOr - | '[' expression (',' expression)* ']' # newArray - | K_TRUE # newTrueBoolean - | K_FALSE # newFalseBoolean - | NUMBER # newNumber - | DATE # newDateTime - | ID # newIdentifier - | SQ_STRING # newString - | K_NULL # newNull - ; - - // Fragments - fragment DIGIT : '0' .. '9'; - fragment UPPER : 'A' .. 'Z'; - fragment LOWER : 'a' .. 'z'; - fragment LETTER : LOWER | UPPER; - fragment WORD : LETTER | '_' | '$' | '#' | '.'; - fragment ALPHANUM : WORD | DIGIT; - - // Tokens - ID : LETTER ALPHANUM*; - NUMBER : DIGIT+ ('.' DIGIT+)? (('e'|'E')('+'|'-')? DIGIT+)?; - DATE : '\'' DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT (' ' DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT ('.' DIGIT+)?)? '\''; - SQ_STRING : '\'' ('\'\'' | ~'\'')* '\''; - DQ_STRING : '"' ('\\\\"' | ~'"')* '"'; - WS : [ \t\n\r]+ -> skip ; - COMMENTS : ('/*' .*? '*' '/' | '//' ~'\n'* '\n' ) -> skip; - */ - @CommentHasStringValue - public String grammar; - } - - public static class WhitespaceInfluence_1 extends WhitespaceInfluence { - public String input = "Test(1,3)"; - public String output = null; - } - - public static class WhitespaceInfluence_2 extends WhitespaceInfluence { - public String input = "Test(1, 3)"; - public String output = null; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LexerErrorsDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LexerErrorsDescriptors.java deleted file mode 100644 index a7bcc3d7d7..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LexerErrorsDescriptors.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseLexerTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class LexerErrorsDescriptors { - public static class DFAToATNThatFailsBackToDFA extends BaseLexerTestDescriptor { - public String input = "ababx"; - /** - [@0,0:1='ab',<1>,1:0] - [@1,2:3='ab',<1>,1:2] - [@2,5:4='',<-1>,1:5] - */ - @CommentHasStringValue - public String output; - - public String errors = "line 1:4 token recognition error at: 'x'\n"; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'ab' ; - B : 'abc' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class DFAToATNThatMatchesThenFailsInATN extends BaseLexerTestDescriptor { - public String input = "ababcx"; - /** - [@0,0:1='ab',<1>,1:0] - [@1,2:4='abc',<2>,1:2] - [@2,6:5='',<-1>,1:6] - */ - @CommentHasStringValue - public String output; - - public String errors = "line 1:5 token recognition error at: 'x'\n"; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'ab' ; - B : 'abc' ; - C : 'abcd' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class EnforcedGreedyNestedBraces extends BaseLexerTestDescriptor { - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ACTION : '{' (ACTION | ~[{}])* '}'; - WS : [ \r\n\t]+ -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class EnforcedGreedyNestedBraces_1 extends EnforcedGreedyNestedBraces { - public String input = "{ { } }"; - /** - [@0,0:6='{ { } }',<1>,1:0] - [@1,7:6='',<-1>,1:7] - */ - @CommentHasStringValue - public String output; - } - - public static class EnforcedGreedyNestedBraces_2 extends EnforcedGreedyNestedBraces { - public String input = "{ { }"; - public String output = "[@0,5:4='',<-1>,1:5]\n"; - public String errors = "line 1:0 token recognition error at: '{ { }'\n"; - } - - public static class ErrorInMiddle extends BaseLexerTestDescriptor { - public String input = "abx"; - public String output = "[@0,3:2='',<-1>,1:3]\n"; - public String errors = "line 1:0 token recognition error at: 'abx'\n"; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'abc' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class InvalidCharAtStart extends BaseLexerTestDescriptor { - public String input = "x"; - public String output = "[@0,1:0='',<-1>,1:1]\n"; - public String errors = "line 1:0 token recognition error at: 'x'\n"; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'a' 'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class InvalidCharAtStartAfterDFACache extends BaseLexerTestDescriptor { - public String input = "abx"; - /** - [@0,0:1='ab',<1>,1:0] - [@1,3:2='',<-1>,1:3] - */ - @CommentHasStringValue - public String output; - - public String errors = "line 1:2 token recognition error at: 'x'\n"; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'a' 'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class InvalidCharInToken extends BaseLexerTestDescriptor { - public String input = "ax"; - public String output = "[@0,2:1='',<-1>,1:2]\n"; - public String errors = "line 1:0 token recognition error at: 'ax'\n"; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'a' 'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class InvalidCharInTokenAfterDFACache extends BaseLexerTestDescriptor { - public String input = "abax"; - /** - [@0,0:1='ab',<1>,1:0] - [@1,4:3='',<-1>,1:4] - */ - @CommentHasStringValue - public String output; - - public String errors = "line 1:2 token recognition error at: 'ax'\n"; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'a' 'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for #45 "NullPointerException in LexerATNSimulator.execDFA". - * https://github.com/antlr/antlr4/issues/46 - */ - public static class LexerExecDFA extends BaseLexerTestDescriptor { - public String input = "x : x"; - /** - [@0,0:0='x',<3>,1:0] - [@1,2:2=':',<1>,1:2] - [@2,4:4='x',<3>,1:4] - [@3,5:4='',<-1>,1:5] - */ - @CommentHasStringValue - public String output; - - /** - line 1:1 token recognition error at: ' ' - line 1:3 token recognition error at: ' ' - */ - @CommentHasStringValue - public String errors; - - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - COLON : ':' ; - PTR : '->' ; - ID : [a-z]+; - */ - @CommentHasStringValue - public String grammar; - } - - public static abstract class StringsEmbeddedInActions extends BaseLexerTestDescriptor { - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - // ST interprets \\ as \ so we need \\\\ to get \\ - /** - lexer grammar L; - ACTION2 : '[' (STRING | ~'"')*? ']'; - STRING : '"' ('\\\\' '"' | .)*? '"'; - WS : [ \t\r\n]+ -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class StringsEmbeddedInActions_1 extends StringsEmbeddedInActions { - public String input = "[\"foo\"]"; - /** - [@0,0:6='["foo"]',<1>,1:0] - [@1,7:6='',<-1>,1:7] - */ - @CommentHasStringValue - public String output; - } - - public static class StringsEmbeddedInActions_2 extends StringsEmbeddedInActions { - public String input = "[\"foo]"; - public String output = "[@0,6:5='',<-1>,1:6]\n"; - public String errors = "line 1:0 token recognition error at: '[\"foo]'\n"; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LexerExecDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LexerExecDescriptors.java deleted file mode 100644 index 32f7d8cc87..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/LexerExecDescriptors.java +++ /dev/null @@ -1,1112 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.runtime.misc.Pair; -import org.antlr.v4.test.runtime.BaseLexerTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Paths; - -public class LexerExecDescriptors { - public static class ActionPlacement extends BaseLexerTestDescriptor { - public String input = "ab"; - /** - stuff0: - stuff1: a - stuff2: ab - ab - [@0,0:1='ab',<1>,1:0] - [@1,2:1='',<-1>,1:2] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : ({} 'a' - | {} - 'a' {} - 'b' {}) - {} ; - WS : (' '|'\n') -> skip ; - J : .; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class CharSet extends BaseLexerTestDescriptor { - public String input = "34\n 34"; - /** - I - I - [@0,0:1='34',<1>,1:0] - [@1,4:5='34',<1>,2:1] - [@2,6:5='',<-1>,2:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : '0'..'9'+ {} ; - WS : [ \n\\u000D] -> skip ; - */ // needs escape on u000D otherwise java converts even in comment - @CommentHasStringValue - public String grammar; - - } - - /* regression test for antlr/antlr4#1925 */ - public static class UnicodeCharSet extends BaseLexerTestDescriptor { - public String input = "均"; - /** - [@0,0:0='均',<1>,1:0] - [@1,1:0='',<-1>,1:1] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ID : ([A-Z_]|'\u0100'..'\uFFFE') ([A-Z_0-9]|'\u0100'..'\uFFFE')*; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetInSet extends BaseLexerTestDescriptor { - public String input = "a x"; - /** - I - I - [@0,0:0='a',<1>,1:0] - [@1,2:2='x',<1>,1:2] - [@2,3:2='',<-1>,1:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : (~[ab \\n]|'a') {} ; - WS : [ \n\\u000D]+ -> skip ; - */ // needs escape on u000D otherwise java converts even in comment - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetNot extends BaseLexerTestDescriptor { - public String input = "xaf"; - /** - I - [@0,0:2='xaf',<1>,1:0] - [@1,3:2='',<-1>,1:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : ~[ab \n] ~[ \ncd]* {} ; - WS : [ \n\\u000D]+ -> skip ; - */ // needs escape on u000D otherwise java converts even in comment - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetPlus extends BaseLexerTestDescriptor { - public String input = "34\n 34"; - /** - I - I - [@0,0:1='34',<1>,1:0] - [@1,4:5='34',<1>,2:1] - [@2,6:5='',<-1>,2:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : '0'..'9'+ {} ; - WS : [ \n\\u000D]+ -> skip ; - */ // needs escape on u000D otherwise java converts even in comment - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetRange extends BaseLexerTestDescriptor { - public String input = "34\n 34 a2 abc \n "; - /** - I - I - ID - ID - [@0,0:1='34',<1>,1:0] - [@1,4:5='34',<1>,2:1] - [@2,7:8='a2',<2>,2:4] - [@3,10:12='abc',<2>,2:7] - [@4,18:17='',<-1>,3:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : [0-9]+ {} ; - ID : [a-zA-Z] [a-zA-Z0-9]* {} ; - WS : [ \n\\u0009\r]+ -> skip ; - */ // needs escape on u0009 otherwise java converts even in comment - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetWithEscapedChar extends BaseLexerTestDescriptor { - public String input = "- ] "; - /** - DASHBRACK - DASHBRACK - [@0,0:0='-',<1>,1:0] - [@1,2:2=']',<1>,1:2] - [@2,4:3='',<-1>,1:4] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - DASHBRACK : [\\-\]]+ {} ; - WS : [ \n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetWithMissingEscapeChar extends BaseLexerTestDescriptor { - public String input = "34 "; - /** - I - [@0,0:1='34',<1>,1:0] - [@1,3:2='',<-1>,1:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : [0-9]+ {} ; - WS : [ \n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetWithQuote1 extends BaseLexerTestDescriptor { - public String input = "b\"a"; - /** - A - [@0,0:2='b"a',<1>,1:0] - [@1,3:2='',<-1>,1:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : ["a-z]+ {} ; - WS : [ \n\t]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class CharSetWithQuote2 extends BaseLexerTestDescriptor { - public String input = "b\"\\a"; - /** - A - [@0,0:3='b"\a',<1>,1:0] - [@1,4:3='',<-1>,1:4] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : ["\\\\ab]+ {} ; - WS : [ \n\t]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class EOFByItself extends BaseLexerTestDescriptor { - public String input = ""; - /** - [@0,0:-1='',<1>,1:0] - [@1,0:-1='',<-1>,1:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - DONE : EOF ; - A : 'a'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class EOFSuffixInFirstRule extends BaseLexerTestDescriptor { - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : 'a' EOF ; - B : 'a'; - C : 'c'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class EOFSuffixInFirstRule_1 extends EOFSuffixInFirstRule { - public String input = ""; - public String output = "[@0,0:-1='',<-1>,1:0]\n"; - } - - public static class EOFSuffixInFirstRule_2 extends EOFSuffixInFirstRule { - public String input = "a"; - /** - [@0,0:0='a',<1>,1:0] - [@1,1:0='',<-1>,1:1] - */ - @CommentHasStringValue - public String output; - } - - public static class GreedyClosure extends BaseLexerTestDescriptor { - /** - //blah - //blah - */ - @CommentHasStringValue - public String input; - - /** - [@0,0:13='//blah\n//blah\n',<1>,1:0] - [@1,14:13='',<-1>,3:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : '//' .*? '\n' CMT*; - WS : (' '|'\t')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class GreedyConfigs extends BaseLexerTestDescriptor { - public String input = "ab"; - /** - ab - [@0,0:1='ab',<1>,1:0] - [@1,2:1='',<-1>,1:2] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : ('a' | 'ab') {} ; - WS : (' '|'\n') -> skip ; - J : .; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class GreedyOptional extends BaseLexerTestDescriptor { - /** - //blah - //blah - */ - @CommentHasStringValue - public String input; - - /** - [@0,0:13='//blah\n//blah\n',<1>,1:0] - [@1,14:13='',<-1>,3:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : '//' .*? '\n' CMT?; - WS : (' '|'\t')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class GreedyPositiveClosure extends BaseLexerTestDescriptor { - /** - //blah - //blah - */ - @CommentHasStringValue - public String input; - - /** - [@0,0:13='//blah\n//blah\n',<1>,1:0] - [@1,14:13='',<-1>,3:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : ('//' .*? '\n')+; - WS : (' '|'\t')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class HexVsID extends BaseLexerTestDescriptor { - public String input = "x 0 1 a.b a.l"; - /** - [@0,0:0='x',<5>,1:0] - [@1,1:1=' ',<6>,1:1] - [@2,2:2='0',<2>,1:2] - [@3,3:3=' ',<6>,1:3] - [@4,4:4='1',<2>,1:4] - [@5,5:5=' ',<6>,1:5] - [@6,6:6='a',<5>,1:6] - [@7,7:7='.',<4>,1:7] - [@8,8:8='b',<5>,1:8] - [@9,9:9=' ',<6>,1:9] - [@10,10:10='a',<5>,1:10] - [@11,11:11='.',<4>,1:11] - [@12,12:12='l',<5>,1:12] - [@13,13:12='',<-1>,1:13] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - HexLiteral : '0' ('x'|'X') HexDigit+ ; - DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) ; - FloatingPointLiteral : ('0x' | '0X') HexDigit* ('.' HexDigit*)? ; - DOT : '.' ; - ID : 'a'..'z'+ ; - fragment HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ; - WS : (' '|'\n')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class KeywordID extends BaseLexerTestDescriptor { - public String input = "end eend ending a"; - /** - [@0,0:2='end',<1>,1:0] - [@1,3:3=' ',<3>,1:3] - [@2,4:7='eend',<2>,1:4] - [@3,8:8=' ',<3>,1:8] - [@4,9:14='ending',<2>,1:9] - [@5,15:15=' ',<3>,1:15] - [@6,16:16='a',<2>,1:16] - [@7,17:16='',<-1>,1:17] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - KEND : 'end' ; // has priority - ID : 'a'..'z'+ ; - WS : (' '|'\n')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NonGreedyClosure extends BaseLexerTestDescriptor { - /** - //blah - //blah - */ - @CommentHasStringValue - public String input; - - /** - [@0,0:6='//blah\n',<1>,1:0] - [@1,7:13='//blah\n',<1>,2:0] - [@2,14:13='',<-1>,3:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : '//' .*? '\n' CMT*?; - WS : (' '|'\t')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NonGreedyConfigs extends BaseLexerTestDescriptor { - public String input = "ab"; - /** - a - b - [@0,0:0='a',<1>,1:0] - [@1,1:1='b',<3>,1:1] - [@2,2:1='',<-1>,1:2] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - I : .*? ('a' | 'ab') {} ; - WS : (' '|'\n') -> skip ; - J : . {}; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NonGreedyOptional extends BaseLexerTestDescriptor { - /** - //blah - //blah - */ - @CommentHasStringValue - public String input; - - /** - [@0,0:6='//blah\n',<1>,1:0] - [@1,7:13='//blah\n',<1>,2:0] - [@2,14:13='',<-1>,3:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : '//' .*? '\n' CMT??; - WS : (' '|'\t')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NonGreedyPositiveClosure extends BaseLexerTestDescriptor { - /** - //blah - //blah - */ - @CommentHasStringValue - public String input; - - /** - [@0,0:6='//blah\n',<1>,1:0] - [@1,7:13='//blah\n',<1>,2:0] - [@2,14:13='',<-1>,3:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : ('//' .*? '\n')+?; - WS : (' '|'\t')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NonGreedyTermination1 extends BaseLexerTestDescriptor { - public String input = "\"hi\"\"mom\""; - /** - [@0,0:3='"hi"',<1>,1:0] - [@1,4:8='"mom"',<1>,1:4] - [@2,9:8='',<-1>,1:9] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - STRING : '"' ('""' | .)*? '"'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NonGreedyTermination2 extends BaseLexerTestDescriptor { - public String input = "\"\"\"mom\""; - /** - [@0,0:6='"""mom"',<1>,1:0] - [@1,7:6='',<-1>,1:7] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - STRING : '"' ('""' | .)+? '"'; - */ - @CommentHasStringValue - public String grammar; - - } - - /* - * This is a regression test for antlr/antlr4#224: "Parentheses without - * quantifier in lexer rules have unclear effect". - * https://github.com/antlr/antlr4/issues/224 - */ - public static class Parentheses extends BaseLexerTestDescriptor { - public String input = "-.-.-!"; - /** - [@0,0:4='-.-.-',<1>,1:0] - [@1,5:5='!',<3>,1:5] - [@2,6:5='',<-1>,1:6] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - START_BLOCK: '-.-.-'; - ID : (LETTER SEPARATOR) (LETTER SEPARATOR)+; - fragment LETTER: L_A|L_K; - fragment L_A: '.-'; - fragment L_K: '-.-'; - SEPARATOR: '!'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class PositionAdjustingLexer extends BaseLexerTestDescriptor { - /** - tokens - tokens { - notLabel - label1 = - label2 += - notLabel - */ - @CommentHasStringValue - public String input; - - /** - [@0,0:5='tokens',<6>,1:0] - [@1,7:12='tokens',<4>,2:0] - [@2,14:14='{',<3>,2:7] - [@3,16:23='notLabel',<6>,3:0] - [@4,25:30='label1',<5>,4:0] - [@5,32:32='=',<1>,4:7] - [@6,34:39='label2',<5>,5:0] - [@7,41:42='+=',<2>,5:7] - [@8,44:51='notLabel',<6>,6:0] - [@9,53:52='',<-1>,7:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "PositionAdjustingLexer"; - - /** - lexer grammar PositionAdjustingLexer; - - @definitions { - - } - - @members { - - } - - ASSIGN : '=' ; - PLUS_ASSIGN : '+=' ; - LCURLY: '{'; - - // 'tokens' followed by '{' - TOKENS : 'tokens' IGNORED '{'; - - // IDENTIFIER followed by '+=' or '=' - LABEL - : IDENTIFIER IGNORED '+'? '=' - ; - - IDENTIFIER - : [a-zA-Z_] [a-zA-Z0-9_]* - ; - - fragment - IGNORED - : [ \t\r\n]* - ; - - NEWLINE - : [\r\n]+ -> skip - ; - - WS - : [ \t]+ -> skip - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class QuoteTranslation extends BaseLexerTestDescriptor { - public String input = "\""; - /** - [@0,0:0='"',<1>,1:0] - [@1,1:0='',<-1>,1:1] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - QUOTE : '"' ; // make sure this compiles - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class RecursiveLexerRuleRefWithWildcardPlus extends BaseLexerTestDescriptor { - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : '/*' (CMT | .)+? '*' '/' ; - WS : (' '|'\n')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class RecursiveLexerRuleRefWithWildcardPlus_1 extends RecursiveLexerRuleRefWithWildcardPlus { - public String input = - "/* ick */\n"+ - "/* /* */\n"+ - "/* /*nested*/ */\n"; // stuff on end of comment matches another rule - - public String output = - "[@0,0:8='/* ick */',<1>,1:0]\n"+ - "[@1,9:9='\\n',<2>,1:9]\n"+ - "[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n"+ - "[@3,35:35='\\n',<2>,3:16]\n"+ - "[@4,36:35='',<-1>,4:0]\n"; - } - - public static class RecursiveLexerRuleRefWithWildcardPlus_2 extends RecursiveLexerRuleRefWithWildcardPlus { - public String input = - "/* ick */x\n"+ - "/* /* */x\n"+ - "/* /*nested*/ */x\n"; - - public String output = - "[@0,0:8='/* ick */',<1>,1:0]\n"+ - "[@1,10:10='\\n',<2>,1:10]\n"+ - "[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n"+ - "[@3,38:38='\\n',<2>,3:17]\n"+ - "[@4,39:38='',<-1>,4:0]\n"; - - /** - line 1:9 token recognition error at: 'x' - line 3:16 token recognition error at: 'x' - */ - @CommentHasStringValue - public String errors; - } - - public static abstract class RecursiveLexerRuleRefWithWildcardStar extends BaseLexerTestDescriptor { - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - CMT : '/*' (CMT | .)*? '*' '/' ; - WS : (' '|'\n')+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class RecursiveLexerRuleRefWithWildcardStar_1 extends RecursiveLexerRuleRefWithWildcardStar { - public String input = - "/* ick */\n"+ - "/* /* */\n"+ - "/* /*nested*/ */\n"; - - public String output = - "[@0,0:8='/* ick */',<1>,1:0]\n"+ - "[@1,9:9='\\n',<2>,1:9]\n"+ - "[@2,10:34='/* /* */\\n/* /*nested*/ */',<1>,2:0]\n"+ - "[@3,35:35='\\n',<2>,3:16]\n"+ - "[@4,36:35='',<-1>,4:0]\n"; - } - - public static class RecursiveLexerRuleRefWithWildcardStar_2 extends RecursiveLexerRuleRefWithWildcardStar { - public String input = - "/* ick */x\n"+ - "/* /* */x\n"+ - "/* /*nested*/ */x\n"; - - public String output = - "[@0,0:8='/* ick */',<1>,1:0]\n"+ - "[@1,10:10='\\n',<2>,1:10]\n"+ - "[@2,11:36='/* /* */x\\n/* /*nested*/ */',<1>,2:0]\n"+ - "[@3,38:38='\\n',<2>,3:17]\n"+ - "[@4,39:38='',<-1>,4:0]\n"; - - /** - line 1:9 token recognition error at: 'x' - line 3:16 token recognition error at: 'x' - */ - @CommentHasStringValue - public String errors; - } - - public static class RefToRuleDoesNotSetTokenNorEmitAnother extends BaseLexerTestDescriptor { - public String input = "34 -21 3"; - - // EOF has no length so range is 8:7 not 8:8 - /** - [@0,0:1='34',<2>,1:0] - [@1,3:5='-21',<1>,1:3] - [@2,7:7='3',<2>,1:7] - [@3,8:7='',<-1>,1:8] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - A : '-' I ; - I : '0'..'9'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Slashes extends BaseLexerTestDescriptor { - public String input = "\\ / \\/ /\\"; - /** - [@0,0:0='\',<1>,1:0] - [@1,2:2='/',<2>,1:2] - [@2,4:5='\/',<3>,1:4] - [@3,7:8='/\',<4>,1:7] - [@4,9:8='',<-1>,1:9] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - Backslash : '\\\\'; - Slash : '/'; - Vee : '\\\\/'; - Wedge : '/\\\\'; - WS : [ \t] -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - /* - * This is a regression test for antlr/antlr4#687 "Empty zero-length tokens - * cannot have lexer commands" and antlr/antlr4#688 "Lexer cannot match - * zero-length tokens" - * https://github.com/antlr/antlr4/issues/687 - * https://github.com/antlr/antlr4/issues/688 - */ - public static class ZeroLengthToken extends BaseLexerTestDescriptor { - public String input = "'xxx'"; - /** - [@0,0:4=''xxx'',<1>,1:0] - [@1,5:4='',<-1>,1:5] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - BeginString - : '\'' -> more, pushMode(StringMode) - ; - mode StringMode; - StringMode_X : 'x' -> more; - StringMode_Done : -> more, mode(EndStringMode); - mode EndStringMode; - EndString : '\'' -> popMode; - */ - @CommentHasStringValue - public String grammar; - } - - /** - * This is a regression test for antlr/antlr4#76 "Serialized ATN strings - * should be split when longer than 2^16 bytes (class file limitation)" - * https://github.com/antlr/antlr4/issues/76 - */ - public static class LargeLexer extends BaseLexerTestDescriptor { - public String input = "KW400"; - /** - [@0,0:4='KW400',<402>,1:0] - [@1,5:4='',<-1>,1:5] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** Look for grammar as resource */ - @Override - public Pair getGrammar() { - String grammar = null; - - final ClassLoader loader = Thread.currentThread().getContextClassLoader(); - final URL stuff = loader.getResource("org/antlr/v4/test/runtime/LargeLexer.g4"); - try { - grammar = new String(Files.readAllBytes(Paths.get(stuff.toURI()))); - } - catch (Exception e) { - System.err.println("Cannot find grammar org/antlr/v4/test/runtime/LargeLexer.g4"); - } - - return new Pair<>(grammarName, grammar); - } - } - - /** - * This is a regression test for antlr/antlr4#2709 "PHP target generates - * invalid output when $ is used as part of the literal in lexer rule" - * https://github.com/antlr/antlr4/issues/2709 - */ - public static class EscapeTargetStringLiteral extends BaseLexerTestDescriptor { - /** - [@0,0:-1='',<-1>,1:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ACTION_WITH_DOLLAR: '$ACTION'; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean ignore(String targetName) { - return !targetName.equals("PHP"); - } - } - - /** https://github.com/antlr/antlr4/issues/1943 */ - public static class StackoverflowDueToNotEscapedHyphen extends BaseLexerTestDescriptor { - public String input = "word"; - - /** - [@0,0:3='word',<1>,1:0] - [@1,4:3='',<-1>,1:4] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - WORD : [a-z-+]+; - */ - @CommentHasStringValue - public String grammar; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ListenersDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ListenersDescriptors.java deleted file mode 100644 index e4bafa7fcf..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ListenersDescriptors.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class ListenersDescriptors { - public static class Basic extends BaseParserTestDescriptor { - public String input = "1 2"; - /** - (a 1 2) - 1 - 2 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - - - - - s - @after { - - - } - : r=a ; - a : INT INT - | ID - ; - MULT: '*' ; - ADD : '+' ; - INT : [0-9]+ ; - ID : [a-z]+ ; - WS : [ \t\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LR extends BaseParserTestDescriptor { - public String input = "1+2*3"; - /** - (e (e 1) + (e (e 2) * (e 3))) - 1 - 2 - 3 - 2 3 2 - 1 2 1 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - - - - - s - @after { - - - } - : r=e ; - e : e op='*' e - | e op='+' e - | INT - ; - MULT: '*' ; - ADD : '+' ; - INT : [0-9]+ ; - ID : [a-z]+ ; - WS : [ \t\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LRWithLabels extends BaseParserTestDescriptor { - public String input = "1(2,3)"; - /** - (e (e 1) ( (eList (e 2) , (e 3)) )) - 1 - 2 - 3 - 1 [13 6] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - - - - - s - @after { - - - } - : r=e ; - e : e '(' eList ')' # Call - | INT # Int - ; - eList : e (',' e)* ; - MULT: '*' ; - ADD : '+' ; - INT : [0-9]+ ; - ID : [a-z]+ ; - WS : [ \t\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class RuleGetters extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - - - - - s - @after { - - - } - : r=a ; - a : b b // forces list - | b // a list still - ; - b : ID | INT; - MULT: '*' ; - ADD : '+' ; - INT : [0-9]+ ; - ID : [a-z]+ ; - WS : [ \t\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class RuleGetters_1 extends RuleGetters { - public String input = "1 2"; - /** - (a (b 1) (b 2)) - 1 2 1 - */ - @CommentHasStringValue - public String output; - } - - public static class RuleGetters_2 extends RuleGetters { - public String input = "abc"; - /** - (a (b abc)) - abc - */ - @CommentHasStringValue - public String output; - } - - public static abstract class TokenGetters extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - - - - - s - @after { - - - } - : r=a ; - a : INT INT - | ID - ; - MULT: '*' ; - ADD : '+' ; - INT : [0-9]+ ; - ID : [a-z]+ ; - WS : [ \t\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TokenGetters_1 extends TokenGetters { - public String input = "1 2"; - /** - (a 1 2) - 1 2 [1, 2] - */ - @CommentHasStringValue - public String output; - } - - public static class TokenGetters_2 extends TokenGetters { - public String input = "abc"; - /** - (a abc) - [@0,0:2='abc',<4>,1:0] - */ - @CommentHasStringValue - public String output; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java deleted file mode 100644 index 5bd26693c7..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParseTreesDescriptors.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class ParseTreesDescriptors { - public static class AltNum extends BaseParserTestDescriptor { - public String input = "xyz"; - public String output = "(a:3 x (b:2 y) z)\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - - options { contextSuperClass=MyRuleNode; } - - - - - s - @init { - - } - @after { - - } - : r=a ; - - a : 'f' - | 'g' - | 'x' b 'z' - ; - b : 'e' {} | 'y' - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ExtraToken extends BaseParserTestDescriptor { - public String input = "xzy"; - public String output = "(a x z y)\n"; - public String errors = "line 1:1 extraneous input 'z' expecting 'y'\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : 'x' 'y' - ; - Z : 'z' - ; - - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ExtraTokensAndAltLabels extends BaseParserTestDescriptor { - public String input = "${ ? a ?}"; - public String output = "(s ${ (v ? a) ? })\n"; - public String errors = - "line 1:3 extraneous input '?' expecting {'a', 'b'}\n"+ - "line 1:7 extraneous input '?' expecting '}'\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - - s - @init { - - } - @after { - - } - : '${' v '}' - ; - - v : A #altA - | B #altB - ; - - A : 'a' ; - B : 'b' ; - - WHITESPACE : [ \n\t\r]+ -> channel(HIDDEN) ; - - ERROR : . ; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean ignore(String targetName) { - return !targetName.matches("Java|Python2|Python3|Node|Swift|CSharp|Dart"); - } - } - - public static class NoViableAlt extends BaseParserTestDescriptor { - public String input = "z"; - public String output = "(a z)\n"; - public String errors = "line 1:0 mismatched input 'z' expecting {'x', 'y'}\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : 'x' | 'y' - ; - Z : 'z' - ; - - */ - @CommentHasStringValue - public String grammar; - - } - - public static class RuleRef extends BaseParserTestDescriptor { - public String input = "yx"; - public String output = "(a (b y) x)\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : b 'x' - ; - b : 'y' - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Sync extends BaseParserTestDescriptor { - public String input = "xzyy!"; - public String output = "(a x z y y !)\n"; - public String errors = "line 1:1 extraneous input 'z' expecting {'y', '!'}\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : 'x' 'y'* '!' - ; - Z : 'z' - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Token2 extends BaseParserTestDescriptor { - public String input = "xy"; - public String output = "(a x y)\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : 'x' 'y' - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TokenAndRuleContextString extends BaseParserTestDescriptor { - public String input = "x"; - /** - [a, s] - (a x) - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : 'x' { - - } ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TwoAltLoop extends BaseParserTestDescriptor { - public String input = "xyyxyxz"; - public String output = "(a x y y x y x z)\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : ('x' | 'y')* 'z' - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TwoAlts extends BaseParserTestDescriptor { - public String input = "y"; - public String output = "(a y)\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s - @init { - - } - @after { - - } - : r=a ; - a : 'x' | 'y' - ; - */ - @CommentHasStringValue - public String grammar; - - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserErrorsDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserErrorsDescriptors.java deleted file mode 100644 index b6f1c46860..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserErrorsDescriptors.java +++ /dev/null @@ -1,645 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class ParserErrorsDescriptors { - public static class ConjuringUpToken extends BaseParserTestDescriptor { - public String input = "ac"; - public String output = "conjured=[@-1,-1:-1='',<2>,1:1]\n"; - public String errors = "line 1:1 missing 'b' at 'c'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' x='b' {} 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ConjuringUpTokenFromSet extends BaseParserTestDescriptor { - public String input = "ad"; - public String output = "conjured=[@-1,-1:-1='',<2>,1:1]\n"; - public String errors = "line 1:1 missing {'b', 'c'} at 'd'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' x=('b'|'c') {} 'd' ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * Regression test for "Getter for context is not a list when it should be". - * https://github.com/antlr/antlr4/issues/19 - */ - public static class ContextListGetters extends BaseParserTestDescriptor { - public String input = "abab"; - public String output = "abab\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members{ - - } - s : (a | b)+; - a : 'a' {}; - b : 'b' {}; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class DuplicatedLeftRecursiveCall extends BaseParserTestDescriptor { - public String output = null; - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : expr EOF; - expr : 'x' - | expr expr - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class DuplicatedLeftRecursiveCall_1 extends DuplicatedLeftRecursiveCall { - public String input = "x"; - } - - public static class DuplicatedLeftRecursiveCall_2 extends DuplicatedLeftRecursiveCall { - public String input = "xx"; - } - - public static class DuplicatedLeftRecursiveCall_3 extends DuplicatedLeftRecursiveCall { - public String input = "xxx"; - } - - public static class DuplicatedLeftRecursiveCall_4 extends DuplicatedLeftRecursiveCall { - public String input = "xxxx"; - } - - /** - * This is a regression test for #45 "NullPointerException in ATNConfig.hashCode". - * https://github.com/antlr/antlr4/issues/45 - *

- * The original cause of this issue was an error in the tool's ATN state optimization, - * which is now detected early in {@link ATNSerializer} by ensuring that all - * serialized transitions point to states which were not removed. - */ - public static class InvalidATNStateRemoval extends BaseParserTestDescriptor { - public String input = "x:x"; - public String output = null; - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : ID ':' expr; - expr : primary expr? {} | expr '->' ID; - primary : ID; - ID : [a-z]+; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for #6 "NullPointerException in getMissingSymbol". - * https://github.com/antlr/antlr4/issues/6 - */ - public static class InvalidEmptyInput extends BaseParserTestDescriptor { - public String input = ""; - public String output = null; - public String errors = "line 1:0 mismatched input '' expecting ID\n"; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : ID+; - ID : [a-z]+; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LL1ErrorInfo extends BaseParserTestDescriptor { - public String input = "dog and software"; - public String output = "{'hardware', 'software'}\n"; - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : animal (AND acClass)? service EOF; - animal : (DOG | CAT ); - service : (HARDWARE | SOFTWARE) ; - AND : 'and'; - DOG : 'dog'; - CAT : 'cat'; - HARDWARE: 'hardware'; - SOFTWARE: 'software'; - WS : ' ' -> skip ; - acClass - @init - {} - : ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LL2 extends BaseParserTestDescriptor { - public String input = "ae"; - public String output = null; - public String errors = "line 1:1 no viable alternative at input 'ae'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b' - | 'a' 'c' - ; - q : 'e' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LL3 extends BaseParserTestDescriptor { - public String input = "abe"; - public String output = null; - public String errors = "line 1:2 no viable alternative at input 'abe'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b'* 'c' - | 'a' 'b' 'd' - ; - q : 'e' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LLStar extends BaseParserTestDescriptor { - public String input = "aaae"; - public String output = null; - public String errors = "line 1:3 no viable alternative at input 'aaae'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a'+ 'b' - | 'a'+ 'c' - ; - q : 'e' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class MultiTokenDeletionBeforeLoop extends BaseParserTestDescriptor { - public String input = "aacabc"; - public String output = null; - public String errors = "line 1:1 extraneous input 'a' expecting {'b', 'c'}\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b'* 'c'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class MultiTokenDeletionBeforeLoop2 extends BaseParserTestDescriptor { - public String input = "aacabc"; - public String output = null; - public String errors = "line 1:1 extraneous input 'a' expecting {'b', 'z', 'c'}\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' ('b'|'z'{})* 'c'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class MultiTokenDeletionDuringLoop extends BaseParserTestDescriptor { - public String input = "abaaababc"; - public String output = null; - /** - line 1:2 extraneous input 'a' expecting {'b', 'c'} - line 1:6 extraneous input 'a' expecting {'b', 'c'} - */ - @CommentHasStringValue - public String errors; - - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b'* 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class MultiTokenDeletionDuringLoop2 extends BaseParserTestDescriptor { - public String input = "abaaababc"; - public String output = null; - /** - line 1:2 extraneous input 'a' expecting {'b', 'z', 'c'} - line 1:6 extraneous input 'a' expecting {'b', 'z', 'c'} - */ - @CommentHasStringValue - public String errors; - - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' ('b'|'z'{})* 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NoViableAltAvoidance extends BaseParserTestDescriptor { - public String input = "a."; - public String output = null; - public String errors = "line 1:1 mismatched input '.' expecting '!'\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : e '!' ; - e : 'a' 'b' - | 'a' - ; - DOT : '.' ; - WS : [ \t\r\n]+ -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleSetInsertion extends BaseParserTestDescriptor { - public String input = "ad"; - public String output = null; - public String errors = "line 1:1 missing {'b', 'c'} at 'd'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' ('b'|'c') 'd' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleSetInsertionConsumption extends BaseParserTestDescriptor { - public String input = "ad"; - public String output = "[@0,0:0='a',<3>,1:0]\n"; - public String errors = "line 1:1 missing {'b', 'c'} at 'd'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - myset: ('b'|'c') ; - a: 'a' myset 'd' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletion extends BaseParserTestDescriptor { - public String input = "aab"; - public String output = null; - public String errors = "line 1:1 extraneous input 'a' expecting 'b'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionBeforeAlt extends BaseParserTestDescriptor { - public String input = "ac"; - public String output = null; - public String errors = "line 1:0 extraneous input 'a' expecting {'b', 'c'}\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ('b' | 'c') - ; - q : 'a' - ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionBeforeLoop extends BaseParserTestDescriptor { - public String input = "aabc"; - public String output = null; - /** - line 1:1 extraneous input 'a' expecting {, 'b'} - line 1:3 token recognition error at: 'c' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b'* EOF ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionBeforeLoop2 extends BaseParserTestDescriptor { - public String input = "aabc"; - public String output = null; - /** - line 1:1 extraneous input 'a' expecting {, 'b', 'z'} - line 1:3 token recognition error at: 'c' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' ('b'|'z'{})* EOF ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionBeforePredict extends BaseParserTestDescriptor { - public String input = "caaab"; - public String output = null; - public String errors = "line 1:0 extraneous input 'c' expecting 'a'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a'+ 'b' - | 'a'+ 'c' - ; - q : 'e' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionConsumption extends BaseParserTestDescriptor { - public String input = "aabd"; - public String output = "[@2,2:2='b',<1>,1:2]\n"; - public String errors = "line 1:1 extraneous input 'a' expecting {'b', 'c'}\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - myset: ('b'|'c') ; - a: 'a' myset 'd' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionDuringLoop extends BaseParserTestDescriptor { - public String input = "ababbc"; - public String output = null; - public String errors = "line 1:2 extraneous input 'a' expecting {'b', 'c'}\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b'* 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionDuringLoop2 extends BaseParserTestDescriptor { - public String input = "ababbc"; - public String output = null; - public String errors = "line 1:2 extraneous input 'a' expecting {'b', 'z', 'c'}\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' ('b'|'z'{})* 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenDeletionExpectingSet extends BaseParserTestDescriptor { - public String input = "aab"; - public String output = null; - public String errors = "line 1:1 extraneous input 'a' expecting {'b', 'c'}\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' ('b'|'c') ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SingleTokenInsertion extends BaseParserTestDescriptor { - public String input = "ac"; - public String output = null; - public String errors = "line 1:1 missing 'b' at 'c'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b' 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TokenMismatch extends BaseParserTestDescriptor { - public String input = "aa"; - public String output = null; - public String errors = "line 1:1 mismatched input 'a' expecting 'b'\n"; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : 'a' 'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TokenMismatch2 extends BaseParserTestDescriptor { - public String input = "( ~FORCE_ERROR~ "; - public String output = null; - public String errors = "line 1:2 mismatched input '~FORCE_ERROR~' expecting {')', ID}\n"; - public String startRule = "stat"; - public String grammarName = "T"; - - /** - grammar T; - - stat: ( '(' expr? ')' )? EOF ; - expr: ID '=' STR ; - - ERR : '~FORCE_ERROR~' ; - ID : [a-zA-Z]+ ; - STR : '"' ~["]* '"' ; - WS : [ \t\r\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TokenMismatch3 extends BaseParserTestDescriptor { - public String input = ""; - public String output = null; - public String errors = "line 1:0 mismatched input '' expecting {'(', BOOLEAN_LITERAL, ID, '$'}\n"; - public String startRule = "expression"; - public String grammarName = "T"; - - /** - grammar T; - - expression - : value - | expression op=AND expression - | expression op=OR expression - ; - value - : BOOLEAN_LITERAL - | ID - | ID1 - | '(' expression ')' - ; - - AND : '&&'; - OR : '||'; - - BOOLEAN_LITERAL : 'true' | 'false'; - - ID : [a-z]+; - ID1 : '$'; - - WS : [ \t\r\n]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ExtraneousInput extends BaseParserTestDescriptor { - public String input = "baa"; - public String output = null; - public String errors = "line 1:0 mismatched input 'b' expecting {, 'a'}\n"; - public String startRule = "file"; - public String grammarName = "T"; - - /** - grammar T; - - member : 'a'; - body : member*; - file : body EOF; - B : 'b'; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean ignore(String targetName) { - return !"Java".equals(targetName) && !"Swift".equals(targetName) && !"Dart".equals(targetName); - } - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java deleted file mode 100644 index d2b0931f09..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/ParserExecDescriptors.java +++ /dev/null @@ -1,920 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class ParserExecDescriptors { - public static class APlus extends BaseParserTestDescriptor { - public String input = "a b c"; - public String output = "abc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ID+ { - - }; - ID : 'a'..'z'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AStar_1 extends BaseParserTestDescriptor { - public String input = ""; - public String output = "\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ID* { - - }; - ID : 'a'..'z'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AStar_2 extends BaseParserTestDescriptor { - public String input = "a b c"; - public String output = "abc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ID* { - - }; - ID : 'a'..'z'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AorAPlus extends BaseParserTestDescriptor { - public String input = "a b c"; - public String output = "abc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|ID)+ { - - }; - ID : 'a'..'z'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AorAStar_1 extends BaseParserTestDescriptor { - public String input = ""; - public String output = "\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|ID)* { - - }; - ID : 'a'..'z'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AorAStar_2 extends BaseParserTestDescriptor { - public String input = "a b c"; - public String output = "abc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|ID)* { - - }; - ID : 'a'..'z'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AorB extends BaseParserTestDescriptor { - public String input = "34"; - public String output = "alt 2\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ID { - - } | INT { - - }; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AorBPlus extends BaseParserTestDescriptor { - public String input = "a 34 c"; - public String output = "a34c\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|INT{ - })+ { - - }; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AorBStar_1 extends BaseParserTestDescriptor { - public String input = ""; - public String output = "\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|INT{ - })* { - - }; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class AorBStar_2 extends BaseParserTestDescriptor { - public String input = "a 34 c"; - public String output = "a34c\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|INT{ - })* { - - }; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Basic extends BaseParserTestDescriptor { - public String input = "abc 34"; - public String output = "abc34\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ID INT { - - }; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - /** Match assignments, ignore other tokens with wildcard. */ - public static class Wildcard extends BaseParserTestDescriptor { - public String input = "x=10; abc;;;; y=99;"; - public String output = "x=10;\ny=99;\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (assign|.)+ EOF ; - assign : ID '=' INT ';' { - - } ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - } - - /** - * This test ensures that {@link org.antlr.v4.runtime.atn.ParserATNSimulator} does not produce a - * {@link StackOverflowError} when it encounters an {@code EOF} transition - * inside a closure. - */ - public static class EOFInClosure extends BaseParserTestDescriptor { - public String input = "x"; - public String output = null; - public String errors = null; - public String startRule = "prog"; - public String grammarName = "T"; - - /** - grammar T; - prog : stat EOF; - stat : 'x' ('y' | EOF)*?; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class IfIfElseGreedyBinding1 extends BaseParserTestDescriptor { - public String input = "if y if y x else x"; - /** - if y x else x - if y if y x else x - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : statement+ ; - statement : 'x' | ifStatement; - ifStatement : 'if' 'y' statement ('else' statement)? { - - }; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> channel(HIDDEN); - */ - @CommentHasStringValue - public String grammar; - - } - - public static class IfIfElseGreedyBinding2 extends BaseParserTestDescriptor { - public String input = "if y if y x else x"; - /** - if y x else x - if y if y x else x - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : statement+ ; - statement : 'x' | ifStatement; - ifStatement : 'if' 'y' statement ('else' statement|) { - - }; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> channel(HIDDEN); - */ - @CommentHasStringValue - public String grammar; - - } - - public static class IfIfElseNonGreedyBinding1 extends BaseParserTestDescriptor { - public String input = "if y if y x else x"; - /** - if y x - if y if y x else x - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : statement+ ; - statement : 'x' | ifStatement; - ifStatement : 'if' 'y' statement ('else' statement)?? { - - }; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> channel(HIDDEN); - */ - @CommentHasStringValue - public String grammar; - - } - - public static class IfIfElseNonGreedyBinding2 extends BaseParserTestDescriptor { - public String input = "if y if y x else x"; - /** - if y x - if y if y x else x - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : statement+ ; - statement : 'x' | ifStatement; - ifStatement : 'if' 'y' statement (|'else' statement) { - - }; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> channel(HIDDEN); - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LL1OptionalBlock_1 extends BaseParserTestDescriptor { - public String input = ""; - public String output = "\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|{}INT)? { - - }; - ID : 'a'..'z'+; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LL1OptionalBlock_2 extends BaseParserTestDescriptor { - public String input = "a"; - public String output = "a\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|{}INT)? { - - }; - ID : 'a'..'z'+; - INT : '0'..'9'+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for antlr/antlr4#195 "label 'label' type - * mismatch with previous definition: TOKEN_LABEL!=RULE_LABEL" - * https://github.com/antlr/antlr4/issues/195 - */ - public static class LabelAliasingAcrossLabeledAlternatives extends BaseParserTestDescriptor { - public String input = "xy"; - /** - x - y - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : a* EOF; - a - : label=subrule {} #One - | label='y' {} #Two - ; - subrule : 'x'; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Labels extends BaseParserTestDescriptor { - public String input = "abc 34;"; - public String output = null; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : b1=b b2+=b* b3+=';' ; - b : id_=ID val+=INT*; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for antlr/antlr4#299 "Repeating subtree not - * accessible in visitor". - * https://github.com/antlr/antlr4/issues/299 - */ - public static class ListLabelForClosureContext extends BaseParserTestDescriptor { - public String input = "a"; - public String output = null; - public String errors = null; - public String startRule = "expression"; - public String grammarName = "T"; - - /** - grammar T; - ifStatement - @after { - })> - } - : 'if' expression - ( ( 'then' - executableStatement* - elseIfStatement* // \<--- problem is here; should yield a list not node - elseStatement? - 'end' 'if' - ) | executableStatement ) - ; - - elseIfStatement - : 'else' 'if' expression 'then' executableStatement* - ; - expression : 'a' ; - executableStatement : 'a' ; - elseStatement : 'a' ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for #270 "Fix operator += applied to a set of - * tokens". - * https://github.com/antlr/antlr4/issues/270 - */ - public static class ListLabelsOnSet extends BaseParserTestDescriptor { - public String input = "abc 34;"; - public String output = null; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : b b* ';' ; - b : ID val+=(INT | FLOAT)*; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - FLOAT : [0-9]+ '.' [0-9]+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This test ensures that {@link ParserATNSimulator} produces a correct - * result when the grammar contains multiple explicit references to - * {@code EOF} inside of parser rules. - */ - public static class MultipleEOFHandling extends BaseParserTestDescriptor { - public String input = "x"; - public String output = null; - public String errors = null; - public String startRule = "prog"; - public String grammarName = "T"; - - /** - grammar T; - prog : ('x' | 'x' 'y') EOF EOF; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This test is meant to detect regressions of bug antlr/antlr4#41. - * https://github.com/antlr/antlr4/issues/41 - */ - public static class Optional_1 extends BaseParserTestDescriptor { - public String input = "x"; - public String output = null; - public String errors = null; - public String startRule = "stat"; - public String grammarName = "T"; - - /** - grammar T; - stat : ifstat | 'x'; - ifstat : 'if' stat ('else' stat)?; - WS : [ \n\t]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Optional_2 extends BaseParserTestDescriptor { - public String input = "if x"; - public String output = null; - public String errors = null; - public String startRule = "stat"; - public String grammarName = "T"; - - /** - grammar T; - stat : ifstat | 'x'; - ifstat : 'if' stat ('else' stat)?; - WS : [ \n\t]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Optional_3 extends BaseParserTestDescriptor { - public String input = "if x else x"; - public String output = null; - public String errors = null; - public String startRule = "stat"; - public String grammarName = "T"; - - /** - grammar T; - stat : ifstat | 'x'; - ifstat : 'if' stat ('else' stat)?; - WS : [ \n\t]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Optional_4 extends BaseParserTestDescriptor { - public String input = "if if x else x"; - public String output = null; - public String errors = null; - public String startRule = "stat"; - public String grammarName = "T"; - - /** - grammar T; - stat : ifstat | 'x'; - ifstat : 'if' stat ('else' stat)?; - WS : [ \n\t]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /* - * This is a regression test for antlr/antlr4#561 "Issue with parser - * generation in 4.2.2" - * https://github.com/antlr/antlr4/issues/561 - */ - public static class ParserProperty extends BaseParserTestDescriptor { - public String input = "abc"; - public String output = "valid\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - - a : {}? ID {} - ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This test is meant to test the expected solution to antlr/antlr4#42. - * https://github.com/antlr/antlr4/issues/42 - */ - public static class PredicatedIfIfElse extends BaseParserTestDescriptor { - public String input = "if x if x a else b"; - public String output = null; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : stmt EOF ; - stmt : ifStmt | ID; - ifStmt : 'if' ID stmt ('else' stmt | { })> }?); - ELSE : 'else'; - ID : [a-zA-Z]+; - WS : [ \\n\\t]+ -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for antlr/antlr4#334 "BailErrorStrategy: bails - * out on proper input". - * https://github.com/antlr/antlr4/issues/334 - */ - public static class PredictionIssue334 extends BaseParserTestDescriptor { - public String input = "a"; - public String output = "(file_ (item a) )\n"; - public String errors = null; - public String startRule = "file_"; - public String grammarName = "T"; - - /** - grammar T; - file_ @init{ - - } - @after { - - } - : item (SEMICOLON item)* SEMICOLON? EOF ; - item : A B?; - SEMICOLON: ';'; - A : 'a'|'A'; - B : 'b'|'B'; - WS : [ \r\t\n]+ -> skip; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for antlr/antlr4#561 "Issue with parser - * generation in 4.2.2" - * https://github.com/antlr/antlr4/issues/561 - */ - public static class ReferenceToATN_1 extends BaseParserTestDescriptor { - public String input = ""; - public String output = "\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|ATN)* ATN? {} ; - ID : 'a'..'z'+ ; - ATN : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ReferenceToATN_2 extends BaseParserTestDescriptor { - public String input = "a 34 c"; - public String output = "a34c\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (ID|ATN)* ATN? {} ; - ID : 'a'..'z'+ ; - ATN : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - } - - /** - * This is a regression test for antlr/antlr4#1545, case 1. - */ - public static class OpenDeviceStatement_Case1 extends BaseParserTestDescriptor { - public String input = "OPEN DEVICE DEVICE"; - public String output = "OPEN DEVICE DEVICE\n"; - public String errors = null; - public String startRule = "statement"; - public String grammarName = "OpenDeviceStatement"; - - /** - grammar OpenDeviceStatement; - program : statement+ '.' ; - - statement : 'OPEN' ( 'DEVICE' ( OPT1 | OPT2 | OPT3 )? )+ {} ; - - OPT1 : 'OPT-1'; - OPT2 : 'OPT-2'; - OPT3 : 'OPT-3'; - - WS : (' '|'\n')+ -> channel(HIDDEN); - */ - @CommentHasStringValue - public String grammar; - } - - /** - * This is a regression test for antlr/antlr4#1545, case 2. - */ - public static class OpenDeviceStatement_Case2 extends BaseParserTestDescriptor { - public String input = "OPEN DEVICE DEVICE"; - public String output = "OPEN DEVICE DEVICE\n"; - public String errors = null; - public String startRule = "statement"; - public String grammarName = "OpenDeviceStatement"; - - /** - grammar OpenDeviceStatement; - program : statement+ '.' ; - - statement : 'OPEN' ( 'DEVICE' ( (OPT1) | OPT2 | OPT3 )? )+ {} ; - - OPT1 : 'OPT-1'; - OPT2 : 'OPT-2'; - OPT3 : 'OPT-3'; - - WS : (' '|'\n')+ -> channel(HIDDEN); - */ - @CommentHasStringValue - public String grammar; - } - - /** - * This is a regression test for antlr/antlr4#1545, case 3. - */ - public static class OpenDeviceStatement_Case3 extends BaseParserTestDescriptor { - public String input = "OPEN DEVICE DEVICE."; - public String output = "OPEN DEVICE DEVICE\n"; - public String errors = null; - public String startRule = "statement"; - public String grammarName = "OpenDeviceStatement"; - - /** - grammar OpenDeviceStatement; - program : statement+ '.' ; - - statement : 'OPEN' ( 'DEVICE' ( (OPT1) | OPT2 | OPT3 )? )+ {} ; - - OPT1 : 'OPT-1'; - OPT2 : 'OPT-2'; - OPT3 : 'OPT-3'; - - WS : (' '|'\n')+ -> channel(HIDDEN); - */ - @CommentHasStringValue - public String grammar; - } - - /** - * This is a regression test for antlr/antlr4#2301. - */ - public static class OrderingPredicates extends BaseParserTestDescriptor { - public String input = "POINT AT X"; - public String output = null; - public String errors = null; - public String startRule = "expr"; - public String grammarName = "Issue2301"; - - /** - grammar Issue2301; - - SPACES: [ \t\r\n]+ -> skip; - - AT: 'AT'; - X : 'X'; - Y : 'Y'; - - ID: [A-Z]+; - - constant - : 'DUMMY' - ; - - expr - : ID constant? - | expr AT X - | expr AT Y - ; - */ - @CommentHasStringValue - public String grammar; - } - - /** - * This is a regression test for antlr/antlr4#2728 - * It should generate correct code for grammars with more than 65 tokens. - * https://github.com/antlr/antlr4/pull/2728#issuecomment-622940562 - */ - public static class TokenOffset extends BaseParserTestDescriptor { - public String input = "12 34 56 66"; - public String output = "12345666\n"; - - public String errors = null; - public String startRule = "a"; - public String grammarName = "L"; - - /** - grammar L; - a : ('1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'10'|'11'|'12'|'13'|'14'|'15'|'16' - |'17'|'18'|'19'|'20'|'21'|'22'|'23'|'24'|'25'|'26'|'27'|'28'|'29'|'30'|'31'|'32' - |'33'|'34'|'35'|'36'|'37'|'38'|'39'|'40'|'41'|'42'|'43'|'44'|'45'|'46'|'47'|'48' - |'49'|'50'|'51'|'52'|'53'|'54'|'55'|'56'|'57'|'58'|'59'|'60'|'61'|'62'|'63'|'64' - |'65'|'66')+ { - - }; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/PerformanceDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/PerformanceDescriptors.java deleted file mode 100644 index 69dbd9a07d..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/PerformanceDescriptors.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -import java.util.Arrays; - -public class PerformanceDescriptors { - /* - * This is a regression test for antlr/antlr4#192 "Poor performance of - * expression parsing". - * https://github.com/antlr/antlr4/issues/192 - */ - public static abstract class ExpressionGrammar extends BaseParserTestDescriptor { - public String output = null; - public String errors = null; - public String startRule = "program"; - public String grammarName = "Expr"; - - /** - grammar Expr; - - program: expr EOF; - - expr - : ID - | 'not' expr - | expr 'and' expr - | expr 'or' expr - ; - - ID: [a-zA-Z_][a-zA-Z_0-9]*; - WS: [ \t\n\r\f]+ -> skip; - ERROR: .; - */ - @CommentHasStringValue - public String grammar; - } - - public static class ExpressionGrammar_1 extends ExpressionGrammar { - /** - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 - */ - @CommentHasStringValue - public String input; - } - - public static class ExpressionGrammar_2 extends ExpressionGrammar { - /** - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and X6 and not X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and X7 and not X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and X8 and not X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and X9 and not X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and X10 and not X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and X11 and not X12 or not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 and not X8 and not X9 and not X10 and not X11 and X12 - */ - @CommentHasStringValue - public String input; - } - - /** Test for https://github.com/antlr/antlr4/issues/1398. - * Seeing through a large expression takes 5 _minutes_ on - * my fast box to complete. After fix, it's instantaneous. - */ - public static abstract class DropLoopEntryBranchInLRRule extends BaseParserTestDescriptor { - public String grammarName = "Expr"; - public String startRule = "stat"; - - /** - grammar Expr; - - stat : expr ';' - | expr '.' - ; - - expr - : ID - | 'not' expr - | expr 'and' expr - | expr 'or' expr - | '(' ID ')' expr - | expr '?' expr ':' expr - | 'between' expr 'and' expr - ; - - ID: [a-zA-Z_][a-zA-Z_0-9]*; - WS: [ \t\n\r\f]+ -> skip; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean ignore(String targetName) { - return !Arrays.asList("Java", "CSharp", "Python2", "Python3", "Node", "Cpp", "Swift", "Dart").contains(targetName); - } - } - - public static class DropLoopEntryBranchInLRRule_1 extends DropLoopEntryBranchInLRRule { - /** - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 - ; - */ - @CommentHasStringValue - public String input; - } - - public static class DropLoopEntryBranchInLRRule_2 extends DropLoopEntryBranchInLRRule { - /** - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 or - X1 and X2 and X3 and X4 and X5 and X6 and X7 - . - */ // Different in final token - @CommentHasStringValue - public String input; - } - - public static class DropLoopEntryBranchInLRRule_3 extends DropLoopEntryBranchInLRRule { - /** - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 or - not X1 and not X2 and not X3 and not X4 and not X5 and not X6 and not X7 - ; - */ - @CommentHasStringValue - public String input; - } - - public static class DropLoopEntryBranchInLRRule_4 extends DropLoopEntryBranchInLRRule { - /** - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 and - between X1 and X2 or between X3 and X4 - ; - */ - @CommentHasStringValue - public String input; - - @Override - public boolean ignore(String targetName) { - // passes, but still too slow in Python and JavaScript - return !Arrays.asList("Java", "CSharp", "Cpp", "Swift", "Dart").contains(targetName); - } - } - - public static class DropLoopEntryBranchInLRRule_5 extends DropLoopEntryBranchInLRRule { - /** - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z or - X ? Y : Z - ; - */ - @CommentHasStringValue - public String input; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexerDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexerDescriptors.java deleted file mode 100644 index 3b91a50f23..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SemPredEvalLexerDescriptors.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseLexerTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class SemPredEvalLexerDescriptors { - // Test for https://github.com/antlr/antlr4/issues/958 - public static class RuleSempredFunction extends BaseLexerTestDescriptor { - public String input = "aaa"; - /** - [@0,0:0='a',<1>,1:0] - [@1,1:1='a',<1>,1:1] - [@2,2:2='a',<1>,1:2] - [@3,3:2='',<-1>,1:3] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - T : 'a' {}? ; - */ - @CommentHasStringValue - public String grammar; - } - - public static class DisableRule extends BaseLexerTestDescriptor { - public String input = "enum abc"; - /** - [@0,0:3='enum',<2>,1:0] - [@1,5:7='abc',<3>,1:5] - [@2,8:7='',<-1>,1:8] - s0-' '->:s5=>4 - s0-'a'->:s6=>3 - s0-'e'->:s1=>3 - :s1=>3-'n'->:s2=>3 - :s2=>3-'u'->:s3=>3 - :s6=>3-'b'->:s6=>3 - :s6=>3-'c'->:s6=>3 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - E1 : 'enum' { }? ; - E2 : 'enum' { }? ; // winner not E1 or ID - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDFA() { return true; } - } - - public static class EnumNotID extends BaseLexerTestDescriptor { - public String input = "enum abc enum"; - /** - [@0,0:3='enum',<1>,1:0] - [@1,5:7='abc',<2>,1:5] - [@2,9:12='enum',<1>,1:9] - [@3,13:12='',<-1>,1:13] - s0-' '->:s3=>3 - */ - @CommentHasStringValue // - - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ENUM : [a-z]+ { }? ; - ID : [a-z]+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDFA() { return true; } - } - - public static class IDnotEnum extends BaseLexerTestDescriptor { - public String input = "enum abc enum"; - /** - [@0,0:3='enum',<2>,1:0] - [@1,5:7='abc',<2>,1:5] - [@2,9:12='enum',<2>,1:9] - [@3,13:12='',<-1>,1:13] - s0-' '->:s2=>3 - */ - @CommentHasStringValue // - - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ENUM : [a-z]+ { }? ; - ID : [a-z]+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDFA() { return true; } - } - - public static class IDvsEnum extends BaseLexerTestDescriptor { - public String input = "enum abc enum"; - - /** - [@0,0:3='enum',<2>,1:0] - [@1,5:7='abc',<2>,1:5] - [@2,9:12='enum',<2>,1:9] - [@3,13:12='',<-1>,1:13] - s0-' '->:s5=>3 - s0-'a'->:s4=>2 - s0-'e'->:s1=>2 - :s1=>2-'n'->:s2=>2 - :s2=>2-'u'->:s3=>2 - :s4=>2-'b'->:s4=>2 - :s4=>2-'c'->:s4=>2 - */ - @CommentHasStringValue // no 'm'-> transition...conflicts with pred - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ENUM : 'enum' { }? ; - ID : 'a'..'z'+ ; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDFA() { return true; } - } - - public static class Indent extends BaseLexerTestDescriptor { - public String input = "abc\n def \n"; - /** - INDENT - [@0,0:2='abc',<1>,1:0] - [@1,3:3='\n',<3>,1:3] - [@2,4:5=' ',<2>,2:0] - [@3,6:8='def',<1>,2:2] - [@4,9:10=' ',<4>,2:5] - [@5,11:11='\n',<3>,2:7] - [@6,12:11='',<-1>,3:0] - s0-' - '->:s2=>3 - s0-'a'->:s1=>1 - s0-'d'->:s1=>1 - :s1=>1-'b'->:s1=>1 - :s1=>1-'c'->:s1=>1 - :s1=>1-'e'->:s1=>1 - :s1=>1-'f'->:s1=>1 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ID : [a-z]+ ; - INDENT : [ \t]+ { }? - { } ; - NL : '\n'; - WS : [ \t]+ ; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDFA() { return true; } - } - - public static class LexerInputPositionSensitivePredicates extends BaseLexerTestDescriptor { - public String input = "a cde\nabcde\n"; - /** - a - cde - ab - cde - [@0,0:0='a',<1>,1:0] - [@1,2:4='cde',<2>,1:2] - [@2,6:7='ab',<1>,2:0] - [@3,8:10='cde',<2>,2:2] - [@4,12:11='',<-1>,3:0] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - WORD1 : ID1+ { } ; - WORD2 : ID2+ { } ; - fragment ID1 : { \< 2 }? [a-zA-Z]; - fragment ID2 : { >= 2 }? [a-zA-Z]; - WS : (' '|'\n') -> skip; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDFA() { return true; } - } - - public static class PredicatedKeywords extends BaseLexerTestDescriptor { - public String input = "enum enu a"; - /** - enum! - ID enu - ID a - [@0,0:3='enum',<1>,1:0] - [@1,5:7='enu',<2>,1:5] - [@2,9:9='a',<2>,1:9] - [@3,10:9='',<-1>,1:10] - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = ""; - public String grammarName = "L"; - - /** - lexer grammar L; - ENUM : [a-z]+ { }? { } ; - ID : [a-z]+ { } ; - WS : [ \n] -> skip ; - */ - @CommentHasStringValue - public String grammar; - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SemPredEvalParserDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SemPredEvalParserDescriptors.java deleted file mode 100644 index b09f074881..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SemPredEvalParserDescriptors.java +++ /dev/null @@ -1,751 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class SemPredEvalParserDescriptors { - public static class ActionHidesPreds extends BaseParserTestDescriptor { - public String input = "x x y"; - /** - alt 1 - alt 1 - alt 1 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members {} - s : a+ ; - a : {} ID {}? {} - | {} ID {}? {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** Regular non-forced actions can create side effects used by semantic - * predicates and so we cannot evaluate any semantic predicate - * encountered after having seen a regular action. This includes - * during global follow operations. - */ - public static class ActionsHidePredsInGlobalFOLLOW extends BaseParserTestDescriptor { - public String input = "a!"; - /** - eval=true - parse - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members { - - } - s : e {} {}? {} '!' ; - t : e {} {}? ID ; - e : ID | ; // non-LL(1) so we use ATN - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for antlr/antlr4#196 - * "element+ in expression grammar doesn't parse properly" - * https://github.com/antlr/antlr4/issues/196 - */ - public static class AtomWithClosureInTranslatedLRRule extends BaseParserTestDescriptor { - public String input = "a+b+a"; - public String output = null; - public String errors = null; - public String startRule = "start"; - public String grammarName = "T"; - - /** - grammar T; - start : e[0] EOF; - e[int _p] - : ( 'a' | 'b'+ ) ( {3 >= $_p}? '+' e[4] )* - ; - - */ - @CommentHasStringValue - public String grammar; - - } - - /** We cannot collect predicates that are dependent on local context if - * we are doing a global follow. They appear as if they were not there at all. - */ - public static class DepedentPredsInGlobalFOLLOW extends BaseParserTestDescriptor { - public String input = "a!"; - /** - eval=true - parse - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members { - - } - s : a[99] ; - a[int i] : e {}? {} '!' ; - b[int i] : e {}? ID ; - e : ID | ; // non-LL(1) so we use ATN - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class DependentPredNotInOuterCtxShouldBeIgnored extends BaseParserTestDescriptor { - public String input = "a;"; - public String output = "alt 2\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : b[2] ';' | b[2] '.' ; // decision in s drills down to ctx-dependent pred in a; - b[] : a[] ; - a[] - : {}? ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * This is a regression test for antlr/antlr4#218 "ANTLR4 EOF Related Bug". - * https://github.com/antlr/antlr4/issues/218 - */ - public static class DisabledAlternative extends BaseParserTestDescriptor { - public String input = "hello"; - public String output = null; - public String errors = null; - public String startRule = "cppCompilationUnit"; - public String grammarName = "T"; - - /** - grammar T; - cppCompilationUnit : content+ EOF; - content: anything | {}? .; - anything: ANY_CHAR; - ANY_CHAR: [_a-zA-Z0-9]; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class IndependentPredNotPassedOuterCtxToAvoidCastException extends BaseParserTestDescriptor { - public String input = "a;"; - public String output = "alt 2\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : b ';' | b '.' ; - b : a ; - a - : {}? ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NoTruePredsThrowsNoViableAlt extends BaseParserTestDescriptor { - public String input = "y 3 x 4"; - public String output = null; - public String errors = "line 1:0 no viable alternative at input 'y'\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a a; - a : {}? ID INT {} - | {}? ID INT {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Order extends BaseParserTestDescriptor { - public String input = "x y"; - /** - alt 1 - alt 1 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a {} a; // do 2x: once in ATN, next in DFA; - // action blocks lookahead from falling off of 'a' - // and looking into 2nd 'a' ref. !ctx dependent pred - a : ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** Loopback doesn't eval predicate at start of alt */ - public static abstract class PredFromAltTestedInLoopBack extends BaseParserTestDescriptor { - public String startRule = "file_"; - public String grammarName = "T"; - - /** - grammar T; - file_ - @after {} - : para para EOF ; - para: paraContent NL NL ; - paraContent : ('s'|'x'|{})>}? NL)+ ; - NL : '\n' ; - s : 's' ; - X : 'x' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class PredFromAltTestedInLoopBack_1 extends PredFromAltTestedInLoopBack { - public String input = "s\n\n\nx\n"; - public String output = "(file_ (para (paraContent s) \\n \\n) (para (paraContent \\n x \\n)) )\n"; - /** - line 5:0 mismatched input '' expecting {'s', ' - ', 'x'} - */ - @CommentHasStringValue - public String errors; - - @Override - public boolean ignore(String targetName) { - return !"Java".equals(targetName) && !"Swift".equals(targetName); - } - } - - public static class PredFromAltTestedInLoopBack_2 extends PredFromAltTestedInLoopBack { - public String input = "s\n\n\nx\n\n"; - public String output = "(file_ (para (paraContent s) \\n \\n) (para (paraContent \\n x) \\n \\n) )\n"; - public String errors = null; - } - - public static abstract class PredTestedEvenWhenUnAmbig extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "primary"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members {} - primary - : ID {} - | {}? 'enum' {} - ; - ID : [a-z]+ ; - WS : [ \t\n\r]+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class PredTestedEvenWhenUnAmbig_1 extends PredTestedEvenWhenUnAmbig { - public String input = "abc"; - public String output = "ID abc\n"; - } - - public static class PredTestedEvenWhenUnAmbig_2 extends PredTestedEvenWhenUnAmbig { - public String input = "enum"; - public String output = null; - public String errors = "line 1:0 no viable alternative at input 'enum'\n"; - } - - /** - * In this case, we're passing a parameter into a rule that uses that - * information to predict the alternatives. This is the special case - * where we know exactly which context we are in. The context stack - * is empty and we have not dipped into the outer context to make a decision. - */ - public static class PredicateDependentOnArg extends BaseParserTestDescriptor { - public String input = "a b"; - /** - alt 2 - alt 1 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members {} - s : a[2] a[1]; - a[int i] - : {}? ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** - * In this case, we have to ensure that the predicates are not tested - * during the closure after recognizing the 1st ID. The closure will - * fall off the end of 'a' 1st time and reach into the a[1] rule - * invocation. It should not execute predicates because it does not know - * what the parameter is. The context stack will not be empty and so - * they should be ignored. It will not affect recognition, however. We - * are really making sure the ATN simulation doesn't crash with context - * object issues when it encounters preds during FOLLOW. - */ - public static class PredicateDependentOnArg2 extends BaseParserTestDescriptor { - public String input = "a b"; - public String output = null; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members {} - s : a[2] a[1]; - a[int i] - : {}? ID - | {}? ID - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** During a global follow operation, we still collect semantic - * predicates as long as they are not dependent on local context - */ - public static class PredsInGlobalFOLLOW extends BaseParserTestDescriptor { - public String input = "a!"; - /** - eval=true - parse - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members { - - } - s : e {}? {} '!' ; - t : e {}? ID ; - e : ID | ; // non-LL(1) so we use ATN - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class RewindBeforePredEval extends BaseParserTestDescriptor { - public String input = "y 3 x 4"; - /** - alt 2 - alt 1 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a a; - a : {}? ID INT {} - | {}? ID INT {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class Simple extends BaseParserTestDescriptor { - public String input = "x y 3"; - /** - alt 2 - alt 2 - alt 3 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a a a; // do 3x: once in ATN, next in DFA then INT in ATN - a : {}? ID {} - | {}? ID {} - | INT {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SimpleValidate extends BaseParserTestDescriptor { - public String input = "x"; - public String output = null; - public String errors = "line 1:0 no viable alternative at input 'x'\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a ; - a : {}? ID {} - | {}? INT {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SimpleValidate2 extends BaseParserTestDescriptor { - public String input = "3 4 x"; - /** - alt 2 - alt 2 - */ - @CommentHasStringValue - public String output; - - public String errors = "line 1:4 no viable alternative at input 'x'\n"; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a a a; - a : {}? ID {} - | {}? INT {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ToLeft extends BaseParserTestDescriptor { - public String input = "x x y"; - /** - alt 2 - alt 2 - alt 2 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a+ ; - a : {}? ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - /** In this case, we use predicates that depend on global information - * like we would do for a symbol table. We simply execute - * the predicates assuming that all necessary information is available. - * The i++ action is done outside of the prediction and so it is executed. - */ - public static class ToLeftWithVaryingPredicate extends BaseParserTestDescriptor { - public String input = "x x y"; - /** - i=1 - alt 2 - i=2 - alt 1 - i=3 - alt 2 - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - @parser::members {} - s : ({ - - } a)+ ; - a : {}? ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class TwoUnpredicatedAlts extends BaseParserTestDescriptor { - public String input = "x; y"; - /** - alt 1 - alt 1 - */ - @CommentHasStringValue - public String output; - - /** - line 1:0 reportAttemptingFullContext d=0 (a), input='x' - line 1:0 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='x' - line 1:3 reportAttemptingFullContext d=0 (a), input='y' - line 1:3 reportAmbiguity d=0 (a): ambigAlts={1, 2}, input='y' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : {} a ';' a; // do 2x: once in ATN, next in DFA - a : ID {} - | ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDiagnosticErrors() { return true; } - } - - public static class TwoUnpredicatedAltsAndOneOrthogonalAlt extends BaseParserTestDescriptor { - public String input = "34; x; y"; - /** - alt 1 - alt 2 - alt 2 - */ - @CommentHasStringValue - public String output; - - /** - line 1:4 reportAttemptingFullContext d=0 (a), input='x' - line 1:4 reportAmbiguity d=0 (a): ambigAlts={2, 3}, input='x' - line 1:7 reportAttemptingFullContext d=0 (a), input='y' - line 1:7 reportAmbiguity d=0 (a): ambigAlts={2, 3}, input='y' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : {} a ';' a ';' a; - a : INT {} - | ID {} // must pick this one for ID since pred is false - | ID {} - | {}? ID {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - @Override - public boolean showDiagnosticErrors() { return true; } - } - - public static class UnpredicatedPathsInAlt extends BaseParserTestDescriptor { - public String input = "x 4"; - public String output = "alt 1\n"; - public String errors = null; - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a {} - | b {} - ; - a : {}? ID INT - | ID INT - ; - b : ID ID - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ValidateInDFA extends BaseParserTestDescriptor { - public String input = "x ; y"; - public String output = null; - /** - line 1:0 no viable alternative at input 'x' - line 1:4 no viable alternative at input 'y' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "s"; - public String grammarName = "T"; - - /** - grammar T; - s : a ';' a; - // ';' helps us to resynchronize without consuming - // 2nd 'a' reference. We our testing that the DFA also - // throws an exception if the validating predicate fails - a : {}? ID {} - | {}? INT {} - ; - ID : 'a'..'z'+ ; - INT : '0'..'9'+; - WS : (' '|'\n') -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SetsDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SetsDescriptors.java deleted file mode 100644 index e877558992..0000000000 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/SetsDescriptors.java +++ /dev/null @@ -1,683 +0,0 @@ -/* - * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -package org.antlr.v4.test.runtime.descriptors; - -import org.antlr.v4.test.runtime.BaseParserTestDescriptor; -import org.antlr.v4.test.runtime.CommentHasStringValue; - -public class SetsDescriptors { - public static class CharSetLiteral extends BaseParserTestDescriptor { - public String input = "A a B b"; - /** - A - a - B - b - */ - @CommentHasStringValue - public String output; - - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : (A {})+ ; - A : [AaBb] ; - WS : (' '|'\n')+ -> skip ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ComplementSet extends BaseParserTestDescriptor { - public String input = "a"; - public String output = null; - /** - line 1:0 token recognition error at: 'a' - line 1:1 missing {} at '' - */ - @CommentHasStringValue - public String errors; - - public String startRule = "parse"; - public String grammarName = "T"; - - /** - grammar T; - parse : ~NEW_LINE; - NEW_LINE: '\\r'? '\\n'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LexerOptionalSet extends BaseParserTestDescriptor { - public String input = "ac"; - public String output = "ac\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : ('a'|'b')? 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LexerPlusSet extends BaseParserTestDescriptor { - public String input = "abaac"; - public String output = "abaac\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : ('a'|'b')+ 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class LexerStarSet extends BaseParserTestDescriptor { - public String input = "abaac"; - public String output = "abaac\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : ('a'|'b')* 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NotChar extends BaseParserTestDescriptor { - public String input = "x"; - public String output = "x\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : ~'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NotCharSet extends BaseParserTestDescriptor { - public String input = "x"; - public String output = "x\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : ~('b'|'c') ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NotCharSetWithLabel extends BaseParserTestDescriptor { - public String input = "x"; - public String output = "x\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : h=~('b'|'c') ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class NotCharSetWithRuleRef3 extends BaseParserTestDescriptor { - public String input = "x"; - public String output = "x\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : ('a'|B) ; // this doesn't collapse to set but works - fragment - B : ~('a'|'c') ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class OptionalLexerSingleElement extends BaseParserTestDescriptor { - public String input = "bc"; - public String output = "bc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : 'b'? 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class OptionalSet extends BaseParserTestDescriptor { - public String input = "ac"; - public String output = "ac\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ('a'|'b')? 'c' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class OptionalSingleElement extends BaseParserTestDescriptor { - public String input = "bc"; - public String output = "bc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A? 'c' {} ; - A : 'b' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ParserNotSet extends BaseParserTestDescriptor { - public String input = "zz"; - public String output = "z\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : t=~('x'|'y') 'z' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ParserNotToken extends BaseParserTestDescriptor { - public String input = "zz"; - public String output = "zz\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ~'x' 'z' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ParserNotTokenWithLabel extends BaseParserTestDescriptor { - public String input = "zz"; - public String output = "z\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : t=~'x' 'z' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class ParserSet extends BaseParserTestDescriptor { - public String input = "x"; - public String output = "x\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : t=('x'|'y') {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class PlusLexerSingleElement extends BaseParserTestDescriptor { - public String input = "bbbbc"; - public String output = "bbbbc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : 'b'+ 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class PlusSet extends BaseParserTestDescriptor { - public String input = "abaac"; - public String output = "abaac\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ('a'|'b')+ 'c' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class RuleAsSet extends BaseParserTestDescriptor { - public String input = "b"; - public String output = "b\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a @after {} : 'a' | 'b' |'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class SeqDoesNotBecomeSet extends BaseParserTestDescriptor { - public String input = "34"; - public String output = "34\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : C {} ; - fragment A : '1' | '2'; - fragment B : '3' '4'; - C : A | B; - */ - @CommentHasStringValue - public String grammar; - - } - - public static abstract class StarLexerSingleElement extends BaseParserTestDescriptor { - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : A {} ; - A : 'b'* 'c' ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class StarLexerSingleElement_1 extends StarLexerSingleElement { - public String input = "bbbbc"; - public String output = "bbbbc\n"; - } - - public static class StarLexerSingleElement_2 extends StarLexerSingleElement { - public String input = "c"; - public String output = "c\n"; - } - - public static class StarSet extends BaseParserTestDescriptor { - public String input = "abaac"; - public String output = "abaac\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : ('a'|'b')* 'c' {} ; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class UnicodeUnescapedBMPSet extends BaseParserTestDescriptor { - public String input = "a\u00E4\u3042\u4E9Cc"; - public String output = "a\u00E4\u3042\u4E9Cc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS {} ; - // These are actually not escaped -- Java passes the - // raw unescaped Unicode values to the grammar compiler. - LETTERS : ('a'|'\u00E4'|'\u4E9C'|'\u3042')* 'c'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class UnicodeUnescapedBMPRangeSet extends BaseParserTestDescriptor { - public String input = "a\u00E1\u00E4\u00E1\u00E2\u00E5d"; - public String output = "a\u00E1\u00E4\u00E1\u00E2\u00E5d\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS* 'd' {} ; - // These are actually not escaped -- Java passes the - // raw unescaped Unicode values to the grammar compiler. - LETTERS : ('a'|'\u00E0'..'\u00E5'); - */ - @CommentHasStringValue - public String grammar; - - } - - public static class UnicodeEscapedBMPSet extends BaseParserTestDescriptor { - public String input = "a\u00E4\u3042\u4E9Cc"; - public String output = "a\u00E4\u3042\u4E9Cc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS {} ; - // Note the double-backslash to avoid Java passing - // unescaped values as part of the grammar. - LETTERS : ('a'|'\\u00E4'|'\\u4E9C'|'\\u3042')* 'c'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class UnicodeEscapedBMPRangeSet extends BaseParserTestDescriptor { - public String input = "a\u00E1\u00E4\u00E1\u00E2\u00E5d"; - public String output = "a\u00E1\u00E4\u00E1\u00E2\u00E5d\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS* 'd' {} ; - // Note the double-backslash to avoid Java passing - // unescaped values as part of the grammar. - LETTERS : ('a'|'\\u00E0'..'\\u00E5'); - */ - @CommentHasStringValue - public String grammar; - - } - - // TODO(bhamiltoncx): This needs to be an error, the V3 - // runtime used by the tool doesn't really understand unescaped code points > - // U+FFFF. - // public static class UnicodeUnescapedSMPSet extends BaseParserTestDescriptor { - // public String input = new StringBuilder() - // .append("a") - // .appendCodePoint(0x1D5C2) - // .appendCodePoint(0x1D5CE) - // .appendCodePoint(0x1D5BA) - // .append("c") - // .toString(); - // public String output = new StringBuilder() - // .append("a") - // .appendCodePoint(0x1D5C2) - // .appendCodePoint(0x1D5CE) - // .appendCodePoint(0x1D5BA) - // .append("c\n") - // .toString(); - // public String errors = null; - // public String startRule = "a"; - // public String grammarName = "T"; - - // /** - // grammar T; - // a : LETTERS {} ; - // // These are actually not escaped -- Java passes the - // // raw unescaped Unicode values to the grammar compiler. - // // - // // Each sequence is the UTF-16 encoding of a raw Unicode - // // SMP code point. - // LETTERS : ('a'|'\uD835\uDDBA'|'\uD835\uDDBE'|'\uD835\uDDC2'|'\uD835\uDDC8'|'\uD835\uDDCE')* 'c'; - // */ - // @CommentHasStringValue - // public String grammar; - - // } - - public static class UnicodeEscapedSMPSet extends BaseParserTestDescriptor { - public String input = new StringBuilder() - .append("a") - .appendCodePoint(0x1D5C2) - .appendCodePoint(0x1D5CE) - .appendCodePoint(0x1D5BA) - .append("c") - .toString(); - public String output = new StringBuilder() - .append("a") - .appendCodePoint(0x1D5C2) - .appendCodePoint(0x1D5CE) - .appendCodePoint(0x1D5BA) - .append("c\n") - .toString(); - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS {} ; - // Note the double-backslash to avoid Java passing - // unescaped values as part of the grammar. - LETTERS : ('a'|'\\u{1D5BA}'|'\\u{1D5BE}'|'\\u{1D5C2}'|'\\u{1D5C8}'|'\\u{1D5CE}')* 'c'; - */ - @CommentHasStringValue - public String grammar; - - } - - // Turns out Tool.java uses ANTLR 3's runtime, which means it can't use - // CodePointCharStream to understand unescaped code points > U+FFFF. - // - // TODO(bhamiltoncx): This needs to be an error, since we don't currently plan - // to port Tool.java to use ANTLR 4's runtime. - - // public static class UnicodeUnescapedSMPRangeSet extends BaseParserTestDescriptor { - // public String input = new StringBuilder() - // .append("a") - // .appendCodePoint(0x1D5C2) - // .appendCodePoint(0x1D5CE) - // .appendCodePoint(0x1D5BA) - // .append("d") - // .toString(); - // public String output = new StringBuilder() - // .append("a") - // .appendCodePoint(0x1D5C2) - // .appendCodePoint(0x1D5CE) - // .appendCodePoint(0x1D5BA) - // .append("d\n") - // .toString(); - // public String errors = null; - // public String startRule = "a"; - // public String grammarName = "T"; - - // /** - // grammar T; - // a : LETTERS* 'd' {} ; - // // These are actually not escaped -- Java passes the - // // raw unescaped Unicode values to the grammar compiler. - // LETTERS : ('a'|'\uD83D\uDE00'..'\uD83E\uDD43'); - // */ - // @CommentHasStringValue - // public String grammar; - - // } - - public static class UnicodeEscapedSMPRangeSet extends BaseParserTestDescriptor { - public String input = new StringBuilder() - .append("a") - .appendCodePoint(0x1F609) - .appendCodePoint(0x1F942) - .appendCodePoint(0x1F700) - .append("d") - .toString(); - public String output = new StringBuilder() - .append("a") - .appendCodePoint(0x1F609) - .appendCodePoint(0x1F942) - .appendCodePoint(0x1F700) - .append("d\n") - .toString(); - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS* 'd' {} ; - // Note the double-backslash to avoid Java passing - // unescaped values as part of the grammar. - LETTERS : ('a'|'\\u{1F600}'..'\\u{1F943}'); - */ - @CommentHasStringValue - public String grammar; - - } - - public static class UnicodeEscapedSMPRangeSetMismatch extends BaseParserTestDescriptor { - // Test the code points just before and just after the range. - public String input = new StringBuilder() - .append("a") - .appendCodePoint(0x1F5FF) - .appendCodePoint(0x1F944) - .append("d") - .toString(); - public String output = "ad\n"; - public String errors = new StringBuilder() - .append("line 1:1 token recognition error at: '") - .appendCodePoint(0x1F5FF) - .append("'\n") - .append("line 1:2 token recognition error at: '") - .appendCodePoint(0x1F944) - .append("'\n") - .toString(); - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS* 'd' {} ; - // Note the double-backslash to avoid Java passing - // unescaped values as part of the grammar. - LETTERS : ('a'|'\\u{1F600}'..'\\u{1F943}'); - */ - @CommentHasStringValue - public String grammar; - - } - - public static class UnicodeNegatedBMPSetIncludesSMPCodePoints extends BaseParserTestDescriptor { - public String input = "a\uD83D\uDE33\uD83D\uDE21\uD83D\uDE1D\uD83E\uDD13c"; - public String output = "a\uD83D\uDE33\uD83D\uDE21\uD83D\uDE1D\uD83E\uDD13c\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS {} ; - LETTERS : 'a' ~('b')+ 'c'; - */ - @CommentHasStringValue - public String grammar; - - } - - public static class UnicodeNegatedSMPSetIncludesBMPCodePoints extends BaseParserTestDescriptor { - public String input = "abc"; - public String output = "abc\n"; - public String errors = null; - public String startRule = "a"; - public String grammarName = "T"; - - /** - grammar T; - a : LETTERS {} ; - LETTERS : 'a' ~('\\u{1F600}'..'\\u{1F943}')+ 'c'; - */ - @CommentHasStringValue - public String grammar; - - } -} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseGoTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseGoTest.java index 4c9717dabe..69f02de2a5 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseGoTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/BaseGoTest.java @@ -152,10 +152,7 @@ protected boolean rawGenerateAndBuildRecognizer(String grammarFileName, boolean defaultListener, String... extraOptions) { ErrorQueue equeue = antlrOnString(getTempParserDirPath(), "Go", grammarFileName, grammarStr, defaultListener, extraOptions); - if (!equeue.errors.isEmpty()) { - return false; - } - return true; + return equeue.errors.isEmpty(); } protected void rawBuildRecognizerTestFile(String parserName, diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java index cd1bcc2742..7c4f6bbf97 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeLexers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java index ce29ab1a00..824b9b2733 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestCompositeParsers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java index e90645b39c..391cb998ef 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestFullContextParsing.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java index ab492c4aef..75f7ce45ec 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLeftRecursion.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java index c4c967e80a..4037505e2d 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java index da01840ddb..d7bc998ca3 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestLexerExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java index 012c0e2ac7..4d18e2d1a1 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestListeners.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java index 9b93978227..bf0b18c8c4 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParseTrees.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java index 4b339cccc5..fd08ecb08d 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java index 5a453fcc2d..a46fb9d909 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestParserExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java index d73b49cad3..36e4438ebc 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestPerformance.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java index 1b632cd334..b7ed596bda 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalLexer.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java index 4e487e6589..1457a38da1 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSemPredEvalParser.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java index 860cbf081d..42403d7bea 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestSets.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; @@ -28,6 +27,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Go"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Go"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java index 43a47558d5..f8e33bd6a3 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/BaseJavaTest.java @@ -56,11 +56,9 @@ import java.util.Set; import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertTrue; import static org.antlr.v4.test.runtime.BaseRuntimeTest.writeFile; -import static org.junit.Assert.assertArrayEquals; public class BaseJavaTest extends BaseRuntimeTestSupport implements RuntimeTestSupport { @@ -127,8 +125,6 @@ protected boolean compile(String... fileNames) { } JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); -// DiagnosticCollector diagnostics = -// new DiagnosticCollector(); StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); @@ -189,7 +185,7 @@ public ParseTree execParser(String startRuleName, String input, public ParseTree execStartRule(String startRuleName, Parser parser) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { - Method startRule = null; + Method startRule; Object[] args = null; try { startRule = parser.getClass().getMethod(startRuleName); diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeLexers.java index 58b316c0e9..44cb30d58c 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeLexers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeParsers.java index 2b3a1b153a..80aae96468 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestCompositeParsers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestFullContextParsing.java index ca6ec83d6d..0791e566b4 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestFullContextParsing.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestIntegerList.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestIntegerList.java index 909a4f3b69..eee769f806 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestIntegerList.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestIntegerList.java @@ -37,7 +37,7 @@ public void surrogateRangeIntegerToCharArray() { // Java allows dangling surrogates, so (currently) we do // as well. We could change this if desired. l.add(0xDC00); - char expected[] = new char[] { 0xDC00 }; + char[] expected = new char[] { 0xDC00 }; assertArrayEquals(expected, l.toCharArray()); } @@ -55,7 +55,7 @@ public void unicodeBMPIntegerListToCharArray() { l.add(0x35); l.add(0x4E94); l.add(0xFF15); - char expected[] = new char[] { 0x35, 0x4E94, 0xFF15 }; + char[] expected = new char[] { 0x35, 0x4E94, 0xFF15 }; assertArrayEquals(expected, l.toCharArray()); } @@ -65,7 +65,7 @@ public void unicodeSMPIntegerListToCharArray() { l.add(0x104A5); l.add(0x116C5); l.add(0x1D7FB); - char expected[] = new char[] { 0xD801, 0xDCA5, 0xD805, 0xDEC5, 0xD835, 0xDFFB }; + char[] expected = new char[] { 0xD801, 0xDCA5, 0xD805, 0xDEC5, 0xD835, 0xDFFB }; assertArrayEquals(expected, l.toCharArray()); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLeftRecursion.java index 90b51ac72c..f7db8ee4f8 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLeftRecursion.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerErrors.java index 3ff3741f34..86773f0a21 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerExec.java index adef511c09..3e41814c68 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestLexerExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestListeners.java index 643f562189..f767d3afd5 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestListeners.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParseTrees.java index 4a293cc700..b4008be1a2 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParseTrees.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserErrors.java index 3c6870f95d..a9aeeaca8c 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserExec.java index 1bf39a4219..816a2e15af 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestParserExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestPerformance.java index 097365816e..561b32411c 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestPerformance.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalLexer.java index 0cd917b1a9..a589036784 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalLexer.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalParser.java index 2cbb91b676..9aaafed3b8 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSemPredEvalParser.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSets.java index bc43a44c02..57da2956a0 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestSets.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Java"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Java"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/TestVisitors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/TestVisitors.java index 5eafca122b..7a494d7873 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/TestVisitors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/TestVisitors.java @@ -107,7 +107,8 @@ protected String aggregateResult(String aggregate, String nextResult) { /** * This test verifies that {@link AbstractParseTreeVisitor#visitChildren} does not call - * {@link ParseTreeVisitor#visit} after {@link AbstractParseTreeVisitor#shouldVisitNextChild} returns + * {@link org.antlr.v4.runtime.tree.ParseTreeVisitor#visit} after + * {@link org.antlr.v4.runtime.tree.AbstractParseTreeVisitor#shouldVisitNextChild} returns * {@code false}. */ @Test diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/perf/TimeLexerSpeed.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/perf/TimeLexerSpeed.java index 5d612d089a..e129fb145a 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/perf/TimeLexerSpeed.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/api/perf/TimeLexerSpeed.java @@ -381,7 +381,7 @@ public void lex_legacy_java_utf8(int n, boolean clearLexerDFACache) throws Excep public void lex_new_java_utf8(int n, boolean clearLexerDFACache) throws Exception { ClassLoader loader = TimeLexerSpeed.class.getClassLoader(); - try (InputStream is = loader.getResourceAsStream(Parser_java_file);) { + try (InputStream is = loader.getResourceAsStream(Parser_java_file)) { long size = getResourceSize(loader, Parser_java_file); CharStream input = CharStreams.fromStream(is, StandardCharsets.UTF_8, size); JavaLexer lexer = new JavaLexer(input); @@ -490,7 +490,7 @@ public static String dirname(Path path) { return path.getName(0).toString(); } - public static final long getResourceSize(ClassLoader loader, String resourceName) throws IOException { + public static long getResourceSize(ClassLoader loader, String resourceName) throws IOException { URLConnection uc = null; try { // Sadly, URLConnection is not AutoCloseable, but it leaks resources if diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/BaseNodeTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/BaseNodeTest.java index c14d32b8dc..97bf6388dd 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/BaseNodeTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/BaseNodeTest.java @@ -126,7 +126,7 @@ protected boolean rawGenerateAndBuildRecognizer(String grammarFileName, out.println(newContent); } } catch (IOException e) { - fail("File not found: " + path.toString()); + fail("File not found: " + path); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeLexers.java index f7b5fe3396..991b4dc93e 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeLexers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeParsers.java index 9d9a35c0da..ad9b2f011e 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestCompositeParsers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestFullContextParsing.java index 1aed8bcb7a..aabf53e941 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestFullContextParsing.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLeftRecursion.java index ab892d92fe..03009efb18 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLeftRecursion.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerErrors.java index d4bb1b8121..966e2a6f0d 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerExec.java index 8f6401dc26..6800bf761b 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestLexerExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestListeners.java index 7e429a0632..2d9c7ee9fd 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestListeners.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParseTrees.java index b69f90f412..77d0536517 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParseTrees.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserErrors.java index 8412327aeb..7b721bb914 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserExec.java index 04838a1396..15eb470a52 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestParserExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestPerformance.java index 038d28a723..511d84344d 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestPerformance.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalLexer.java index ffc4b5434b..852674ab7e 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalLexer.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalParser.java index 01b5b95dac..f1e32d78a2 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSemPredEvalParser.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSets.java index 8036d69564..535a6832b7 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/TestSets.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Node"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Node"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/BasePHPTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/BasePHPTest.java index dd5af7cb90..d906ff0cd0 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/BasePHPTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/BasePHPTest.java @@ -20,7 +20,6 @@ import static org.antlr.v4.test.runtime.BaseRuntimeTest.antlrOnString; import static org.antlr.v4.test.runtime.BaseRuntimeTest.writeFile; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; public class BasePHPTest extends BaseRuntimeTestSupport implements RuntimeTestSupport { diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeLexers.java index d1d353875d..991d6ff42a 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeLexers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeParsers.java index dd5b0015a7..fb62abb114 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestCompositeParsers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestFullContextParsing.java index 60efc07184..3ebbe308f7 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestFullContextParsing.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLeftRecursion.java index cb200ef38a..c009012177 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLeftRecursion.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerErrors.java index cd7a5c5968..10c5d0a039 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerExec.java index 03595f564e..8bd82c4912 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestLexerExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestListeners.java index 52260158d5..2269a51f16 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestListeners.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParseTrees.java index 656e14d71e..100c48ae2d 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParseTrees.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserErrors.java index ac3ab88ef6..d0f780c4d6 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserExec.java index 01e3f321ca..5bcbb62ea5 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestParserExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestPerformance.java index 7459d77d82..a14f3153f2 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestPerformance.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalLexer.java index ec7f14efc8..f081b896a8 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalLexer.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalParser.java index 1441444c53..410174fee5 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSemPredEvalParser.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSets.java index 9960453614..65f06ad0fc 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/php/TestSets.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "PHP"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "PHP"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/BasePython2Test.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/BasePython2Test.java index 7167a290ee..5eb8ec8b43 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/BasePython2Test.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/BasePython2Test.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.python.BasePythonTest; import org.stringtemplate.v4.ST; -import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeLexers.java index c68c0f579c..0492de7ab3 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeLexers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeParsers.java index 489249c23c..0edfe429ff 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestCompositeParsers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestFullContextParsing.java index 05eb6038f2..42c47bfa37 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestFullContextParsing.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLeftRecursion.java index 7685599d2e..dcf44e1640 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLeftRecursion.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerErrors.java index 3708c6ff8e..fdde5b1478 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerExec.java index d99851ccea..6e20bc2837 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestLexerExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestListeners.java index 0cbcbcafaf..7579e16767 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestListeners.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParseTrees.java index 311f85cd79..f0a7f6efba 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParseTrees.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserErrors.java index d405643dde..383171ace8 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserExec.java index 95c41f4c93..be868111b4 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestParserExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestPerformance.java index 7248041e8e..26c6225631 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestPerformance.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalLexer.java index 96fbe6c2b6..a4b6b47e0f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalLexer.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalParser.java index a0bc6d0348..39b7842ffa 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSemPredEvalParser.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSets.java index 8f569648df..7e8d8294d0 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestSets.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Python2"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Python2"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeLexers.java index e9511e7423..9eed33e594 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeLexers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeParsers.java index d7f51a5e18..480c48a46f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestCompositeParsers.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestFullContextParsing.java index 4fb28eea08..869e4e1d07 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestFullContextParsing.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLeftRecursion.java index 75c1c575f9..454e19a950 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLeftRecursion.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerErrors.java index 285174171d..1b9cf1655f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerExec.java index c612164a20..c855bd4ac8 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestLexerExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestListeners.java index 6264fa7dd7..6d66cad21e 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestListeners.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParseTrees.java index 5e62ea93ba..255e719e79 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParseTrees.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserErrors.java index 4920c9b8d6..1cbf038535 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserErrors.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserExec.java index f041443e40..0db1053c7b 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestParserExec.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestPerformance.java index 961d98b06d..5d9b61241b 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestPerformance.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalLexer.java index 3f0c659535..05e5011d73 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalLexer.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalParser.java index a931fd2b96..100939a516 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSemPredEvalParser.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSets.java index 1a3ac2641c..272daf1930 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestSets.java @@ -8,7 +8,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -20,6 +19,6 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Python3"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Python3"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java index d142bb5d1e..67a52b8725 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java @@ -194,7 +194,7 @@ private static Pair runProcess(String execPath, String... args) t argsWithArch.addAll(Arrays.asList("arch", "-arm64")); argsWithArch.addAll(Arrays.asList(args)); if(VERBOSE) - System.err.println("Executing " + argsWithArch.toString() + " " + execPath); + System.err.println("Executing " + argsWithArch + " " + execPath); final Process process = Runtime.getRuntime().exec(argsWithArch.toArray(new String[0]), null, new File(execPath)); StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream()); StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream()); @@ -216,10 +216,10 @@ public void run() { stdoutVacuum.join(); stderrVacuum.join(); if(VERBOSE) - System.err.println("Done executing " + argsWithArch.toString() + " " + execPath); + System.err.println("Done executing " + argsWithArch + " " + execPath); if (status != 0) { System.err.println("Process exited with status " + status); - throw new IOException("Process exited with status " + status + ":\n" + stdoutVacuum.toString() + "\n" + stderrVacuum.toString()); + throw new IOException("Process exited with status " + status + ":\n" + stdoutVacuum + "\n" + stderrVacuum); } return new Pair<>(stdoutVacuum.toString(), stderrVacuum.toString()); } @@ -230,7 +230,7 @@ private static void fastFailRunProcess(String workingDir, String... command) thr argsWithArch.addAll(Arrays.asList("arch", "-arm64")); argsWithArch.addAll(Arrays.asList(command)); if(VERBOSE) - System.err.println("Executing " + argsWithArch.toString() + " " + workingDir); + System.err.println("Executing " + argsWithArch + " " + workingDir); ProcessBuilder builder = new ProcessBuilder(argsWithArch.toArray(new String[0])); builder.directory(new File(workingDir)); final Process process = builder.start(); @@ -248,7 +248,7 @@ public void run() { int status = process.waitFor(); timer.cancel(); if(VERBOSE) - System.err.println("Done executing " + argsWithArch.toString() + " " + workingDir); + System.err.println("Done executing " + argsWithArch + " " + workingDir); if (status != 0) { System.err.println("Process exited with status " + status); throw new IOException("Process exited with status " + status); diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeLexers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeLexers.java index 5dad5c8395..817f6fb3c9 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeLexers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeLexers.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.CompositeLexersDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,7 +22,7 @@ public TestCompositeLexers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeLexersDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeLexers", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeParsers.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeParsers.java index faaa7792eb..550e9cf6b8 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeParsers.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestCompositeParsers.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.CompositeParsersDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestCompositeParsers extends BaseRuntimeTest { public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestCompositeParsers(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(CompositeParsersDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("CompositeParsers", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestFullContextParsing.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestFullContextParsing.java index ad3844211f..ccabb6976a 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestFullContextParsing.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestFullContextParsing.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.FullContextParsingDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestFullContextParsing extends BaseRuntimeTest { public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestFullContextParsing(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(FullContextParsingDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("FullContextParsing", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLeftRecursion.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLeftRecursion.java index cfea28411c..6b5c4a7415 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLeftRecursion.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLeftRecursion.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LeftRecursionTests; -import org.antlr.v4.test.runtime.descriptors.LeftRecursionDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,7 +22,7 @@ public TestLeftRecursion(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LeftRecursionDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LeftRecursion", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerErrors.java index 9e094dc486..e056d86144 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerErrors.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.LexerErrorsDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,7 +22,7 @@ public TestLexerErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerErrorsDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerErrors", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerExec.java index 9d5a64716c..2a352d78d4 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestLexerExec.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.LexerExecDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,7 +22,7 @@ public TestLexerExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(LexerExecDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("LexerExec", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestListeners.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestListeners.java index 330680de94..939ca33bcc 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestListeners.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestListeners.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ListenersDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestListeners extends BaseRuntimeTest { public TestListeners(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestListeners(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ListenersDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Listeners", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParseTrees.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParseTrees.java index a03e8fa576..94ec63804c 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParseTrees.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParseTrees.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParseTreesDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestParseTrees extends BaseRuntimeTest { public TestParseTrees(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestParseTrees(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParseTreesDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParseTrees", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserErrors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserErrors.java index 98d310e992..91e6afb317 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserErrors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserErrors.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParserErrorsDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup1; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup1.class) @RunWith(Parameterized.class) public class TestParserErrors extends BaseRuntimeTest { public TestParserErrors(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestParserErrors(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserErrorsDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserErrors", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserExec.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserExec.java index 23b9823dfd..9e7c50186a 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserExec.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestParserExec.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.ParserExecDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestParserExec extends BaseRuntimeTest { public TestParserExec(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestParserExec(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(ParserExecDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("ParserExec", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestPerformance.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestPerformance.java index 469877d3d8..272060af1f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestPerformance.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestPerformance.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.PerformanceDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestPerformance extends BaseRuntimeTest { public TestPerformance(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestPerformance(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(PerformanceDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Performance", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalLexer.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalLexer.java index fe0e380a53..46f5f035e2 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalLexer.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalLexer.java @@ -10,7 +10,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalLexerDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -24,7 +23,7 @@ public TestSemPredEvalLexer(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalLexerDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalLexer", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalParser.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalParser.java index ba231c9674..981c9d6bc4 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalParser.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSemPredEvalParser.java @@ -8,13 +8,12 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; -import org.antlr.v4.test.runtime.category.ParserTests; -import org.antlr.v4.test.runtime.descriptors.SemPredEvalParserDescriptors; +import org.antlr.v4.test.runtime.category.ParserTestsGroup2; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -@Category(ParserTests.class) +@Category(ParserTestsGroup2.class) @RunWith(Parameterized.class) public class TestSemPredEvalParser extends BaseRuntimeTest { public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @@ -23,7 +22,7 @@ public TestSemPredEvalParser(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SemPredEvalParserDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("SemPredEvalParser", "Swift"); } } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSets.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSets.java index e46e9514db..274e8f73bd 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSets.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/TestSets.java @@ -9,7 +9,6 @@ import org.antlr.v4.test.runtime.BaseRuntimeTest; import org.antlr.v4.test.runtime.RuntimeTestDescriptor; import org.antlr.v4.test.runtime.category.LexerTests; -import org.antlr.v4.test.runtime.descriptors.SetsDescriptors; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -23,7 +22,7 @@ public TestSets(RuntimeTestDescriptor descriptor) { @Parameterized.Parameters(name="{0}") public static RuntimeTestDescriptor[] getAllTestDescriptors() { - return BaseRuntimeTest.getRuntimeTestDescriptors(SetsDescriptors.class, "Swift"); + return BaseRuntimeTest.getRuntimeTestDescriptors("Sets", "Swift"); } } diff --git a/runtime/Cpp/README.md b/runtime/Cpp/README.md index 4caf612a11..80289732c3 100644 --- a/runtime/Cpp/README.md +++ b/runtime/Cpp/README.md @@ -16,7 +16,7 @@ The C++ target has been the work of the following people: * Dan McLaughlin, dan.mclaughlin@gmail.com (initial port, got code to compile) * David Sisson, dsisson@google.com (initial port, made the runtime C++ tests runnable) -* [Mike Lischke](www.soft-gems.net), mike@lischke-online.de (brought the initial port to a working library, made most runtime tests passing) +* [Mike Lischke](http://www.soft-gems.net), mike@lischke-online.de (brought the initial port to a working library, made most runtime tests passing) ## Other contributors diff --git a/runtime/Go/antlr/utils.go b/runtime/Go/antlr/utils.go index 8fc8763345..9c7d0a6cda 100644 --- a/runtime/Go/antlr/utils.go +++ b/runtime/Go/antlr/utils.go @@ -8,7 +8,7 @@ import ( "bytes" "errors" "fmt" - "math/bits" + "sort" "strconv" "strings" ) @@ -71,87 +71,59 @@ type hasher interface { hash() int } -const bitsPerWord = 64 - -func indexForBit(bit int) int { - return bit / bitsPerWord -} - -func wordForBit(data []uint64, bit int) uint64 { - idx := indexForBit(bit) - if idx >= len(data) { - return 0 - } - return data[idx] -} - -func maskForBit(bit int) uint64 { - return uint64(1) << (bit % bitsPerWord) -} - -func wordsNeeded(bit int) int { - return indexForBit(bit) + 1 -} - type BitSet struct { - data []uint64 + data map[int]bool } func NewBitSet() *BitSet { - return &BitSet{} + b := new(BitSet) + b.data = make(map[int]bool) + return b } func (b *BitSet) add(value int) { - idx := indexForBit(value) - if idx >= len(b.data) { - size := wordsNeeded(value) - data := make([]uint64, size) - copy(data, b.data) - b.data = data - } - b.data[idx] |= maskForBit(value) + b.data[value] = true } func (b *BitSet) clear(index int) { - idx := indexForBit(index) - if idx >= len(b.data) { - return - } - b.data[idx] &= ^maskForBit(index) + delete(b.data, index) } func (b *BitSet) or(set *BitSet) { - size := intMax(b.minLen(), set.minLen()) - if size > len(b.data) { - data := make([]uint64, size) - copy(data, b.data) - b.data = data - } - for i := 0; i < size; i++ { - b.data[i] |= set.data[i] + for k := range set.data { + b.add(k) } } func (b *BitSet) remove(value int) { - b.clear(value) + delete(b.data, value) } func (b *BitSet) contains(value int) bool { - idx := indexForBit(value) - if idx >= len(b.data) { - return false + return b.data[value] +} + +func (b *BitSet) values() []int { + ks := make([]int, len(b.data)) + i := 0 + for k := range b.data { + ks[i] = k + i++ } - return (b.data[idx] & maskForBit(value)) != 0 + sort.Ints(ks) + return ks } func (b *BitSet) minValue() int { - for i, v := range b.data { - if v == 0 { - continue + min := 2147483647 + + for k := range b.data { + if k < min { + min = k } - return i*bitsPerWord + bits.TrailingZeros64(v) } - return 2147483647 + + return min } func (b *BitSet) equals(other interface{}) bool { @@ -160,16 +132,12 @@ func (b *BitSet) equals(other interface{}) bool { return false } - if b == otherBitSet { - return true - } - if len(b.data) != len(otherBitSet.data) { return false } - for k := range b.data { - if b.data[k] != otherBitSet.data[k] { + for k, v := range b.data { + if otherBitSet.data[k] != v { return false } } @@ -177,35 +145,18 @@ func (b *BitSet) equals(other interface{}) bool { return true } -func (b *BitSet) minLen() int { - for i := len(b.data); i > 0; i-- { - if b.data[i-1] != 0 { - return i - } - } - return 0 -} - func (b *BitSet) length() int { - cnt := 0 - for _, val := range b.data { - cnt += bits.OnesCount64(val) - } - return cnt + return len(b.data) } func (b *BitSet) String() string { - vals := make([]string, 0, b.length()) + vals := b.values() + valsS := make([]string, len(vals)) - for i, v := range b.data { - for v != 0 { - n := bits.TrailingZeros64(v) - vals = append(vals, strconv.Itoa(i*bitsPerWord+n)) - v &= ^(uint64(1) << n) - } + for i, val := range vals { + valsS[i] = strconv.Itoa(val) } - - return "{" + strings.Join(vals, ", ") + "}" + return "{" + strings.Join(valsS, ", ") + "}" } type AltDict struct { diff --git a/runtime/Go/antlr/utils_test.go b/runtime/Go/antlr/utils_test.go deleted file mode 100644 index 88e7aa9fe8..0000000000 --- a/runtime/Go/antlr/utils_test.go +++ /dev/null @@ -1,151 +0,0 @@ -package antlr - -import "testing" - -func TestBitSet(t *testing.T) { - bs1 := NewBitSet() - if got, want := bs1.String(), "{}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 0; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(1), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 2147483647; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } - bs1.add(0) - if got, want := bs1.String(), "{0}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 1; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(0), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 0; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } - bs1.add(63) - if got, want := bs1.String(), "{0, 63}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 2; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(1), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(0), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(63), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 0; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } - bs1.remove(0) - if got, want := bs1.String(), "{63}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 1; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(0), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(63), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 63; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } - bs1.add(20) - if got, want := bs1.String(), "{20, 63}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 2; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(0), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(20), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(63), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 20; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } - bs1.clear(63) - if got, want := bs1.String(), "{20}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 1; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(0), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(20), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(63), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 20; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } - bs2 := NewBitSet() - bs2.add(64) - bs1.or(bs2) - if got, want := bs1.String(), "{20, 64}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 2; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(0), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(20), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(63), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(64), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 20; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } - bs1.remove(20) - if got, want := bs1.String(), "{64}"; got != want { - t.Errorf("String() = %q, want %q", got, want) - } - if got, want := bs1.length(), 1; got != want { - t.Errorf("length() = %q, want %q", got, want) - } - if got, want := bs1.contains(0), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(20), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(63), false; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.contains(64), true; got != want { - t.Errorf("contains(%v) = %v, want %v", 1, got, want) - } - if got, want := bs1.minValue(), 64; got != want { - t.Errorf("minValue() = %v, want %v", got, want) - } -}