diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dbab00d258c59d292362448046d8951377e8eeb0..a309194642e7c5d24a1d7ced2cd30f9532c3ce82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,10 @@ tests:jdk-17: extends: tests image: eclipse-temurin:17 +tests:jdk-21: + extends: tests + image: eclipse-temurin:21 + publish: stage: deploy script: diff --git a/build.gradle b/build.gradle index 8a0996581182a1bac810646d36af127a1a12638a..059f2c1239eaae07b683c7a6b79b4652287cb3da 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'signing' allprojects { project.group = 'de.hhu.stups' - project.version = '3.6.0' + project.version = '3.7.0' project.ext.isSnapshot = project.version.endsWith("-SNAPSHOT") ext."signing.secretKeyRingFile" = rootProject.file("secring.gpg").absolutePath @@ -21,8 +21,8 @@ dependencies { } java { - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 withSourcesJar() withJavadocJar() diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d3e0ab67b14947c167a862655af9b..d64cd4917707c1f8861d8cb53dd15194d4248596 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d3f0c9fffa920a8290320a6c78095e1591..a80b22ce5cffec8b48ee79b11c67945e91f99d5f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cbb43e3931a2455a838345c3f6b8131aaa2..1aa94a4269074199e6ed2c37e8db3e0826030965 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,10 +131,13 @@ 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. + if ! command -v java >/dev/null 2>&1 + then + 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 fi # Increase the maximum file descriptors if we can. @@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,11 +202,11 @@ fi # 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"' -# 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. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85beecde676054c39c2408085f41e6be6dc..7101f8e4676fcad8adc961e929ea3bcb37b5262f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 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. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ 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. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/sablecc-runtime/build.gradle b/sablecc-runtime/build.gradle index 9fb2145f1fd89f80b1a0c1299dfaf5b4843e3a06..04aef5c5b058f2adec7fc1c8b3f13a0736ee9e05 100644 --- a/sablecc-runtime/build.gradle +++ b/sablecc-runtime/build.gradle @@ -5,7 +5,7 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 withSourcesJar() withJavadocJar() } diff --git a/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java b/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java index b7a36e5b1ae96b070f1199be34f8c968dc37eacd..a061b73b7e4dacc4bff771f23ebc8db88c677fc2 100644 --- a/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java +++ b/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java @@ -84,7 +84,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter } else if("Lnull".equals(typeName)) { - return "Collections.EMPTY_LIST"; // Once we require Java 8, this can be replaced with Collections.emptyList() + return "Collections.emptyList()"; } else if(typeName.startsWith("L")) { diff --git a/src/main/java/org/sablecc/sablecc/In_Production.java b/src/main/java/org/sablecc/sablecc/In_Production.java index 63b00d5c871eae6549dcbd92657b19f690b18355..433161b78662b7168cb8ebb451bb4bfcc3118c30 100644 --- a/src/main/java/org/sablecc/sablecc/In_Production.java +++ b/src/main/java/org/sablecc/sablecc/In_Production.java @@ -23,7 +23,7 @@ public class In_Production public In_Production(AProd prod) { - setName(prod.getId().getText()); + this.name = prod.getId().getText(); AElem[] prodTransforms = prod.getProdTransform().toArray(new AElem[0]); prodTransformElems = new String[prodTransforms.length]; @@ -57,11 +57,6 @@ public class In_Production nbAlts = alts.length; } - public void setName(String name) - { - this.name = name; - } - public String getName() { return name; @@ -72,7 +67,7 @@ public class In_Production return nbAlts; } - public void addAlternative(int position, In_Alternative alt) + private void addAlternative(int position, In_Alternative alt) { alternatives[position] = alt; } diff --git a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java index bb0f9ff3e44008698a0869b4692cdce1b6698dbd..43c6fda5dfab8fdd431b3ac2a5e0675e8e774f16 100644 --- a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java +++ b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java @@ -7,14 +7,9 @@ import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; import java.io.PushbackReader; -import java.util.LinkedList; -import java.util.Queue; - -import de.hhu.stups.sablecc.patch.IToken; import org.sablecc.sablecc.node.*; -@SuppressWarnings("unused") public class Lexer { protected Token token; @@ -27,77 +22,51 @@ public class Lexer private boolean eof; private final StringBuilder text = new StringBuilder(); - @Deprecated - private final Queue<IToken> nextList = new LinkedList<IToken>(); - - /** - * @deprecated Use {@link #token} to get, modify, replace, and/or delete the current token. - * Injecting new tokens into the token stream will not be supported in the future. - */ - @Deprecated - public Queue<IToken> getNextList() { - return nextList; - } - protected void filter() throws LexerException, IOException {} - /** - * @deprecated Override {@link #filter()} instead. - */ - @Deprecated - protected void filterWrap() throws LexerException, IOException - { - filter(); - if (token != null) { - nextList.add(token); - } - } - - public Lexer(PushbackReader in) { this.in = in; } - @SuppressWarnings("deprecation") // because of filterWrap and nextList public Token peek() throws LexerException, IOException { while(this.token == null) { token = getToken(); - filterWrap(); + filter(); } - return (Token) nextList.peek(); + return token; } - @SuppressWarnings("deprecation") // because of filterWrap and nextList public Token next() throws LexerException, IOException { while(this.token == null) { token = getToken(); - filterWrap(); + filter(); } - Token result = (Token) nextList.poll(); + Token result = token; token = null; return result; } protected Token getToken() throws IOException, LexerException { - int dfa_state = 0; + int dfaState = 0; - int start_pos = this.pos; - int start_line = this.line; + int startPos = this.pos; + int startLine = this.line; - int accept_state = -1; - int accept_token = -1; - int accept_length = -1; - int accept_pos = -1; - int accept_line = -1; + int acceptState = -1; + int acceptToken = -1; + int acceptLength = -1; + int acceptPos = -1; + int acceptLine = -1; + boolean acceptCr = false; int[][][] gotoTable = Lexer.gotoTable[this.state.ordinal()]; int[] accept = Lexer.accept[this.state.ordinal()]; @@ -111,24 +80,38 @@ public class Lexer { switch(c) { - case 10: + case '\n': if(this.cr) { + // If the preceding character was \r (CR), + // ignore this \n (LF) character and don't increase the line or column. this.cr = false; } else { + // If there was no preceding \r (CR) character, + // consider this \n (LF) character an actual newline. this.line++; this.pos = 0; } break; - case 13: - case 8232: // Unicode line separator - case 8233: // Unicode paragraph separator + case '\r': + // A \r (CR) character is always considered a newline, + // but a \n (LF) character following it (if any) will be ignored (see above). this.line++; this.pos = 0; this.cr = true; break; + case 0x2028: // Unicode line separator + case 0x2029: // Unicode paragraph separator + // A Unicode line or paragraph separator is treated like a newline, + // but doesn't take part in the special handling for CR+LF. + // FIXME This case is a workaround for a limitation in the ProB cliparser prepl protocol, which doesn't support embedded newlines. + // TODO Remove this case once that is resolved. Practically nothing else uses the Unicode line separator character. + this.line++; + this.pos = 0; + this.cr = false; + break; default: this.pos++; this.cr = false; @@ -139,9 +122,9 @@ public class Lexer do { - int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state; + int oldState = (dfaState < -1) ? (-2 -dfaState) : dfaState; - dfa_state = -1; + dfaState = -1; int[][] tmp1 = gotoTable[oldState]; int low = 0; @@ -164,43 +147,42 @@ public class Lexer } else { - dfa_state = tmp2[2]; + dfaState = tmp2[2]; break; } } - } while(dfa_state < -1); + } while(dfaState < -1); } else { - dfa_state = -1; + dfaState = -1; } - if(dfa_state >= 0) + if(dfaState >= 0) { - if(accept[dfa_state] != -1) + if(accept[dfaState] != -1) { - accept_state = dfa_state; - accept_token = accept[dfa_state]; - accept_length = this.text.length(); - accept_pos = this.pos; - accept_line = this.line; + acceptState = dfaState; + acceptToken = accept[dfaState]; + acceptLength = this.text.length(); + acceptPos = this.pos; + acceptLine = this.line; + acceptCr = this.cr; } } else { - if(accept_state != -1) + if(acceptState != -1) { - switch(accept_token) + switch(acceptToken) { case 0: { - Token token = new TPkgId( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TPkgId(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; switch(state.ordinal()) { case 1: state = State.PACKAGE; break; @@ -209,12 +191,11 @@ public class Lexer } case 1: { - Token token = new TPackage( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TPackage(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; switch(state.ordinal()) { case 0: state = State.PACKAGE; break; @@ -223,152 +204,137 @@ public class Lexer } case 2: { - Token token = new TStates( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TStates(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 3: { - Token token = new THelpers( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new THelpers(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 4: { - Token token = new TTokens( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TTokens(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 5: { - Token token = new TIgnored( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TIgnored(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 6: { - Token token = new TProductions( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TProductions(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 7: { - Token token = new TAbstract( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TAbstract(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 8: { - Token token = new TSyntax( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TSyntax(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 9: { - Token token = new TTree( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TTree(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 10: { - Token token = new TNew( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TNew(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 11: { - Token token = new TNull( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TNull(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 12: { - Token token = new TTokenSpecifier( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TTokenSpecifier(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 13: { - Token token = new TProductionSpecifier( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TProductionSpecifier(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 14: { - Token token = new TDot( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TDot(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 15: { - Token token = new TDDot( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TDDot(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 16: { - Token token = new TSemicolon( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TSemicolon(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; switch(state.ordinal()) { case 0: state = State.NORMAL; break; @@ -378,239 +344,209 @@ public class Lexer } case 17: { - Token token = new TEqual( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TEqual(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 18: { - Token token = new TLBkt( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TLBkt(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 19: { - Token token = new TRBkt( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TRBkt(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 20: { - Token token = new TLPar( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TLPar(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 21: { - Token token = new TRPar( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TRPar(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 22: { - Token token = new TLBrace( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TLBrace(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 23: { - Token token = new TRBrace( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TRBrace(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 24: { - Token token = new TPlus( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TPlus(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 25: { - Token token = new TMinus( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TMinus(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 26: { - Token token = new TQMark( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TQMark(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 27: { - Token token = new TStar( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TStar(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 28: { - Token token = new TBar( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TBar(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 29: { - Token token = new TComma( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TComma(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 30: { - Token token = new TSlash( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TSlash(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 31: { - Token token = new TArrow( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TArrow(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 32: { - Token token = new TColon( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TColon(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 33: { - Token token = new TId( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TId(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 34: { - Token token = new TChar( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TChar(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 35: { - Token token = new TDecChar( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TDecChar(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 36: { - Token token = new THexChar( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new THexChar(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 37: { - Token token = new TString( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TString(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 38: { - Token token = new TBlank( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TBlank(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } case 39: { - Token token = new TComment( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new TComment(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; return token; } } @@ -619,14 +555,10 @@ public class Lexer { if(this.text.length() > 0) { - throw new LexerException( - "[" + (start_line + 1) + "," + (start_pos + 1) + "]" + - " Unknown token: " + this.text); + throw new LexerException("[" + (startLine + 1) + "," + (startPos + 1) + "] Unknown token: " + this.text); } - EOF token = new EOF( - start_line + 1, - start_pos + 1); + EOF token = new EOF(startLine + 1, startPos + 1); return token; } } @@ -661,6 +593,12 @@ public class Lexer } } + /** + * @deprecated This method doesn't restore line/column info correctly in some cases + * (if a token begins in the middle of a CRLF newline pair). + * There is no planned replacement. + */ + @Deprecated protected void unread(Token token) throws IOException { String text = token.getText(); diff --git a/src/main/java/org/sablecc/sablecc/parser/Parser.java b/src/main/java/org/sablecc/sablecc/parser/Parser.java index 626967b1bd1e1c6a2cb310dc99b65ebb162a1b96..85092dbeb734e2c16f8a831dccf3e6ca2bea0ff2 100644 --- a/src/main/java/org/sablecc/sablecc/parser/Parser.java +++ b/src/main/java/org/sablecc/sablecc/parser/Parser.java @@ -1854,7 +1854,7 @@ public class Parser implements IParser private List<?> new0() /* reduce AAgrammar1Grammar */ { - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, null, null, null); return Collections.singletonList(pgrammarNode1); } @@ -1874,7 +1874,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, null, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(pgrammarNode1); @@ -1897,7 +1897,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, null, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(pgrammarNode1); @@ -1922,7 +1922,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, null, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -1947,7 +1947,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); PTokens ptokensNode5 = (PTokens)nodeArrayList1.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, null, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(pgrammarNode1); @@ -1972,7 +1972,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, null, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -1999,7 +1999,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, null, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2028,7 +2028,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, null, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, null, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2055,7 +2055,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(pgrammarNode1); @@ -2080,7 +2080,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2107,7 +2107,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2136,7 +2136,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2165,7 +2165,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PTokens ptokensNode5 = (PTokens)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2194,7 +2194,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2225,7 +2225,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2258,7 +2258,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList3.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -2287,7 +2287,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); PProductions pproductionsNode7 = (PProductions)nodeArrayList1.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(pgrammarNode1); @@ -2312,7 +2312,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2339,7 +2339,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2368,7 +2368,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2397,7 +2397,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PTokens ptokensNode5 = (PTokens)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2426,7 +2426,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2457,7 +2457,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2490,7 +2490,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -2521,7 +2521,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2550,7 +2550,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2581,7 +2581,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2614,7 +2614,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -2647,7 +2647,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2680,7 +2680,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -2715,7 +2715,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -2752,7 +2752,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList3.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList5.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList5); return Collections.singletonList(pgrammarNode1); @@ -2783,7 +2783,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); PAst pastNode8 = (PAst)nodeArrayList1.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(pgrammarNode1); @@ -2808,7 +2808,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PAst pastNode8 = (PAst)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2835,7 +2835,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PAst pastNode8 = (PAst)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2864,7 +2864,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2893,7 +2893,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PTokens ptokensNode5 = (PTokens)nodeArrayList1.get(0); PAst pastNode8 = (PAst)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -2922,7 +2922,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2953,7 +2953,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -2986,7 +2986,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PTokens ptokensNode5 = (PTokens)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, null, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, null, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3017,7 +3017,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); PAst pastNode8 = (PAst)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -3046,7 +3046,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -3077,7 +3077,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -3110,7 +3110,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3143,7 +3143,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList1.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -3176,7 +3176,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3211,7 +3211,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3248,7 +3248,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList3.get(0); PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); PAst pastNode8 = (PAst)nodeArrayList5.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList5); return Collections.singletonList(pgrammarNode1); @@ -3281,7 +3281,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PProductions pproductionsNode7 = (PProductions)nodeArrayList1.get(0); PAst pastNode8 = (PAst)nodeArrayList2.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(pgrammarNode1); @@ -3310,7 +3310,7 @@ public class Parser implements IParser PHelpers phelpersNode3 = (PHelpers)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -3341,7 +3341,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -3374,7 +3374,7 @@ public class Parser implements IParser PStates pstatesNode4 = (PStates)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3407,7 +3407,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -3440,7 +3440,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3475,7 +3475,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3512,7 +3512,7 @@ public class Parser implements IParser PTokens ptokensNode5 = (PTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); PAst pastNode8 = (PAst)nodeArrayList5.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList5); return Collections.singletonList(pgrammarNode1); @@ -3547,7 +3547,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList2.get(0); PAst pastNode8 = (PAst)nodeArrayList3.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, null, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, null, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pgrammarNode1); @@ -3580,7 +3580,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3615,7 +3615,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3652,7 +3652,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); PAst pastNode8 = (PAst)nodeArrayList5.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList5); return Collections.singletonList(pgrammarNode1); @@ -3689,7 +3689,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList3.get(0); PAst pastNode8 = (PAst)nodeArrayList4.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pgrammarNode1); @@ -3726,7 +3726,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); PAst pastNode8 = (PAst)nodeArrayList5.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList5); return Collections.singletonList(pgrammarNode1); @@ -3765,7 +3765,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList4.get(0); PAst pastNode8 = (PAst)nodeArrayList5.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList5); return Collections.singletonList(pgrammarNode1); @@ -3806,7 +3806,7 @@ public class Parser implements IParser PIgnTokens pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); PProductions pproductionsNode7 = (PProductions)nodeArrayList5.get(0); PAst pastNode8 = (PAst)nodeArrayList6.get(0); - AGrammar pgrammarNode1 = new AGrammar(Collections.EMPTY_LIST, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + AGrammar pgrammarNode1 = new AGrammar(Collections.emptyList(), phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); checkResult(pgrammarNode1, nodeArrayList1, nodeArrayList6); return Collections.singletonList(pgrammarNode1); @@ -4056,7 +4056,7 @@ public class Parser implements IParser List<?> nodeArrayList2 = pop(); List<?> nodeArrayList1 = pop(); TId tidNode2 = (TId)nodeArrayList2.get(0); - AStateList pstatelistNode1 = new AStateList(tidNode2, null, Collections.EMPTY_LIST); + AStateList pstatelistNode1 = new AStateList(tidNode2, null, Collections.emptyList()); checkResult(pstatelistNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pstatelistNode1); @@ -4070,7 +4070,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); TId tidNode2 = (TId)nodeArrayList2.get(0); PTransition ptransitionNode3 = (PTransition)nodeArrayList3.get(0); - AStateList pstatelistNode1 = new AStateList(tidNode2, ptransitionNode3, Collections.EMPTY_LIST); + AStateList pstatelistNode1 = new AStateList(tidNode2, ptransitionNode3, Collections.emptyList()); checkResult(pstatelistNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pstatelistNode1); @@ -4148,7 +4148,7 @@ public class Parser implements IParser List<?> nodeArrayList3 = pop(); List<?> nodeArrayList2 = pop(); List<?> nodeArrayList1 = pop(); - AIgnTokens pigntokensNode1 = new AIgnTokens(Collections.EMPTY_LIST); + AIgnTokens pigntokensNode1 = new AIgnTokens(Collections.emptyList()); checkResult(pigntokensNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(pigntokensNode1); @@ -4230,7 +4230,7 @@ public class Parser implements IParser private List<?> new156() /* reduce AAconcat1Concat */ { - AConcat pconcatNode1 = new AConcat(Collections.EMPTY_LIST); + AConcat pconcatNode1 = new AConcat(Collections.emptyList()); return Collections.singletonList(pconcatNode1); } @@ -4450,7 +4450,7 @@ public class Parser implements IParser TId tidNode2 = (TId)nodeArrayList1.get(0); List<PAlt> listNode5 = (List<PAlt>)nodeArrayList3.get(0); List<PAlt> listNode6 = listNode5; - AProd pprodNode1 = new AProd(tidNode2, null, Collections.EMPTY_LIST, listNode6); + AProd pprodNode1 = new AProd(tidNode2, null, Collections.emptyList(), listNode6); checkResult(pprodNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(pprodNode1); @@ -4484,7 +4484,7 @@ public class Parser implements IParser checkResult(tarrowNode1, nodeArrayList1, nodeArrayList3); return Arrays.asList(new Object[] { tarrowNode1, - Collections.EMPTY_LIST, + Collections.emptyList(), }); } @@ -4549,7 +4549,7 @@ public class Parser implements IParser private List<?> new183() /* reduce AAalt1Alt */ { - AAlt paltNode1 = new AAlt(null, Collections.EMPTY_LIST, null); + AAlt paltNode1 = new AAlt(null, Collections.emptyList(), null); return Collections.singletonList(paltNode1); } @@ -4558,7 +4558,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); TId tidNode2 = (TId)nodeArrayList1.get(0); - AAlt paltNode1 = new AAlt(tidNode2, Collections.EMPTY_LIST, null); + AAlt paltNode1 = new AAlt(tidNode2, Collections.emptyList(), null); checkResult(paltNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(paltNode1); @@ -4592,7 +4592,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); PAltTransform palttransformNode4 = (PAltTransform)nodeArrayList1.get(0); - AAlt paltNode1 = new AAlt(null, Collections.EMPTY_LIST, palttransformNode4); + AAlt paltNode1 = new AAlt(null, Collections.emptyList(), palttransformNode4); checkResult(paltNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(paltNode1); @@ -4604,7 +4604,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); TId tidNode2 = (TId)nodeArrayList1.get(0); PAltTransform palttransformNode4 = (PAltTransform)nodeArrayList2.get(0); - AAlt paltNode1 = new AAlt(tidNode2, Collections.EMPTY_LIST, palttransformNode4); + AAlt paltNode1 = new AAlt(tidNode2, Collections.emptyList(), palttransformNode4); checkResult(paltNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(paltNode1); @@ -4645,7 +4645,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); TLBrace tlbraceNode2 = (TLBrace)nodeArrayList1.get(0); TRBrace trbraceNode4 = (TRBrace)nodeArrayList3.get(0); - AAltTransform palttransformNode1 = new AAltTransform(tlbraceNode2, Collections.EMPTY_LIST, trbraceNode4); + AAltTransform palttransformNode1 = new AAltTransform(tlbraceNode2, Collections.emptyList(), trbraceNode4); checkResult(palttransformNode1, nodeArrayList1, nodeArrayList3); return Collections.singletonList(palttransformNode1); @@ -4675,7 +4675,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PProdName pprodnameNode2 = (PProdName)nodeArrayList2.get(0); TLPar tlparNode3 = (TLPar)nodeArrayList3.get(0); - ANewTerm ptermNode1 = new ANewTerm(pprodnameNode2, tlparNode3, Collections.EMPTY_LIST); + ANewTerm ptermNode1 = new ANewTerm(pprodnameNode2, tlparNode3, Collections.emptyList()); checkResult(ptermNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(ptermNode1); @@ -4703,7 +4703,7 @@ public class Parser implements IParser List<?> nodeArrayList2 = pop(); List<?> nodeArrayList1 = pop(); TLBkt tlbktNode2 = (TLBkt)nodeArrayList1.get(0); - AListTerm ptermNode1 = new AListTerm(tlbktNode2, Collections.EMPTY_LIST); + AListTerm ptermNode1 = new AListTerm(tlbktNode2, Collections.emptyList()); checkResult(ptermNode1, nodeArrayList1, nodeArrayList2); return Collections.singletonList(ptermNode1); @@ -4822,7 +4822,7 @@ public class Parser implements IParser List<?> nodeArrayList1 = pop(); PProdName pprodnameNode2 = (PProdName)nodeArrayList2.get(0); TLPar tlparNode3 = (TLPar)nodeArrayList3.get(0); - ANewListTerm plisttermNode1 = new ANewListTerm(pprodnameNode2, tlparNode3, Collections.EMPTY_LIST); + ANewListTerm plisttermNode1 = new ANewListTerm(pprodnameNode2, tlparNode3, Collections.emptyList()); checkResult(plisttermNode1, nodeArrayList1, nodeArrayList4); return Collections.singletonList(plisttermNode1); @@ -5204,7 +5204,7 @@ public class Parser implements IParser private List<?> new235() /* reduce AAastalt1AstAlt */ { - AAstAlt pastaltNode1 = new AAstAlt(null, Collections.EMPTY_LIST); + AAstAlt pastaltNode1 = new AAstAlt(null, Collections.emptyList()); return Collections.singletonList(pastaltNode1); } @@ -5213,7 +5213,7 @@ public class Parser implements IParser { List<?> nodeArrayList1 = pop(); TId tidNode2 = (TId)nodeArrayList1.get(0); - AAstAlt pastaltNode1 = new AAstAlt(tidNode2, Collections.EMPTY_LIST); + AAstAlt pastaltNode1 = new AAstAlt(tidNode2, Collections.emptyList()); checkResult(pastaltNode1, nodeArrayList1, nodeArrayList1); return Collections.singletonList(pastaltNode1); diff --git a/src/main/resources/org/sablecc/sablecc/lexer.txt b/src/main/resources/org/sablecc/sablecc/lexer.txt index d441b05d32d84180ba5591471048cbeadb56dd5e..5960c9fcf0df41994e2db59ba37548956b7390e0 100644 --- a/src/main/resources/org/sablecc/sablecc/lexer.txt +++ b/src/main/resources/org/sablecc/sablecc/lexer.txt @@ -31,14 +31,9 @@ import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; import java.io.PushbackReader; -import java.util.LinkedList; -import java.util.Queue; - -import de.hhu.stups.sablecc.patch.IToken; import $0$node.*; -@SuppressWarnings("unused") public class Lexer { protected Token token; @@ -51,77 +46,51 @@ public class Lexer private boolean eof; private final StringBuilder text = new StringBuilder(); - @Deprecated - private final Queue<IToken> nextList = new LinkedList<IToken>(); - - /** - * @deprecated Use {@link #token} to get, modify, replace, and/or delete the current token. - * Injecting new tokens into the token stream will not be supported in the future. - */ - @Deprecated - public Queue<IToken> getNextList() { - return nextList; - } - protected void filter() throws LexerException, IOException {} - /** - * @deprecated Override {@link #filter()} instead. - */ - @Deprecated - protected void filterWrap() throws LexerException, IOException - { - filter(); - if (token != null) { - nextList.add(token); - } - } - - public Lexer(PushbackReader in) { this.in = in; } - @SuppressWarnings("deprecation") // because of filterWrap and nextList public Token peek() throws LexerException, IOException { while(this.token == null) { token = getToken(); - filterWrap(); + filter(); } - return (Token) nextList.peek(); + return token; } - @SuppressWarnings("deprecation") // because of filterWrap and nextList public Token next() throws LexerException, IOException { while(this.token == null) { token = getToken(); - filterWrap(); + filter(); } - Token result = (Token) nextList.poll(); + Token result = token; token = null; return result; } protected Token getToken() throws IOException, LexerException { - int dfa_state = 0; + int dfaState = 0; - int start_pos = this.pos; - int start_line = this.line; + int startPos = this.pos; + int startLine = this.line; - int accept_state = -1; - int accept_token = -1; - int accept_length = -1; - int accept_pos = -1; - int accept_line = -1; + int acceptState = -1; + int acceptToken = -1; + int acceptLength = -1; + int acceptPos = -1; + int acceptLine = -1; + boolean acceptCr = false; int[][][] gotoTable = Lexer.gotoTable[this.state.ordinal()]; int[] accept = Lexer.accept[this.state.ordinal()]; @@ -135,24 +104,38 @@ public class Lexer { switch(c) { - case 10: + case '\n': if(this.cr) { + // If the preceding character was \r (CR), + // ignore this \n (LF) character and don't increase the line or column. this.cr = false; } else { + // If there was no preceding \r (CR) character, + // consider this \n (LF) character an actual newline. this.line++; this.pos = 0; } break; - case 13: - case 8232: // Unicode line separator - case 8233: // Unicode paragraph separator + case '\r': + // A \r (CR) character is always considered a newline, + // but a \n (LF) character following it (if any) will be ignored (see above). this.line++; this.pos = 0; this.cr = true; break; + case 0x2028: // Unicode line separator + case 0x2029: // Unicode paragraph separator + // A Unicode line or paragraph separator is treated like a newline, + // but doesn't take part in the special handling for CR+LF. + // FIXME This case is a workaround for a limitation in the ProB cliparser prepl protocol, which doesn't support embedded newlines. + // TODO Remove this case once that is resolved. Practically nothing else uses the Unicode line separator character. + this.line++; + this.pos = 0; + this.cr = false; + break; default: this.pos++; this.cr = false; @@ -163,9 +146,9 @@ public class Lexer do { - int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state; + int oldState = (dfaState < -1) ? (-2 -dfaState) : dfaState; - dfa_state = -1; + dfaState = -1; int[][] tmp1 = gotoTable[oldState]; int low = 0; @@ -188,33 +171,34 @@ public class Lexer } else { - dfa_state = tmp2[2]; + dfaState = tmp2[2]; break; } } - } while(dfa_state < -1); + } while(dfaState < -1); } else { - dfa_state = -1; + dfaState = -1; } - if(dfa_state >= 0) + if(dfaState >= 0) { - if(accept[dfa_state] != -1) + if(accept[dfaState] != -1) { - accept_state = dfa_state; - accept_token = accept[dfa_state]; - accept_length = this.text.length(); - accept_pos = this.pos; - accept_line = this.line; + acceptState = dfaState; + acceptToken = accept[dfaState]; + acceptLength = this.text.length(); + acceptPos = this.pos; + acceptLine = this.line; + acceptCr = this.cr; } } else { - if(accept_state != -1) + if(acceptState != -1) { - switch(accept_token) + switch(acceptToken) { $ @@ -222,25 +206,22 @@ $ Macro:LexerVariableToken case $0$: { - Token token = new $1$( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new $1$(getText(acceptLength), startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; $ Macro:LexerFixedToken case $0$: { - Token token = new $1$( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - this.pos = accept_pos; - this.line = accept_line; + Token token = new $1$(startLine + 1, startPos + 1); + pushBack(acceptLength); + this.pos = acceptPos; + this.line = acceptLine; + this.cr = acceptCr; $ @@ -273,14 +254,10 @@ Macro:LexerBody { if(this.text.length() > 0) { - throw new LexerException( - "[" + (start_line + 1) + "," + (start_pos + 1) + "]" + - " Unknown token: " + this.text); + throw new LexerException("[" + (startLine + 1) + "," + (startPos + 1) + "] Unknown token: " + this.text); } - EOF token = new EOF( - start_line + 1, - start_pos + 1); + EOF token = new EOF(startLine + 1, startPos + 1); return token; } } @@ -315,6 +292,12 @@ Macro:LexerBody } } + /** + * @deprecated This method doesn't restore line/column info correctly in some cases + * (if a token begins in the middle of a CRLF newline pair). + * There is no planned replacement. + */ + @Deprecated protected void unread(Token token) throws IOException { String text = token.getText();