diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 83fa0bad9..5c933d8f4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,42 +1,36 @@
-name: Build
+name: Build project
-on: [ push, pull_request, workflow_dispatch ]
-
-env:
- GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
+#workflow_dispatch -- for manual trigger
+on: [ push, workflow_dispatch ]
jobs:
build:
- strategy:
- matrix:
- os: [ ubuntu-latest, macos-latest, windows-latest ]
- runs-on: ${{ matrix.os }}
+
+ runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@v3
- - name: Setup JDK 11
+ - name: Set up JDK 11
uses: actions/setup-java@v3
with:
- distribution: temurin
- java-version: 11
+ java-version: '11'
+ distribution: 'temurin'
- - name: Execute Gradle `build` task
- uses: gradle/gradle-build-action@v2
- with:
- arguments: build --scan
- cache-read-only: |
- ${{ github.ref != 'refs/heads/main' &&
- github.ref != 'refs/heads/dev' }}
- gradle-home-cache-includes: |
- caches
- notifications
- jdks
-
- - name: Upload `build` report
- if: always()
- uses: actions/upload-artifact@v3
+ - name: Install JFlex
+ run: |
+ sudo apt-get install -y jflex
+
+ - name: Install ANTLR4 files
+ run: |
+ sudo apt-get install antlr4
+
+ - name: Generate files
+ run: |
+ ./benchmarks/scripts/generate_all.sh
+
+ - name: Build with Gradle
+ uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
- name: BuildReport-${{ matrix.os }}
- path: build/reports/
\ No newline at end of file
+ arguments: build
diff --git a/.gitignore b/.gitignore
index 0c8ea9a61..4be53026b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,57 +1,31 @@
-# Compiled class file
-*.class
-
# Log file
*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
+*.logs
.gradle
-build/
!gradle/wrapper/gradle-wrapper.jar
-!**/src/main/**/build/
-!**/src/test/**/build/
+**/build/
### IntelliJ IDEA ###
.idea
-
-### Eclipse ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-bin/
-!**/src/main/**/bin/
-!**/src/test/**/bin/
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-
+./test-shared/gen
### VS Code ###
.vscode/
### Mac OS ###
-.DS_Store
\ No newline at end of file
+.DS_Store
+
+### Generated files ###
+/benchmarks/gen/
+/benchmarks/logs/
+
+### Antlr parsers ###
+/benchmarks/src/main/java/org/antlr/*
+!/benchmarks/src/main/java/org/antlr/*.g4
+
+### Jflex scanner ###
+/benchmarks/src/main/java/org/ucfs/scanner/*
+!/benchmarks/src/main/java/org/ucfs/scanner/*.flex
+
+### Large datasets ###
+/benchmarks/src/test/resources/java/correct/*
\ No newline at end of file
diff --git a/README.md b/README.md
index dfac771ed..d85f79c7f 100644
--- a/README.md
+++ b/README.md
@@ -1,191 +1,139 @@
+
# UCFS
-[](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll/actions/workflows/build.yml)
-[](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll/actions/workflows/test.yml)
-
-* [About](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#about)
-* [Usage](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#usage)
- * [From sources](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#from-sources)
- * [Using JAR](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#using-jar)
- * [CFG Format Example](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#cfg-format-example)
- * [RSM Format Example](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#rsm-format-example)
-* [Performance](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#performance)
- * [Graphs](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#graphs)
- * [Grammars](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#grammars)
- * [Results](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#results)
- * [More results](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#more-results)
> Note: project under heavy development!
## About
-**UCFS** is an **U**nuversal **C**ontext-**F**ree **S**olver: a tool to solve problems related to context-free and regular language intersection. Examples of such problems:
+**UCFS** is an **U**niversal **C**ontext-**F**ree **S**olver: a tool to solve problems related to context-free and regular language intersection. Examples of such problems:
- Parsing
- Context-free path querying (CFPQ)
-- Context-free language reachability (CFL-r)
-
-
-
-## Usage
-
-### Command Line Interface
-
-```text
-Usage: kotgll options_list
-Options:
- --input -> Input format (always required) { Value should be one of [string, graph] }
- --grammar -> Grammar format (always required) { Value should be one of [cfg, rsm] }
- --sppf [ON] -> Sppf mode { Value should be one of [on, off] }
- --inputPath -> Path to input txt file (always required) { String }
- --grammarPath -> Path to grammar txt file (always required) { String }
- --outputPath -> Path to output txt file (always required) { String }
- --help, -h -> Usage info
+- Context-free language reachability (CFL-R)
+
+
+
+## Project structure
+```
+├── solver -- base ucfs logic
+├── benchmarks -- comparison with antlr4
+├── generator -- parser and ast node classes generator
+├── examples -- examples of grammars
+└── test-shared -- test cases
+ └── src
+ └── test
+ └── resources -- grammars' description and inputs
```
-### From sources
-
-#### Step 1. Clone repository
-
-`git clone https://github.com/FormalLanguageConstrainedPathQuerying/kotgll.git`
-
-or
-
-`git clone git@github.com:FormalLanguageConstrainedPathQuerying/kotgll.git`
-
-or
-
-`gh repo clone FormalLanguageConstrainedPathQuerying/kotgll`
-
-#### Step 2. Go to the folder
-
-`cd kotgll`
+## Core Algorithm
+UCFS is based on Generalized LL (GLL) parsing algorithm modified to handle language specification in form of Recursive State Machines (RSM-s) and input in form of arbitratry directed edge-labelled graph. Basic ideas described [here](https://arxiv.org/pdf/2312.11925.pdf).
-#### Step 3. Run the help command
+## Grammar Combinator
-`gradle run --args="--help"`
+Kotlin DSL for describing context-free grammars.
-You will see the ["Options list"](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll#command-line-interface) message.
-#### Example
-```text
-gradle run --args="--input graph --grammar rsm --sppf off --inputPath src/test/resources/cli/TestGraphReadWriteCSV/dyck.csv --grammarPath src/test/resources/cli/TestRSMReadWriteTXT/dyck.txt --outputPath ./result.txt"
-```
+### Declaration
-### Using JAR
+Example for A* grammar
-#### Step 1. Download the latest JAR
+*EBNF*
+```
+A = "a"
+S = A*
+```
+*DSL*
+```kotlin
+class AStar : Grammar() {
+ var A = Term("a")
+ val S by Nt().asStart(many(A))
+ }
+```
+### Non-terminals
-```text
-curl -L -O https://github.com/FormalLanguageConstrainedPathQuerying/kotgll/releases/download/v1.0.0/kotgll-1.0.0.jar
-```
+`val S by Nt()`
-#### Step 2. Run JAR with Java
+Non-terminals must be fields of the grammar class. Make sure to declare using delegation `by Nt()`!
-```text
-java -jar kotgll-1.0.0.jar --input graph --grammar rsm --sppf off --inputPath src/test/resources/cli/TestGraphReadWriteCSV/dyck.csv --grammarPath src/test/resources/cli/TestRSMReadWriteTXT/dyck.txt --outputPath ./result.txt
-```
-### CFG Format Example
-
-```text
-StartNonterminal("S")
-Nonterminal("S") -> Terminal("subClassOf_r") Nonterminal("S") Terminal("subClassOf")
-Nonterminal("S") -> Terminal("subClassOf_r") Terminal("subClassOf")
-Nonterminal("S") -> Terminal("type_r") Nonterminal("S") Terminal("type")
-Nonterminal("S") -> Terminal("type_r") Terminal("type")
-```
+Start non-terminal set with method `setStart(nt)`. Or in initialization with Nt method `asStart`.
-### RSM Format Example
-
-```text
-StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=false)
-State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=false)
-State(id=1,nonterminal=Nonterminal("S"),isStart=false,isFinal=false)
-State(id=4,nonterminal=Nonterminal("S"),isStart=false,isFinal=false)
-State(id=3,nonterminal=Nonterminal("S"),isStart=false,isFinal=true)
-State(id=2,nonterminal=Nonterminal("S"),isStart=false,isFinal=false)
-State(id=6,nonterminal=Nonterminal("S"),isStart=false,isFinal=true)
-State(id=5,nonterminal=Nonterminal("S"),isStart=false,isFinal=false)
-TerminalEdge(tail=0,head=1,terminal=Terminal("subClassOf_r"))
-TerminalEdge(tail=0,head=4,terminal=Terminal("type_r"))
-TerminalEdge(tail=1,head=3,terminal=Terminal("subClassOf"))
-NonterminalEdge(tail=1,head=2,nonterminal=Nonterminal("S"))
-TerminalEdge(tail=4,head=6,terminal=Terminal("type"))
-NonterminalEdge(tail=4,head=5,nonterminal=Nonterminal("S"))
-TerminalEdge(tail=2,head=3,terminal=Terminal("subClassOf"))
-TerminalEdge(tail=5,head=6,terminal=Terminal("type"))
-```
+ Can be set only once for grammar.
-## Performance
+### Terminals
-The GLL algorithm has been modified to support graph input.
-The proposed modification has been evaluated on several real graphs for the scenario of finding all pairs of reachability.
+`val A = Term("a")`
-**Machine configuration**: PC with Ubuntu 20.04, Intel Core i7-6700 3.40GHz CPU, DDR4 64Gb RAM.
+`val B = Term(42)`
-**Enviroment configuration**:
-* Java HotSpot(TM) 64-Bit server virtual machine (build 15.0.2+7-27, mixed mode, sharing).
-* JVM heap configuration: 55Gb both xms and xmx.
+Terminal is a generic class. Can store terminals of any type. Terminals are compared based on their content.
-### Graphs
+They can be declared as fields of a grammar class or directly in productions.
-The graph data is selected from [CFPQ_Data dataset](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data).
+### Operations
+Example for Dyck language
-A detailed description of the graphs is listed bellow.
+*EBNF*
+```
+S = S1 | S2 | S3 | ε
+S1 = '(' S ')' S
+S2 = '[' S ']' S
+S3 = '{' S '}' S
+```
+*DSL*
+```kotlin
+class DyckGrammar : Grammar() {
+ val S by Nt().asStart()
+ val Round by Nt("(" * S * ")")
+ val Quadrat by Nt("[" * S * "]")
+ val Curly by Nt("{" * S * "}")
-#### RDF analysis graphs
+ init {
+ //recursive nonterminals initialize in `init` block
+ S /= S * (Round or Quadrat or Curly) or Epsilon
+ }
+}
+```
+### Production
+$A \Longrightarrow B \hspace{4pt} \overset{def}{=} \hspace{4pt} A$ \\= $B$
-| Graph name | \|*V*\| | \|*E*\| | #subClassOf | #type | #broaderTransitive |
-|:------------|----------:|------------:|-------------:|-----------:|--------------------:|
-| [Enzyme](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/enzyme.html#enzyme) | 48 815 | 86 543 | 8 163 | 14 989 | 8 156 |
-| [Eclass](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/eclass.html#eclass) | 239 111 | 360 248 | 90 962 | 72 517 | 0 |
-| [Go hierarchy](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/go_hierarchy.html#go-hierarchy) | 45 007 | 490 109 | 490 109 | 0 | 0 |
-| [Go](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/go.html#go) | 582 929 | 1 437 437 | 94 514 | 226 481 | 0 |
-| [Geospecies](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/geospecies.html#geospecies) | 450 609 | 2 201 532 | 0 | 89 065 | 20 867 |
-| [Taxonomy](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/taxonomy.html#taxonomy) | 5 728 398 | 14 922 125 | 2 112 637 | 2 508 635 | 0 |
+$A \Longrightarrow B \hspace{4pt} \overset{def}{=} \hspace{4pt} A~by~Nt(B)$
-### Grammars
+### Concatenation
+$( \hspace{4pt} \cdot \hspace{4pt} ) : \sum_∗ \times \sum_∗ → \sum_∗$
-All queries used in evaluation are variants of same-generation query.
-The inverse of an ```x``` relation and the respective edge is denoted as ```x_r```.
+$a \cdot b \hspace{4pt} \overset{def}{=} \hspace{4pt} a * b$
-
+### Alternative
+$( \hspace{4pt} | \hspace{4pt} ) : \sum_∗ \times \sum_∗ → \sum_∗$
-Grammars used for **RDF** graphs:
+$a \hspace{4pt} | \hspace{4pt} b \hspace{4pt} \overset{def}{=} \hspace{4pt} a \hspace{4pt} or \hspace{4pt} b$
-**G1**
-```
-S -> subClassOf_r S subClassOf | subClassOf_r subClassOf
- | type_r S type | type_r type
-```
+### Kleene Star
-The representation of **G1** context-free grammar in the repository can be found [here](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll/blob/main/src/test/resources/cli/TestCFGReadWriteTXT/g1.txt).
+$( \hspace{4pt} * \hspace{4pt} ) : \sum \to \sum_∗$
-The representation of **G1** context-free grammar as recursive automaton in the repository can be found [here](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll/blob/main/src/test/resources/cli/TestRSMReadWriteTXT/g1.txt).
+$a^* \hspace{4pt} \overset{def}{=} \hspace{4pt} \displaystyle\bigcup_{i = 0}^{\infty}a^i$
-### Results
+$a^* \hspace{4pt} \overset{def}{=} \hspace{4pt} many(a)$
-The results of the **all pairs reachability** queries evaluation on graphs related to **RDF analysis** are listed below.
+$a^+ \hspace{4pt} \overset{def}{=} \hspace{4pt} some(a)$
-In each row, the best mean time in seconds is highlighted in **bold**.
+### Optional
+$a? \hspace{4pt} \overset{def}{=} \hspace{4pt} a \hspace{4pt} or \hspace{4pt} Epsilon$
-| Graph | [CFG](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll/tree/main/src/main/kotlin/org/kotgll/cfg/graphinput/withoutsppf) | [RSM](https://github.com/FormalLanguageConstrainedPathQuerying/kotgll/tree/main/src/main/kotlin/org/kotgll/rsm/graphinput/withoutsppf) | [GLL4Graph](https://github.com/FormalLanguageConstrainedPathQuerying/GLL4Graph) |
-|-------------- |:-----: |:---------: |:---------: |
-| [Enzyme](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/enzyme.html#enzyme) | 0.107 | **0.044** | 0.22 |
-| [Eclass](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/eclass.html#eclass) | 0.94 | **0.43** | 1.5 |
-| [Go hierarchy](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/go_hierarchy.html#go-hierarchy) | 4.1 | **3.0** | 3.6 |
-| [Go](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/go.html#go) | 3.2 | **1.86** | 5.55 |
-| [Geospecies](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/geospecies.html#geospecies) | 0.97 | **0.34** | 2.89 |
-| [Taxonomy](https://formallanguageconstrainedpathquerying.github.io/CFPQ_Data/graphs/data/taxonomy.html#taxonomy) | 31.2 | **14.8** | 45.4 |
+Epsilon -- constant terminal with behavior corresponding to the $\varepsilon$ -- terminal (empty string).
-#### More results
+$a? \hspace{4pt} \overset{def}{=} \hspace{4pt} opt(a)$
-More results, but in raw form, can be found in the repository [kotgll_benchmarks](https://github.com/vadyushkins/kotgll_benchmarks/)
+### RSM
+DSL provides access to the RSM corresponding to the grammar using the `getRsm` method.
+The algorithm for RSM construction is based on Brzozowski derivations.
diff --git a/all_test.py b/all_test.py
new file mode 100644
index 000000000..01859f050
--- /dev/null
+++ b/all_test.py
@@ -0,0 +1,85 @@
+import os
+import subprocess
+import sys
+
+gradlew = "./gradlew"
+task = ":test-shared:test"
+
+test_name = "" # example "solver.correctnessTests.AmbiguousAStar3GrammarTest.AmbiguousAStar3GrammarTreeCorrectnessTest"
+test_case_name = "" # example "small_test"
+def run_test_for_mem(test_name):
+ def get_cmd(mem):
+ return [
+ gradlew,
+ task,
+ f"-DtestMaxHeapSize={mem}m",
+ "--tests", test_name,
+ f"-Dspecial_case={test_case_name}",
+ f"-Dcount_for_case=1",
+ f"-Dwrite_case_time=0"
+ ]
+
+ cache = {}
+
+ def execute(mem):
+ if mem in cache:
+ return cache[mem]
+
+ cmd = get_cmd(mem)
+ try:
+ process = subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,timeout=60)
+ return_code = process.returncode
+ except:
+ return_code = 1
+ cache[mem] = return_code
+ return return_code
+
+ l = 1
+ r = 64
+ max_mem = 4*1024
+ while r <= max_mem:
+ return_code = execute(r)
+ print(r)
+ if return_code != 0:
+ l = r
+ r *= 2
+ else:
+ break
+ if r == 2*max_mem:
+ return r
+
+ while l < r - 1:
+ m = (l + r) // 2
+ print(m)
+ return_code = execute(m)
+
+ if return_code != 0:
+ l = m
+ else:
+ r = m
+
+ return r
+
+
+with open("tests_list.conf", "r") as input:
+ with open(f"res.txt", "w") as output:
+ output.write(f"test,case,mem\n")
+ for line in input:
+ config = line.split()
+ test_name = config[0]
+ test_case_name = config[1]
+ print(test_name)
+ print(test_case_name)
+ mem = run_test_for_mem(test_name)
+ cmd = [
+ gradlew,
+ task,
+ f"-DtestMaxHeapSize=15m",
+ "--tests", test_name,
+ f"-Dspecial_case={test_case_name}",
+ f"-Dcount_for_case=1"
+ ]
+ process = subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ return_code = process.returncode
+ print(f"Got for test = {test_name}: {mem}mb")
+ output.write(f"{test_name},{test_case_name},{mem}\n")
diff --git a/benchmarks/README.md b/benchmarks/README.md
new file mode 100644
index 000000000..afccf1dce
--- /dev/null
+++ b/benchmarks/README.md
@@ -0,0 +1,19 @@
+# UCFSBenchmarks
+
+## Prerequisites
+
+```text
+(1) Gradle (version >= 7.2)
+(2) Antlr V4
+(3) Jflex
+```
+## Generate files
+Run `/scripts/generate_all.sh`
+## Run benchmarks
+From root project folder run `./gradlew :benchmarks:jmh -PtoolName=${toolRegexp} -Pdataset=${absolutePathToDatasetFolder}`
+
+## Logging
+
+Logs are stored in `logs`
+
+Results are stored in `build/reports/benchmarks`
diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts
new file mode 100644
index 000000000..a2944b5b1
--- /dev/null
+++ b/benchmarks/build.gradle.kts
@@ -0,0 +1,36 @@
+plugins {
+ java
+ kotlin("jvm") version "1.9.20"
+ application
+}
+
+application{
+ mainClass = "org.ucfs.GeneratorKt"
+}
+
+repositories {
+ mavenCentral()
+ maven("https://releases.usethesource.io/maven/")
+}
+
+dependencies {
+ // Other dependencies.
+ testImplementation(kotlin("test"))
+ testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.0")
+ //compared projects
+ // 1. for ucfs
+ implementation(project(":solver"))
+ implementation(project(":generator"))
+ implementation(project(":examples"))
+ // 2. for antlr
+ implementation("org.antlr:antlr4:4.13.1")
+ implementation(kotlin("stdlib-jdk8"))
+}
+
+kotlin {
+ jvmToolchain(17)
+}
+
+tasks.test {
+ useJUnitPlatform()
+}
\ No newline at end of file
diff --git a/benchmarks/gradle.properties b/benchmarks/gradle.properties
new file mode 100644
index 000000000..2de43ab72
--- /dev/null
+++ b/benchmarks/gradle.properties
@@ -0,0 +1,3 @@
+kotlin.code.style=official
+org.gradle.daemon=true
+org.gradle.jvmargs=-Xmx4096m -Xss4m -XX:+UseG1GC
\ No newline at end of file
diff --git a/benchmarks/gradle/wrapper/gradle-wrapper.properties b/benchmarks/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..06febab41
--- /dev/null
+++ b/benchmarks/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
\ No newline at end of file
diff --git a/benchmarks/gradlew b/benchmarks/gradlew
new file mode 100755
index 000000000..1b6c78733
--- /dev/null
+++ b/benchmarks/gradlew
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/benchmarks/gradlew.bat b/benchmarks/gradlew.bat
new file mode 100644
index 000000000..107acd32c
--- /dev/null
+++ b/benchmarks/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/benchmarks/scripts/extract_all_java_files.sh b/benchmarks/scripts/extract_all_java_files.sh
new file mode 100755
index 000000000..a626537d3
--- /dev/null
+++ b/benchmarks/scripts/extract_all_java_files.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Check if the correct number of arguments are provided
+if [ "$#" -ne 2 ]; then
+ echo "Usage: $0 "
+ exit 1
+fi
+
+# Assign arguments to variables
+destination=$1
+search_path=$2
+
+# Check if the destination directory exists, if not, create it
+if [ ! -d "$destination" ]; then
+ mkdir -p "$destination"
+fi
+
+# Initialize counters
+file_count=0
+line_count=0
+char_count=0
+size=0
+
+# Find, copy all .java files, and calculate the stats
+while IFS= read -r -d '' file; do
+ cp "$file" "$destination"
+ ((file_count++))
+ line_count=$(($line_count + $(wc -l < "$file")))
+ char_count=$(($char_count + $(wc -m < "$file")))
+ size=$(($size + $(stat --format=%s "$file")))
+done < <(find "$search_path" -name "*.java" -print0)
+
+echo "$file_count .java files have been copied to the $destination folder."
+echo "Total lines: $line_count"
+echo "Total characters: $char_count"
+echo "Total size on disk: $size bytes"
+
+# Convert size from bytes to megabytes
+size_mb=$(awk "BEGIN {printf \"%.2f\", $size/1024/1024}")
+
+
+echo "#Files,#Chars,SLOC,Size (on disk)"
+echo "$file_count,$char_count,$line_count,$size_mb"
\ No newline at end of file
diff --git a/benchmarks/scripts/generate_all.sh b/benchmarks/scripts/generate_all.sh
new file mode 100755
index 000000000..d8b8ba3ec
--- /dev/null
+++ b/benchmarks/scripts/generate_all.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+shopt -s nullglob #ingore failed patterns
+rootPrj=$(pwd)
+
+parserDest="benchmarks/src/main/kotlin/org/ucfs"
+antlrSrc="benchmarks/src/main/java/org/antlr"
+fastAntlrSrc="benchmarks/src/main/java/org/antlr/fast"
+antlrPackage="org.antlr"
+antlrFastPackage="org.antlr.fast"
+
+lexerSrc="benchmarks/src/main/java/org/ucfs/scanner"
+
+printf "\n\nINSTALL PACKAGES\n"
+apt-get install jflex
+apt-get install antlr4
+
+printf "\n\nGENERATE FILES\n"
+
+printf "\nGenerate ANTLR4 files"
+
+cd $antlrSrc
+antlr4 -package $antlrPackage Java8Lexer.g4
+antlr4 -package $antlrPackage Java8Parser.g4
+cd $rootPrj
+
+printf "\nGenerate fast ANTLR4 files"
+cd $fastAntlrSrc
+antlr4 -package $antlrFastPackage JavaLexer.g4
+antlr4 -package $antlrFastPackage JavaParser.g4
+cd $rootPrj
+
+printf "\nGenerate lexers"
+cd $lexerSrc
+for lexer_name in *.jflex *.jlex *.lex *.flex *.x
+do
+ jflex $lexer_name
+done
+cd $rootPrj
+
+printf $(pwd)
+printf "\nGenerate UCFS parser files at"
+echo $parserDest
\ No newline at end of file
diff --git a/benchmarks/scripts/mem_measure_bin_search.py b/benchmarks/scripts/mem_measure_bin_search.py
new file mode 100644
index 000000000..ccf3d38e7
--- /dev/null
+++ b/benchmarks/scripts/mem_measure_bin_search.py
@@ -0,0 +1,71 @@
+
+import os
+import subprocess
+import sys
+
+cp_path = '/home/olga/gllgen/ucfs/simpleApp/build/install/simpleApp/lib/*'
+files_dir = '/home/olga/gllgen/java7/junit/'
+
+tool = sys.argv[1]
+files_dir = sys.argv[2]
+cp_path = sys.argv[3]
+
+def run_tool_for_file(tool, file_path):
+ def get_cmd(mem):
+ return ['java', '-cp', cp_path, f'-Xmx{mem}m', 'org.ucfs.MainKt', tool, file_path]
+
+
+ cache = {}
+
+ def execute(mem):
+ if mem in cache:
+ return cache[mem]
+
+ cmd = get_cmd(mem)
+ process = subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ return_code = process.returncode
+ if return_code == 42:
+ print("it return 42")
+ exit(1)
+ cache[mem] = return_code
+ return return_code
+
+ l = 1
+ r = 64
+ max = 4*1024
+ while r <= max:
+ return_code = execute(r)
+ if return_code != 0:
+ l = r
+ r *= 2
+ else:
+ break
+ print(f"calculate r = {r}")
+ if r == 2*max:
+ return r
+
+
+ while l < r - 1:
+ m = (l + r) // 2
+ return_code = execute(m)
+ print(f"for {m} mem get code {return_code}")
+
+ if return_code != 0:
+ l = m
+ else:
+ r = m
+
+ return l
+
+
+files = os.listdir(files_dir)
+
+print(tool)
+with open(f"{tool}_res.txt", "w") as output:
+ output.write(f"file,mem\n")
+ output.flush()
+ for file in files:
+ mem = run_tool_for_file(tool, files_dir + file)
+ print(f"Got for tool = {tool}, file = {file}: {mem}mb")
+ output.write(f"{file},{mem}\n")
+ output.flush()
diff --git a/benchmarks/src/main/java/org/antlr/Java8Lexer.g4 b/benchmarks/src/main/java/org/antlr/Java8Lexer.g4
new file mode 100644
index 000000000..7beefbe55
--- /dev/null
+++ b/benchmarks/src/main/java/org/antlr/Java8Lexer.g4
@@ -0,0 +1,977 @@
+/*
+ * [The "BSD license"]
+ * Copyright (c) 2014 Terence Parr
+ * Copyright (c) 2014 Sam Harwell
+ * Copyright (c) 2019 Student Main (Make it universal)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * A Java 8 grammar for ANTLR 4 derived from the Java Language Specification
+ * chapter 19.
+ *
+ * NOTE: This grammar results in a generated parser that is much slower
+ * than the Java 7 grammar in the grammars-v4/java directory. This
+ * one is, however, extremely close to the spec.
+ *
+ * You can test with
+ *
+ * $ antlr4 Java8.g4
+ * $ javac *.java
+ * $ grun Java8 compilationUnit *.java
+ *
+ * Or,
+~/antlr/code/grammars-v4/java8 $ java Test .
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8BaseListener.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8Lexer.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8Listener.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8Parser.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Test.java
+Total lexer+parser time 30844ms.
+ */
+
+// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false
+// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine
+// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true
+
+lexer grammar Java8Lexer;
+
+// LEXER
+
+// §3.9 Keywords
+
+ABSTRACT : 'abstract';
+ASSERT : 'assert';
+BOOLEAN : 'boolean';
+BREAK : 'break';
+BYTE : 'byte';
+CASE : 'case';
+CATCH : 'catch';
+CHAR : 'char';
+CLASS : 'class';
+CONST : 'const';
+CONTINUE : 'continue';
+DEFAULT : 'default';
+DO : 'do';
+DOUBLE : 'double';
+ELSE : 'else';
+ENUM : 'enum';
+EXTENDS : 'extends';
+FINAL : 'final';
+FINALLY : 'finally';
+FLOAT : 'float';
+FOR : 'for';
+IF : 'if';
+GOTO : 'goto';
+IMPLEMENTS : 'implements';
+IMPORT : 'import';
+INSTANCEOF : 'instanceof';
+INT : 'int';
+INTERFACE : 'interface';
+LONG : 'long';
+NATIVE : 'native';
+NEW : 'new';
+PACKAGE : 'package';
+PRIVATE : 'private';
+PROTECTED : 'protected';
+PUBLIC : 'public';
+RETURN : 'return';
+SHORT : 'short';
+STATIC : 'static';
+STRICTFP : 'strictfp';
+SUPER : 'super';
+SWITCH : 'switch';
+SYNCHRONIZED : 'synchronized';
+THIS : 'this';
+THROW : 'throw';
+THROWS : 'throws';
+TRANSIENT : 'transient';
+TRY : 'try';
+VOID : 'void';
+VOLATILE : 'volatile';
+WHILE : 'while';
+
+// §3.10.1 Integer Literals
+
+IntegerLiteral:
+ DecimalIntegerLiteral
+ | HexIntegerLiteral
+ | OctalIntegerLiteral
+ | BinaryIntegerLiteral
+;
+
+fragment DecimalIntegerLiteral: DecimalNumeral IntegerTypeSuffix?;
+
+fragment HexIntegerLiteral: HexNumeral IntegerTypeSuffix?;
+
+fragment OctalIntegerLiteral: OctalNumeral IntegerTypeSuffix?;
+
+fragment BinaryIntegerLiteral: BinaryNumeral IntegerTypeSuffix?;
+
+fragment IntegerTypeSuffix: [lL];
+
+fragment DecimalNumeral: '0' | NonZeroDigit (Digits? | Underscores Digits);
+
+fragment Digits: Digit (DigitsAndUnderscores? Digit)?;
+
+fragment Digit: '0' | NonZeroDigit;
+
+fragment NonZeroDigit: [1-9];
+
+fragment DigitsAndUnderscores: DigitOrUnderscore+;
+
+fragment DigitOrUnderscore: Digit | '_';
+
+fragment Underscores: '_'+;
+
+fragment HexNumeral: '0' [xX] HexDigits;
+
+fragment HexDigits: HexDigit (HexDigitsAndUnderscores? HexDigit)?;
+
+fragment HexDigit: [0-9a-fA-F];
+
+fragment HexDigitsAndUnderscores: HexDigitOrUnderscore+;
+
+fragment HexDigitOrUnderscore: HexDigit | '_';
+
+fragment OctalNumeral: '0' Underscores? OctalDigits;
+
+fragment OctalDigits: OctalDigit (OctalDigitsAndUnderscores? OctalDigit)?;
+
+fragment OctalDigit: [0-7];
+
+fragment OctalDigitsAndUnderscores: OctalDigitOrUnderscore+;
+
+fragment OctalDigitOrUnderscore: OctalDigit | '_';
+
+fragment BinaryNumeral: '0' [bB] BinaryDigits;
+
+fragment BinaryDigits: BinaryDigit (BinaryDigitsAndUnderscores? BinaryDigit)?;
+
+fragment BinaryDigit: [01];
+
+fragment BinaryDigitsAndUnderscores: BinaryDigitOrUnderscore+;
+
+fragment BinaryDigitOrUnderscore: BinaryDigit | '_';
+
+// §3.10.2 Floating-Point Literals
+
+FloatingPointLiteral: DecimalFloatingPointLiteral | HexadecimalFloatingPointLiteral;
+
+fragment DecimalFloatingPointLiteral:
+ Digits '.' Digits? ExponentPart? FloatTypeSuffix?
+ | '.' Digits ExponentPart? FloatTypeSuffix?
+ | Digits ExponentPart FloatTypeSuffix?
+ | Digits FloatTypeSuffix
+;
+
+fragment ExponentPart: ExponentIndicator SignedInteger;
+
+fragment ExponentIndicator: [eE];
+
+fragment SignedInteger: Sign? Digits;
+
+fragment Sign: [+-];
+
+fragment FloatTypeSuffix: [fFdD];
+
+fragment HexadecimalFloatingPointLiteral: HexSignificand BinaryExponent FloatTypeSuffix?;
+
+fragment HexSignificand: HexNumeral '.'? | '0' [xX] HexDigits? '.' HexDigits;
+
+fragment BinaryExponent: BinaryExponentIndicator SignedInteger;
+
+fragment BinaryExponentIndicator: [pP];
+
+// §3.10.3 Boolean Literals
+
+BooleanLiteral: 'true' | 'false';
+
+// §3.10.4 Character Literals
+
+CharacterLiteral: '\'' SingleCharacter '\'' | '\'' EscapeSequence '\'';
+
+fragment SingleCharacter: ~['\\\r\n];
+
+// §3.10.5 String Literals
+
+StringLiteral: '"' StringCharacters? '"';
+
+fragment StringCharacters: StringCharacter+;
+
+fragment StringCharacter: ~["\\\r\n] | EscapeSequence;
+
+// §3.10.6 Escape Sequences for Character and String Literals
+
+fragment EscapeSequence:
+ '\\' 'u005c'? [btnfr"'\\]
+ | OctalEscape
+ | UnicodeEscape // This is not in the spec but prevents having to preprocess the input
+;
+
+fragment OctalEscape:
+ '\\' 'u005c'? OctalDigit
+ | '\\' 'u005c'? OctalDigit OctalDigit
+ | '\\' 'u005c'? ZeroToThree OctalDigit OctalDigit
+;
+
+fragment ZeroToThree: [0-3];
+
+// This is not in the spec but prevents having to preprocess the input
+fragment UnicodeEscape: '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit;
+
+// §3.10.7 The Null Literal
+
+NullLiteral: 'null';
+
+// §3.11 Separators
+
+LPAREN : '(';
+RPAREN : ')';
+LBRACE : '{';
+RBRACE : '}';
+LBRACK : '[';
+RBRACK : ']';
+SEMI : ';';
+COMMA : ',';
+DOT : '.';
+
+// §3.12 Operators
+
+ASSIGN : '=';
+GT : '>';
+LT : '<';
+BANG : '!';
+TILDE : '~';
+QUESTION : '?';
+COLON : ':';
+EQUAL : '==';
+LE : '<=';
+GE : '>=';
+NOTEQUAL : '!=';
+AND : '&&';
+OR : '||';
+INC : '++';
+DEC : '--';
+ADD : '+';
+SUB : '-';
+MUL : '*';
+DIV : '/';
+BITAND : '&';
+BITOR : '|';
+CARET : '^';
+MOD : '%';
+ARROW : '->';
+COLONCOLON : '::';
+
+ADD_ASSIGN : '+=';
+SUB_ASSIGN : '-=';
+MUL_ASSIGN : '*=';
+DIV_ASSIGN : '/=';
+AND_ASSIGN : '&=';
+OR_ASSIGN : '|=';
+XOR_ASSIGN : '^=';
+MOD_ASSIGN : '%=';
+LSHIFT_ASSIGN : '<<=';
+RSHIFT_ASSIGN : '>>=';
+URSHIFT_ASSIGN : '>>>=';
+
+// §3.8 Identifiers (must appear after all keywords in the grammar)
+
+Identifier: IdentifierStart IdentifierPart*;
+/*
+fragment
+JavaLetter
+ : [a-zA-Z$_] // these are the "java letters" below 0x7F
+ | // covers all characters above 0x7F which are not a surrogate
+ ~[\u0000-\u007F\uD800-\uDBFF] {this.wasJavaIdentiferStart()}?
+ | // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
+ [\uD800-\uDBFF] [\uDC00-\uDFFF] {this.wasJavaIdentiferStartUTF16()}?
+ ;
+
+fragment
+JavaLetterOrDigit
+ : [a-zA-Z0-9$_] // these are the "java letters or digits" below 0x7F
+ | // covers all characters above 0x7F which are not a surrogate
+ ~[\u0000-\u007F\uD800-\uDBFF] {this.wasJavaIdentiferPart()}?
+ | // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
+ [\uD800-\uDBFF] [\uDC00-\uDFFF] {this.wasJavaIdentiferPartUTF16()}?
+ ;*/
+
+// Dropped SMP support as ANTLR has no native support for it
+fragment IdentifierStart:
+ [\u0024]
+ | [\u0041-\u005A]
+ | [\u005F]
+ | [\u0061-\u007A]
+ | [\u00A2-\u00A5]
+ | [\u00AA]
+ | [\u00B5]
+ | [\u00BA]
+ | [\u00C0-\u00D6]
+ | [\u00D8-\u00F6]
+ | [\u00F8-\u02C1]
+ | [\u02C6-\u02D1]
+ | [\u02E0-\u02E4]
+ | [\u02EC]
+ | [\u02EE]
+ | [\u0370-\u0374]
+ | [\u0376-\u0377]
+ | [\u037A-\u037D]
+ | [\u037F]
+ | [\u0386]
+ | [\u0388-\u038A]
+ | [\u038C]
+ | [\u038E-\u03A1]
+ | [\u03A3-\u03F5]
+ | [\u03F7-\u0481]
+ | [\u048A-\u052F]
+ | [\u0531-\u0556]
+ | [\u0559]
+ | [\u0561-\u0587]
+ | [\u058F]
+ | [\u05D0-\u05EA]
+ | [\u05F0-\u05F2]
+ | [\u060B]
+ | [\u0620-\u064A]
+ | [\u066E-\u066F]
+ | [\u0671-\u06D3]
+ | [\u06D5]
+ | [\u06E5-\u06E6]
+ | [\u06EE-\u06EF]
+ | [\u06FA-\u06FC]
+ | [\u06FF]
+ | [\u0710]
+ | [\u0712-\u072F]
+ | [\u074D-\u07A5]
+ | [\u07B1]
+ | [\u07CA-\u07EA]
+ | [\u07F4-\u07F5]
+ | [\u07FA]
+ | [\u0800-\u0815]
+ | [\u081A]
+ | [\u0824]
+ | [\u0828]
+ | [\u0840-\u0858]
+ | [\u0860-\u086A]
+ | [\u08A0-\u08B4]
+ | [\u08B6-\u08BD]
+ | [\u0904-\u0939]
+ | [\u093D]
+ | [\u0950]
+ | [\u0958-\u0961]
+ | [\u0971-\u0980]
+ | [\u0985-\u098C]
+ | [\u098F-\u0990]
+ | [\u0993-\u09A8]
+ | [\u09AA-\u09B0]
+ | [\u09B2]
+ | [\u09B6-\u09B9]
+ | [\u09BD]
+ | [\u09CE]
+ | [\u09DC-\u09DD]
+ | [\u09DF-\u09E1]
+ | [\u09F0-\u09F3]
+ | [\u09FB-\u09FC]
+ | [\u0A05-\u0A0A]
+ | [\u0A0F-\u0A10]
+ | [\u0A13-\u0A28]
+ | [\u0A2A-\u0A30]
+ | [\u0A32-\u0A33]
+ | [\u0A35-\u0A36]
+ | [\u0A38-\u0A39]
+ | [\u0A59-\u0A5C]
+ | [\u0A5E]
+ | [\u0A72-\u0A74]
+ | [\u0A85-\u0A8D]
+ | [\u0A8F-\u0A91]
+ | [\u0A93-\u0AA8]
+ | [\u0AAA-\u0AB0]
+ | [\u0AB2-\u0AB3]
+ | [\u0AB5-\u0AB9]
+ | [\u0ABD]
+ | [\u0AD0]
+ | [\u0AE0-\u0AE1]
+ | [\u0AF1]
+ | [\u0AF9]
+ | [\u0B05-\u0B0C]
+ | [\u0B0F-\u0B10]
+ | [\u0B13-\u0B28]
+ | [\u0B2A-\u0B30]
+ | [\u0B32-\u0B33]
+ | [\u0B35-\u0B39]
+ | [\u0B3D]
+ | [\u0B5C-\u0B5D]
+ | [\u0B5F-\u0B61]
+ | [\u0B71]
+ | [\u0B83]
+ | [\u0B85-\u0B8A]
+ | [\u0B8E-\u0B90]
+ | [\u0B92-\u0B95]
+ | [\u0B99-\u0B9A]
+ | [\u0B9C]
+ | [\u0B9E-\u0B9F]
+ | [\u0BA3-\u0BA4]
+ | [\u0BA8-\u0BAA]
+ | [\u0BAE-\u0BB9]
+ | [\u0BD0]
+ | [\u0BF9]
+ | [\u0C05-\u0C0C]
+ | [\u0C0E-\u0C10]
+ | [\u0C12-\u0C28]
+ | [\u0C2A-\u0C39]
+ | [\u0C3D]
+ | [\u0C58-\u0C5A]
+ | [\u0C60-\u0C61]
+ | [\u0C80]
+ | [\u0C85-\u0C8C]
+ | [\u0C8E-\u0C90]
+ | [\u0C92-\u0CA8]
+ | [\u0CAA-\u0CB3]
+ | [\u0CB5-\u0CB9]
+ | [\u0CBD]
+ | [\u0CDE]
+ | [\u0CE0-\u0CE1]
+ | [\u0CF1-\u0CF2]
+ | [\u0D05-\u0D0C]
+ | [\u0D0E-\u0D10]
+ | [\u0D12-\u0D3A]
+ | [\u0D3D]
+ | [\u0D4E]
+ | [\u0D54-\u0D56]
+ | [\u0D5F-\u0D61]
+ | [\u0D7A-\u0D7F]
+ | [\u0D85-\u0D96]
+ | [\u0D9A-\u0DB1]
+ | [\u0DB3-\u0DBB]
+ | [\u0DBD]
+ | [\u0DC0-\u0DC6]
+ | [\u0E01-\u0E30]
+ | [\u0E32-\u0E33]
+ | [\u0E3F-\u0E46]
+ | [\u0E81-\u0E82]
+ | [\u0E84]
+ | [\u0E87-\u0E88]
+ | [\u0E8A]
+ | [\u0E8D]
+ | [\u0E94-\u0E97]
+ | [\u0E99-\u0E9F]
+ | [\u0EA1-\u0EA3]
+ | [\u0EA5]
+ | [\u0EA7]
+ | [\u0EAA-\u0EAB]
+ | [\u0EAD-\u0EB0]
+ | [\u0EB2-\u0EB3]
+ | [\u0EBD]
+ | [\u0EC0-\u0EC4]
+ | [\u0EC6]
+ | [\u0EDC-\u0EDF]
+ | [\u0F00]
+ | [\u0F40-\u0F47]
+ | [\u0F49-\u0F6C]
+ | [\u0F88-\u0F8C]
+ | [\u1000-\u102A]
+ | [\u103F]
+ | [\u1050-\u1055]
+ | [\u105A-\u105D]
+ | [\u1061]
+ | [\u1065-\u1066]
+ | [\u106E-\u1070]
+ | [\u1075-\u1081]
+ | [\u108E]
+ | [\u10A0-\u10C5]
+ | [\u10C7]
+ | [\u10CD]
+ | [\u10D0-\u10FA]
+ | [\u10FC-\u1248]
+ | [\u124A-\u124D]
+ | [\u1250-\u1256]
+ | [\u1258]
+ | [\u125A-\u125D]
+ | [\u1260-\u1288]
+ | [\u128A-\u128D]
+ | [\u1290-\u12B0]
+ | [\u12B2-\u12B5]
+ | [\u12B8-\u12BE]
+ | [\u12C0]
+ | [\u12C2-\u12C5]
+ | [\u12C8-\u12D6]
+ | [\u12D8-\u1310]
+ | [\u1312-\u1315]
+ | [\u1318-\u135A]
+ | [\u1380-\u138F]
+ | [\u13A0-\u13F5]
+ | [\u13F8-\u13FD]
+ | [\u1401-\u166C]
+ | [\u166F-\u167F]
+ | [\u1681-\u169A]
+ | [\u16A0-\u16EA]
+ | [\u16EE-\u16F8]
+ | [\u1700-\u170C]
+ | [\u170E-\u1711]
+ | [\u1720-\u1731]
+ | [\u1740-\u1751]
+ | [\u1760-\u176C]
+ | [\u176E-\u1770]
+ | [\u1780-\u17B3]
+ | [\u17D7]
+ | [\u17DB-\u17DC]
+ | [\u1820-\u1877]
+ | [\u1880-\u1884]
+ | [\u1887-\u18A8]
+ | [\u18AA]
+ | [\u18B0-\u18F5]
+ | [\u1900-\u191E]
+ | [\u1950-\u196D]
+ | [\u1970-\u1974]
+ | [\u1980-\u19AB]
+ | [\u19B0-\u19C9]
+ | [\u1A00-\u1A16]
+ | [\u1A20-\u1A54]
+ | [\u1AA7]
+ | [\u1B05-\u1B33]
+ | [\u1B45-\u1B4B]
+ | [\u1B83-\u1BA0]
+ | [\u1BAE-\u1BAF]
+ | [\u1BBA-\u1BE5]
+ | [\u1C00-\u1C23]
+ | [\u1C4D-\u1C4F]
+ | [\u1C5A-\u1C7D]
+ | [\u1C80-\u1C88]
+ | [\u1CE9-\u1CEC]
+ | [\u1CEE-\u1CF1]
+ | [\u1CF5-\u1CF6]
+ | [\u1D00-\u1DBF]
+ | [\u1E00-\u1F15]
+ | [\u1F18-\u1F1D]
+ | [\u1F20-\u1F45]
+ | [\u1F48-\u1F4D]
+ | [\u1F50-\u1F57]
+ | [\u1F59]
+ | [\u1F5B]
+ | [\u1F5D]
+ | [\u1F5F-\u1F7D]
+ | [\u1F80-\u1FB4]
+ | [\u1FB6-\u1FBC]
+ | [\u1FBE]
+ | [\u1FC2-\u1FC4]
+ | [\u1FC6-\u1FCC]
+ | [\u1FD0-\u1FD3]
+ | [\u1FD6-\u1FDB]
+ | [\u1FE0-\u1FEC]
+ | [\u1FF2-\u1FF4]
+ | [\u1FF6-\u1FFC]
+ | [\u203F-\u2040]
+ | [\u2054]
+ | [\u2071]
+ | [\u207F]
+ | [\u2090-\u209C]
+ | [\u20A0-\u20BF]
+ | [\u2102]
+ | [\u2107]
+ | [\u210A-\u2113]
+ | [\u2115]
+ | [\u2119-\u211D]
+ | [\u2124]
+ | [\u2126]
+ | [\u2128]
+ | [\u212A-\u212D]
+ | [\u212F-\u2139]
+ | [\u213C-\u213F]
+ | [\u2145-\u2149]
+ | [\u214E]
+ | [\u2160-\u2188]
+ | [\u2C00-\u2C2E]
+ | [\u2C30-\u2C5E]
+ | [\u2C60-\u2CE4]
+ | [\u2CEB-\u2CEE]
+ | [\u2CF2-\u2CF3]
+ | [\u2D00-\u2D25]
+ | [\u2D27]
+ | [\u2D2D]
+ | [\u2D30-\u2D67]
+ | [\u2D6F]
+ | [\u2D80-\u2D96]
+ | [\u2DA0-\u2DA6]
+ | [\u2DA8-\u2DAE]
+ | [\u2DB0-\u2DB6]
+ | [\u2DB8-\u2DBE]
+ | [\u2DC0-\u2DC6]
+ | [\u2DC8-\u2DCE]
+ | [\u2DD0-\u2DD6]
+ | [\u2DD8-\u2DDE]
+ | [\u2E2F]
+ | [\u3005-\u3007]
+ | [\u3021-\u3029]
+ | [\u3031-\u3035]
+ | [\u3038-\u303C]
+ | [\u3041-\u3096]
+ | [\u309D-\u309F]
+ | [\u30A1-\u30FA]
+ | [\u30FC-\u30FF]
+ | [\u3105-\u312E]
+ | [\u3131-\u318E]
+ | [\u31A0-\u31BA]
+ | [\u31F0-\u31FF]
+ | [\u3400-\u4DB5]
+ | [\u4E00-\u9FEA]
+ | [\uA000-\uA48C]
+ | [\uA4D0-\uA4FD]
+ | [\uA500-\uA60C]
+ | [\uA610-\uA61F]
+ | [\uA62A-\uA62B]
+ | [\uA640-\uA66E]
+ | [\uA67F-\uA69D]
+ | [\uA6A0-\uA6EF]
+ | [\uA717-\uA71F]
+ | [\uA722-\uA788]
+ | [\uA78B-\uA7AE]
+ | [\uA7B0-\uA7B7]
+ | [\uA7F7-\uA801]
+ | [\uA803-\uA805]
+ | [\uA807-\uA80A]
+ | [\uA80C-\uA822]
+ | [\uA838]
+ | [\uA840-\uA873]
+ | [\uA882-\uA8B3]
+ | [\uA8F2-\uA8F7]
+ | [\uA8FB]
+ | [\uA8FD]
+ | [\uA90A-\uA925]
+ | [\uA930-\uA946]
+ | [\uA960-\uA97C]
+ | [\uA984-\uA9B2]
+ | [\uA9CF]
+ | [\uA9E0-\uA9E4]
+ | [\uA9E6-\uA9EF]
+ | [\uA9FA-\uA9FE]
+ | [\uAA00-\uAA28]
+ | [\uAA40-\uAA42]
+ | [\uAA44-\uAA4B]
+ | [\uAA60-\uAA76]
+ | [\uAA7A]
+ | [\uAA7E-\uAAAF]
+ | [\uAAB1]
+ | [\uAAB5-\uAAB6]
+ | [\uAAB9-\uAABD]
+ | [\uAAC0]
+ | [\uAAC2]
+ | [\uAADB-\uAADD]
+ | [\uAAE0-\uAAEA]
+ | [\uAAF2-\uAAF4]
+ | [\uAB01-\uAB06]
+ | [\uAB09-\uAB0E]
+ | [\uAB11-\uAB16]
+ | [\uAB20-\uAB26]
+ | [\uAB28-\uAB2E]
+ | [\uAB30-\uAB5A]
+ | [\uAB5C-\uAB65]
+ | [\uAB70-\uABE2]
+ | [\uAC00-\uD7A3]
+ | [\uD7B0-\uD7C6]
+ | [\uD7CB-\uD7FB]
+ | [\uF900-\uFA6D]
+ | [\uFA70-\uFAD9]
+ | [\uFB00-\uFB06]
+ | [\uFB13-\uFB17]
+ | [\uFB1D]
+ | [\uFB1F-\uFB28]
+ | [\uFB2A-\uFB36]
+ | [\uFB38-\uFB3C]
+ | [\uFB3E]
+ | [\uFB40-\uFB41]
+ | [\uFB43-\uFB44]
+ | [\uFB46-\uFBB1]
+ | [\uFBD3-\uFD3D]
+ | [\uFD50-\uFD8F]
+ | [\uFD92-\uFDC7]
+ | [\uFDF0-\uFDFC]
+ | [\uFE33-\uFE34]
+ | [\uFE4D-\uFE4F]
+ | [\uFE69]
+ | [\uFE70-\uFE74]
+ | [\uFE76-\uFEFC]
+ | [\uFF04]
+ | [\uFF21-\uFF3A]
+ | [\uFF3F]
+ | [\uFF41-\uFF5A]
+ | [\uFF66-\uFFBE]
+ | [\uFFC2-\uFFC7]
+ | [\uFFCA-\uFFCF]
+ | [\uFFD2-\uFFD7]
+ | [\uFFDA-\uFFDC]
+ | [\uFFE0-\uFFE1]
+ | [\uFFE5-\uFFE6]
+;
+
+fragment IdentifierPart:
+ IdentifierStart
+ | [\u0030-\u0039]
+ | [\u007F-\u009F]
+ | [\u00AD]
+ | [\u0300-\u036F]
+ | [\u0483-\u0487]
+ | [\u0591-\u05BD]
+ | [\u05BF]
+ | [\u05C1-\u05C2]
+ | [\u05C4-\u05C5]
+ | [\u05C7]
+ | [\u0600-\u0605]
+ | [\u0610-\u061A]
+ | [\u061C]
+ | [\u064B-\u0669]
+ | [\u0670]
+ | [\u06D6-\u06DD]
+ | [\u06DF-\u06E4]
+ | [\u06E7-\u06E8]
+ | [\u06EA-\u06ED]
+ | [\u06F0-\u06F9]
+ | [\u070F]
+ | [\u0711]
+ | [\u0730-\u074A]
+ | [\u07A6-\u07B0]
+ | [\u07C0-\u07C9]
+ | [\u07EB-\u07F3]
+ | [\u0816-\u0819]
+ | [\u081B-\u0823]
+ | [\u0825-\u0827]
+ | [\u0829-\u082D]
+ | [\u0859-\u085B]
+ | [\u08D4-\u0903]
+ | [\u093A-\u093C]
+ | [\u093E-\u094F]
+ | [\u0951-\u0957]
+ | [\u0962-\u0963]
+ | [\u0966-\u096F]
+ | [\u0981-\u0983]
+ | [\u09BC]
+ | [\u09BE-\u09C4]
+ | [\u09C7-\u09C8]
+ | [\u09CB-\u09CD]
+ | [\u09D7]
+ | [\u09E2-\u09E3]
+ | [\u09E6-\u09EF]
+ | [\u0A01-\u0A03]
+ | [\u0A3C]
+ | [\u0A3E-\u0A42]
+ | [\u0A47-\u0A48]
+ | [\u0A4B-\u0A4D]
+ | [\u0A51]
+ | [\u0A66-\u0A71]
+ | [\u0A75]
+ | [\u0A81-\u0A83]
+ | [\u0ABC]
+ | [\u0ABE-\u0AC5]
+ | [\u0AC7-\u0AC9]
+ | [\u0ACB-\u0ACD]
+ | [\u0AE2-\u0AE3]
+ | [\u0AE6-\u0AEF]
+ | [\u0AFA-\u0AFF]
+ | [\u0B01-\u0B03]
+ | [\u0B3C]
+ | [\u0B3E-\u0B44]
+ | [\u0B47-\u0B48]
+ | [\u0B4B-\u0B4D]
+ | [\u0B56-\u0B57]
+ | [\u0B62-\u0B63]
+ | [\u0B66-\u0B6F]
+ | [\u0B82]
+ | [\u0BBE-\u0BC2]
+ | [\u0BC6-\u0BC8]
+ | [\u0BCA-\u0BCD]
+ | [\u0BD7]
+ | [\u0BE6-\u0BEF]
+ | [\u0C00-\u0C03]
+ | [\u0C3E-\u0C44]
+ | [\u0C46-\u0C48]
+ | [\u0C4A-\u0C4D]
+ | [\u0C55-\u0C56]
+ | [\u0C62-\u0C63]
+ | [\u0C66-\u0C6F]
+ | [\u0C81-\u0C83]
+ | [\u0CBC]
+ | [\u0CBE-\u0CC4]
+ | [\u0CC6-\u0CC8]
+ | [\u0CCA-\u0CCD]
+ | [\u0CD5-\u0CD6]
+ | [\u0CE2-\u0CE3]
+ | [\u0CE6-\u0CEF]
+ | [\u0D00-\u0D03]
+ | [\u0D3B-\u0D3C]
+ | [\u0D3E-\u0D44]
+ | [\u0D46-\u0D48]
+ | [\u0D4A-\u0D4D]
+ | [\u0D57]
+ | [\u0D62-\u0D63]
+ | [\u0D66-\u0D6F]
+ | [\u0D82-\u0D83]
+ | [\u0DCA]
+ | [\u0DCF-\u0DD4]
+ | [\u0DD6]
+ | [\u0DD8-\u0DDF]
+ | [\u0DE6-\u0DEF]
+ | [\u0DF2-\u0DF3]
+ | [\u0E31]
+ | [\u0E34-\u0E3A]
+ | [\u0E47-\u0E4E]
+ | [\u0E50-\u0E59]
+ | [\u0EB1]
+ | [\u0EB4-\u0EB9]
+ | [\u0EBB-\u0EBC]
+ | [\u0EC8-\u0ECD]
+ | [\u0ED0-\u0ED9]
+ | [\u0F18-\u0F19]
+ | [\u0F20-\u0F29]
+ | [\u0F35]
+ | [\u0F37]
+ | [\u0F39]
+ | [\u0F3E-\u0F3F]
+ | [\u0F71-\u0F84]
+ | [\u0F86-\u0F87]
+ | [\u0F8D-\u0F97]
+ | [\u0F99-\u0FBC]
+ | [\u0FC6]
+ | [\u102B-\u103E]
+ | [\u1040-\u1049]
+ | [\u1056-\u1059]
+ | [\u105E-\u1060]
+ | [\u1062-\u1064]
+ | [\u1067-\u106D]
+ | [\u1071-\u1074]
+ | [\u1082-\u108D]
+ | [\u108F-\u109D]
+ | [\u135D-\u135F]
+ | [\u1712-\u1714]
+ | [\u1732-\u1734]
+ | [\u1752-\u1753]
+ | [\u1772-\u1773]
+ | [\u17B4-\u17D3]
+ | [\u17DD]
+ | [\u17E0-\u17E9]
+ | [\u180B-\u180E]
+ | [\u1810-\u1819]
+ | [\u1885-\u1886]
+ | [\u18A9]
+ | [\u1920-\u192B]
+ | [\u1930-\u193B]
+ | [\u1946-\u194F]
+ | [\u19D0-\u19D9]
+ | [\u1A17-\u1A1B]
+ | [\u1A55-\u1A5E]
+ | [\u1A60-\u1A7C]
+ | [\u1A7F-\u1A89]
+ | [\u1A90-\u1A99]
+ | [\u1AB0-\u1ABD]
+ | [\u1B00-\u1B04]
+ | [\u1B34-\u1B44]
+ | [\u1B50-\u1B59]
+ | [\u1B6B-\u1B73]
+ | [\u1B80-\u1B82]
+ | [\u1BA1-\u1BAD]
+ | [\u1BB0-\u1BB9]
+ | [\u1BE6-\u1BF3]
+ | [\u1C24-\u1C37]
+ | [\u1C40-\u1C49]
+ | [\u1C50-\u1C59]
+ | [\u1CD0-\u1CD2]
+ | [\u1CD4-\u1CE8]
+ | [\u1CED]
+ | [\u1CF2-\u1CF4]
+ | [\u1CF7-\u1CF9]
+ | [\u1DC0-\u1DF9]
+ | [\u1DFB-\u1DFF]
+ | [\u200B-\u200F]
+ | [\u202A-\u202E]
+ | [\u2060-\u2064]
+ | [\u2066-\u206F]
+ | [\u20D0-\u20DC]
+ | [\u20E1]
+ | [\u20E5-\u20F0]
+ | [\u2CEF-\u2CF1]
+ | [\u2D7F]
+ | [\u2DE0-\u2DFF]
+ | [\u302A-\u302F]
+ | [\u3099-\u309A]
+ | [\uA620-\uA629]
+ | [\uA66F]
+ | [\uA674-\uA67D]
+ | [\uA69E-\uA69F]
+ | [\uA6F0-\uA6F1]
+ | [\uA802]
+ | [\uA806]
+ | [\uA80B]
+ | [\uA823-\uA827]
+ | [\uA880-\uA881]
+ | [\uA8B4-\uA8C5]
+ | [\uA8D0-\uA8D9]
+ | [\uA8E0-\uA8F1]
+ | [\uA900-\uA909]
+ | [\uA926-\uA92D]
+ | [\uA947-\uA953]
+ | [\uA980-\uA983]
+ | [\uA9B3-\uA9C0]
+ | [\uA9D0-\uA9D9]
+ | [\uA9E5]
+ | [\uA9F0-\uA9F9]
+ | [\uAA29-\uAA36]
+ | [\uAA43]
+ | [\uAA4C-\uAA4D]
+ | [\uAA50-\uAA59]
+ | [\uAA7B-\uAA7D]
+ | [\uAAB0]
+ | [\uAAB2-\uAAB4]
+ | [\uAAB7-\uAAB8]
+ | [\uAABE-\uAABF]
+ | [\uAAC1]
+ | [\uAAEB-\uAAEF]
+ | [\uAAF5-\uAAF6]
+ | [\uABE3-\uABEA]
+ | [\uABEC-\uABED]
+ | [\uABF0-\uABF9]
+ | [\uFB1E]
+ | [\uFE00-\uFE0F]
+ | [\uFE20-\uFE2F]
+ | [\uFEFF]
+ | [\uFF10-\uFF19]
+ | [\uFFF9-\uFFFB]
+;
+
+//
+// Additional symbols not defined in the lexical specification
+//
+
+AT : '@';
+ELLIPSIS : '...';
+
+//
+// Whitespace and comments
+//
+
+WS: [ \t\r\n\u000C]+ -> skip;
+
+COMMENT: '/*' .*? '*/' -> skip;
+
+LINE_COMMENT: '//' ~[\r\n]* -> skip;
\ No newline at end of file
diff --git a/benchmarks/src/main/java/org/antlr/Java8Parser.g4 b/benchmarks/src/main/java/org/antlr/Java8Parser.g4
new file mode 100644
index 000000000..8b6b46615
--- /dev/null
+++ b/benchmarks/src/main/java/org/antlr/Java8Parser.g4
@@ -0,0 +1,1335 @@
+/*
+ * [The "BSD license"]
+ * Copyright (c) 2014 Terence Parr
+ * Copyright (c) 2014 Sam Harwell
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * A Java 8 grammar for ANTLR 4 derived from the Java Language Specification
+ * chapter 19.
+ *
+ * NOTE: This grammar results in a generated parser that is much slower
+ * than the Java 7 grammar in the grammars-v4/java directory. This
+ * one is, however, extremely close to the spec.
+ *
+ * You can test with
+ *
+ * $ antlr4 Java8.g4
+ * $ javac *.java
+ * $ grun Java8 compilationUnit *.java
+ *
+ * Or,
+~/antlr/code/grammars-v4/java8 $ java Test .
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8BaseListener.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8Lexer.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8Listener.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Java8Parser.java
+/Users/parrt/antlr/code/grammars-v4/java8/./Test.java
+Total lexer+parser time 30844ms.
+ */
+
+// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
+// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
+
+parser grammar Java8Parser;
+
+options {
+ tokenVocab = Java8Lexer;
+}
+
+/*
+ * Productions from §3 (Lexical Structure)
+ */
+
+literal
+ : IntegerLiteral
+ | FloatingPointLiteral
+ | BooleanLiteral
+ | CharacterLiteral
+ | StringLiteral
+ | NullLiteral
+ ;
+
+/*
+ * Productions from §4 (Types, Values, and Variables)
+ */
+
+primitiveType
+ : annotation* numericType
+ | annotation* 'boolean'
+ ;
+
+numericType
+ : integralType
+ | floatingPointType
+ ;
+
+integralType
+ : 'byte'
+ | 'short'
+ | 'int'
+ | 'long'
+ | 'char'
+ ;
+
+floatingPointType
+ : 'float'
+ | 'double'
+ ;
+
+referenceType
+ : classOrInterfaceType
+ | typeVariable
+ | arrayType
+ ;
+
+classOrInterfaceType
+ : (classType_lfno_classOrInterfaceType | interfaceType_lfno_classOrInterfaceType) (
+ classType_lf_classOrInterfaceType
+ | interfaceType_lf_classOrInterfaceType
+ )*
+ ;
+
+classType
+ : annotation* Identifier typeArguments?
+ | classOrInterfaceType '.' annotation* Identifier typeArguments?
+ ;
+
+classType_lf_classOrInterfaceType
+ : '.' annotation* Identifier typeArguments?
+ ;
+
+classType_lfno_classOrInterfaceType
+ : annotation* Identifier typeArguments?
+ ;
+
+interfaceType
+ : classType
+ ;
+
+interfaceType_lf_classOrInterfaceType
+ : classType_lf_classOrInterfaceType
+ ;
+
+interfaceType_lfno_classOrInterfaceType
+ : classType_lfno_classOrInterfaceType
+ ;
+
+typeVariable
+ : annotation* Identifier
+ ;
+
+arrayType
+ : primitiveType dims
+ | classOrInterfaceType dims
+ | typeVariable dims
+ ;
+
+dims
+ : annotation* '[' ']' (annotation* '[' ']')*
+ ;
+
+typeParameter
+ : typeParameterModifier* Identifier typeBound?
+ ;
+
+typeParameterModifier
+ : annotation
+ ;
+
+typeBound
+ : 'extends' typeVariable
+ | 'extends' classOrInterfaceType additionalBound*
+ ;
+
+additionalBound
+ : '&' interfaceType
+ ;
+
+typeArguments
+ : '<' typeArgumentList '>'
+ ;
+
+typeArgumentList
+ : typeArgument (',' typeArgument)*
+ ;
+
+typeArgument
+ : referenceType
+ | wildcard
+ ;
+
+wildcard
+ : annotation* '?' wildcardBounds?
+ ;
+
+wildcardBounds
+ : 'extends' referenceType
+ | 'super' referenceType
+ ;
+
+/*
+ * Productions from §6 (Names)
+ */
+
+packageName
+ : Identifier
+ | packageName '.' Identifier
+ ;
+
+typeName
+ : Identifier
+ | packageOrTypeName '.' Identifier
+ ;
+
+packageOrTypeName
+ : Identifier
+ | packageOrTypeName '.' Identifier
+ ;
+
+expressionName
+ : Identifier
+ | ambiguousName '.' Identifier
+ ;
+
+methodName
+ : Identifier
+ ;
+
+ambiguousName
+ : Identifier
+ | ambiguousName '.' Identifier
+ ;
+
+/*
+ * Productions from §7 (Packages)
+ */
+
+compilationUnit
+ : packageDeclaration? importDeclaration* typeDeclaration* EOF
+ ;
+
+packageDeclaration
+ : packageModifier* 'package' packageName ';'
+ ;
+
+packageModifier
+ : annotation
+ ;
+
+importDeclaration
+ : singleTypeImportDeclaration
+ | typeImportOnDemandDeclaration
+ | singleStaticImportDeclaration
+ | staticImportOnDemandDeclaration
+ ;
+
+singleTypeImportDeclaration
+ : 'import' typeName ';'
+ ;
+
+typeImportOnDemandDeclaration
+ : 'import' packageOrTypeName '.' '*' ';'
+ ;
+
+singleStaticImportDeclaration
+ : 'import' 'static' typeName '.' Identifier ';'
+ ;
+
+staticImportOnDemandDeclaration
+ : 'import' 'static' typeName '.' '*' ';'
+ ;
+
+typeDeclaration
+ : classDeclaration
+ | interfaceDeclaration
+ | ';'
+ ;
+
+/*
+ * Productions from §8 (Classes)
+ */
+
+classDeclaration
+ : normalClassDeclaration
+ | enumDeclaration
+ ;
+
+normalClassDeclaration
+ : classModifier* 'class' Identifier typeParameters? superclass? superinterfaces? classBody
+ ;
+
+classModifier
+ : annotation
+ | 'public'
+ | 'protected'
+ | 'private'
+ | 'abstract'
+ | 'static'
+ | 'final'
+ | 'strictfp'
+ ;
+
+typeParameters
+ : '<' typeParameterList '>'
+ ;
+
+typeParameterList
+ : typeParameter (',' typeParameter)*
+ ;
+
+superclass
+ : 'extends' classType
+ ;
+
+superinterfaces
+ : 'implements' interfaceTypeList
+ ;
+
+interfaceTypeList
+ : interfaceType (',' interfaceType)*
+ ;
+
+classBody
+ : '{' classBodyDeclaration* '}'
+ ;
+
+classBodyDeclaration
+ : classMemberDeclaration
+ | instanceInitializer
+ | staticInitializer
+ | constructorDeclaration
+ ;
+
+classMemberDeclaration
+ : fieldDeclaration
+ | methodDeclaration
+ | classDeclaration
+ | interfaceDeclaration
+ | ';'
+ ;
+
+fieldDeclaration
+ : fieldModifier* unannType variableDeclaratorList ';'
+ ;
+
+fieldModifier
+ : annotation
+ | 'public'
+ | 'protected'
+ | 'private'
+ | 'static'
+ | 'final'
+ | 'transient'
+ | 'volatile'
+ ;
+
+variableDeclaratorList
+ : variableDeclarator (',' variableDeclarator)*
+ ;
+
+variableDeclarator
+ : variableDeclaratorId ('=' variableInitializer)?
+ ;
+
+variableDeclaratorId
+ : Identifier dims?
+ ;
+
+variableInitializer
+ : expression
+ | arrayInitializer
+ ;
+
+unannType
+ : unannPrimitiveType
+ | unannReferenceType
+ ;
+
+unannPrimitiveType
+ : numericType
+ | 'boolean'
+ ;
+
+unannReferenceType
+ : unannClassOrInterfaceType
+ | unannTypeVariable
+ | unannArrayType
+ ;
+
+unannClassOrInterfaceType
+ : (
+ unannClassType_lfno_unannClassOrInterfaceType
+ | unannInterfaceType_lfno_unannClassOrInterfaceType
+ ) (
+ unannClassType_lf_unannClassOrInterfaceType
+ | unannInterfaceType_lf_unannClassOrInterfaceType
+ )*
+ ;
+
+unannClassType
+ : Identifier typeArguments?
+ | unannClassOrInterfaceType '.' annotation* Identifier typeArguments?
+ ;
+
+unannClassType_lf_unannClassOrInterfaceType
+ : '.' annotation* Identifier typeArguments?
+ ;
+
+unannClassType_lfno_unannClassOrInterfaceType
+ : Identifier typeArguments?
+ ;
+
+unannInterfaceType
+ : unannClassType
+ ;
+
+unannInterfaceType_lf_unannClassOrInterfaceType
+ : unannClassType_lf_unannClassOrInterfaceType
+ ;
+
+unannInterfaceType_lfno_unannClassOrInterfaceType
+ : unannClassType_lfno_unannClassOrInterfaceType
+ ;
+
+unannTypeVariable
+ : Identifier
+ ;
+
+unannArrayType
+ : unannPrimitiveType dims
+ | unannClassOrInterfaceType dims
+ | unannTypeVariable dims
+ ;
+
+methodDeclaration
+ : methodModifier* methodHeader methodBody
+ ;
+
+methodModifier
+ : annotation
+ | 'public'
+ | 'protected'
+ | 'private'
+ | 'abstract'
+ | 'static'
+ | 'final'
+ | 'synchronized'
+ | 'native'
+ | 'strictfp'
+ ;
+
+methodHeader
+ : result methodDeclarator throws_?
+ | typeParameters annotation* result methodDeclarator throws_?
+ ;
+
+result
+ : unannType
+ | 'void'
+ ;
+
+methodDeclarator
+ : Identifier '(' formalParameterList? ')' dims?
+ ;
+
+formalParameterList
+ : receiverParameter
+ | formalParameters ',' lastFormalParameter
+ | lastFormalParameter
+ ;
+
+formalParameters
+ : formalParameter (',' formalParameter)*
+ | receiverParameter (',' formalParameter)*
+ ;
+
+formalParameter
+ : variableModifier* unannType variableDeclaratorId
+ ;
+
+variableModifier
+ : annotation
+ | 'final'
+ ;
+
+lastFormalParameter
+ : variableModifier* unannType annotation* '...' variableDeclaratorId
+ | formalParameter
+ ;
+
+receiverParameter
+ : annotation* unannType (Identifier '.')? 'this'
+ ;
+
+throws_
+ : 'throws' exceptionTypeList
+ ;
+
+exceptionTypeList
+ : exceptionType (',' exceptionType)*
+ ;
+
+exceptionType
+ : classType
+ | typeVariable
+ ;
+
+methodBody
+ : block
+ | ';'
+ ;
+
+instanceInitializer
+ : block
+ ;
+
+staticInitializer
+ : 'static' block
+ ;
+
+constructorDeclaration
+ : constructorModifier* constructorDeclarator throws_? constructorBody
+ ;
+
+constructorModifier
+ : annotation
+ | 'public'
+ | 'protected'
+ | 'private'
+ ;
+
+constructorDeclarator
+ : typeParameters? simpleTypeName '(' formalParameterList? ')'
+ ;
+
+simpleTypeName
+ : Identifier
+ ;
+
+constructorBody
+ : '{' explicitConstructorInvocation? blockStatements? '}'
+ ;
+
+explicitConstructorInvocation
+ : typeArguments? 'this' '(' argumentList? ')' ';'
+ | typeArguments? 'super' '(' argumentList? ')' ';'
+ | expressionName '.' typeArguments? 'super' '(' argumentList? ')' ';'
+ | primary '.' typeArguments? 'super' '(' argumentList? ')' ';'
+ ;
+
+enumDeclaration
+ : classModifier* 'enum' Identifier superinterfaces? enumBody
+ ;
+
+enumBody
+ : '{' enumConstantList? ','? enumBodyDeclarations? '}'
+ ;
+
+enumConstantList
+ : enumConstant (',' enumConstant)*
+ ;
+
+enumConstant
+ : enumConstantModifier* Identifier ('(' argumentList? ')')? classBody?
+ ;
+
+enumConstantModifier
+ : annotation
+ ;
+
+enumBodyDeclarations
+ : ';' classBodyDeclaration*
+ ;
+
+/*
+ * Productions from §9 (Interfaces)
+ */
+
+interfaceDeclaration
+ : normalInterfaceDeclaration
+ | annotationTypeDeclaration
+ ;
+
+normalInterfaceDeclaration
+ : interfaceModifier* 'interface' Identifier typeParameters? extendsInterfaces? interfaceBody
+ ;
+
+interfaceModifier
+ : annotation
+ | 'public'
+ | 'protected'
+ | 'private'
+ | 'abstract'
+ | 'static'
+ | 'strictfp'
+ ;
+
+extendsInterfaces
+ : 'extends' interfaceTypeList
+ ;
+
+interfaceBody
+ : '{' interfaceMemberDeclaration* '}'
+ ;
+
+interfaceMemberDeclaration
+ : constantDeclaration
+ | interfaceMethodDeclaration
+ | classDeclaration
+ | interfaceDeclaration
+ | ';'
+ ;
+
+constantDeclaration
+ : constantModifier* unannType variableDeclaratorList ';'
+ ;
+
+constantModifier
+ : annotation
+ | 'public'
+ | 'static'
+ | 'final'
+ ;
+
+interfaceMethodDeclaration
+ : interfaceMethodModifier* methodHeader methodBody
+ ;
+
+interfaceMethodModifier
+ : annotation
+ | 'public'
+ | 'abstract'
+ | 'default'
+ | 'static'
+ | 'strictfp'
+ ;
+
+annotationTypeDeclaration
+ : interfaceModifier* '@' 'interface' Identifier annotationTypeBody
+ ;
+
+annotationTypeBody
+ : '{' annotationTypeMemberDeclaration* '}'
+ ;
+
+annotationTypeMemberDeclaration
+ : annotationTypeElementDeclaration
+ | constantDeclaration
+ | classDeclaration
+ | interfaceDeclaration
+ | ';'
+ ;
+
+annotationTypeElementDeclaration
+ : annotationTypeElementModifier* unannType Identifier '(' ')' dims? defaultValue? ';'
+ ;
+
+annotationTypeElementModifier
+ : annotation
+ | 'public'
+ | 'abstract'
+ ;
+
+defaultValue
+ : 'default' elementValue
+ ;
+
+annotation
+ : normalAnnotation
+ | markerAnnotation
+ | singleElementAnnotation
+ ;
+
+normalAnnotation
+ : '@' typeName '(' elementValuePairList? ')'
+ ;
+
+elementValuePairList
+ : elementValuePair (',' elementValuePair)*
+ ;
+
+elementValuePair
+ : Identifier '=' elementValue
+ ;
+
+elementValue
+ : conditionalExpression
+ | elementValueArrayInitializer
+ | annotation
+ ;
+
+elementValueArrayInitializer
+ : '{' elementValueList? ','? '}'
+ ;
+
+elementValueList
+ : elementValue (',' elementValue)*
+ ;
+
+markerAnnotation
+ : '@' typeName
+ ;
+
+singleElementAnnotation
+ : '@' typeName '(' elementValue ')'
+ ;
+
+/*
+ * Productions from §10 (Arrays)
+ */
+
+arrayInitializer
+ : '{' variableInitializerList? ','? '}'
+ ;
+
+variableInitializerList
+ : variableInitializer (',' variableInitializer)*
+ ;
+
+/*
+ * Productions from §14 (Blocks and Statements)
+ */
+
+block
+ : '{' blockStatements? '}'
+ ;
+
+blockStatements
+ : blockStatement+
+ ;
+
+blockStatement
+ : localVariableDeclarationStatement
+ | classDeclaration
+ | statement
+ ;
+
+localVariableDeclarationStatement
+ : localVariableDeclaration ';'
+ ;
+
+localVariableDeclaration
+ : variableModifier* unannType variableDeclaratorList
+ ;
+
+statement
+ : statementWithoutTrailingSubstatement
+ | labeledStatement
+ | ifThenStatement
+ | ifThenElseStatement
+ | whileStatement
+ | forStatement
+ ;
+
+statementNoShortIf
+ : statementWithoutTrailingSubstatement
+ | labeledStatementNoShortIf
+ | ifThenElseStatementNoShortIf
+ | whileStatementNoShortIf
+ | forStatementNoShortIf
+ ;
+
+statementWithoutTrailingSubstatement
+ : block
+ | emptyStatement_
+ | expressionStatement
+ | assertStatement
+ | switchStatement
+ | doStatement
+ | breakStatement
+ | continueStatement
+ | returnStatement
+ | synchronizedStatement
+ | throwStatement
+ | tryStatement
+ ;
+
+emptyStatement_
+ : ';'
+ ;
+
+labeledStatement
+ : Identifier ':' statement
+ ;
+
+labeledStatementNoShortIf
+ : Identifier ':' statementNoShortIf
+ ;
+
+expressionStatement
+ : statementExpression ';'
+ ;
+
+statementExpression
+ : assignment
+ | preIncrementExpression
+ | preDecrementExpression
+ | postIncrementExpression
+ | postDecrementExpression
+ | methodInvocation
+ | classInstanceCreationExpression
+ ;
+
+ifThenStatement
+ : 'if' '(' expression ')' statement
+ ;
+
+ifThenElseStatement
+ : 'if' '(' expression ')' statementNoShortIf 'else' statement
+ ;
+
+ifThenElseStatementNoShortIf
+ : 'if' '(' expression ')' statementNoShortIf 'else' statementNoShortIf
+ ;
+
+assertStatement
+ : 'assert' expression ';'
+ | 'assert' expression ':' expression ';'
+ ;
+
+switchStatement
+ : 'switch' '(' expression ')' switchBlock
+ ;
+
+switchBlock
+ : '{' switchBlockStatementGroup* switchLabel* '}'
+ ;
+
+switchBlockStatementGroup
+ : switchLabels blockStatements
+ ;
+
+switchLabels
+ : switchLabel switchLabel*
+ ;
+
+switchLabel
+ : 'case' constantExpression ':'
+ | 'case' enumConstantName ':'
+ | 'default' ':'
+ ;
+
+enumConstantName
+ : Identifier
+ ;
+
+whileStatement
+ : 'while' '(' expression ')' statement
+ ;
+
+whileStatementNoShortIf
+ : 'while' '(' expression ')' statementNoShortIf
+ ;
+
+doStatement
+ : 'do' statement 'while' '(' expression ')' ';'
+ ;
+
+forStatement
+ : basicForStatement
+ | enhancedForStatement
+ ;
+
+forStatementNoShortIf
+ : basicForStatementNoShortIf
+ | enhancedForStatementNoShortIf
+ ;
+
+basicForStatement
+ : 'for' '(' forInit? ';' expression? ';' forUpdate? ')' statement
+ ;
+
+basicForStatementNoShortIf
+ : 'for' '(' forInit? ';' expression? ';' forUpdate? ')' statementNoShortIf
+ ;
+
+forInit
+ : statementExpressionList
+ | localVariableDeclaration
+ ;
+
+forUpdate
+ : statementExpressionList
+ ;
+
+statementExpressionList
+ : statementExpression (',' statementExpression)*
+ ;
+
+enhancedForStatement
+ : 'for' '(' variableModifier* unannType variableDeclaratorId ':' expression ')' statement
+ ;
+
+enhancedForStatementNoShortIf
+ : 'for' '(' variableModifier* unannType variableDeclaratorId ':' expression ')' statementNoShortIf
+ ;
+
+breakStatement
+ : 'break' Identifier? ';'
+ ;
+
+continueStatement
+ : 'continue' Identifier? ';'
+ ;
+
+returnStatement
+ : 'return' expression? ';'
+ ;
+
+throwStatement
+ : 'throw' expression ';'
+ ;
+
+synchronizedStatement
+ : 'synchronized' '(' expression ')' block
+ ;
+
+tryStatement
+ : 'try' block catches
+ | 'try' block catches? finally_
+ | tryWithResourcesStatement
+ ;
+
+catches
+ : catchClause catchClause*
+ ;
+
+catchClause
+ : 'catch' '(' catchFormalParameter ')' block
+ ;
+
+catchFormalParameter
+ : variableModifier* catchType variableDeclaratorId
+ ;
+
+catchType
+ : unannClassType ('|' classType)*
+ ;
+
+finally_
+ : 'finally' block
+ ;
+
+tryWithResourcesStatement
+ : 'try' resourceSpecification block catches? finally_?
+ ;
+
+resourceSpecification
+ : '(' resourceList ';'? ')'
+ ;
+
+resourceList
+ : resource (';' resource)*
+ ;
+
+resource
+ : variableModifier* unannType variableDeclaratorId '=' expression
+ ;
+
+/*
+ * Productions from §15 (Expressions)
+ */
+
+primary
+ : (primaryNoNewArray_lfno_primary | arrayCreationExpression) primaryNoNewArray_lf_primary*
+ ;
+
+primaryNoNewArray
+ : literal
+ | typeName ('[' ']')* '.' 'class'
+ | 'void' '.' 'class'
+ | 'this'
+ | typeName '.' 'this'
+ | '(' expression ')'
+ | classInstanceCreationExpression
+ | fieldAccess
+ | arrayAccess
+ | methodInvocation
+ | methodReference
+ ;
+
+primaryNoNewArray_lf_arrayAccess
+ :
+ ;
+
+primaryNoNewArray_lfno_arrayAccess
+ : literal
+ | typeName ('[' ']')* '.' 'class'
+ | 'void' '.' 'class'
+ | 'this'
+ | typeName '.' 'this'
+ | '(' expression ')'
+ | classInstanceCreationExpression
+ | fieldAccess
+ | methodInvocation
+ | methodReference
+ ;
+
+primaryNoNewArray_lf_primary
+ : classInstanceCreationExpression_lf_primary
+ | fieldAccess_lf_primary
+ | arrayAccess_lf_primary
+ | methodInvocation_lf_primary
+ | methodReference_lf_primary
+ ;
+
+primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary
+ :
+ ;
+
+primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary
+ : classInstanceCreationExpression_lf_primary
+ | fieldAccess_lf_primary
+ | methodInvocation_lf_primary
+ | methodReference_lf_primary
+ ;
+
+primaryNoNewArray_lfno_primary
+ : literal
+ | typeName ('[' ']')* '.' 'class'
+ | unannPrimitiveType ('[' ']')* '.' 'class'
+ | 'void' '.' 'class'
+ | 'this'
+ | typeName '.' 'this'
+ | '(' expression ')'
+ | classInstanceCreationExpression_lfno_primary
+ | fieldAccess_lfno_primary
+ | arrayAccess_lfno_primary
+ | methodInvocation_lfno_primary
+ | methodReference_lfno_primary
+ ;
+
+primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary
+ :
+ ;
+
+primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary
+ : literal
+ | typeName ('[' ']')* '.' 'class'
+ | unannPrimitiveType ('[' ']')* '.' 'class'
+ | 'void' '.' 'class'
+ | 'this'
+ | typeName '.' 'this'
+ | '(' expression ')'
+ | classInstanceCreationExpression_lfno_primary
+ | fieldAccess_lfno_primary
+ | methodInvocation_lfno_primary
+ | methodReference_lfno_primary
+ ;
+
+classInstanceCreationExpression
+ : 'new' typeArguments? annotation* Identifier ('.' annotation* Identifier)* typeArgumentsOrDiamond? '(' argumentList? ')' classBody?
+ | expressionName '.' 'new' typeArguments? annotation* Identifier typeArgumentsOrDiamond? '(' argumentList? ')' classBody?
+ | primary '.' 'new' typeArguments? annotation* Identifier typeArgumentsOrDiamond? '(' argumentList? ')' classBody?
+ ;
+
+classInstanceCreationExpression_lf_primary
+ : '.' 'new' typeArguments? annotation* Identifier typeArgumentsOrDiamond? '(' argumentList? ')' classBody?
+ ;
+
+classInstanceCreationExpression_lfno_primary
+ : 'new' typeArguments? annotation* Identifier ('.' annotation* Identifier)* typeArgumentsOrDiamond? '(' argumentList? ')' classBody?
+ | expressionName '.' 'new' typeArguments? annotation* Identifier typeArgumentsOrDiamond? '(' argumentList? ')' classBody?
+ ;
+
+typeArgumentsOrDiamond
+ : typeArguments
+ | '<' '>'
+ ;
+
+fieldAccess
+ : primary '.' Identifier
+ | 'super' '.' Identifier
+ | typeName '.' 'super' '.' Identifier
+ ;
+
+fieldAccess_lf_primary
+ : '.' Identifier
+ ;
+
+fieldAccess_lfno_primary
+ : 'super' '.' Identifier
+ | typeName '.' 'super' '.' Identifier
+ ;
+
+arrayAccess
+ : (expressionName '[' expression ']' | primaryNoNewArray_lfno_arrayAccess '[' expression ']') (
+ primaryNoNewArray_lf_arrayAccess '[' expression ']'
+ )*
+ ;
+
+arrayAccess_lf_primary
+ : primaryNoNewArray_lf_primary_lfno_arrayAccess_lf_primary '[' expression ']' (
+ primaryNoNewArray_lf_primary_lf_arrayAccess_lf_primary '[' expression ']'
+ )*
+ ;
+
+arrayAccess_lfno_primary
+ : (
+ expressionName '[' expression ']'
+ | primaryNoNewArray_lfno_primary_lfno_arrayAccess_lfno_primary '[' expression ']'
+ ) (primaryNoNewArray_lfno_primary_lf_arrayAccess_lfno_primary '[' expression ']')*
+ ;
+
+methodInvocation
+ : methodName '(' argumentList? ')'
+ | typeName '.' typeArguments? Identifier '(' argumentList? ')'
+ | expressionName '.' typeArguments? Identifier '(' argumentList? ')'
+ | primary '.' typeArguments? Identifier '(' argumentList? ')'
+ | 'super' '.' typeArguments? Identifier '(' argumentList? ')'
+ | typeName '.' 'super' '.' typeArguments? Identifier '(' argumentList? ')'
+ ;
+
+methodInvocation_lf_primary
+ : '.' typeArguments? Identifier '(' argumentList? ')'
+ ;
+
+methodInvocation_lfno_primary
+ : methodName '(' argumentList? ')'
+ | typeName '.' typeArguments? Identifier '(' argumentList? ')'
+ | expressionName '.' typeArguments? Identifier '(' argumentList? ')'
+ | 'super' '.' typeArguments? Identifier '(' argumentList? ')'
+ | typeName '.' 'super' '.' typeArguments? Identifier '(' argumentList? ')'
+ ;
+
+argumentList
+ : expression (',' expression)*
+ ;
+
+methodReference
+ : expressionName '::' typeArguments? Identifier
+ | referenceType '::' typeArguments? Identifier
+ | primary '::' typeArguments? Identifier
+ | 'super' '::' typeArguments? Identifier
+ | typeName '.' 'super' '::' typeArguments? Identifier
+ | classType '::' typeArguments? 'new'
+ | arrayType '::' 'new'
+ ;
+
+methodReference_lf_primary
+ : '::' typeArguments? Identifier
+ ;
+
+methodReference_lfno_primary
+ : expressionName '::' typeArguments? Identifier
+ | referenceType '::' typeArguments? Identifier
+ | 'super' '::' typeArguments? Identifier
+ | typeName '.' 'super' '::' typeArguments? Identifier
+ | classType '::' typeArguments? 'new'
+ | arrayType '::' 'new'
+ ;
+
+arrayCreationExpression
+ : 'new' primitiveType dimExprs dims?
+ | 'new' classOrInterfaceType dimExprs dims?
+ | 'new' primitiveType dims arrayInitializer
+ | 'new' classOrInterfaceType dims arrayInitializer
+ ;
+
+dimExprs
+ : dimExpr dimExpr*
+ ;
+
+dimExpr
+ : annotation* '[' expression ']'
+ ;
+
+constantExpression
+ : expression
+ ;
+
+expression
+ : lambdaExpression
+ | assignmentExpression
+ ;
+
+lambdaExpression
+ : lambdaParameters '->' lambdaBody
+ ;
+
+lambdaParameters
+ : Identifier
+ | '(' formalParameterList? ')'
+ | '(' inferredFormalParameterList ')'
+ ;
+
+inferredFormalParameterList
+ : Identifier (',' Identifier)*
+ ;
+
+lambdaBody
+ : expression
+ | block
+ ;
+
+assignmentExpression
+ : conditionalExpression
+ | assignment
+ ;
+
+assignment
+ : leftHandSide assignmentOperator expression
+ ;
+
+leftHandSide
+ : expressionName
+ | fieldAccess
+ | arrayAccess
+ ;
+
+assignmentOperator
+ : '='
+ | '*='
+ | '/='
+ | '%='
+ | '+='
+ | '-='
+ | '<<='
+ | '>>='
+ | '>>>='
+ | '&='
+ | '^='
+ | '|='
+ ;
+
+conditionalExpression
+ : conditionalOrExpression
+ | conditionalOrExpression '?' expression ':' conditionalExpression
+ ;
+
+conditionalOrExpression
+ : conditionalAndExpression
+ | conditionalOrExpression '||' conditionalAndExpression
+ ;
+
+conditionalAndExpression
+ : inclusiveOrExpression
+ | conditionalAndExpression '&&' inclusiveOrExpression
+ ;
+
+inclusiveOrExpression
+ : exclusiveOrExpression
+ | inclusiveOrExpression '|' exclusiveOrExpression
+ ;
+
+exclusiveOrExpression
+ : andExpression
+ | exclusiveOrExpression '^' andExpression
+ ;
+
+andExpression
+ : equalityExpression
+ | andExpression '&' equalityExpression
+ ;
+
+equalityExpression
+ : relationalExpression
+ | equalityExpression '==' relationalExpression
+ | equalityExpression '!=' relationalExpression
+ ;
+
+relationalExpression
+ : shiftExpression
+ | relationalExpression '<' shiftExpression
+ | relationalExpression '>' shiftExpression
+ | relationalExpression '<=' shiftExpression
+ | relationalExpression '>=' shiftExpression
+ | relationalExpression 'instanceof' referenceType
+ ;
+
+shiftExpression
+ : additiveExpression
+ | shiftExpression '<' '<' additiveExpression
+ | shiftExpression '>' '>' additiveExpression
+ | shiftExpression '>' '>' '>' additiveExpression
+ ;
+
+additiveExpression
+ : multiplicativeExpression
+ | additiveExpression '+' multiplicativeExpression
+ | additiveExpression '-' multiplicativeExpression
+ ;
+
+multiplicativeExpression
+ : unaryExpression
+ | multiplicativeExpression '*' unaryExpression
+ | multiplicativeExpression '/' unaryExpression
+ | multiplicativeExpression '%' unaryExpression
+ ;
+
+unaryExpression
+ : preIncrementExpression
+ | preDecrementExpression
+ | '+' unaryExpression
+ | '-' unaryExpression
+ | unaryExpressionNotPlusMinus
+ ;
+
+preIncrementExpression
+ : '++' unaryExpression
+ ;
+
+preDecrementExpression
+ : '--' unaryExpression
+ ;
+
+unaryExpressionNotPlusMinus
+ : postfixExpression
+ | '~' unaryExpression
+ | '!' unaryExpression
+ | castExpression
+ ;
+
+postfixExpression
+ : (primary | expressionName) (
+ postIncrementExpression_lf_postfixExpression
+ | postDecrementExpression_lf_postfixExpression
+ )*
+ ;
+
+postIncrementExpression
+ : postfixExpression '++'
+ ;
+
+postIncrementExpression_lf_postfixExpression
+ : '++'
+ ;
+
+postDecrementExpression
+ : postfixExpression '--'
+ ;
+
+postDecrementExpression_lf_postfixExpression
+ : '--'
+ ;
+
+castExpression
+ : '(' primitiveType ')' unaryExpression
+ | '(' referenceType additionalBound* ')' unaryExpressionNotPlusMinus
+ | '(' referenceType additionalBound* ')' lambdaExpression
+ ;
\ No newline at end of file
diff --git a/benchmarks/src/main/java/org/antlr/fast/JavaLexer.g4 b/benchmarks/src/main/java/org/antlr/fast/JavaLexer.g4
new file mode 100644
index 000000000..b3de61fea
--- /dev/null
+++ b/benchmarks/src/main/java/org/antlr/fast/JavaLexer.g4
@@ -0,0 +1,233 @@
+/*
+ [The "BSD licence"]
+ Copyright (c) 2013 Terence Parr, Sam Harwell
+ Copyright (c) 2017 Ivan Kochurkin (upgrade to Java 8)
+ Copyright (c) 2021 Michał Lorek (upgrade to Java 11)
+ Copyright (c) 2022 Michał Lorek (upgrade to Java 17)
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false
+// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine
+// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true
+
+lexer grammar JavaLexer;
+
+// Keywords
+
+ABSTRACT : 'abstract';
+ASSERT : 'assert';
+BOOLEAN : 'boolean';
+BREAK : 'break';
+BYTE : 'byte';
+CASE : 'case';
+CATCH : 'catch';
+CHAR : 'char';
+CLASS : 'class';
+CONST : 'const';
+CONTINUE : 'continue';
+DEFAULT : 'default';
+DO : 'do';
+DOUBLE : 'double';
+ELSE : 'else';
+ENUM : 'enum';
+EXTENDS : 'extends';
+FINAL : 'final';
+FINALLY : 'finally';
+FLOAT : 'float';
+FOR : 'for';
+IF : 'if';
+GOTO : 'goto';
+IMPLEMENTS : 'implements';
+IMPORT : 'import';
+INSTANCEOF : 'instanceof';
+INT : 'int';
+INTERFACE : 'interface';
+LONG : 'long';
+NATIVE : 'native';
+NEW : 'new';
+PACKAGE : 'package';
+PRIVATE : 'private';
+PROTECTED : 'protected';
+PUBLIC : 'public';
+RETURN : 'return';
+SHORT : 'short';
+STATIC : 'static';
+STRICTFP : 'strictfp';
+SUPER : 'super';
+SWITCH : 'switch';
+SYNCHRONIZED : 'synchronized';
+THIS : 'this';
+THROW : 'throw';
+THROWS : 'throws';
+TRANSIENT : 'transient';
+TRY : 'try';
+VOID : 'void';
+VOLATILE : 'volatile';
+WHILE : 'while';
+
+// Module related keywords
+MODULE : 'module';
+OPEN : 'open';
+REQUIRES : 'requires';
+EXPORTS : 'exports';
+OPENS : 'opens';
+TO : 'to';
+USES : 'uses';
+PROVIDES : 'provides';
+WITH : 'with';
+TRANSITIVE : 'transitive';
+
+// Local Variable Type Inference
+VAR: 'var'; // reserved type name
+
+// Switch Expressions
+YIELD: 'yield'; // reserved type name from Java 14
+
+// Records
+RECORD: 'record';
+
+// Sealed Classes
+SEALED : 'sealed';
+PERMITS : 'permits';
+NON_SEALED : 'non-sealed';
+
+// Literals
+
+DECIMAL_LITERAL : ('0' | [1-9] (Digits? | '_'+ Digits)) [lL]?;
+HEX_LITERAL : '0' [xX] [0-9a-fA-F] ([0-9a-fA-F_]* [0-9a-fA-F])? [lL]?;
+OCT_LITERAL : '0' '_'* [0-7] ([0-7_]* [0-7])? [lL]?;
+BINARY_LITERAL : '0' [bB] [01] ([01_]* [01])? [lL]?;
+
+FLOAT_LITERAL:
+ (Digits '.' Digits? | '.' Digits) ExponentPart? [fFdD]?
+ | Digits (ExponentPart [fFdD]? | [fFdD])
+;
+
+HEX_FLOAT_LITERAL: '0' [xX] (HexDigits '.'? | HexDigits? '.' HexDigits) [pP] [+-]? Digits [fFdD]?;
+
+BOOL_LITERAL: 'true' | 'false';
+
+CHAR_LITERAL: '\'' (~['\\\r\n] | EscapeSequence) '\'';
+
+STRING_LITERAL: '"' (~["\\\r\n] | EscapeSequence)* '"';
+
+TEXT_BLOCK: '"""' [ \t]* [\r\n] (. | EscapeSequence)*? '"""';
+
+NULL_LITERAL: 'null';
+
+// Separators
+
+LPAREN : '(';
+RPAREN : ')';
+LBRACE : '{';
+RBRACE : '}';
+LBRACK : '[';
+RBRACK : ']';
+SEMI : ';';
+COMMA : ',';
+DOT : '.';
+
+// Operators
+
+ASSIGN : '=';
+GT : '>';
+LT : '<';
+BANG : '!';
+TILDE : '~';
+QUESTION : '?';
+COLON : ':';
+EQUAL : '==';
+LE : '<=';
+GE : '>=';
+NOTEQUAL : '!=';
+AND : '&&';
+OR : '||';
+INC : '++';
+DEC : '--';
+ADD : '+';
+SUB : '-';
+MUL : '*';
+DIV : '/';
+BITAND : '&';
+BITOR : '|';
+CARET : '^';
+MOD : '%';
+
+ADD_ASSIGN : '+=';
+SUB_ASSIGN : '-=';
+MUL_ASSIGN : '*=';
+DIV_ASSIGN : '/=';
+AND_ASSIGN : '&=';
+OR_ASSIGN : '|=';
+XOR_ASSIGN : '^=';
+MOD_ASSIGN : '%=';
+LSHIFT_ASSIGN : '<<=';
+RSHIFT_ASSIGN : '>>=';
+URSHIFT_ASSIGN : '>>>=';
+
+// Java 8 tokens
+
+ARROW : '->';
+COLONCOLON : '::';
+
+// Additional symbols not defined in the lexical specification
+
+AT : '@';
+ELLIPSIS : '...';
+
+// Whitespace and comments
+
+WS : [ \t\r\n\u000C]+ -> channel(HIDDEN);
+COMMENT : '/*' .*? '*/' -> channel(HIDDEN);
+LINE_COMMENT : '//' ~[\r\n]* -> channel(HIDDEN);
+
+// Identifiers
+
+IDENTIFIER: Letter LetterOrDigit*;
+
+// Fragment rules
+
+fragment ExponentPart: [eE] [+-]? Digits;
+
+fragment EscapeSequence:
+ '\\' 'u005c'? [btnfr"'\\]
+ | '\\' 'u005c'? ([0-3]? [0-7])? [0-7]
+ | '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit
+;
+
+fragment HexDigits: HexDigit ((HexDigit | '_')* HexDigit)?;
+
+fragment HexDigit: [0-9a-fA-F];
+
+fragment Digits: [0-9] ([0-9_]* [0-9])?;
+
+fragment LetterOrDigit: Letter | [0-9];
+
+fragment Letter:
+ [a-zA-Z$_] // these are the "java letters" below 0x7F
+ | ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
+ | [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
+;
\ No newline at end of file
diff --git a/benchmarks/src/main/java/org/antlr/fast/JavaParser.g4 b/benchmarks/src/main/java/org/antlr/fast/JavaParser.g4
new file mode 100644
index 000000000..a240eb308
--- /dev/null
+++ b/benchmarks/src/main/java/org/antlr/fast/JavaParser.g4
@@ -0,0 +1,800 @@
+/*
+ [The "BSD licence"]
+ Copyright (c) 2013 Terence Parr, Sam Harwell
+ Copyright (c) 2017 Ivan Kochurkin (upgrade to Java 8)
+ Copyright (c) 2021 Michał Lorek (upgrade to Java 11)
+ Copyright (c) 2022 Michał Lorek (upgrade to Java 17)
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
+// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
+
+parser grammar JavaParser;
+
+options {
+ tokenVocab = JavaLexer;
+}
+
+compilationUnit
+ : packageDeclaration? (importDeclaration | ';')* (typeDeclaration | ';')*
+ | moduleDeclaration EOF
+ ;
+
+packageDeclaration
+ : annotation* PACKAGE qualifiedName ';'
+ ;
+
+importDeclaration
+ : IMPORT STATIC? qualifiedName ('.' '*')? ';'
+ ;
+
+typeDeclaration
+ : classOrInterfaceModifier* (
+ classDeclaration
+ | enumDeclaration
+ | interfaceDeclaration
+ | annotationTypeDeclaration
+ | recordDeclaration
+ )
+ ;
+
+modifier
+ : classOrInterfaceModifier
+ | NATIVE
+ | SYNCHRONIZED
+ | TRANSIENT
+ | VOLATILE
+ ;
+
+classOrInterfaceModifier
+ : annotation
+ | PUBLIC
+ | PROTECTED
+ | PRIVATE
+ | STATIC
+ | ABSTRACT
+ | FINAL // FINAL for class only -- does not apply to interfaces
+ | STRICTFP
+ | SEALED // Java17
+ | NON_SEALED // Java17
+ ;
+
+variableModifier
+ : FINAL
+ | annotation
+ ;
+
+classDeclaration
+ : CLASS identifier typeParameters? (EXTENDS typeType)? (IMPLEMENTS typeList)? (
+ PERMITS typeList
+ )? // Java17
+ classBody
+ ;
+
+typeParameters
+ : '<' typeParameter (',' typeParameter)* '>'
+ ;
+
+typeParameter
+ : annotation* identifier (EXTENDS annotation* typeBound)?
+ ;
+
+typeBound
+ : typeType ('&' typeType)*
+ ;
+
+enumDeclaration
+ : ENUM identifier (IMPLEMENTS typeList)? '{' enumConstants? ','? enumBodyDeclarations? '}'
+ ;
+
+enumConstants
+ : enumConstant (',' enumConstant)*
+ ;
+
+enumConstant
+ : annotation* identifier arguments? classBody?
+ ;
+
+enumBodyDeclarations
+ : ';' classBodyDeclaration*
+ ;
+
+interfaceDeclaration
+ : INTERFACE identifier typeParameters? (EXTENDS typeList)? (PERMITS typeList)? interfaceBody
+ ;
+
+classBody
+ : '{' classBodyDeclaration* '}'
+ ;
+
+interfaceBody
+ : '{' interfaceBodyDeclaration* '}'
+ ;
+
+classBodyDeclaration
+ : ';'
+ | STATIC? block
+ | modifier* memberDeclaration
+ ;
+
+memberDeclaration
+ : recordDeclaration //Java17
+ | methodDeclaration
+ | genericMethodDeclaration
+ | fieldDeclaration
+ | constructorDeclaration
+ | genericConstructorDeclaration
+ | interfaceDeclaration
+ | annotationTypeDeclaration
+ | classDeclaration
+ | enumDeclaration
+ ;
+
+/* We use rule this even for void methods which cannot have [] after parameters.
+ This simplifies grammar and we can consider void to be a type, which
+ renders the [] matching as a context-sensitive issue or a semantic check
+ for invalid return type after parsing.
+ */
+methodDeclaration
+ : typeTypeOrVoid identifier formalParameters ('[' ']')* (THROWS qualifiedNameList)? methodBody
+ ;
+
+methodBody
+ : block
+ | ';'
+ ;
+
+typeTypeOrVoid
+ : typeType
+ | VOID
+ ;
+
+genericMethodDeclaration
+ : typeParameters methodDeclaration
+ ;
+
+genericConstructorDeclaration
+ : typeParameters constructorDeclaration
+ ;
+
+constructorDeclaration
+ : identifier formalParameters (THROWS qualifiedNameList)? constructorBody = block
+ ;
+
+compactConstructorDeclaration
+ : modifier* identifier constructorBody = block
+ ;
+
+fieldDeclaration
+ : typeType variableDeclarators ';'
+ ;
+
+interfaceBodyDeclaration
+ : modifier* interfaceMemberDeclaration
+ | ';'
+ ;
+
+interfaceMemberDeclaration
+ : recordDeclaration // Java17
+ | constDeclaration
+ | interfaceMethodDeclaration
+ | genericInterfaceMethodDeclaration
+ | interfaceDeclaration
+ | annotationTypeDeclaration
+ | classDeclaration
+ | enumDeclaration
+ ;
+
+constDeclaration
+ : typeType constantDeclarator (',' constantDeclarator)* ';'
+ ;
+
+constantDeclarator
+ : identifier ('[' ']')* '=' variableInitializer
+ ;
+
+// Early versions of Java allows brackets after the method name, eg.
+// public int[] return2DArray() [] { ... }
+// is the same as
+// public int[][] return2DArray() { ... }
+interfaceMethodDeclaration
+ : interfaceMethodModifier* interfaceCommonBodyDeclaration
+ ;
+
+// Java8
+interfaceMethodModifier
+ : annotation
+ | PUBLIC
+ | ABSTRACT
+ | DEFAULT
+ | STATIC
+ | STRICTFP
+ ;
+
+genericInterfaceMethodDeclaration
+ : interfaceMethodModifier* typeParameters interfaceCommonBodyDeclaration
+ ;
+
+interfaceCommonBodyDeclaration
+ : annotation* typeTypeOrVoid identifier formalParameters ('[' ']')* (THROWS qualifiedNameList)? methodBody
+ ;
+
+variableDeclarators
+ : variableDeclarator (',' variableDeclarator)*
+ ;
+
+variableDeclarator
+ : variableDeclaratorId ('=' variableInitializer)?
+ ;
+
+variableDeclaratorId
+ : identifier ('[' ']')*
+ ;
+
+variableInitializer
+ : arrayInitializer
+ | expression
+ ;
+
+arrayInitializer
+ : '{' (variableInitializer (',' variableInitializer)* ','?)? '}'
+ ;
+
+classOrInterfaceType
+ : (identifier typeArguments? '.')* typeIdentifier typeArguments?
+ ;
+
+typeArgument
+ : typeType
+ | annotation* '?' ((EXTENDS | SUPER) typeType)?
+ ;
+
+qualifiedNameList
+ : qualifiedName (',' qualifiedName)*
+ ;
+
+formalParameters
+ : '(' (
+ receiverParameter?
+ | receiverParameter (',' formalParameterList)?
+ | formalParameterList?
+ ) ')'
+ ;
+
+receiverParameter
+ : typeType (identifier '.')* THIS
+ ;
+
+formalParameterList
+ : formalParameter (',' formalParameter)* (',' lastFormalParameter)?
+ | lastFormalParameter
+ ;
+
+formalParameter
+ : variableModifier* typeType variableDeclaratorId
+ ;
+
+lastFormalParameter
+ : variableModifier* typeType annotation* '...' variableDeclaratorId
+ ;
+
+// local variable type inference
+lambdaLVTIList
+ : lambdaLVTIParameter (',' lambdaLVTIParameter)*
+ ;
+
+lambdaLVTIParameter
+ : variableModifier* VAR identifier
+ ;
+
+qualifiedName
+ : identifier ('.' identifier)*
+ ;
+
+literal
+ : integerLiteral
+ | floatLiteral
+ | CHAR_LITERAL
+ | STRING_LITERAL
+ | BOOL_LITERAL
+ | NULL_LITERAL
+ | TEXT_BLOCK // Java17
+ ;
+
+integerLiteral
+ : DECIMAL_LITERAL
+ | HEX_LITERAL
+ | OCT_LITERAL
+ | BINARY_LITERAL
+ ;
+
+floatLiteral
+ : FLOAT_LITERAL
+ | HEX_FLOAT_LITERAL
+ ;
+
+// ANNOTATIONS
+altAnnotationQualifiedName
+ : (identifier DOT)* '@' identifier
+ ;
+
+annotation
+ : ('@' qualifiedName | altAnnotationQualifiedName) (
+ '(' ( elementValuePairs | elementValue)? ')'
+ )?
+ ;
+
+elementValuePairs
+ : elementValuePair (',' elementValuePair)*
+ ;
+
+elementValuePair
+ : identifier '=' elementValue
+ ;
+
+elementValue
+ : expression
+ | annotation
+ | elementValueArrayInitializer
+ ;
+
+elementValueArrayInitializer
+ : '{' (elementValue (',' elementValue)*)? ','? '}'
+ ;
+
+annotationTypeDeclaration
+ : '@' INTERFACE identifier annotationTypeBody
+ ;
+
+annotationTypeBody
+ : '{' annotationTypeElementDeclaration* '}'
+ ;
+
+annotationTypeElementDeclaration
+ : modifier* annotationTypeElementRest
+ | ';' // this is not allowed by the grammar, but apparently allowed by the actual compiler
+ ;
+
+annotationTypeElementRest
+ : typeType annotationMethodOrConstantRest ';'
+ | classDeclaration ';'?
+ | interfaceDeclaration ';'?
+ | enumDeclaration ';'?
+ | annotationTypeDeclaration ';'?
+ | recordDeclaration ';'? // Java17
+ ;
+
+annotationMethodOrConstantRest
+ : annotationMethodRest
+ | annotationConstantRest
+ ;
+
+annotationMethodRest
+ : identifier '(' ')' defaultValue?
+ ;
+
+annotationConstantRest
+ : variableDeclarators
+ ;
+
+defaultValue
+ : DEFAULT elementValue
+ ;
+
+// MODULES - Java9
+
+moduleDeclaration
+ : OPEN? MODULE qualifiedName moduleBody
+ ;
+
+moduleBody
+ : '{' moduleDirective* '}'
+ ;
+
+moduleDirective
+ : REQUIRES requiresModifier* qualifiedName ';'
+ | EXPORTS qualifiedName (TO qualifiedName)? ';'
+ | OPENS qualifiedName (TO qualifiedName)? ';'
+ | USES qualifiedName ';'
+ | PROVIDES qualifiedName WITH qualifiedName ';'
+ ;
+
+requiresModifier
+ : TRANSITIVE
+ | STATIC
+ ;
+
+// RECORDS - Java 17
+
+recordDeclaration
+ : RECORD identifier typeParameters? recordHeader (IMPLEMENTS typeList)? recordBody
+ ;
+
+recordHeader
+ : '(' recordComponentList? ')'
+ ;
+
+recordComponentList
+ : recordComponent (',' recordComponent)*
+ ;
+
+recordComponent
+ : typeType identifier
+ ;
+
+recordBody
+ : '{' (classBodyDeclaration | compactConstructorDeclaration)* '}'
+ ;
+
+// STATEMENTS / BLOCKS
+
+block
+ : '{' blockStatement* '}'
+ ;
+
+blockStatement
+ : localVariableDeclaration ';'
+ | localTypeDeclaration
+ | statement
+ ;
+
+localVariableDeclaration
+ : variableModifier* (VAR identifier '=' expression | typeType variableDeclarators)
+ ;
+
+identifier
+ : IDENTIFIER
+ | MODULE
+ | OPEN
+ | REQUIRES
+ | EXPORTS
+ | OPENS
+ | TO
+ | USES
+ | PROVIDES
+ | WITH
+ | TRANSITIVE
+ | YIELD
+ | SEALED
+ | PERMITS
+ | RECORD
+ | VAR
+ ;
+
+typeIdentifier // Identifiers that are not restricted for type declarations
+ : IDENTIFIER
+ | MODULE
+ | OPEN
+ | REQUIRES
+ | EXPORTS
+ | OPENS
+ | TO
+ | USES
+ | PROVIDES
+ | WITH
+ | TRANSITIVE
+ | SEALED
+ | PERMITS
+ | RECORD
+ ;
+
+localTypeDeclaration
+ : classOrInterfaceModifier* (classDeclaration | interfaceDeclaration | recordDeclaration)
+ ;
+
+statement
+ : blockLabel = block
+ | ASSERT expression (':' expression)? ';'
+ | IF parExpression statement (ELSE statement)?
+ | FOR '(' forControl ')' statement
+ | WHILE parExpression statement
+ | DO statement WHILE parExpression ';'
+ | TRY block (catchClause+ finallyBlock? | finallyBlock)
+ | TRY resourceSpecification block catchClause* finallyBlock?
+ | SWITCH parExpression '{' switchBlockStatementGroup* switchLabel* '}'
+ | SYNCHRONIZED parExpression block
+ | RETURN expression? ';'
+ | THROW expression ';'
+ | BREAK identifier? ';'
+ | CONTINUE identifier? ';'
+ | YIELD expression ';' // Java17
+ | SEMI
+ | statementExpression = expression ';'
+ | switchExpression ';'? // Java17
+ | identifierLabel = identifier ':' statement
+ ;
+
+catchClause
+ : CATCH '(' variableModifier* catchType identifier ')' block
+ ;
+
+catchType
+ : qualifiedName ('|' qualifiedName)*
+ ;
+
+finallyBlock
+ : FINALLY block
+ ;
+
+resourceSpecification
+ : '(' resources ';'? ')'
+ ;
+
+resources
+ : resource (';' resource)*
+ ;
+
+resource
+ : variableModifier* (classOrInterfaceType variableDeclaratorId | VAR identifier) '=' expression
+ | qualifiedName
+ ;
+
+/** Matches cases then statements, both of which are mandatory.
+ * To handle empty cases at the end, we add switchLabel* to statement.
+ */
+switchBlockStatementGroup
+ : switchLabel+ blockStatement+
+ ;
+
+switchLabel
+ : CASE (
+ constantExpression = expression
+ | enumConstantName = IDENTIFIER
+ | typeType varName = identifier
+ ) ':'
+ | DEFAULT ':'
+ ;
+
+forControl
+ : enhancedForControl
+ | forInit? ';' expression? ';' forUpdate = expressionList?
+ ;
+
+forInit
+ : localVariableDeclaration
+ | expressionList
+ ;
+
+enhancedForControl
+ : variableModifier* (typeType | VAR) variableDeclaratorId ':' expression
+ ;
+
+// EXPRESSIONS
+
+parExpression
+ : '(' expression ')'
+ ;
+
+expressionList
+ : expression (',' expression)*
+ ;
+
+methodCall
+ : (identifier | THIS | SUPER) arguments
+ ;
+
+expression
+ // Expression order in accordance with https://introcs.cs.princeton.edu/java/11precedence/
+ // Level 16, Primary, array and member access
+ : primary
+ | expression '[' expression ']'
+ | expression bop = '.' (
+ identifier
+ | methodCall
+ | THIS
+ | NEW nonWildcardTypeArguments? innerCreator
+ | SUPER superSuffix
+ | explicitGenericInvocation
+ )
+ // Method calls and method references are part of primary, and hence level 16 precedence
+ | methodCall
+ | expression '::' typeArguments? identifier
+ | typeType '::' (typeArguments? identifier | NEW)
+ | classType '::' typeArguments? NEW
+ | switchExpression // Java17
+
+ // Level 15 Post-increment/decrement operators
+ | expression postfix = ('++' | '--')
+
+ // Level 14, Unary operators
+ | prefix = ('+' | '-' | '++' | '--' | '~' | '!') expression
+
+ // Level 13 Cast and object creation
+ | '(' annotation* typeType ('&' typeType)* ')' expression
+ | NEW creator
+
+ // Level 12 to 1, Remaining operators
+ | expression bop = ('*' | '/' | '%') expression // Level 12, Multiplicative operators
+ | expression bop = ('+' | '-') expression // Level 11, Additive operators
+ | expression ('<' '<' | '>' '>' '>' | '>' '>') expression // Level 10, Shift operators
+ | expression bop = ('<=' | '>=' | '>' | '<') expression // Level 9, Relational operators
+ | expression bop = INSTANCEOF (typeType | pattern)
+ | expression bop = ('==' | '!=') expression // Level 8, Equality Operators
+ | expression bop = '&' expression // Level 7, Bitwise AND
+ | expression bop = '^' expression // Level 6, Bitwise XOR
+ | expression bop = '|' expression // Level 5, Bitwise OR
+ | expression bop = '&&' expression // Level 4, Logic AND
+ | expression bop = '||' expression // Level 3, Logic OR
+ | expression bop = '?' expression ':' expression // Level 2, Ternary
+ // Level 1, Assignment
+ | expression bop = (
+ '='
+ | '+='
+ | '-='
+ | '*='
+ | '/='
+ | '&='
+ | '|='
+ | '^='
+ | '>>='
+ | '>>>='
+ | '<<='
+ | '%='
+ ) expression
+
+ // Level 0, Lambda Expression
+ | lambdaExpression // Java8
+ ;
+
+// Java17
+pattern
+ : variableModifier* typeType annotation* identifier
+ ;
+
+// Java8
+lambdaExpression
+ : lambdaParameters '->' lambdaBody
+ ;
+
+// Java8
+lambdaParameters
+ : identifier
+ | '(' formalParameterList? ')'
+ | '(' identifier (',' identifier)* ')'
+ | '(' lambdaLVTIList? ')'
+ ;
+
+// Java8
+lambdaBody
+ : expression
+ | block
+ ;
+
+primary
+ : '(' expression ')'
+ | THIS
+ | SUPER
+ | literal
+ | identifier
+ | typeTypeOrVoid '.' CLASS
+ | nonWildcardTypeArguments (explicitGenericInvocationSuffix | THIS arguments)
+ ;
+
+// Java17
+switchExpression
+ : SWITCH parExpression '{' switchLabeledRule* '}'
+ ;
+
+// Java17
+switchLabeledRule
+ : CASE (expressionList | NULL_LITERAL | guardedPattern) (ARROW | COLON) switchRuleOutcome
+ | DEFAULT (ARROW | COLON) switchRuleOutcome
+ ;
+
+// Java17
+guardedPattern
+ : '(' guardedPattern ')'
+ | variableModifier* typeType annotation* identifier ('&&' expression)*
+ | guardedPattern '&&' expression
+ ;
+
+// Java17
+switchRuleOutcome
+ : block
+ | blockStatement*
+ ;
+
+classType
+ : (classOrInterfaceType '.')? annotation* identifier typeArguments?
+ ;
+
+creator
+ : nonWildcardTypeArguments? createdName classCreatorRest
+ | createdName arrayCreatorRest
+ ;
+
+createdName
+ : identifier typeArgumentsOrDiamond? ('.' identifier typeArgumentsOrDiamond?)*
+ | primitiveType
+ ;
+
+innerCreator
+ : identifier nonWildcardTypeArgumentsOrDiamond? classCreatorRest
+ ;
+
+arrayCreatorRest
+ : ('[' ']')+ arrayInitializer
+ | ('[' expression ']')+ ('[' ']')*
+ ;
+
+classCreatorRest
+ : arguments classBody?
+ ;
+
+explicitGenericInvocation
+ : nonWildcardTypeArguments explicitGenericInvocationSuffix
+ ;
+
+typeArgumentsOrDiamond
+ : '<' '>'
+ | typeArguments
+ ;
+
+nonWildcardTypeArgumentsOrDiamond
+ : '<' '>'
+ | nonWildcardTypeArguments
+ ;
+
+nonWildcardTypeArguments
+ : '<' typeList '>'
+ ;
+
+typeList
+ : typeType (',' typeType)*
+ ;
+
+typeType
+ : annotation* (classOrInterfaceType | primitiveType) (annotation* '[' ']')*
+ ;
+
+primitiveType
+ : BOOLEAN
+ | CHAR
+ | BYTE
+ | SHORT
+ | INT
+ | LONG
+ | FLOAT
+ | DOUBLE
+ ;
+
+typeArguments
+ : '<' typeArgument (',' typeArgument)* '>'
+ ;
+
+superSuffix
+ : arguments
+ | '.' typeArguments? identifier arguments?
+ ;
+
+explicitGenericInvocationSuffix
+ : SUPER superSuffix
+ | identifier arguments
+ ;
+
+arguments
+ : '(' expressionList? ')'
+ ;
\ No newline at end of file
diff --git a/benchmarks/src/main/java/org/ucfs/scanner/java.flex b/benchmarks/src/main/java/org/ucfs/scanner/java.flex
new file mode 100644
index 000000000..4d958c0dc
--- /dev/null
+++ b/benchmarks/src/main/java/org/ucfs/scanner/java.flex
@@ -0,0 +1,281 @@
+package org.ucfs;
+/*
+ * Copyright (C) 1998-2018 Gerwin Klein
+ * SPDX-License-Identifier: GPL-2.0-only
+ */
+
+/* Java 1.2 language lexer specification */
+
+/* Use together with unicode.flex for Unicode preprocesssing */
+/* and java12.cup for a Java 1.2 parser */
+
+/* Note that this lexer specification is not tuned for speed.
+ It is in fact quite slow on integer and floating point literals,
+ because the input is read twice and the methods used to parse
+ the numbers are not very fast.
+ For a production quality application (e.g. a Java compiler)
+ this could be optimized */
+
+
+%%
+
+%public
+%class Scanner
+
+%unicode
+
+%line
+%column
+%type JavaToken
+
+
+%{
+
+ /**
+ * assumes correct representation of a long value for
+ * specified radix in scanner buffer from start
+ * to end
+ */
+
+%}
+
+/* main character classes */
+LineTerminator = \r|\n|\r\n
+InputCharacter = [^\r\n]
+
+WhiteSpace = {LineTerminator} | [ \t\f]
+
+/* comments */
+Comment = {TraditionalComment} | {EndOfLineComment} |
+ {DocumentationComment}
+
+TraditionalComment = "/*" [^*] ~"*/" | "/*" "*"+ "/"
+EndOfLineComment = "//" {InputCharacter}* {LineTerminator}?
+DocumentationComment = "/*" "*"+ [^/*] ~"*/"
+
+/* identifiers */
+Identifier = [:jletter:][:jletterdigit:]*
+
+/* integer literals */
+DecIntegerLiteral = 0 | [1-9][0-9]*
+DecLongLiteral = {DecIntegerLiteral} [lL]
+
+HexIntegerLiteral = 0 [xX] 0* {HexDigit} {1,8}
+HexLongLiteral = 0 [xX] 0* {HexDigit} {1,16} [lL]
+HexDigit = [0-9a-fA-F]
+
+OctIntegerLiteral = 0+ [1-3]? {OctDigit} {1,15}
+OctLongLiteral = 0+ 1? {OctDigit} {1,21} [lL]
+OctDigit = [0-7]
+
+/* floating point literals */
+FloatLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}? [fF]
+DoubleLiteral = ({FLit1}|{FLit2}|{FLit3}) {Exponent}?
+
+FLit1 = [0-9]+ \. [0-9]*
+FLit2 = \. [0-9]+
+FLit3 = [0-9]+
+Exponent = [eE] [+-]? [0-9]+
+
+/* string and character literals */
+StringCharacter = [^\r\n\"\\]
+SingleCharacter = [^\r\n\'\\]
+
+%state STRING, CHARLITERAL
+
+%%
+
+ {
+
+ /* keywords */
+ "abstract" { return JavaToken.ABSTRACT; }
+ "boolean" { return JavaToken.BOOLEAN; }
+ "break" { return JavaToken.BREAK; }
+ "byte" { return JavaToken.BYTE; }
+ "case" { return JavaToken.CASE; }
+ "catch" { return JavaToken.CATCH; }
+ "char" { return JavaToken.CHAR; }
+ "class" { return JavaToken.CLASS; }
+ "const" { return JavaToken.CONST; }
+ "continue" { return JavaToken.CONTINUE; }
+ "do" { return JavaToken.DO; }
+ "double" { return JavaToken.DOUBLE; }
+ "else" { return JavaToken.ELSE; }
+ "extends" { return JavaToken.EXTENDS; }
+ "final" { return JavaToken.FINAL; }
+ "finally" { return JavaToken.FINALLY; }
+ "float" { return JavaToken.FLOAT; }
+ "for" { return JavaToken.FOR; }
+ "default" { return JavaToken.DEFAULT; }
+ "implements" { return JavaToken.IMPLEMENTS; }
+ "import" { return JavaToken.IMPORT; }
+ "instanceof" { return JavaToken.INSTANCEOF; }
+ "int" { return JavaToken.INT; }
+ "interface" { return JavaToken.INTERFACE; }
+ "long" { return JavaToken.LONG; }
+ "native" { return JavaToken.NATIVE; }
+ "new" { return JavaToken.NEW; }
+ "goto" { return JavaToken.GOTO; }
+ "if" { return JavaToken.IF; }
+ "public" { return JavaToken.PUBLIC; }
+ "short" { return JavaToken.SHORT; }
+ "super" { return JavaToken.SUPER; }
+ "switch" { return JavaToken.SWITCH; }
+ "synchronized" { return JavaToken.SYNCHRONIZED; }
+ "package" { return JavaToken.PACKAGE; }
+ "private" { return JavaToken.PRIVATE; }
+ "protected" { return JavaToken.PROTECTED; }
+ "transient" { return JavaToken.TRANSIENT; }
+ "return" { return JavaToken.RETURN; }
+ "void" { return JavaToken.VOID; }
+ "static" { return JavaToken.STATIC; }
+ "while" { return JavaToken.WHILE; }
+ "this" { return JavaToken.THIS; }
+ "throw" { return JavaToken.THROW; }
+ "throws" { return JavaToken.THROWS; }
+ "try" { return JavaToken.TRY; }
+ "volatile" { return JavaToken.VOLATILE; }
+ "strictfp" { return JavaToken.STRICTFP; }
+ "enum" { return JavaToken.ENUM; }
+ "@" { return JavaToken.AT; }
+
+ /* boolean literals */
+ "true" { return JavaToken.BOOLEAN_LITERAL; }
+ "false" { return JavaToken.BOOLEAN_LITERAL; }
+
+ /* null literal */
+ "null" { return JavaToken.NULL_LITERAL; }
+
+ "..." { return JavaToken.ELLIPSIS; }
+
+
+ /* separators */
+ "(" { return JavaToken.LPAREN; }
+ ")" { return JavaToken.RPAREN; }
+ "{" { return JavaToken.LBRACE; }
+ "}" { return JavaToken.RBRACE; }
+ "[" { return JavaToken.LBRACK; }
+ "]" { return JavaToken.RBRACK; }
+ ";" { return JavaToken.SEMICOLON; }
+ "," { return JavaToken.COMMA; }
+ "." { return JavaToken.DOT; }
+
+ /* operators */
+ "=" { return JavaToken.EQ; }
+ ">" { return JavaToken.GT; }
+ "<" { return JavaToken.LT; }
+ "!" { return JavaToken.NOT; }
+ "~" { return JavaToken.COMP; }
+ "?" { return JavaToken.QUESTION; }
+ "::" { return JavaToken.COLONCOLON; }
+ ":" { return JavaToken.COLON; }
+ "==" { return JavaToken.EQEQ; }
+ "<=" { return JavaToken.LTEQ; }
+ ">=" { return JavaToken.GTEQ; }
+ "!=" { return JavaToken.NOTEQ; }
+ "&&" { return JavaToken.ANDAND; }
+ "||" { return JavaToken.OROR; }
+ "++" { return JavaToken.PLUSPLUS; }
+ "--" { return JavaToken.MINUSMINUS; }
+ "+" { return JavaToken.PLUS; }
+ "-" { return JavaToken.MINUS; }
+ "*" { return JavaToken.MULT; }
+ "/" { return JavaToken.DIV; }
+ "&" { return JavaToken.AND; }
+ "|" { return JavaToken.OR; }
+ "^" { return JavaToken.XOR; }
+ "%" { return JavaToken.MOD; }
+ "+=" { return JavaToken.PLUSEQ; }
+ "-=" { return JavaToken.MINUSEQ; }
+ "*=" { return JavaToken.MULTEQ; }
+ "/=" { return JavaToken.DIVEQ; }
+ "&=" { return JavaToken.ANDEQ; }
+ "|=" { return JavaToken.OREQ; }
+ "^=" { return JavaToken.XOREQ; }
+ "%=" { return JavaToken.MODEQ; }
+ "<<=" { return JavaToken.LSHIFTEQ; }
+ ">>=" { return JavaToken.RSHIFTEQ; }
+ ">>>=" { return JavaToken.URSHIFTEQ; }
+
+ /* string literal */
+ \" { yybegin(STRING); }
+
+ /* character literal */
+ \' { yybegin(CHARLITERAL); }
+
+ /* numeric literals */
+
+ /* This is matched together with the minus, because the number is too big to
+ be represented by a positive integer. */
+ "-2147483648" { return JavaToken.INTEGER_LITERAL; }
+
+ {DecIntegerLiteral} { return JavaToken.INTEGER_LITERAL ; }
+ {DecLongLiteral} { return JavaToken.INTEGER_LITERAL ; }
+
+ {HexIntegerLiteral} { return JavaToken.INTEGER_LITERAL ; }
+ {HexLongLiteral} { return JavaToken.INTEGER_LITERAL; }
+
+ {OctIntegerLiteral} { return JavaToken.INTEGER_LITERAL; }
+ {OctLongLiteral} { return JavaToken.INTEGER_LITERAL; }
+
+ {FloatLiteral} { return JavaToken.FLOATING_POINT_LITERAL; }
+ {DoubleLiteral} { return JavaToken.FLOATING_POINT_LITERAL; }
+ {DoubleLiteral}[dD] { return JavaToken.FLOATING_POINT_LITERAL; }
+
+ /* comments */
+ {Comment} { /* ignore */ }
+
+ /* whitespace */
+ {WhiteSpace} { /* ignore */ }
+
+ /* identifiers */
+ {Identifier} { return JavaToken.IDENTIFIER; }
+}
+
+ {
+ \" { yybegin(YYINITIAL); return JavaToken.STRING_LITERAL; }
+
+ {StringCharacter}+ { }
+
+ /* escape sequences */
+ "\\b" { }
+ "\\t" { }
+ "\\n" { }
+ "\\f" { }
+ "\\r" { }
+ "\\u" { }
+ "\\u000C" { }
+ "\\\"" { }
+ "\\'" { }
+ "\\\\" { }
+ \\[0-3]?{OctDigit}?{OctDigit} { }
+
+ /* error cases */
+ \\. { throw new RuntimeException("Illegal escape sequence \""+yytext()+"\""); }
+ {LineTerminator} { throw new RuntimeException("Unterminated string at end of line"); }
+}
+
+ {
+ {SingleCharacter}\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL; }
+
+ /* escape sequences */
+ "\\b"\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL;}
+ "\\t"\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL;}
+ "\\n"\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL;}
+ "\\f"\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL;}
+ "\\r"\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL;}
+ "\\\""\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL;}
+ "\\'"\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL;}
+ "\\\\"\' { yybegin(YYINITIAL); return JavaToken.CHARACTER_LITERAL; }
+ \\[0-3]?{OctDigit}?{OctDigit}\' { yybegin(YYINITIAL);
+ return JavaToken.CHARACTER_LITERAL; }
+
+ /* error cases */
+ \\. { throw new RuntimeException("Illegal escape sequence \""+yytext()+"\""); }
+ {LineTerminator} { throw new RuntimeException("Unterminated character literal at end of line"); }
+}
+
+/* error fallback */
+[^] { throw new RuntimeException("Illegal character \""+yytext()+
+ "\" at line "+yyline+", column "+yycolumn); }
+<> { return JavaToken.EOF; }
\ No newline at end of file
diff --git a/benchmarks/src/main/kotlin/Benchmarks.kt b/benchmarks/src/main/kotlin/Benchmarks.kt
new file mode 100644
index 000000000..bf567873d
--- /dev/null
+++ b/benchmarks/src/main/kotlin/Benchmarks.kt
@@ -0,0 +1,56 @@
+import org.ucfs.JavaToken
+import org.ucfs.Scanner
+import org.ucfs.input.*
+import org.ucfs.rsm.symbol.Term
+import java.io.StringReader
+
+fun getResultPath(
+ pathToOutput: String,
+ inputName: String,
+ grammarMode: String,
+ grammarName: String,
+ sppfMode: String,
+): String {
+ return pathToOutput + (if (pathToOutput.endsWith("/")) "" else "/") + "${inputName}_${grammarMode}_${grammarName}_${sppfMode}.csv"
+}
+
+
+fun getTokenStream(input: String): LinearInput {
+ val graph = LinearInput()
+ getTokenStream(input, graph)
+ return graph
+}
+
+
+
+fun > getTokenStream(input: String, inputGraph: G): G {
+ val lexer = Scanner(StringReader(input))
+ var token: JavaToken
+ var vertexId = 1
+
+ inputGraph.addVertex(vertexId)
+ inputGraph.addStartVertex(vertexId)
+
+ while (true) {
+ token = lexer.yylex() as JavaToken
+ if (token == JavaToken.EOF) break
+ inputGraph.addEdge(vertexId, TerminalInputLabel(token), ++vertexId)
+ }
+
+ return inputGraph
+}
+
+fun getCharStream(input: String): LinearInput {
+ val inputGraph = LinearInput()
+ var vertexId = 1
+
+ inputGraph.addVertex(vertexId)
+ inputGraph.addStartVertex(vertexId)
+
+ for (ch in input) {
+ inputGraph.addEdge(vertexId, TerminalInputLabel(Term(ch.toString())), ++vertexId)
+ inputGraph.addVertex(vertexId)
+ }
+
+ return inputGraph
+}
diff --git a/benchmarks/src/main/kotlin/UcfsRunExample.kt b/benchmarks/src/main/kotlin/UcfsRunExample.kt
new file mode 100644
index 000000000..a9f17c943
--- /dev/null
+++ b/benchmarks/src/main/kotlin/UcfsRunExample.kt
@@ -0,0 +1,14 @@
+import org.ucfs.Java8
+import org.ucfs.parser.Gll
+
+fun main(){
+ // get RSM start state
+ val startState = Java8().rsm
+ // get linear graph from source code
+ val text = "package a; class X {}"
+ val tokens = getTokenStream(text)
+ // parse (intersect graph and rsm)
+ val gll = Gll.gll(startState, tokens)
+ // make sure that sppf isn't empty
+ assert(gll.parse().first != null) { "can't build sppf" }
+}
\ No newline at end of file
diff --git a/benchmarks/src/main/kotlin/org/ucfs/Generator.kt b/benchmarks/src/main/kotlin/org/ucfs/Generator.kt
new file mode 100644
index 000000000..01dce4c42
--- /dev/null
+++ b/benchmarks/src/main/kotlin/org/ucfs/Generator.kt
@@ -0,0 +1,35 @@
+package org.ucfs
+import org.ucfs.ast.NodeClassesGenerator
+import org.ucfs.parser.ParserGenerator
+import org.ucfs.parser.RecoveryParserGenerator
+import java.nio.file.Path
+
+val grammarClass = Java8::class.java
+val tokenClass = JavaToken::class.java
+val pkg = "org.ucfs"
+
+fun main(args: Array){
+ val path: Path = if(args.isEmpty()){
+ Path.of("benchmarks/src/main/kotlin")
+ }
+ else{
+ Path.of(args[0])
+ }
+ println("Generate ${Java8::class} UCFS parsers at ${path.toAbsolutePath()}")
+ generateJavaParser(path)
+ generateJavaRecoveryParser(path)
+ generateNodes(path)
+}
+
+fun generateJavaParser(path: Path) {
+ ParserGenerator(grammarClass, tokenClass).generate(path, pkg)
+}
+fun generateJavaRecoveryParser(path: Path) {
+ RecoveryParserGenerator(grammarClass, tokenClass).generate(path, pkg)
+}
+
+fun generateNodes(path: Path){
+ var nodeGenerator = NodeClassesGenerator(grammarClass)
+ nodeGenerator.generate(path, "$pkg.nodes")
+}
+
diff --git a/benchmarks/src/main/kotlin/org/ucfs/Java8.kt b/benchmarks/src/main/kotlin/org/ucfs/Java8.kt
new file mode 100644
index 000000000..8068df8e5
--- /dev/null
+++ b/benchmarks/src/main/kotlin/org/ucfs/Java8.kt
@@ -0,0 +1,933 @@
+package org.ucfs
+import org.ucfs.JavaToken.*
+import org.ucfs.grammar.combinator.Grammar
+import org.ucfs.grammar.combinator.regexp.*
+
+class Java8 : Grammar() {
+ val compilationUnit by Nt().asStart()
+ val identifier by Nt()
+ val literal by Nt()
+ val type by Nt()
+ val primitiveType by Nt()
+ val referenceType by Nt()
+ val annotation by Nt()
+ val numericType by Nt()
+ val integralType by Nt()
+ val floatingPointType by Nt()
+ val classOrInterfaceType by Nt()
+ val typeVariable by Nt()
+ val arrayType by Nt()
+ val classType by Nt()
+ val interfaceType by Nt()
+ val typeArguments by Nt()
+ val dims by Nt()
+ val typeParameter by Nt()
+ val typeParameterModifier by Nt()
+ val typeBound by Nt()
+ val additionalBound by Nt()
+ val typeArgumentList by Nt()
+ val typeArgument by Nt()
+ val wildcard by Nt()
+ val wildcardBounds by Nt()
+ val typeName by Nt()
+ val packageOrTypeName by Nt()
+ val expressionName by Nt()
+ val ambiguousName by Nt()
+ val methodName by Nt()
+ val packageName by Nt()
+ val result by Nt()
+ val packageDeclaration by Nt()
+ val importDeclaration by Nt()
+ val typeDeclaration by Nt()
+ val packageModifier by Nt()
+ val singleTypeImportDeclaration by Nt()
+ val typeImportOnDemandDeclaration by Nt()
+ val singleStaticImportDeclaration by Nt()
+ val staticImportOnDemandDeclaration by Nt()
+ val classDeclaration by Nt()
+ val interfaceDeclaration by Nt()
+ val throws by Nt()
+ val normalClassDeclaration by Nt()
+ val enumDeclaration by Nt()
+ val classModifier by Nt()
+ val typeParameters by Nt()
+ val superclass by Nt()
+ val superinterfaces by Nt()
+ val classBody by Nt()
+ val typeParameterList by Nt()
+ val interfaceTypeList by Nt()
+ val classBodyDeclaration by Nt()
+ val classMemberDeclaration by Nt()
+ val instanceInitializer by Nt()
+ val staticInitializer by Nt()
+ val constructorDeclaration by Nt()
+ val fieldDeclaration by Nt()
+ val methodDeclaration by Nt()
+ val fieldModifier by Nt()
+ val unannType by Nt()
+ val variableDeclaratorList by Nt()
+ val variableDeclarator
+ by Nt()
+ val variableDeclaratorId by Nt()
+ val variableInitializer by Nt()
+ val expression by Nt()
+ val arrayInitializer by Nt()
+ val unannPrimitiveType by Nt()
+ val unannReferenceType by Nt()
+ val unannClassOrInterfaceType by Nt()
+ val unannTypeVariable by Nt()
+ val unannArrayType by Nt()
+ val unannClassType by Nt()
+ val unannInterfaceType by Nt()
+ val methodModifier by Nt()
+ val methodHeader by Nt()
+ val methodBody by Nt()
+ val methodDeclarator
+ by Nt()
+ val formalParameterList by Nt()
+ val receiverParameter by Nt()
+ val formalParameters by Nt()
+ val lastFormalParameter by Nt()
+ val formalParameter by Nt()
+ val variableModifier by Nt()
+ val exceptionTypeList by Nt()
+ val exceptionType by Nt()
+ val block by Nt()
+ val constructorModifier by Nt()
+ val constructorDeclarator
+ by Nt()
+ val constructorBody by Nt()
+ val simpleTypeName by Nt()
+ val explicitConstructorInvocation by Nt()
+ val enumBody by Nt()
+ val enumConstantList by Nt()
+ val enumConstant by Nt()
+ val enumConstantModifier by Nt()
+ val enumBodyDeclarations by Nt()
+ val blockStatements by Nt()
+ val argumentList by Nt()
+ val primary by Nt()
+ val normalInterfaceDeclaration by Nt()
+ val interfaceModifier by Nt()
+ val extendsInterfaces by Nt()
+ val interfaceBody by Nt()
+ val interfaceMemberDeclaration by Nt()
+ val constantDeclaration by Nt()
+ val constantModifier by Nt()
+ val annotationTypeDeclaration by Nt()
+ val annotationTypeBody by Nt()
+ val annotationTypeMemberDeclaration by Nt()
+ val annotationTypeElementDeclaration by Nt()
+ val defaultValue by Nt()
+ val normalAnnotation by Nt()
+ val elementValuePairList by Nt()
+ val elementValuePair by Nt()
+ val elementValue by Nt()
+ val elementValueArrayInitializer by Nt()
+ val elementValueList by Nt()
+ val markerAnnotation by Nt()
+ val singleElementAnnotation by Nt()
+ val interfaceMethodDeclaration by Nt()
+ val annotationTypeElementModifier by Nt()
+ val conditionalExpression by Nt()
+ val variableInitializerList by Nt()
+ val blockStatement by Nt()
+ val localVariableDeclarationStatement by Nt()
+ val localVariableDeclaration by Nt()
+ val statement by Nt()
+ val statementNoShortIf by Nt()
+ val statementWithoutTrailingSubstatement by Nt()
+ val emptyStatement by Nt()
+ val labeledStatement by Nt()
+ val labeledStatementNoShortIf by Nt()
+ val expressionStatement by Nt()
+ val statementExpression by Nt()
+ val ifThenStatement by Nt()
+ val ifThenElseStatement by Nt()
+ val ifThenElseStatementNoShortIf by Nt()
+ val assertStatement by Nt()
+ val switchStatement by Nt()
+ val switchBlock by Nt()
+ val switchBlockStatementGroup by Nt()
+ val switchLabels by Nt()
+ val switchLabel by Nt()
+ val enumConstantName by Nt()
+ val whileStatement by Nt()
+ val whileStatementNoShortIf by Nt()
+ val doStatement by Nt()
+ val interfaceMethodModifier by Nt()
+ val forStatement by Nt()
+ val forStatementNoShortIf by Nt()
+ val basicForStatement by Nt()
+ val basicForStatementNoShortIf by Nt()
+ val forInit by Nt()
+ val forUpdate by Nt()
+ val statementExpressionList by Nt()
+ val enhancedForStatement by Nt()
+ val enhancedForStatementNoShortIf by Nt()
+ val breakStatement by Nt()
+ val continueStatement by Nt()
+ val returnStatement by Nt()
+ val throwStatement by Nt()
+ val synchronizedStatement by Nt()
+ val tryStatement by Nt()
+ val catches by Nt()
+ val catchClause by Nt()
+ val catchFormalParameter by Nt()
+ val catchType by Nt()
+ val finally by Nt()
+ val tryWithResourcesStatement by Nt()
+ val resourceSpecification by Nt()
+ val resourceList by Nt()
+ val resource by Nt()
+ val primaryNoNewArray by Nt()
+ val classLiteral by Nt()
+ val classOrInterfaceTypeToInstantiate by Nt()
+ val unqualifiedClassInstanceCreationExpression by Nt()
+ val classInstanceCreationExpression by Nt()
+ val fieldAccess by Nt()
+ val typeArgumentsOrDiamond by Nt()
+ val arrayAccess by Nt()
+ val methodInvocation by Nt()
+ val methodReference by Nt()
+ val arrayCreationExpression by Nt()
+ val dimExprs by Nt()
+ val dimExpr by Nt()
+ val lambdaExpression by Nt()
+ val lambdaParameters by Nt()
+ val inferredFormalParameterList by Nt()
+ val lambdaBody by Nt()
+ val assignmentExpression by Nt()
+ val assignment by Nt()
+ val leftHandSide by Nt()
+ val assignmentOperator
+ by Nt()
+ val conditionalOrExpression by Nt()
+ val conditionalAndExpression by Nt()
+ val inclusiveOrExpression by Nt()
+ val exclusiveOrExpression by Nt()
+ val andExpression by Nt()
+ val equalityExpression by Nt()
+ val relationalExpression by Nt()
+ val shiftExpression by Nt()
+ val additiveExpression by Nt()
+ val multiplicativeExpression by Nt()
+ val preIncrementExpression by Nt()
+ val preDecrementExpression by Nt()
+ val unaryExpressionNotPlusMinus by Nt()
+ val unaryExpression by Nt()
+ val postfixExpression by Nt()
+ val postIncrementExpression by Nt()
+ val postDecrementExpression by Nt()
+ val castExpression by Nt()
+ val constantExpression by Nt()
+
+ init {
+ identifier /= IDENTIFIER
+
+ /**
+ * productions from §4 (Lexical structure)
+ */
+ literal /= INTEGER_LITERAL or
+ FLOATING_POINT_LITERAL or
+ BOOLEAN_LITERAL or
+ CHARACTER_LITERAL or
+ STRING_LITERAL or
+ NULL_LITERAL
+
+ /**
+ * productions from §4 (types, values, and variables)
+ */
+ type /= primitiveType or
+ referenceType
+
+ primitiveType /= Many(annotation) * numericType or
+ Many(annotation) * BOOLEAN
+
+ numericType /= integralType or
+ floatingPointType
+
+ integralType /= BYTE or
+ SHORT or
+ INT or
+ LONG or
+ CHAR
+
+ floatingPointType /= FLOAT or
+ DOUBLE
+
+ referenceType /= classOrInterfaceType or
+ typeVariable or
+ arrayType
+
+ classOrInterfaceType /= classType or
+ interfaceType
+
+ classType /= Many(annotation) * identifier * Option(typeArguments) or
+ classOrInterfaceType * DOT * Many(annotation) * identifier * Option(typeArguments)
+
+ interfaceType /= classType
+
+ typeVariable /= Many(annotation) * identifier
+
+ arrayType /= primitiveType * dims or
+ classOrInterfaceType * dims or
+ typeVariable * dims
+
+ dims /= some(Many(annotation) * LBRACK * RBRACK)
+
+ typeParameter /= Many(typeParameterModifier) * identifier * Option(typeBound)
+
+ typeParameterModifier /= annotation
+
+ typeBound /= EXTENDS * typeVariable or
+ EXTENDS * classOrInterfaceType * Many(additionalBound)
+
+ additionalBound /= AND * interfaceType
+
+ typeArguments /= LT * typeArgumentList * GT
+
+ typeArgumentList /= typeArgument * Many(COMMA * typeArgument)
+
+ typeArgument /= referenceType or
+ wildcard
+
+ wildcard /= Many(annotation) * QUESTION * Option(wildcardBounds)
+
+ wildcardBounds /= EXTENDS * referenceType or
+ SUPER * referenceType
+
+ /**
+ * productions from §6 (Names)
+ */
+ packageName /= identifier or
+ packageName * DOT * identifier
+
+ typeName /= identifier or
+ packageOrTypeName * DOT * identifier
+
+ packageOrTypeName /= identifier or
+ packageOrTypeName * DOT * identifier
+
+ expressionName /= identifier or
+ ambiguousName * DOT * identifier
+
+ methodName /= identifier
+
+ ambiguousName /= identifier or
+ ambiguousName * DOT * identifier
+
+ /**
+ * productions from §7 (packages)
+ */
+
+ compilationUnit /= Option(packageDeclaration) * Many(importDeclaration) * Many(typeDeclaration)
+
+ packageDeclaration /= Many(packageModifier) * PACKAGE * identifier * Many(DOT * identifier ) * SEMICOLON
+
+ packageModifier /= annotation
+
+ importDeclaration /= singleTypeImportDeclaration or
+ typeImportOnDemandDeclaration or
+ singleStaticImportDeclaration or
+ staticImportOnDemandDeclaration
+
+ singleTypeImportDeclaration /= IMPORT * typeName * SEMICOLON
+
+ typeImportOnDemandDeclaration /= IMPORT * packageOrTypeName * DOT * MULT * SEMICOLON
+
+ singleStaticImportDeclaration /= IMPORT * STATIC * typeName * DOT * identifier * SEMICOLON
+
+ staticImportOnDemandDeclaration /= IMPORT * STATIC * typeName * DOT * MULT * SEMICOLON
+
+ typeDeclaration /= classDeclaration or
+ interfaceDeclaration or
+ SEMICOLON
+
+ /**
+ * productions from §8 (classes)
+ */
+
+ classDeclaration /= normalClassDeclaration or
+ enumDeclaration
+
+ normalClassDeclaration /= Many(classModifier) * CLASS * identifier *
+ Option(typeParameters) * Option(superclass) * Option(superinterfaces) * classBody
+
+ classModifier /= annotation or
+ PUBLIC or
+ PROTECTED or
+ PRIVATE or
+ ABSTRACT or
+ STATIC or
+ FINAL or
+ STRICTFP
+
+ typeParameters /= LT * typeParameterList * GT
+
+ typeParameterList /= typeParameter * Many(COMMA * typeParameter)
+
+ superclass /= EXTENDS * classType
+
+ superinterfaces /= IMPLEMENTS * interfaceTypeList
+
+ interfaceTypeList /= interfaceType * Many(COMMA * interfaceType)
+
+ classBody /= LBRACE * Many(classBodyDeclaration) * RBRACE
+
+ classBodyDeclaration /= classMemberDeclaration or
+ instanceInitializer or
+ staticInitializer or
+ constructorDeclaration
+
+ classMemberDeclaration /= fieldDeclaration or
+ methodDeclaration or
+ classDeclaration or
+ interfaceDeclaration or
+ SEMICOLON
+
+ fieldDeclaration /= Many(fieldModifier) * unannType * variableDeclaratorList * SEMICOLON
+
+ fieldModifier /= annotation or
+ PUBLIC or
+ PROTECTED or
+ PRIVATE or
+ STATIC or
+ FINAL or
+ TRANSIENT or
+ VOLATILE
+
+ variableDeclaratorList /= variableDeclarator * Many(COMMA * variableDeclarator)
+
+ variableDeclarator /= variableDeclaratorId * Option(EQ * variableInitializer)
+
+ variableDeclaratorId /= identifier * Option(dims)
+
+ variableInitializer /= expression or
+ arrayInitializer
+
+ unannType /= unannPrimitiveType or
+ unannReferenceType
+
+ unannPrimitiveType /= numericType or
+ BOOLEAN
+
+ unannReferenceType /= unannClassOrInterfaceType or
+ unannTypeVariable or
+ unannArrayType
+
+ unannClassOrInterfaceType /= unannClassType or
+ unannInterfaceType
+
+ unannClassType /= identifier * Option(typeArguments) or
+ unannClassOrInterfaceType * DOT * Many(annotation) * identifier * Option(typeArguments)
+
+ unannInterfaceType /= unannClassType
+
+ unannTypeVariable /= identifier
+
+ unannArrayType /= unannPrimitiveType * dims or
+ unannClassOrInterfaceType * dims or
+ unannTypeVariable * dims
+
+ methodDeclaration /= Many(methodModifier) * methodHeader * methodBody
+
+ methodModifier /= annotation or
+ PUBLIC or
+ PROTECTED or
+ PRIVATE or
+ ABSTRACT or
+ STATIC or
+ FINAL or
+ SYNCHRONIZED or
+ NATIVE or
+ STRICTFP
+
+ methodHeader /= result * methodDeclarator * Option(throws) or
+ typeParameters * Many(annotation) * result * methodDeclarator * Option(throws)
+
+ result /= unannType or
+ VOID
+
+ methodDeclarator /= identifier * LPAREN * Option(formalParameterList) * RPAREN * Option(dims)
+
+ formalParameterList /= receiverParameter or
+ formalParameters * COMMA * lastFormalParameter or
+ lastFormalParameter
+
+ formalParameters /= formalParameter * Many(COMMA * formalParameter) or
+ receiverParameter * Many(COMMA * formalParameter)
+
+ formalParameter /= Many(variableModifier) * unannType * variableDeclaratorId
+
+ variableModifier /= annotation or
+ FINAL
+
+ lastFormalParameter /= Many(variableModifier) * unannType * Many(annotation) * ELLIPSIS * variableDeclaratorId or
+ formalParameter
+
+ receiverParameter /= Many(annotation) * unannType * Option(identifier * DOT) * THIS
+
+ throws /= THROWS * exceptionTypeList
+
+ exceptionTypeList /= exceptionType * Many(COMMA * exceptionType)
+
+ exceptionType /= classType or
+ typeVariable
+
+ methodBody /= block or
+ SEMICOLON
+
+ instanceInitializer /= block
+
+ staticInitializer /= STATIC * block
+
+ constructorDeclaration /= Many(constructorModifier) * constructorDeclarator * Option(throws) * constructorBody
+
+ constructorModifier /= annotation or
+ PUBLIC or
+ PROTECTED or
+ PRIVATE
+
+ constructorDeclarator /= Option(typeParameters) * simpleTypeName * LPAREN * Option(formalParameterList) * RPAREN
+
+ simpleTypeName /= identifier
+
+ constructorBody /= LBRACE * Option(explicitConstructorInvocation) * Option(blockStatements) * RBRACE
+
+ explicitConstructorInvocation /= Option(typeArguments) * THIS * LPAREN * Option(argumentList) * RPAREN * SEMICOLON or
+ Option(typeArguments) * SUPER * LPAREN * Option(argumentList) * RPAREN * SEMICOLON or
+ expressionName * DOT * Option(typeArguments) * SUPER * LPAREN * Option(argumentList) * RPAREN * SEMICOLON or
+ primary * DOT * Option(typeArguments) * SUPER * LPAREN * Option(argumentList) * RPAREN * SEMICOLON
+
+ enumDeclaration /= Many(classModifier) * ENUM * identifier * Option(superinterfaces) * enumBody
+
+ enumBody /= LBRACE * Option(enumConstantList) * Option(COMMA) * Option(enumBodyDeclarations) * RBRACE
+
+ enumConstantList /= enumConstant * Many(COMMA * enumConstant)
+
+ enumConstant /= Many(enumConstantModifier) * identifier * Option(LPAREN * Option(argumentList) * RPAREN * Option(classBody))
+
+ enumConstantModifier /= annotation
+
+ enumBodyDeclarations /= SEMICOLON * Many(classBodyDeclaration)
+
+ /**
+ * productions from §9 (interfaces)
+ */
+
+ interfaceDeclaration /= normalInterfaceDeclaration or
+ annotationTypeDeclaration
+
+ normalInterfaceDeclaration /=
+ Many(interfaceModifier) * INTERFACE * identifier * Option(typeParameters) *
+ Option(extendsInterfaces) * interfaceBody
+
+ interfaceModifier /= annotation or
+ PUBLIC or
+ PROTECTED or
+ PRIVATE or
+ ABSTRACT or
+ STATIC or
+ STRICTFP
+
+ extendsInterfaces /= EXTENDS * interfaceTypeList
+
+ interfaceBody /= LBRACE * Many(interfaceMemberDeclaration) * RBRACE
+
+ interfaceMemberDeclaration /= constantDeclaration or
+ interfaceMethodDeclaration or
+ classDeclaration or
+ interfaceDeclaration or
+ SEMICOLON
+
+ constantDeclaration /= Many(constantModifier) * unannType * variableDeclaratorList * SEMICOLON
+
+ constantModifier /= annotation or
+ PUBLIC or
+ STATIC or
+ FINAL
+
+ interfaceMethodDeclaration /= Many(interfaceMethodModifier) * methodHeader * methodBody
+
+ interfaceMethodModifier /= annotation or
+ PUBLIC or
+ ABSTRACT or
+ DEFAULT or
+ STATIC or
+ STRICTFP
+
+ annotationTypeDeclaration /= Many(interfaceModifier) * AT * INTERFACE * identifier * annotationTypeBody
+
+ annotationTypeBody /= LBRACE * Many(annotationTypeMemberDeclaration) * RBRACE
+
+ annotationTypeMemberDeclaration /= annotationTypeElementDeclaration or
+ constantDeclaration or
+ classDeclaration or
+ interfaceDeclaration or
+ SEMICOLON
+
+ annotationTypeElementDeclaration /=
+ Many(annotationTypeElementModifier) * unannType * identifier * LPAREN * RPAREN *
+ Option(dims) * Option(defaultValue) * SEMICOLON
+
+ annotationTypeElementModifier /= annotation or
+ PUBLIC or
+ ABSTRACT
+
+ defaultValue /= DEFAULT * elementValue
+
+ annotation /= normalAnnotation or
+ markerAnnotation or
+ singleElementAnnotation
+
+ normalAnnotation /= AT * typeName * LPAREN * Option(elementValuePairList) * RPAREN
+
+ elementValuePairList /= elementValuePair * Many(COMMA * elementValuePair)
+
+ elementValuePair /= identifier * EQ * elementValue
+
+ elementValue /= conditionalExpression or
+ elementValueArrayInitializer or
+ annotation
+
+ elementValueArrayInitializer /= LBRACE * Option(elementValueList) * Option(COMMA) * RBRACE
+
+ elementValueList /= elementValue * Many(COMMA * elementValue)
+
+ markerAnnotation /= AT * typeName
+
+ singleElementAnnotation /= AT * typeName * LPAREN * elementValue * RPAREN
+
+ /**
+ * productions from §10 (arrays)
+ */
+
+ arrayInitializer /= LBRACE * Option(variableInitializerList) * Option(COMMA) * RBRACE
+
+ variableInitializerList /= variableInitializer * Many(COMMA * variableInitializer)
+
+ /**
+ * productions from §14 (Blocks and statements)
+ */
+
+ block /= LBRACE * Option(blockStatements) * RBRACE
+
+ blockStatements /= blockStatement * Many(blockStatement)
+
+ blockStatement /= localVariableDeclarationStatement or
+ classDeclaration or
+ statement
+
+ localVariableDeclarationStatement /= localVariableDeclaration * SEMICOLON
+
+ localVariableDeclaration /= Many(variableModifier) * unannType * variableDeclaratorList
+
+ statement /= statementWithoutTrailingSubstatement or
+ labeledStatement or
+ ifThenStatement or
+ ifThenElseStatement or
+ whileStatement or
+ forStatement
+
+ statementNoShortIf /= statementWithoutTrailingSubstatement or
+ labeledStatementNoShortIf or
+ ifThenElseStatementNoShortIf or
+ whileStatementNoShortIf or
+ forStatementNoShortIf
+
+ statementWithoutTrailingSubstatement /= block or
+ emptyStatement or
+ expressionStatement or
+ assertStatement or
+ switchStatement or
+ doStatement or
+ breakStatement or
+ continueStatement or
+ returnStatement or
+ synchronizedStatement or
+ throwStatement or
+ tryStatement
+
+ emptyStatement /= SEMICOLON
+
+ labeledStatement /= identifier * COLON * statement
+
+ labeledStatementNoShortIf /= identifier * COLON * statementNoShortIf
+
+ expressionStatement /= statementExpression * SEMICOLON
+
+ statementExpression /= assignment or
+ preIncrementExpression or
+ preDecrementExpression or
+ postIncrementExpression or
+ postDecrementExpression or
+ methodInvocation or
+ classInstanceCreationExpression
+
+ ifThenStatement /= IF * LPAREN * expression * RPAREN * statement
+
+ ifThenElseStatement /= IF * LPAREN * expression * RPAREN * statementNoShortIf * ELSE * statement
+
+ ifThenElseStatementNoShortIf /=
+ IF * LPAREN * expression * RPAREN * statementNoShortIf * ELSE * statementNoShortIf
+
+ assertStatement /= ASSERT * expression * SEMICOLON or
+ ASSERT * expression * COLON * expression * SEMICOLON
+
+ switchStatement /= SWITCH * LPAREN * expression * RPAREN * switchBlock
+
+ switchBlock /= LBRACE * Many(switchBlockStatementGroup) * Many(switchLabel) * RBRACE
+
+ switchBlockStatementGroup /= switchLabels * blockStatements
+
+ switchLabels /= some(switchLabel)
+
+ switchLabel /= CASE * constantExpression * COLON or
+ CASE * enumConstantName * COLON or
+ DEFAULT * COLON
+
+ enumConstantName /= identifier
+
+ whileStatement /= WHILE * LPAREN * expression * RPAREN * statement
+
+ whileStatementNoShortIf /= WHILE * LPAREN * expression * RPAREN * statementNoShortIf
+
+ doStatement /= DO * statement * WHILE * LPAREN * expression * RPAREN * SEMICOLON
+
+ forStatement /= basicForStatement or
+ enhancedForStatement
+
+ forStatementNoShortIf /= basicForStatementNoShortIf or
+ enhancedForStatementNoShortIf
+
+ basicForStatement /= FOR * LPAREN * Option(forInit) * SEMICOLON * Option(expression) * SEMICOLON *
+ Option(forUpdate) * RPAREN * statement
+
+ basicForStatementNoShortIf /= FOR * LPAREN * Option(forInit) * SEMICOLON * Option(expression) * SEMICOLON *
+ Option(forUpdate) * RPAREN * statementNoShortIf
+
+ forInit /= statementExpressionList or
+ localVariableDeclaration
+
+ forUpdate /= statementExpressionList
+
+ statementExpressionList /= statementExpression * Many(COMMA * statementExpression)
+
+ enhancedForStatement /= FOR * LPAREN * Many(variableModifier) * unannType * variableDeclaratorId * COLON *
+ expression * RPAREN * statement
+ enhancedForStatementNoShortIf /= FOR * LPAREN * Many(variableModifier) * unannType * variableDeclaratorId *
+ COLON * expression * RPAREN * statementNoShortIf
+
+ breakStatement /= BREAK * Option(identifier) * SEMICOLON
+
+ continueStatement /= CONTINUE * Option(identifier) * SEMICOLON
+
+ returnStatement /= RETURN * Option(expression) * SEMICOLON
+
+ throwStatement /= THROW * expression * SEMICOLON
+
+ synchronizedStatement /= SYNCHRONIZED * LPAREN * expression * RPAREN * block
+
+ tryStatement /= TRY * block * catches or
+ TRY * block * Option(catches) * finally or
+ tryWithResourcesStatement
+
+ catches /= some(catchClause)
+
+ catchClause /= CATCH * LPAREN * catchFormalParameter * RPAREN * block
+
+ catchFormalParameter /= Many(variableModifier) * catchType * variableDeclaratorId
+
+ catchType /= unannClassType * Many(OR * classType)
+
+ finally /= FINALLY * block
+
+ tryWithResourcesStatement /= TRY * resourceSpecification * block * Option(catches) * Option(finally)
+
+ resourceSpecification /= LPAREN * resourceList * Option(SEMICOLON) * RPAREN
+
+ resourceList /= resource * Many(COMMA * resource)
+
+ resource /= Many(variableModifier) * unannType * variableDeclaratorId * EQ * expression
+
+ /**
+ * productions from §15 (expressions)
+ */
+
+ primary /= primaryNoNewArray or
+ arrayCreationExpression
+
+ primaryNoNewArray /= literal or
+ classLiteral or
+ THIS or
+ typeName * DOT * THIS or
+ LPAREN * expression * RPAREN or
+ classInstanceCreationExpression or
+ fieldAccess or
+ arrayAccess or
+ methodInvocation or
+ methodReference
+
+ classLiteral /= typeName * Many(LBRACK * RBRACK) * DOT * CLASS or
+ numericType * Many(LBRACK * RBRACK) * DOT * CLASS or
+ BOOLEAN * Many(LBRACK * RBRACK) * DOT * CLASS or
+ VOID * DOT * CLASS
+
+ classInstanceCreationExpression /= unqualifiedClassInstanceCreationExpression or
+ expressionName * DOT * unqualifiedClassInstanceCreationExpression or
+ primary * DOT * unqualifiedClassInstanceCreationExpression
+
+ unqualifiedClassInstanceCreationExpression /= NEW * Option(typeArguments) * classOrInterfaceTypeToInstantiate *
+ LPAREN * Option(argumentList) * RPAREN * Option(classBody)
+
+ classOrInterfaceTypeToInstantiate /= Many(annotation) *
+ identifier * Many(DOT * Many(annotation) * identifier ) * Option(typeArgumentsOrDiamond)
+
+ typeArgumentsOrDiamond /= typeArguments or
+ LT * GT
+
+ fieldAccess /= primary * DOT * identifier or
+ SUPER * DOT * identifier or
+ typeName * DOT * SUPER * DOT * identifier
+
+ arrayAccess /= expressionName * LBRACK * expression * RBRACK or
+ primaryNoNewArray * LBRACK * expression * RBRACK
+
+ methodInvocation /= methodName * LPAREN * Option(argumentList) * RPAREN or
+ typeName * DOT * Option(typeArguments) * identifier * LPAREN * Option(argumentList) * RPAREN or
+ expressionName * DOT * Option(typeArguments) * identifier * LPAREN * Option(argumentList) * RPAREN or
+ primary * DOT * Option(typeArguments) * identifier * LPAREN * Option(argumentList) * RPAREN or
+ SUPER * DOT * Option(typeArguments) * identifier * LPAREN * Option(argumentList) * RPAREN or
+ typeName * DOT * SUPER * DOT * Option(typeArguments) * identifier * LPAREN * Option(argumentList) * RPAREN
+
+ argumentList /= expression * Many(COMMA * expression)
+
+ methodReference /= expressionName * COLONCOLON * Option(typeArguments) * identifier or
+ referenceType * COLONCOLON * Option(typeArguments) * identifier or
+ primary * COLONCOLON * Option(typeArguments) * identifier or
+ SUPER * COLONCOLON * Option(typeArguments) * identifier or
+ typeName * DOT * SUPER * COLONCOLON * Option(typeArguments) * identifier or
+ classType * COLONCOLON * Option(typeArguments) * NEW or
+ arrayType * COLONCOLON * NEW
+
+ arrayCreationExpression /= NEW * primitiveType * dimExprs * Option(dims) or
+ NEW * classOrInterfaceType * dimExprs * Option(dims) or
+ NEW * primitiveType * dims * arrayInitializer or
+ NEW * classOrInterfaceType * dims * arrayInitializer
+
+ dimExprs /= some(dimExpr)
+
+ dimExpr /= Many(annotation) * LBRACK * expression * RBRACK
+
+ expression /= lambdaExpression or
+ assignmentExpression
+
+ lambdaExpression /= lambdaParameters * ARROW * lambdaBody
+
+ lambdaParameters /= identifier or
+ LPAREN * Option(formalParameterList) * RPAREN or
+ LPAREN * inferredFormalParameterList * RPAREN
+
+ inferredFormalParameterList /= identifier * Many(COMMA * identifier )
+
+ lambdaBody /= expression or
+ block
+
+ assignmentExpression /= conditionalExpression or
+ assignment
+
+ assignment /= leftHandSide * assignmentOperator * expression
+
+ leftHandSide /= expressionName or
+ fieldAccess or
+ arrayAccess
+
+ assignmentOperator /= EQ or
+ MULTEQ or
+ DIVEQ or
+ MODEQ or
+ PLUSEQ or
+ MINUSEQ or
+ LSHIFTEQ or
+ RSHIFTEQ or
+ URSHIFTEQ or
+ ANDEQ or
+ XOREQ or
+ OREQ
+
+ conditionalExpression /= conditionalOrExpression or
+ conditionalOrExpression * QUESTION * expression * COLON * conditionalExpression or
+ conditionalOrExpression * QUESTION * expression * COLON * lambdaExpression
+
+ conditionalOrExpression /= conditionalAndExpression or
+ conditionalOrExpression * OROR * conditionalAndExpression
+
+ conditionalAndExpression /= inclusiveOrExpression or
+ conditionalAndExpression * ANDAND * inclusiveOrExpression
+
+ inclusiveOrExpression /= exclusiveOrExpression or
+ inclusiveOrExpression * OR * exclusiveOrExpression
+
+ exclusiveOrExpression /= andExpression or
+ exclusiveOrExpression * XOR * andExpression
+
+ andExpression /= equalityExpression or
+ andExpression * AND * equalityExpression
+
+ equalityExpression /= relationalExpression or
+ equalityExpression * EQEQ * relationalExpression or
+ equalityExpression * NOTEQ * relationalExpression
+
+ relationalExpression /= shiftExpression or
+ relationalExpression * LT * shiftExpression or
+ relationalExpression * GT * shiftExpression or
+ relationalExpression * LTEQ * shiftExpression or
+ relationalExpression * GTEQ * shiftExpression or
+ relationalExpression * INSTANCEOF * referenceType
+
+ shiftExpression /= additiveExpression or
+ shiftExpression * LT * LT * additiveExpression or
+ shiftExpression * GT * GT * additiveExpression or
+ shiftExpression * GT * GT * GT * additiveExpression
+
+ additiveExpression /= multiplicativeExpression or
+ additiveExpression * PLUS * multiplicativeExpression or
+ additiveExpression * MINUS * multiplicativeExpression
+
+ multiplicativeExpression /= unaryExpression or
+ multiplicativeExpression * MULT * unaryExpression or
+ multiplicativeExpression * DIV * unaryExpression or
+ multiplicativeExpression * MOD * unaryExpression
+
+ unaryExpression /= preIncrementExpression or
+ preDecrementExpression or
+ PLUS * unaryExpression or
+ MINUS * unaryExpression or
+ unaryExpressionNotPlusMinus
+
+ preIncrementExpression /= PLUSPLUS * unaryExpression
+
+ preDecrementExpression /= MINUSMINUS * unaryExpression
+
+ unaryExpressionNotPlusMinus /= postfixExpression or
+ COMP * unaryExpression or
+ NOT * unaryExpression or
+ castExpression
+
+ postfixExpression /= primary or
+ expressionName or
+ postIncrementExpression or
+ postDecrementExpression
+
+ postIncrementExpression /= postfixExpression * PLUSPLUS
+
+ postDecrementExpression /= postfixExpression * MINUSMINUS
+
+ castExpression /= LPAREN * primitiveType * RPAREN * unaryExpression or
+ LPAREN * referenceType * Many(additionalBound) * RPAREN * unaryExpressionNotPlusMinus or
+ LPAREN * referenceType * Many(additionalBound) * RPAREN * lambdaExpression
+
+ constantExpression /= expression
+ }
+}
\ No newline at end of file
diff --git a/benchmarks/src/main/kotlin/org/ucfs/Java8Parser.kt b/benchmarks/src/main/kotlin/org/ucfs/Java8Parser.kt
new file mode 100644
index 000000000..adef2a51d
--- /dev/null
+++ b/benchmarks/src/main/kotlin/org/ucfs/Java8Parser.kt
@@ -0,0 +1,8655 @@
+@file:Suppress("RedundantVisibilityModifier")
+
+package org.ucfs
+
+import org.ucfs.JavaToken
+import org.ucfs.descriptors.Descriptor
+import org.ucfs.input.IInputGraph
+import org.ucfs.input.ILabel
+import org.ucfs.parser.GeneratedParser
+import org.ucfs.rsm.symbol.Nonterminal
+import org.ucfs.sppf.node.SppfNode
+
+public class Java8Parser : GeneratedParser()
+ {
+ public val grammar: Java8 = Java8()
+
+ private val compilationUnit: Nonterminal = grammar.compilationUnit.nonterm
+
+ private val identifier: Nonterminal = grammar.identifier.nonterm
+
+ private val literal: Nonterminal = grammar.literal.nonterm
+
+ private val type: Nonterminal = grammar.type.nonterm
+
+ private val primitiveType: Nonterminal = grammar.primitiveType.nonterm
+
+ private val referenceType: Nonterminal = grammar.referenceType.nonterm
+
+ private val `annotation`: Nonterminal = grammar.annotation.nonterm
+
+ private val numericType: Nonterminal = grammar.numericType.nonterm
+
+ private val integralType: Nonterminal = grammar.integralType.nonterm
+
+ private val floatingPointType: Nonterminal = grammar.floatingPointType.nonterm
+
+ private val classOrInterfaceType: Nonterminal = grammar.classOrInterfaceType.nonterm
+
+ private val typeVariable: Nonterminal = grammar.typeVariable.nonterm
+
+ private val arrayType: Nonterminal = grammar.arrayType.nonterm
+
+ private val classType: Nonterminal = grammar.classType.nonterm
+
+ private val interfaceType: Nonterminal = grammar.interfaceType.nonterm
+
+ private val typeArguments: Nonterminal = grammar.typeArguments.nonterm
+
+ private val dims: Nonterminal = grammar.dims.nonterm
+
+ private val typeParameter: Nonterminal = grammar.typeParameter.nonterm
+
+ private val typeParameterModifier: Nonterminal = grammar.typeParameterModifier.nonterm
+
+ private val typeBound: Nonterminal = grammar.typeBound.nonterm
+
+ private val additionalBound: Nonterminal = grammar.additionalBound.nonterm
+
+ private val typeArgumentList: Nonterminal = grammar.typeArgumentList.nonterm
+
+ private val typeArgument: Nonterminal = grammar.typeArgument.nonterm
+
+ private val wildcard: Nonterminal = grammar.wildcard.nonterm
+
+ private val wildcardBounds: Nonterminal = grammar.wildcardBounds.nonterm
+
+ private val typeName: Nonterminal = grammar.typeName.nonterm
+
+ private val packageOrTypeName: Nonterminal = grammar.packageOrTypeName.nonterm
+
+ private val expressionName: Nonterminal = grammar.expressionName.nonterm
+
+ private val ambiguousName: Nonterminal = grammar.ambiguousName.nonterm
+
+ private val methodName: Nonterminal = grammar.methodName.nonterm
+
+ private val packageName: Nonterminal = grammar.packageName.nonterm
+
+ private val result: Nonterminal = grammar.result.nonterm
+
+ private val packageDeclaration: Nonterminal = grammar.packageDeclaration.nonterm
+
+ private val importDeclaration: Nonterminal = grammar.importDeclaration.nonterm
+
+ private val typeDeclaration: Nonterminal = grammar.typeDeclaration.nonterm
+
+ private val packageModifier: Nonterminal = grammar.packageModifier.nonterm
+
+ private val singleTypeImportDeclaration: Nonterminal = grammar.singleTypeImportDeclaration.nonterm
+
+ private val typeImportOnDemandDeclaration: Nonterminal =
+ grammar.typeImportOnDemandDeclaration.nonterm
+
+ private val singleStaticImportDeclaration: Nonterminal =
+ grammar.singleStaticImportDeclaration.nonterm
+
+ private val staticImportOnDemandDeclaration: Nonterminal =
+ grammar.staticImportOnDemandDeclaration.nonterm
+
+ private val classDeclaration: Nonterminal = grammar.classDeclaration.nonterm
+
+ private val interfaceDeclaration: Nonterminal = grammar.interfaceDeclaration.nonterm
+
+ private val throws: Nonterminal = grammar.throws.nonterm
+
+ private val normalClassDeclaration: Nonterminal = grammar.normalClassDeclaration.nonterm
+
+ private val enumDeclaration: Nonterminal = grammar.enumDeclaration.nonterm
+
+ private val classModifier: Nonterminal = grammar.classModifier.nonterm
+
+ private val typeParameters: Nonterminal = grammar.typeParameters.nonterm
+
+ private val superclass: Nonterminal = grammar.superclass.nonterm
+
+ private val superinterfaces: Nonterminal = grammar.superinterfaces.nonterm
+
+ private val classBody: Nonterminal = grammar.classBody.nonterm
+
+ private val typeParameterList: Nonterminal = grammar.typeParameterList.nonterm
+
+ private val interfaceTypeList: Nonterminal = grammar.interfaceTypeList.nonterm
+
+ private val classBodyDeclaration: Nonterminal = grammar.classBodyDeclaration.nonterm
+
+ private val classMemberDeclaration: Nonterminal = grammar.classMemberDeclaration.nonterm
+
+ private val instanceInitializer: Nonterminal = grammar.instanceInitializer.nonterm
+
+ private val staticInitializer: Nonterminal = grammar.staticInitializer.nonterm
+
+ private val constructorDeclaration: Nonterminal = grammar.constructorDeclaration.nonterm
+
+ private val fieldDeclaration: Nonterminal = grammar.fieldDeclaration.nonterm
+
+ private val methodDeclaration: Nonterminal = grammar.methodDeclaration.nonterm
+
+ private val fieldModifier: Nonterminal = grammar.fieldModifier.nonterm
+
+ private val unannType: Nonterminal = grammar.unannType.nonterm
+
+ private val variableDeclaratorList: Nonterminal = grammar.variableDeclaratorList.nonterm
+
+ private val variableDeclarator: Nonterminal = grammar.variableDeclarator.nonterm
+
+ private val variableDeclaratorId: Nonterminal = grammar.variableDeclaratorId.nonterm
+
+ private val variableInitializer: Nonterminal = grammar.variableInitializer.nonterm
+
+ private val expression: Nonterminal = grammar.expression.nonterm
+
+ private val arrayInitializer: Nonterminal = grammar.arrayInitializer.nonterm
+
+ private val unannPrimitiveType: Nonterminal = grammar.unannPrimitiveType.nonterm
+
+ private val unannReferenceType: Nonterminal = grammar.unannReferenceType.nonterm
+
+ private val unannClassOrInterfaceType: Nonterminal = grammar.unannClassOrInterfaceType.nonterm
+
+ private val unannTypeVariable: Nonterminal = grammar.unannTypeVariable.nonterm
+
+ private val unannArrayType: Nonterminal = grammar.unannArrayType.nonterm
+
+ private val unannClassType: Nonterminal = grammar.unannClassType.nonterm
+
+ private val unannInterfaceType: Nonterminal = grammar.unannInterfaceType.nonterm
+
+ private val methodModifier: Nonterminal = grammar.methodModifier.nonterm
+
+ private val methodHeader: Nonterminal = grammar.methodHeader.nonterm
+
+ private val methodBody: Nonterminal = grammar.methodBody.nonterm
+
+ private val methodDeclarator: Nonterminal = grammar.methodDeclarator.nonterm
+
+ private val formalParameterList: Nonterminal = grammar.formalParameterList.nonterm
+
+ private val receiverParameter: Nonterminal = grammar.receiverParameter.nonterm
+
+ private val formalParameters: Nonterminal = grammar.formalParameters.nonterm
+
+ private val lastFormalParameter: Nonterminal = grammar.lastFormalParameter.nonterm
+
+ private val formalParameter: Nonterminal = grammar.formalParameter.nonterm
+
+ private val variableModifier: Nonterminal = grammar.variableModifier.nonterm
+
+ private val exceptionTypeList: Nonterminal = grammar.exceptionTypeList.nonterm
+
+ private val exceptionType: Nonterminal = grammar.exceptionType.nonterm
+
+ private val block: Nonterminal = grammar.block.nonterm
+
+ private val constructorModifier: Nonterminal = grammar.constructorModifier.nonterm
+
+ private val constructorDeclarator: Nonterminal = grammar.constructorDeclarator.nonterm
+
+ private val constructorBody: Nonterminal = grammar.constructorBody.nonterm
+
+ private val simpleTypeName: Nonterminal = grammar.simpleTypeName.nonterm
+
+ private val explicitConstructorInvocation: Nonterminal =
+ grammar.explicitConstructorInvocation.nonterm
+
+ private val enumBody: Nonterminal = grammar.enumBody.nonterm
+
+ private val enumConstantList: Nonterminal = grammar.enumConstantList.nonterm
+
+ private val enumConstant: Nonterminal = grammar.enumConstant.nonterm
+
+ private val enumConstantModifier: Nonterminal = grammar.enumConstantModifier.nonterm
+
+ private val enumBodyDeclarations: Nonterminal = grammar.enumBodyDeclarations.nonterm
+
+ private val blockStatements: Nonterminal = grammar.blockStatements.nonterm
+
+ private val argumentList: Nonterminal = grammar.argumentList.nonterm
+
+ private val primary: Nonterminal = grammar.primary.nonterm
+
+ private val normalInterfaceDeclaration: Nonterminal = grammar.normalInterfaceDeclaration.nonterm
+
+ private val interfaceModifier: Nonterminal = grammar.interfaceModifier.nonterm
+
+ private val extendsInterfaces: Nonterminal = grammar.extendsInterfaces.nonterm
+
+ private val interfaceBody: Nonterminal = grammar.interfaceBody.nonterm
+
+ private val interfaceMemberDeclaration: Nonterminal = grammar.interfaceMemberDeclaration.nonterm
+
+ private val constantDeclaration: Nonterminal = grammar.constantDeclaration.nonterm
+
+ private val constantModifier: Nonterminal = grammar.constantModifier.nonterm
+
+ private val annotationTypeDeclaration: Nonterminal = grammar.annotationTypeDeclaration.nonterm
+
+ private val annotationTypeBody: Nonterminal = grammar.annotationTypeBody.nonterm
+
+ private val annotationTypeMemberDeclaration: Nonterminal =
+ grammar.annotationTypeMemberDeclaration.nonterm
+
+ private val annotationTypeElementDeclaration: Nonterminal =
+ grammar.annotationTypeElementDeclaration.nonterm
+
+ private val defaultValue: Nonterminal = grammar.defaultValue.nonterm
+
+ private val normalAnnotation: Nonterminal = grammar.normalAnnotation.nonterm
+
+ private val elementValuePairList: Nonterminal = grammar.elementValuePairList.nonterm
+
+ private val elementValuePair: Nonterminal = grammar.elementValuePair.nonterm
+
+ private val elementValue: Nonterminal = grammar.elementValue.nonterm
+
+ private val elementValueArrayInitializer: Nonterminal =
+ grammar.elementValueArrayInitializer.nonterm
+
+ private val elementValueList: Nonterminal = grammar.elementValueList.nonterm
+
+ private val markerAnnotation: Nonterminal = grammar.markerAnnotation.nonterm
+
+ private val singleElementAnnotation: Nonterminal = grammar.singleElementAnnotation.nonterm
+
+ private val interfaceMethodDeclaration: Nonterminal = grammar.interfaceMethodDeclaration.nonterm
+
+ private val annotationTypeElementModifier: Nonterminal =
+ grammar.annotationTypeElementModifier.nonterm
+
+ private val conditionalExpression: Nonterminal = grammar.conditionalExpression.nonterm
+
+ private val variableInitializerList: Nonterminal = grammar.variableInitializerList.nonterm
+
+ private val blockStatement: Nonterminal = grammar.blockStatement.nonterm
+
+ private val localVariableDeclarationStatement: Nonterminal =
+ grammar.localVariableDeclarationStatement.nonterm
+
+ private val localVariableDeclaration: Nonterminal = grammar.localVariableDeclaration.nonterm
+
+ private val statement: Nonterminal = grammar.statement.nonterm
+
+ private val statementNoShortIf: Nonterminal = grammar.statementNoShortIf.nonterm
+
+ private val statementWithoutTrailingSubstatement: Nonterminal =
+ grammar.statementWithoutTrailingSubstatement.nonterm
+
+ private val emptyStatement: Nonterminal = grammar.emptyStatement.nonterm
+
+ private val labeledStatement: Nonterminal = grammar.labeledStatement.nonterm
+
+ private val labeledStatementNoShortIf: Nonterminal = grammar.labeledStatementNoShortIf.nonterm
+
+ private val expressionStatement: Nonterminal = grammar.expressionStatement.nonterm
+
+ private val statementExpression: Nonterminal = grammar.statementExpression.nonterm
+
+ private val ifThenStatement: Nonterminal = grammar.ifThenStatement.nonterm
+
+ private val ifThenElseStatement: Nonterminal = grammar.ifThenElseStatement.nonterm
+
+ private val ifThenElseStatementNoShortIf: Nonterminal =
+ grammar.ifThenElseStatementNoShortIf.nonterm
+
+ private val assertStatement: Nonterminal = grammar.assertStatement.nonterm
+
+ private val switchStatement: Nonterminal = grammar.switchStatement.nonterm
+
+ private val switchBlock: Nonterminal = grammar.switchBlock.nonterm
+
+ private val switchBlockStatementGroup: Nonterminal = grammar.switchBlockStatementGroup.nonterm
+
+ private val switchLabels: Nonterminal = grammar.switchLabels.nonterm
+
+ private val switchLabel: Nonterminal = grammar.switchLabel.nonterm
+
+ private val enumConstantName: Nonterminal = grammar.enumConstantName.nonterm
+
+ private val whileStatement: Nonterminal = grammar.whileStatement.nonterm
+
+ private val whileStatementNoShortIf: Nonterminal = grammar.whileStatementNoShortIf.nonterm
+
+ private val doStatement: Nonterminal = grammar.doStatement.nonterm
+
+ private val interfaceMethodModifier: Nonterminal = grammar.interfaceMethodModifier.nonterm
+
+ private val forStatement: Nonterminal = grammar.forStatement.nonterm
+
+ private val forStatementNoShortIf: Nonterminal = grammar.forStatementNoShortIf.nonterm
+
+ private val basicForStatement: Nonterminal = grammar.basicForStatement.nonterm
+
+ private val basicForStatementNoShortIf: Nonterminal = grammar.basicForStatementNoShortIf.nonterm
+
+ private val forInit: Nonterminal = grammar.forInit.nonterm
+
+ private val forUpdate: Nonterminal = grammar.forUpdate.nonterm
+
+ private val statementExpressionList: Nonterminal = grammar.statementExpressionList.nonterm
+
+ private val enhancedForStatement: Nonterminal = grammar.enhancedForStatement.nonterm
+
+ private val enhancedForStatementNoShortIf: Nonterminal =
+ grammar.enhancedForStatementNoShortIf.nonterm
+
+ private val breakStatement: Nonterminal = grammar.breakStatement.nonterm
+
+ private val continueStatement: Nonterminal = grammar.continueStatement.nonterm
+
+ private val returnStatement: Nonterminal = grammar.returnStatement.nonterm
+
+ private val throwStatement: Nonterminal = grammar.throwStatement.nonterm
+
+ private val synchronizedStatement: Nonterminal = grammar.synchronizedStatement.nonterm
+
+ private val tryStatement: Nonterminal = grammar.tryStatement.nonterm
+
+ private val catches: Nonterminal = grammar.catches.nonterm
+
+ private val catchClause: Nonterminal = grammar.catchClause.nonterm
+
+ private val catchFormalParameter: Nonterminal = grammar.catchFormalParameter.nonterm
+
+ private val catchType: Nonterminal = grammar.catchType.nonterm
+
+ private val `finally`: Nonterminal = grammar.finally.nonterm
+
+ private val tryWithResourcesStatement: Nonterminal = grammar.tryWithResourcesStatement.nonterm
+
+ private val resourceSpecification: Nonterminal = grammar.resourceSpecification.nonterm
+
+ private val resourceList: Nonterminal = grammar.resourceList.nonterm
+
+ private val resource: Nonterminal = grammar.resource.nonterm
+
+ private val primaryNoNewArray: Nonterminal = grammar.primaryNoNewArray.nonterm
+
+ private val classLiteral: Nonterminal = grammar.classLiteral.nonterm
+
+ private val classOrInterfaceTypeToInstantiate: Nonterminal =
+ grammar.classOrInterfaceTypeToInstantiate.nonterm
+
+ private val unqualifiedClassInstanceCreationExpression: Nonterminal =
+ grammar.unqualifiedClassInstanceCreationExpression.nonterm
+
+ private val classInstanceCreationExpression: Nonterminal =
+ grammar.classInstanceCreationExpression.nonterm
+
+ private val fieldAccess: Nonterminal = grammar.fieldAccess.nonterm
+
+ private val typeArgumentsOrDiamond: Nonterminal = grammar.typeArgumentsOrDiamond.nonterm
+
+ private val arrayAccess: Nonterminal = grammar.arrayAccess.nonterm
+
+ private val methodInvocation: Nonterminal = grammar.methodInvocation.nonterm
+
+ private val methodReference: Nonterminal = grammar.methodReference.nonterm
+
+ private val arrayCreationExpression: Nonterminal = grammar.arrayCreationExpression.nonterm
+
+ private val dimExprs: Nonterminal = grammar.dimExprs.nonterm
+
+ private val dimExpr: Nonterminal = grammar.dimExpr.nonterm
+
+ private val lambdaExpression: Nonterminal = grammar.lambdaExpression.nonterm
+
+ private val lambdaParameters: Nonterminal = grammar.lambdaParameters.nonterm
+
+ private val inferredFormalParameterList: Nonterminal = grammar.inferredFormalParameterList.nonterm
+
+ private val lambdaBody: Nonterminal = grammar.lambdaBody.nonterm
+
+ private val assignmentExpression: Nonterminal = grammar.assignmentExpression.nonterm
+
+ private val assignment: Nonterminal = grammar.assignment.nonterm
+
+ private val leftHandSide: Nonterminal = grammar.leftHandSide.nonterm
+
+ private val assignmentOperator: Nonterminal = grammar.assignmentOperator.nonterm
+
+ private val conditionalOrExpression: Nonterminal = grammar.conditionalOrExpression.nonterm
+
+ private val conditionalAndExpression: Nonterminal = grammar.conditionalAndExpression.nonterm
+
+ private val inclusiveOrExpression: Nonterminal = grammar.inclusiveOrExpression.nonterm
+
+ private val exclusiveOrExpression: Nonterminal = grammar.exclusiveOrExpression.nonterm
+
+ private val andExpression: Nonterminal = grammar.andExpression.nonterm
+
+ private val equalityExpression: Nonterminal = grammar.equalityExpression.nonterm
+
+ private val relationalExpression: Nonterminal = grammar.relationalExpression.nonterm
+
+ private val shiftExpression: Nonterminal = grammar.shiftExpression.nonterm
+
+ private val additiveExpression: Nonterminal = grammar.additiveExpression.nonterm
+
+ private val multiplicativeExpression: Nonterminal = grammar.multiplicativeExpression.nonterm
+
+ private val preIncrementExpression: Nonterminal = grammar.preIncrementExpression.nonterm
+
+ private val preDecrementExpression: Nonterminal = grammar.preDecrementExpression.nonterm
+
+ private val unaryExpressionNotPlusMinus: Nonterminal = grammar.unaryExpressionNotPlusMinus.nonterm
+
+ private val unaryExpression: Nonterminal = grammar.unaryExpression.nonterm
+
+ private val postfixExpression: Nonterminal = grammar.postfixExpression.nonterm
+
+ private val postIncrementExpression: Nonterminal = grammar.postIncrementExpression.nonterm
+
+ private val postDecrementExpression: Nonterminal = grammar.postDecrementExpression.nonterm
+
+ private val castExpression: Nonterminal = grammar.castExpression.nonterm
+
+ private val constantExpression: Nonterminal = grammar.constantExpression.nonterm
+
+ override fun callNtFuncs(
+ nt: Nonterminal,
+ descriptor: Descriptor,
+ curSppfNode: SppfNode?,
+ ) {
+ when(nt.name) {
+ "compilationUnit" -> parsecompilationUnit(descriptor, curSppfNode)
+ "identifier" -> parseidentifier(descriptor, curSppfNode)
+ "literal" -> parseliteral(descriptor, curSppfNode)
+ "type" -> parsetype(descriptor, curSppfNode)
+ "primitiveType" -> parseprimitiveType(descriptor, curSppfNode)
+ "referenceType" -> parsereferenceType(descriptor, curSppfNode)
+ "annotation" -> parseannotation(descriptor, curSppfNode)
+ "numericType" -> parsenumericType(descriptor, curSppfNode)
+ "integralType" -> parseintegralType(descriptor, curSppfNode)
+ "floatingPointType" -> parsefloatingPointType(descriptor, curSppfNode)
+ "classOrInterfaceType" -> parseclassOrInterfaceType(descriptor, curSppfNode)
+ "typeVariable" -> parsetypeVariable(descriptor, curSppfNode)
+ "arrayType" -> parsearrayType(descriptor, curSppfNode)
+ "classType" -> parseclassType(descriptor, curSppfNode)
+ "interfaceType" -> parseinterfaceType(descriptor, curSppfNode)
+ "typeArguments" -> parsetypeArguments(descriptor, curSppfNode)
+ "dims" -> parsedims(descriptor, curSppfNode)
+ "typeParameter" -> parsetypeParameter(descriptor, curSppfNode)
+ "typeParameterModifier" -> parsetypeParameterModifier(descriptor, curSppfNode)
+ "typeBound" -> parsetypeBound(descriptor, curSppfNode)
+ "additionalBound" -> parseadditionalBound(descriptor, curSppfNode)
+ "typeArgumentList" -> parsetypeArgumentList(descriptor, curSppfNode)
+ "typeArgument" -> parsetypeArgument(descriptor, curSppfNode)
+ "wildcard" -> parsewildcard(descriptor, curSppfNode)
+ "wildcardBounds" -> parsewildcardBounds(descriptor, curSppfNode)
+ "typeName" -> parsetypeName(descriptor, curSppfNode)
+ "packageOrTypeName" -> parsepackageOrTypeName(descriptor, curSppfNode)
+ "expressionName" -> parseexpressionName(descriptor, curSppfNode)
+ "ambiguousName" -> parseambiguousName(descriptor, curSppfNode)
+ "methodName" -> parsemethodName(descriptor, curSppfNode)
+ "packageName" -> parsepackageName(descriptor, curSppfNode)
+ "result" -> parseresult(descriptor, curSppfNode)
+ "packageDeclaration" -> parsepackageDeclaration(descriptor, curSppfNode)
+ "importDeclaration" -> parseimportDeclaration(descriptor, curSppfNode)
+ "typeDeclaration" -> parsetypeDeclaration(descriptor, curSppfNode)
+ "packageModifier" -> parsepackageModifier(descriptor, curSppfNode)
+ "singleTypeImportDeclaration" -> parsesingleTypeImportDeclaration(descriptor, curSppfNode)
+ "typeImportOnDemandDeclaration" -> parsetypeImportOnDemandDeclaration(descriptor, curSppfNode)
+ "singleStaticImportDeclaration" -> parsesingleStaticImportDeclaration(descriptor, curSppfNode)
+ "staticImportOnDemandDeclaration" -> parsestaticImportOnDemandDeclaration(descriptor,
+ curSppfNode)
+ "classDeclaration" -> parseclassDeclaration(descriptor, curSppfNode)
+ "interfaceDeclaration" -> parseinterfaceDeclaration(descriptor, curSppfNode)
+ "throws" -> parsethrows(descriptor, curSppfNode)
+ "normalClassDeclaration" -> parsenormalClassDeclaration(descriptor, curSppfNode)
+ "enumDeclaration" -> parseenumDeclaration(descriptor, curSppfNode)
+ "classModifier" -> parseclassModifier(descriptor, curSppfNode)
+ "typeParameters" -> parsetypeParameters(descriptor, curSppfNode)
+ "superclass" -> parsesuperclass(descriptor, curSppfNode)
+ "superinterfaces" -> parsesuperinterfaces(descriptor, curSppfNode)
+ "classBody" -> parseclassBody(descriptor, curSppfNode)
+ "typeParameterList" -> parsetypeParameterList(descriptor, curSppfNode)
+ "interfaceTypeList" -> parseinterfaceTypeList(descriptor, curSppfNode)
+ "classBodyDeclaration" -> parseclassBodyDeclaration(descriptor, curSppfNode)
+ "classMemberDeclaration" -> parseclassMemberDeclaration(descriptor, curSppfNode)
+ "instanceInitializer" -> parseinstanceInitializer(descriptor, curSppfNode)
+ "staticInitializer" -> parsestaticInitializer(descriptor, curSppfNode)
+ "constructorDeclaration" -> parseconstructorDeclaration(descriptor, curSppfNode)
+ "fieldDeclaration" -> parsefieldDeclaration(descriptor, curSppfNode)
+ "methodDeclaration" -> parsemethodDeclaration(descriptor, curSppfNode)
+ "fieldModifier" -> parsefieldModifier(descriptor, curSppfNode)
+ "unannType" -> parseunannType(descriptor, curSppfNode)
+ "variableDeclaratorList" -> parsevariableDeclaratorList(descriptor, curSppfNode)
+ "variableDeclarator" -> parsevariableDeclarator(descriptor, curSppfNode)
+ "variableDeclaratorId" -> parsevariableDeclaratorId(descriptor, curSppfNode)
+ "variableInitializer" -> parsevariableInitializer(descriptor, curSppfNode)
+ "expression" -> parseexpression(descriptor, curSppfNode)
+ "arrayInitializer" -> parsearrayInitializer(descriptor, curSppfNode)
+ "unannPrimitiveType" -> parseunannPrimitiveType(descriptor, curSppfNode)
+ "unannReferenceType" -> parseunannReferenceType(descriptor, curSppfNode)
+ "unannClassOrInterfaceType" -> parseunannClassOrInterfaceType(descriptor, curSppfNode)
+ "unannTypeVariable" -> parseunannTypeVariable(descriptor, curSppfNode)
+ "unannArrayType" -> parseunannArrayType(descriptor, curSppfNode)
+ "unannClassType" -> parseunannClassType(descriptor, curSppfNode)
+ "unannInterfaceType" -> parseunannInterfaceType(descriptor, curSppfNode)
+ "methodModifier" -> parsemethodModifier(descriptor, curSppfNode)
+ "methodHeader" -> parsemethodHeader(descriptor, curSppfNode)
+ "methodBody" -> parsemethodBody(descriptor, curSppfNode)
+ "methodDeclarator" -> parsemethodDeclarator(descriptor, curSppfNode)
+ "formalParameterList" -> parseformalParameterList(descriptor, curSppfNode)
+ "receiverParameter" -> parsereceiverParameter(descriptor, curSppfNode)
+ "formalParameters" -> parseformalParameters(descriptor, curSppfNode)
+ "lastFormalParameter" -> parselastFormalParameter(descriptor, curSppfNode)
+ "formalParameter" -> parseformalParameter(descriptor, curSppfNode)
+ "variableModifier" -> parsevariableModifier(descriptor, curSppfNode)
+ "exceptionTypeList" -> parseexceptionTypeList(descriptor, curSppfNode)
+ "exceptionType" -> parseexceptionType(descriptor, curSppfNode)
+ "block" -> parseblock(descriptor, curSppfNode)
+ "constructorModifier" -> parseconstructorModifier(descriptor, curSppfNode)
+ "constructorDeclarator" -> parseconstructorDeclarator(descriptor, curSppfNode)
+ "constructorBody" -> parseconstructorBody(descriptor, curSppfNode)
+ "simpleTypeName" -> parsesimpleTypeName(descriptor, curSppfNode)
+ "explicitConstructorInvocation" -> parseexplicitConstructorInvocation(descriptor, curSppfNode)
+ "enumBody" -> parseenumBody(descriptor, curSppfNode)
+ "enumConstantList" -> parseenumConstantList(descriptor, curSppfNode)
+ "enumConstant" -> parseenumConstant(descriptor, curSppfNode)
+ "enumConstantModifier" -> parseenumConstantModifier(descriptor, curSppfNode)
+ "enumBodyDeclarations" -> parseenumBodyDeclarations(descriptor, curSppfNode)
+ "blockStatements" -> parseblockStatements(descriptor, curSppfNode)
+ "argumentList" -> parseargumentList(descriptor, curSppfNode)
+ "primary" -> parseprimary(descriptor, curSppfNode)
+ "normalInterfaceDeclaration" -> parsenormalInterfaceDeclaration(descriptor, curSppfNode)
+ "interfaceModifier" -> parseinterfaceModifier(descriptor, curSppfNode)
+ "extendsInterfaces" -> parseextendsInterfaces(descriptor, curSppfNode)
+ "interfaceBody" -> parseinterfaceBody(descriptor, curSppfNode)
+ "interfaceMemberDeclaration" -> parseinterfaceMemberDeclaration(descriptor, curSppfNode)
+ "constantDeclaration" -> parseconstantDeclaration(descriptor, curSppfNode)
+ "constantModifier" -> parseconstantModifier(descriptor, curSppfNode)
+ "annotationTypeDeclaration" -> parseannotationTypeDeclaration(descriptor, curSppfNode)
+ "annotationTypeBody" -> parseannotationTypeBody(descriptor, curSppfNode)
+ "annotationTypeMemberDeclaration" -> parseannotationTypeMemberDeclaration(descriptor,
+ curSppfNode)
+ "annotationTypeElementDeclaration" -> parseannotationTypeElementDeclaration(descriptor,
+ curSppfNode)
+ "defaultValue" -> parsedefaultValue(descriptor, curSppfNode)
+ "normalAnnotation" -> parsenormalAnnotation(descriptor, curSppfNode)
+ "elementValuePairList" -> parseelementValuePairList(descriptor, curSppfNode)
+ "elementValuePair" -> parseelementValuePair(descriptor, curSppfNode)
+ "elementValue" -> parseelementValue(descriptor, curSppfNode)
+ "elementValueArrayInitializer" -> parseelementValueArrayInitializer(descriptor, curSppfNode)
+ "elementValueList" -> parseelementValueList(descriptor, curSppfNode)
+ "markerAnnotation" -> parsemarkerAnnotation(descriptor, curSppfNode)
+ "singleElementAnnotation" -> parsesingleElementAnnotation(descriptor, curSppfNode)
+ "interfaceMethodDeclaration" -> parseinterfaceMethodDeclaration(descriptor, curSppfNode)
+ "annotationTypeElementModifier" -> parseannotationTypeElementModifier(descriptor, curSppfNode)
+ "conditionalExpression" -> parseconditionalExpression(descriptor, curSppfNode)
+ "variableInitializerList" -> parsevariableInitializerList(descriptor, curSppfNode)
+ "blockStatement" -> parseblockStatement(descriptor, curSppfNode)
+ "localVariableDeclarationStatement" -> parselocalVariableDeclarationStatement(descriptor,
+ curSppfNode)
+ "localVariableDeclaration" -> parselocalVariableDeclaration(descriptor, curSppfNode)
+ "statement" -> parsestatement(descriptor, curSppfNode)
+ "statementNoShortIf" -> parsestatementNoShortIf(descriptor, curSppfNode)
+ "statementWithoutTrailingSubstatement" ->
+ parsestatementWithoutTrailingSubstatement(descriptor, curSppfNode)
+ "emptyStatement" -> parseemptyStatement(descriptor, curSppfNode)
+ "labeledStatement" -> parselabeledStatement(descriptor, curSppfNode)
+ "labeledStatementNoShortIf" -> parselabeledStatementNoShortIf(descriptor, curSppfNode)
+ "expressionStatement" -> parseexpressionStatement(descriptor, curSppfNode)
+ "statementExpression" -> parsestatementExpression(descriptor, curSppfNode)
+ "ifThenStatement" -> parseifThenStatement(descriptor, curSppfNode)
+ "ifThenElseStatement" -> parseifThenElseStatement(descriptor, curSppfNode)
+ "ifThenElseStatementNoShortIf" -> parseifThenElseStatementNoShortIf(descriptor, curSppfNode)
+ "assertStatement" -> parseassertStatement(descriptor, curSppfNode)
+ "switchStatement" -> parseswitchStatement(descriptor, curSppfNode)
+ "switchBlock" -> parseswitchBlock(descriptor, curSppfNode)
+ "switchBlockStatementGroup" -> parseswitchBlockStatementGroup(descriptor, curSppfNode)
+ "switchLabels" -> parseswitchLabels(descriptor, curSppfNode)
+ "switchLabel" -> parseswitchLabel(descriptor, curSppfNode)
+ "enumConstantName" -> parseenumConstantName(descriptor, curSppfNode)
+ "whileStatement" -> parsewhileStatement(descriptor, curSppfNode)
+ "whileStatementNoShortIf" -> parsewhileStatementNoShortIf(descriptor, curSppfNode)
+ "doStatement" -> parsedoStatement(descriptor, curSppfNode)
+ "interfaceMethodModifier" -> parseinterfaceMethodModifier(descriptor, curSppfNode)
+ "forStatement" -> parseforStatement(descriptor, curSppfNode)
+ "forStatementNoShortIf" -> parseforStatementNoShortIf(descriptor, curSppfNode)
+ "basicForStatement" -> parsebasicForStatement(descriptor, curSppfNode)
+ "basicForStatementNoShortIf" -> parsebasicForStatementNoShortIf(descriptor, curSppfNode)
+ "forInit" -> parseforInit(descriptor, curSppfNode)
+ "forUpdate" -> parseforUpdate(descriptor, curSppfNode)
+ "statementExpressionList" -> parsestatementExpressionList(descriptor, curSppfNode)
+ "enhancedForStatement" -> parseenhancedForStatement(descriptor, curSppfNode)
+ "enhancedForStatementNoShortIf" -> parseenhancedForStatementNoShortIf(descriptor, curSppfNode)
+ "breakStatement" -> parsebreakStatement(descriptor, curSppfNode)
+ "continueStatement" -> parsecontinueStatement(descriptor, curSppfNode)
+ "returnStatement" -> parsereturnStatement(descriptor, curSppfNode)
+ "throwStatement" -> parsethrowStatement(descriptor, curSppfNode)
+ "synchronizedStatement" -> parsesynchronizedStatement(descriptor, curSppfNode)
+ "tryStatement" -> parsetryStatement(descriptor, curSppfNode)
+ "catches" -> parsecatches(descriptor, curSppfNode)
+ "catchClause" -> parsecatchClause(descriptor, curSppfNode)
+ "catchFormalParameter" -> parsecatchFormalParameter(descriptor, curSppfNode)
+ "catchType" -> parsecatchType(descriptor, curSppfNode)
+ "finally" -> parsefinally(descriptor, curSppfNode)
+ "tryWithResourcesStatement" -> parsetryWithResourcesStatement(descriptor, curSppfNode)
+ "resourceSpecification" -> parseresourceSpecification(descriptor, curSppfNode)
+ "resourceList" -> parseresourceList(descriptor, curSppfNode)
+ "resource" -> parseresource(descriptor, curSppfNode)
+ "primaryNoNewArray" -> parseprimaryNoNewArray(descriptor, curSppfNode)
+ "classLiteral" -> parseclassLiteral(descriptor, curSppfNode)
+ "classOrInterfaceTypeToInstantiate" -> parseclassOrInterfaceTypeToInstantiate(descriptor,
+ curSppfNode)
+ "unqualifiedClassInstanceCreationExpression" ->
+ parseunqualifiedClassInstanceCreationExpression(descriptor, curSppfNode)
+ "classInstanceCreationExpression" -> parseclassInstanceCreationExpression(descriptor,
+ curSppfNode)
+ "fieldAccess" -> parsefieldAccess(descriptor, curSppfNode)
+ "typeArgumentsOrDiamond" -> parsetypeArgumentsOrDiamond(descriptor, curSppfNode)
+ "arrayAccess" -> parsearrayAccess(descriptor, curSppfNode)
+ "methodInvocation" -> parsemethodInvocation(descriptor, curSppfNode)
+ "methodReference" -> parsemethodReference(descriptor, curSppfNode)
+ "arrayCreationExpression" -> parsearrayCreationExpression(descriptor, curSppfNode)
+ "dimExprs" -> parsedimExprs(descriptor, curSppfNode)
+ "dimExpr" -> parsedimExpr(descriptor, curSppfNode)
+ "lambdaExpression" -> parselambdaExpression(descriptor, curSppfNode)
+ "lambdaParameters" -> parselambdaParameters(descriptor, curSppfNode)
+ "inferredFormalParameterList" -> parseinferredFormalParameterList(descriptor, curSppfNode)
+ "lambdaBody" -> parselambdaBody(descriptor, curSppfNode)
+ "assignmentExpression" -> parseassignmentExpression(descriptor, curSppfNode)
+ "assignment" -> parseassignment(descriptor, curSppfNode)
+ "leftHandSide" -> parseleftHandSide(descriptor, curSppfNode)
+ "assignmentOperator" -> parseassignmentOperator(descriptor, curSppfNode)
+ "conditionalOrExpression" -> parseconditionalOrExpression(descriptor, curSppfNode)
+ "conditionalAndExpression" -> parseconditionalAndExpression(descriptor, curSppfNode)
+ "inclusiveOrExpression" -> parseinclusiveOrExpression(descriptor, curSppfNode)
+ "exclusiveOrExpression" -> parseexclusiveOrExpression(descriptor, curSppfNode)
+ "andExpression" -> parseandExpression(descriptor, curSppfNode)
+ "equalityExpression" -> parseequalityExpression(descriptor, curSppfNode)
+ "relationalExpression" -> parserelationalExpression(descriptor, curSppfNode)
+ "shiftExpression" -> parseshiftExpression(descriptor, curSppfNode)
+ "additiveExpression" -> parseadditiveExpression(descriptor, curSppfNode)
+ "multiplicativeExpression" -> parsemultiplicativeExpression(descriptor, curSppfNode)
+ "preIncrementExpression" -> parsepreIncrementExpression(descriptor, curSppfNode)
+ "preDecrementExpression" -> parsepreDecrementExpression(descriptor, curSppfNode)
+ "unaryExpressionNotPlusMinus" -> parseunaryExpressionNotPlusMinus(descriptor, curSppfNode)
+ "unaryExpression" -> parseunaryExpression(descriptor, curSppfNode)
+ "postfixExpression" -> parsepostfixExpression(descriptor, curSppfNode)
+ "postIncrementExpression" -> parsepostIncrementExpression(descriptor, curSppfNode)
+ "postDecrementExpression" -> parsepostDecrementExpression(descriptor, curSppfNode)
+ "castExpression" -> parsecastExpression(descriptor, curSppfNode)
+ "constantExpression" -> parseconstantExpression(descriptor, curSppfNode)
+ }
+ }
+
+ private fun parsecompilationUnit(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, packageDeclaration,
+ state.nonterminalEdges[packageDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, typeDeclaration,
+ state.nonterminalEdges[typeDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, importDeclaration,
+ state.nonterminalEdges[importDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeDeclaration,
+ state.nonterminalEdges[typeDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, importDeclaration,
+ state.nonterminalEdges[importDeclaration]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeDeclaration,
+ state.nonterminalEdges[typeDeclaration]!!, curSppfNode)
+ }
+ }
+ }
+
+ private fun parseidentifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.IDENTIFIER ->
+ handleTerminal(JavaToken.IDENTIFIER, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseliteral(descriptor: Descriptor, curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.FLOATING_POINT_LITERAL ->
+ handleTerminal(JavaToken.FLOATING_POINT_LITERAL, state, inputEdge, descriptor,
+ curSppfNode)
+ JavaToken.BOOLEAN_LITERAL ->
+ handleTerminal(JavaToken.BOOLEAN_LITERAL, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.CHARACTER_LITERAL ->
+ handleTerminal(JavaToken.CHARACTER_LITERAL, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.INTEGER_LITERAL ->
+ handleTerminal(JavaToken.INTEGER_LITERAL, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.STRING_LITERAL ->
+ handleTerminal(JavaToken.STRING_LITERAL, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.NULL_LITERAL ->
+ handleTerminal(JavaToken.NULL_LITERAL, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetype(descriptor: Descriptor, curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, referenceType, state.nonterminalEdges[referenceType]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, primitiveType, state.nonterminalEdges[primitiveType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseprimitiveType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.BOOLEAN ->
+ handleTerminal(JavaToken.BOOLEAN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, numericType, state.nonterminalEdges[numericType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsereferenceType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeVariable, state.nonterminalEdges[typeVariable]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, arrayType, state.nonterminalEdges[arrayType]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classOrInterfaceType,
+ state.nonterminalEdges[classOrInterfaceType]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseannotation(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, singleElementAnnotation,
+ state.nonterminalEdges[singleElementAnnotation]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, normalAnnotation,
+ state.nonterminalEdges[normalAnnotation]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, markerAnnotation,
+ state.nonterminalEdges[markerAnnotation]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsenumericType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, floatingPointType,
+ state.nonterminalEdges[floatingPointType]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, integralType, state.nonterminalEdges[integralType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseintegralType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.CHAR ->
+ handleTerminal(JavaToken.CHAR, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.BYTE ->
+ handleTerminal(JavaToken.BYTE, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.INT ->
+ handleTerminal(JavaToken.INT, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.LONG ->
+ handleTerminal(JavaToken.LONG, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.SHORT ->
+ handleTerminal(JavaToken.SHORT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsefloatingPointType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOUBLE ->
+ handleTerminal(JavaToken.DOUBLE, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.FLOAT ->
+ handleTerminal(JavaToken.FLOAT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseclassOrInterfaceType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceType, state.nonterminalEdges[interfaceType]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classType, state.nonterminalEdges[classType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeVariable(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsearrayType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeVariable, state.nonterminalEdges[typeVariable]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classOrInterfaceType,
+ state.nonterminalEdges[classOrInterfaceType]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, primitiveType, state.nonterminalEdges[primitiveType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, dims, state.nonterminalEdges[dims]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parseclassType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classOrInterfaceType,
+ state.nonterminalEdges[classOrInterfaceType]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeArguments, state.nonterminalEdges[typeArguments]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parseinterfaceType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classType, state.nonterminalEdges[classType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeArguments(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LT ->
+ handleTerminal(JavaToken.LT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeArgumentList,
+ state.nonterminalEdges[typeArgumentList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.GT ->
+ handleTerminal(JavaToken.GT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parsedims(descriptor: Descriptor, curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACK ->
+ handleTerminal(JavaToken.LBRACK, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACK ->
+ handleTerminal(JavaToken.RBRACK, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACK ->
+ handleTerminal(JavaToken.LBRACK, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ }
+ }
+
+ private fun parsetypeParameter(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, typeParameterModifier,
+ state.nonterminalEdges[typeParameterModifier]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeBound, state.nonterminalEdges[typeBound]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeParameterModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeBound(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.EXTENDS ->
+ handleTerminal(JavaToken.EXTENDS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeVariable, state.nonterminalEdges[typeVariable]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classOrInterfaceType,
+ state.nonterminalEdges[classOrInterfaceType]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, additionalBound,
+ state.nonterminalEdges[additionalBound]!!, curSppfNode)
+ }
+ }
+ }
+
+ private fun parseadditionalBound(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.AND ->
+ handleTerminal(JavaToken.AND, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceType, state.nonterminalEdges[interfaceType]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeArgumentList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeArgument, state.nonterminalEdges[typeArgument]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parsetypeArgument(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, referenceType, state.nonterminalEdges[referenceType]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, wildcard, state.nonterminalEdges[wildcard]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsewildcard(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.QUESTION ->
+ handleTerminal(JavaToken.QUESTION, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, wildcardBounds, state.nonterminalEdges[wildcardBounds]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsewildcardBounds(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SUPER ->
+ handleTerminal(JavaToken.SUPER, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.EXTENDS ->
+ handleTerminal(JavaToken.EXTENDS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, referenceType, state.nonterminalEdges[referenceType]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeName(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, packageOrTypeName,
+ state.nonterminalEdges[packageOrTypeName]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ }
+ }
+
+ private fun parsepackageOrTypeName(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, packageOrTypeName,
+ state.nonterminalEdges[packageOrTypeName]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ }
+ }
+
+ private fun parseexpressionName(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, ambiguousName, state.nonterminalEdges[ambiguousName]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ }
+ }
+
+ private fun parseambiguousName(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, ambiguousName, state.nonterminalEdges[ambiguousName]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ }
+ }
+
+ private fun parsemethodName(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsepackageName(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, packageName, state.nonterminalEdges[packageName]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ }
+ }
+
+ private fun parseresult(descriptor: Descriptor, curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.VOID ->
+ handleTerminal(JavaToken.VOID, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsepackageDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.PACKAGE ->
+ handleTerminal(JavaToken.PACKAGE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, packageModifier,
+ state.nonterminalEdges[packageModifier]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parseimportDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, singleTypeImportDeclaration,
+ state.nonterminalEdges[singleTypeImportDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, staticImportOnDemandDeclaration,
+ state.nonterminalEdges[staticImportOnDemandDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, singleStaticImportDeclaration,
+ state.nonterminalEdges[singleStaticImportDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, typeImportOnDemandDeclaration,
+ state.nonterminalEdges[typeImportOnDemandDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceDeclaration,
+ state.nonterminalEdges[interfaceDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, classDeclaration,
+ state.nonterminalEdges[classDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsepackageModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsesingleTypeImportDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.IMPORT ->
+ handleTerminal(JavaToken.IMPORT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeName, state.nonterminalEdges[typeName]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeImportOnDemandDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.IMPORT ->
+ handleTerminal(JavaToken.IMPORT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, packageOrTypeName,
+ state.nonterminalEdges[packageOrTypeName]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.MULT ->
+ handleTerminal(JavaToken.MULT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 5 ->
+ {
+ }
+ }
+ }
+
+ private fun parsesingleStaticImportDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.IMPORT ->
+ handleTerminal(JavaToken.IMPORT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeName, state.nonterminalEdges[typeName]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 5 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 6 ->
+ {
+ }
+ }
+ }
+
+ private fun parsestaticImportOnDemandDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.IMPORT ->
+ handleTerminal(JavaToken.IMPORT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeName, state.nonterminalEdges[typeName]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.MULT ->
+ handleTerminal(JavaToken.MULT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 5 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 6 ->
+ {
+ }
+ }
+ }
+
+ private fun parseclassDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, enumDeclaration,
+ state.nonterminalEdges[enumDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, normalClassDeclaration,
+ state.nonterminalEdges[normalClassDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseinterfaceDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotationTypeDeclaration,
+ state.nonterminalEdges[annotationTypeDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, normalInterfaceDeclaration,
+ state.nonterminalEdges[normalInterfaceDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsethrows(descriptor: Descriptor, curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.THROWS ->
+ handleTerminal(JavaToken.THROWS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, exceptionTypeList,
+ state.nonterminalEdges[exceptionTypeList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsenormalClassDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.CLASS ->
+ handleTerminal(JavaToken.CLASS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classModifier, state.nonterminalEdges[classModifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, superinterfaces,
+ state.nonterminalEdges[superinterfaces]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, superclass, state.nonterminalEdges[superclass]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classBody, state.nonterminalEdges[classBody]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, typeParameters, state.nonterminalEdges[typeParameters]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, superinterfaces,
+ state.nonterminalEdges[superinterfaces]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, superclass, state.nonterminalEdges[superclass]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classBody, state.nonterminalEdges[classBody]!!,
+ curSppfNode)
+ }
+ 4 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, superinterfaces,
+ state.nonterminalEdges[superinterfaces]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, classBody, state.nonterminalEdges[classBody]!!,
+ curSppfNode)
+ }
+ 5 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classBody, state.nonterminalEdges[classBody]!!,
+ curSppfNode)
+ }
+ 6 ->
+ {
+ }
+ }
+ }
+
+ private fun parseenumDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.ENUM ->
+ handleTerminal(JavaToken.ENUM, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classModifier, state.nonterminalEdges[classModifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, superinterfaces,
+ state.nonterminalEdges[superinterfaces]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, enumBody, state.nonterminalEdges[enumBody]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, enumBody, state.nonterminalEdges[enumBody]!!, curSppfNode)
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parseclassModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PUBLIC ->
+ handleTerminal(JavaToken.PUBLIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.ABSTRACT ->
+ handleTerminal(JavaToken.ABSTRACT, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.FINAL ->
+ handleTerminal(JavaToken.FINAL, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.STRICTFP ->
+ handleTerminal(JavaToken.STRICTFP, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PROTECTED ->
+ handleTerminal(JavaToken.PROTECTED, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PRIVATE ->
+ handleTerminal(JavaToken.PRIVATE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeParameters(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LT ->
+ handleTerminal(JavaToken.LT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeParameterList,
+ state.nonterminalEdges[typeParameterList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.GT ->
+ handleTerminal(JavaToken.GT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parsesuperclass(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.EXTENDS ->
+ handleTerminal(JavaToken.EXTENDS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classType, state.nonterminalEdges[classType]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsesuperinterfaces(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.IMPLEMENTS ->
+ handleTerminal(JavaToken.IMPLEMENTS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceTypeList,
+ state.nonterminalEdges[interfaceTypeList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parseclassBody(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classBodyDeclaration,
+ state.nonterminalEdges[classBodyDeclaration]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsetypeParameterList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeParameter, state.nonterminalEdges[typeParameter]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parseinterfaceTypeList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceType, state.nonterminalEdges[interfaceType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parseclassBodyDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classMemberDeclaration,
+ state.nonterminalEdges[classMemberDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, staticInitializer,
+ state.nonterminalEdges[staticInitializer]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, instanceInitializer,
+ state.nonterminalEdges[instanceInitializer]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, constructorDeclaration,
+ state.nonterminalEdges[constructorDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseclassMemberDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, methodDeclaration,
+ state.nonterminalEdges[methodDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, interfaceDeclaration,
+ state.nonterminalEdges[interfaceDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, fieldDeclaration,
+ state.nonterminalEdges[fieldDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, classDeclaration,
+ state.nonterminalEdges[classDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseinstanceInitializer(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, block, state.nonterminalEdges[block]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsestaticInitializer(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, block, state.nonterminalEdges[block]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parseconstructorDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, constructorDeclarator,
+ state.nonterminalEdges[constructorDeclarator]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, constructorModifier,
+ state.nonterminalEdges[constructorModifier]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, throws, state.nonterminalEdges[throws]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, constructorBody,
+ state.nonterminalEdges[constructorBody]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, constructorBody,
+ state.nonterminalEdges[constructorBody]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parsefieldDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, fieldModifier, state.nonterminalEdges[fieldModifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableDeclaratorList,
+ state.nonterminalEdges[variableDeclaratorList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parsemethodDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, methodHeader, state.nonterminalEdges[methodHeader]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, methodModifier, state.nonterminalEdges[methodModifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, methodBody, state.nonterminalEdges[methodBody]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsefieldModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.TRANSIENT ->
+ handleTerminal(JavaToken.TRANSIENT, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.VOLATILE ->
+ handleTerminal(JavaToken.VOLATILE, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PUBLIC ->
+ handleTerminal(JavaToken.PUBLIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.FINAL ->
+ handleTerminal(JavaToken.FINAL, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PROTECTED ->
+ handleTerminal(JavaToken.PROTECTED, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PRIVATE ->
+ handleTerminal(JavaToken.PRIVATE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, unannReferenceType,
+ state.nonterminalEdges[unannReferenceType]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannPrimitiveType,
+ state.nonterminalEdges[unannPrimitiveType]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsevariableDeclaratorList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableDeclarator,
+ state.nonterminalEdges[variableDeclarator]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parsevariableDeclarator(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableDeclaratorId,
+ state.nonterminalEdges[variableDeclaratorId]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.EQ ->
+ handleTerminal(JavaToken.EQ, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableInitializer,
+ state.nonterminalEdges[variableInitializer]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parsevariableDeclaratorId(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, dims, state.nonterminalEdges[dims]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsevariableInitializer(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, expression, state.nonterminalEdges[expression]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, arrayInitializer,
+ state.nonterminalEdges[arrayInitializer]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseexpression(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, lambdaExpression,
+ state.nonterminalEdges[lambdaExpression]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, assignmentExpression,
+ state.nonterminalEdges[assignmentExpression]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsearrayInitializer(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableInitializerList,
+ state.nonterminalEdges[variableInitializerList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannPrimitiveType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.BOOLEAN ->
+ handleTerminal(JavaToken.BOOLEAN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, numericType, state.nonterminalEdges[numericType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannReferenceType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, unannTypeVariable,
+ state.nonterminalEdges[unannTypeVariable]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannArrayType, state.nonterminalEdges[unannArrayType]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, unannClassOrInterfaceType,
+ state.nonterminalEdges[unannClassOrInterfaceType]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannClassOrInterfaceType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, unannClassType, state.nonterminalEdges[unannClassType]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, unannInterfaceType,
+ state.nonterminalEdges[unannInterfaceType]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannTypeVariable(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannArrayType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, unannTypeVariable,
+ state.nonterminalEdges[unannTypeVariable]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannPrimitiveType,
+ state.nonterminalEdges[unannPrimitiveType]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannClassOrInterfaceType,
+ state.nonterminalEdges[unannClassOrInterfaceType]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, dims, state.nonterminalEdges[dims]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannClassType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, unannClassOrInterfaceType,
+ state.nonterminalEdges[unannClassOrInterfaceType]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeArguments, state.nonterminalEdges[typeArguments]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parseunannInterfaceType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, unannClassType, state.nonterminalEdges[unannClassType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsemethodModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.NATIVE ->
+ handleTerminal(JavaToken.NATIVE, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PUBLIC ->
+ handleTerminal(JavaToken.PUBLIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.ABSTRACT ->
+ handleTerminal(JavaToken.ABSTRACT, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.FINAL ->
+ handleTerminal(JavaToken.FINAL, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.SYNCHRONIZED ->
+ handleTerminal(JavaToken.SYNCHRONIZED, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.STRICTFP ->
+ handleTerminal(JavaToken.STRICTFP, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PROTECTED ->
+ handleTerminal(JavaToken.PROTECTED, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PRIVATE ->
+ handleTerminal(JavaToken.PRIVATE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsemethodHeader(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, result, state.nonterminalEdges[result]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, typeParameters, state.nonterminalEdges[typeParameters]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, methodDeclarator,
+ state.nonterminalEdges[methodDeclarator]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, result, state.nonterminalEdges[result]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, throws, state.nonterminalEdges[throws]!!, curSppfNode)
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parsemethodBody(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, block, state.nonterminalEdges[block]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsemethodDeclarator(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LPAREN ->
+ handleTerminal(JavaToken.LPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, formalParameterList,
+ state.nonterminalEdges[formalParameterList]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, dims, state.nonterminalEdges[dims]!!, curSppfNode)
+ }
+ 5 ->
+ {
+ }
+ }
+ }
+
+ private fun parseformalParameterList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, receiverParameter,
+ state.nonterminalEdges[receiverParameter]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, formalParameters,
+ state.nonterminalEdges[formalParameters]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, lastFormalParameter,
+ state.nonterminalEdges[lastFormalParameter]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, lastFormalParameter,
+ state.nonterminalEdges[lastFormalParameter]!!, curSppfNode)
+ }
+ }
+ }
+
+ private fun parsereceiverParameter(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.THIS ->
+ handleTerminal(JavaToken.THIS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.THIS ->
+ handleTerminal(JavaToken.THIS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parseformalParameters(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, receiverParameter,
+ state.nonterminalEdges[receiverParameter]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, formalParameter,
+ state.nonterminalEdges[formalParameter]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, formalParameter,
+ state.nonterminalEdges[formalParameter]!!, curSppfNode)
+ }
+ }
+ }
+
+ private fun parselastFormalParameter(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableModifier,
+ state.nonterminalEdges[variableModifier]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, formalParameter,
+ state.nonterminalEdges[formalParameter]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableModifier,
+ state.nonterminalEdges[variableModifier]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.ELLIPSIS ->
+ handleTerminal(JavaToken.ELLIPSIS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ }
+ 4 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableDeclaratorId,
+ state.nonterminalEdges[variableDeclaratorId]!!, curSppfNode)
+ }
+ }
+ }
+
+ private fun parseformalParameter(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableModifier,
+ state.nonterminalEdges[variableModifier]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableDeclaratorId,
+ state.nonterminalEdges[variableDeclaratorId]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsevariableModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.FINAL ->
+ handleTerminal(JavaToken.FINAL, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseexceptionTypeList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, exceptionType, state.nonterminalEdges[exceptionType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parseexceptionType(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeVariable, state.nonterminalEdges[typeVariable]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, classType, state.nonterminalEdges[classType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseblock(descriptor: Descriptor, curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, blockStatements,
+ state.nonterminalEdges[blockStatements]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parseconstructorModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.PUBLIC ->
+ handleTerminal(JavaToken.PUBLIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PROTECTED ->
+ handleTerminal(JavaToken.PROTECTED, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PRIVATE ->
+ handleTerminal(JavaToken.PRIVATE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseconstructorDeclarator(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, simpleTypeName, state.nonterminalEdges[simpleTypeName]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, typeParameters, state.nonterminalEdges[typeParameters]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, simpleTypeName, state.nonterminalEdges[simpleTypeName]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LPAREN ->
+ handleTerminal(JavaToken.LPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, formalParameterList,
+ state.nonterminalEdges[formalParameterList]!!, curSppfNode)
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 5 ->
+ {
+ }
+ }
+ }
+
+ private fun parseconstructorBody(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, blockStatements,
+ state.nonterminalEdges[blockStatements]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, explicitConstructorInvocation,
+ state.nonterminalEdges[explicitConstructorInvocation]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, blockStatements,
+ state.nonterminalEdges[blockStatements]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parsesimpleTypeName(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseexplicitConstructorInvocation(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.THIS ->
+ handleTerminal(JavaToken.THIS, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.SUPER ->
+ handleTerminal(JavaToken.SUPER, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeArguments, state.nonterminalEdges[typeArguments]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, expressionName, state.nonterminalEdges[expressionName]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, primary, state.nonterminalEdges[primary]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.THIS ->
+ handleTerminal(JavaToken.THIS, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.SUPER ->
+ handleTerminal(JavaToken.SUPER, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LPAREN ->
+ handleTerminal(JavaToken.LPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DOT ->
+ handleTerminal(JavaToken.DOT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SUPER ->
+ handleTerminal(JavaToken.SUPER, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeArguments, state.nonterminalEdges[typeArguments]!!,
+ curSppfNode)
+ }
+ 5 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SUPER ->
+ handleTerminal(JavaToken.SUPER, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 6 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, argumentList, state.nonterminalEdges[argumentList]!!,
+ curSppfNode)
+ }
+ 7 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 8 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 9 ->
+ {
+ }
+ }
+ }
+
+ private fun parseenumBody(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, enumConstantList,
+ state.nonterminalEdges[enumConstantList]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, enumBodyDeclarations,
+ state.nonterminalEdges[enumBodyDeclarations]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, enumBodyDeclarations,
+ state.nonterminalEdges[enumBodyDeclarations]!!, curSppfNode)
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, enumBodyDeclarations,
+ state.nonterminalEdges[enumBodyDeclarations]!!, curSppfNode)
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 5 ->
+ {
+ }
+ }
+ }
+
+ private fun parseenumConstantList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, enumConstant, state.nonterminalEdges[enumConstant]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parseenumConstant(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, enumConstantModifier,
+ state.nonterminalEdges[enumConstantModifier]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LPAREN ->
+ handleTerminal(JavaToken.LPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, argumentList, state.nonterminalEdges[argumentList]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classBody, state.nonterminalEdges[classBody]!!,
+ curSppfNode)
+ }
+ 5 ->
+ {
+ }
+ }
+ }
+
+ private fun parseenumConstantModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseenumBodyDeclarations(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, classBodyDeclaration,
+ state.nonterminalEdges[classBodyDeclaration]!!, curSppfNode)
+ }
+ }
+ }
+
+ private fun parseblockStatements(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, blockStatement, state.nonterminalEdges[blockStatement]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, blockStatement, state.nonterminalEdges[blockStatement]!!,
+ curSppfNode)
+ }
+ }
+ }
+
+ private fun parseargumentList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, expression, state.nonterminalEdges[expression]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parseprimary(descriptor: Descriptor, curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, primaryNoNewArray,
+ state.nonterminalEdges[primaryNoNewArray]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, arrayCreationExpression,
+ state.nonterminalEdges[arrayCreationExpression]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parsenormalInterfaceDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.INTERFACE ->
+ handleTerminal(JavaToken.INTERFACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceModifier,
+ state.nonterminalEdges[interfaceModifier]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceBody, state.nonterminalEdges[interfaceBody]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, extendsInterfaces,
+ state.nonterminalEdges[extendsInterfaces]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, typeParameters, state.nonterminalEdges[typeParameters]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceBody, state.nonterminalEdges[interfaceBody]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, extendsInterfaces,
+ state.nonterminalEdges[extendsInterfaces]!!, curSppfNode)
+ }
+ 4 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceBody, state.nonterminalEdges[interfaceBody]!!,
+ curSppfNode)
+ }
+ 5 ->
+ {
+ }
+ }
+ }
+
+ private fun parseinterfaceModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PUBLIC ->
+ handleTerminal(JavaToken.PUBLIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.ABSTRACT ->
+ handleTerminal(JavaToken.ABSTRACT, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.STRICTFP ->
+ handleTerminal(JavaToken.STRICTFP, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PROTECTED ->
+ handleTerminal(JavaToken.PROTECTED, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PRIVATE ->
+ handleTerminal(JavaToken.PRIVATE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseextendsInterfaces(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.EXTENDS ->
+ handleTerminal(JavaToken.EXTENDS, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceTypeList,
+ state.nonterminalEdges[interfaceTypeList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parseinterfaceBody(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceMemberDeclaration,
+ state.nonterminalEdges[interfaceMemberDeclaration]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parseinterfaceMemberDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceDeclaration,
+ state.nonterminalEdges[interfaceDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, constantDeclaration,
+ state.nonterminalEdges[constantDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, interfaceMethodDeclaration,
+ state.nonterminalEdges[interfaceMethodDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, classDeclaration,
+ state.nonterminalEdges[classDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseconstantDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, constantModifier,
+ state.nonterminalEdges[constantModifier]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, variableDeclaratorList,
+ state.nonterminalEdges[variableDeclaratorList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parseconstantModifier(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.STATIC ->
+ handleTerminal(JavaToken.STATIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.PUBLIC ->
+ handleTerminal(JavaToken.PUBLIC, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.FINAL ->
+ handleTerminal(JavaToken.FINAL, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseannotationTypeDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.AT ->
+ handleTerminal(JavaToken.AT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceModifier,
+ state.nonterminalEdges[interfaceModifier]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.INTERFACE ->
+ handleTerminal(JavaToken.INTERFACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotationTypeBody,
+ state.nonterminalEdges[annotationTypeBody]!!, curSppfNode)
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parseannotationTypeBody(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotationTypeMemberDeclaration,
+ state.nonterminalEdges[annotationTypeMemberDeclaration]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parseannotationTypeMemberDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, interfaceDeclaration,
+ state.nonterminalEdges[interfaceDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, annotationTypeElementDeclaration,
+ state.nonterminalEdges[annotationTypeElementDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, constantDeclaration,
+ state.nonterminalEdges[constantDeclaration]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, classDeclaration,
+ state.nonterminalEdges[classDeclaration]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseannotationTypeElementDeclaration(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotationTypeElementModifier,
+ state.nonterminalEdges[annotationTypeElementModifier]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, unannType, state.nonterminalEdges[unannType]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LPAREN ->
+ handleTerminal(JavaToken.LPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, dims, state.nonterminalEdges[dims]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, defaultValue, state.nonterminalEdges[defaultValue]!!,
+ curSppfNode)
+ }
+ 5 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, defaultValue, state.nonterminalEdges[defaultValue]!!,
+ curSppfNode)
+ }
+ 6 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.SEMICOLON ->
+ handleTerminal(JavaToken.SEMICOLON, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 7 ->
+ {
+ }
+ }
+ }
+
+ private fun parsedefaultValue(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.DEFAULT ->
+ handleTerminal(JavaToken.DEFAULT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, elementValue, state.nonterminalEdges[elementValue]!!,
+ curSppfNode)
+ }
+ 2 ->
+ {
+ }
+ }
+ }
+
+ private fun parsenormalAnnotation(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.AT ->
+ handleTerminal(JavaToken.AT, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, typeName, state.nonterminalEdges[typeName]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LPAREN ->
+ handleTerminal(JavaToken.LPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, elementValuePairList,
+ state.nonterminalEdges[elementValuePairList]!!, curSppfNode)
+ }
+ 4 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RPAREN ->
+ handleTerminal(JavaToken.RPAREN, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 5 ->
+ {
+ }
+ }
+ }
+
+ private fun parseelementValuePairList(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, elementValuePair,
+ state.nonterminalEdges[elementValuePair]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ }
+ }
+
+ private fun parseelementValuePair(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, identifier, state.nonterminalEdges[identifier]!!,
+ curSppfNode)
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.EQ ->
+ handleTerminal(JavaToken.EQ, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 2 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, elementValue, state.nonterminalEdges[elementValue]!!,
+ curSppfNode)
+ }
+ 3 ->
+ {
+ }
+ }
+ }
+
+ private fun parseelementValue(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ when(state.numId) {
+ 0 ->
+ {
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, annotation, state.nonterminalEdges[annotation]!!,
+ curSppfNode)
+ handleNonterminalEdge(descriptor, elementValueArrayInitializer,
+ state.nonterminalEdges[elementValueArrayInitializer]!!, curSppfNode)
+ handleNonterminalEdge(descriptor, conditionalExpression,
+ state.nonterminalEdges[conditionalExpression]!!, curSppfNode)
+ }
+ 1 ->
+ {
+ }
+ }
+ }
+
+ private fun parseelementValueArrayInitializer(descriptor: Descriptor,
+ curSppfNode: SppfNode?) {
+ val state = descriptor.rsmState
+ val pos = descriptor.inputPosition
+ when(state.numId) {
+ 0 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.LBRACE ->
+ handleTerminal(JavaToken.LBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 1 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ // handle nonterminal edges
+ handleNonterminalEdge(descriptor, elementValueList,
+ state.nonterminalEdges[elementValueList]!!, curSppfNode)
+ }
+ 2 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.COMMA ->
+ handleTerminal(JavaToken.COMMA, state, inputEdge, descriptor, curSppfNode)
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 3 ->
+ {
+ // handle terminal edges
+ for (inputEdge in ctx.input.getEdges(pos)) {
+ when(inputEdge.label.terminal) {
+ JavaToken.RBRACE ->
+ handleTerminal(JavaToken.RBRACE, state, inputEdge, descriptor, curSppfNode)
+ else -> {}
+ }
+ }
+ }
+ 4 ->
+ {
+ }
+ }
+ }
+
+ private fun parseelementValueList(descriptor: Descriptor,
+ curSppfNode: SppfNode