diff --git a/.editorconfig b/.editorconfig index a45db48e146596da3c7d69b124388500998ed5f3..b522a5e5819c22255630455c4621716f93a2ab85 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,3 +5,7 @@ indent_style = space indent_size = 2 charset = utf-8 insert_final_newline = true + +[*.{sablecc3,txt}] +indent_size = 4 +trim_trailing_whitespace = true diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f9eea14bde485978c6225f5b691c16084baf7bdd..4e6db468b178c544c92c15ca2532577b9a5fecc6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,11 @@ before_script: tests: stage: test - script: ./gradlew ${GRADLE_OPTIONS} check + script: + # We don't have proper tests for SableCC, so as a minimal test, run SableCC on itself twice. + # If this succeeds, we at least know that it's not completely broken. + - ./gradlew ${GRADLE_OPTIONS} regenerateParser + - ./gradlew ${GRADLE_OPTIONS} regenerateParser tests:jdk-11: extends: tests diff --git a/build.gradle b/build.gradle index c4690f1108de5df195e24770a33937fe03293953..f758cdc48aa321a633f0fdbc78cbc34d1c432e2d 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'signing' allprojects { project.group = 'de.hhu.stups' - project.version = '3.3.3' + project.version = '3.4.0' project.ext.isSnapshot = project.version.endsWith("-SNAPSHOT") ext."signing.secretKeyRingFile" = rootProject.file("secring.gpg").absolutePath @@ -20,6 +20,10 @@ repositories { mavenCentral() } +dependencies { + implementation(project(":sablecc-runtime")) +} + java { sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 @@ -39,6 +43,52 @@ processResources { } } +// Run this task to regenerate the SableCC parser using itself. +// The generated files are checked into Git, +// to avoid bootstrapping problems, +// so normally you do not need to run this task to build the parser. +// If you change something in the parser generator or templates that affects the output, +// please run this task manually and commit the updated generated files. +tasks.register("regenerateParser", JavaExec) { + final sableCCGrammar = file("src/main/sablecc/sablecc-3x.sablecc3") + final outputDirs = [ + "src/main/java/org/sablecc/sablecc/analysis", + "src/main/java/org/sablecc/sablecc/lexer", + "src/main/java/org/sablecc/sablecc/node", + "src/main/java/org/sablecc/sablecc/parser", + "src/main/resources/org/sablecc/sablecc/lexer", + "src/main/resources/org/sablecc/sablecc/parser", + ].collect {file(it)} + + inputs.file(sableCCGrammar) + outputs.dir(temporaryDir) + outputs.dirs(outputDirs) + + doFirst { + delete(temporaryDir) + mkdir(temporaryDir) + } + + classpath(sourceSets.main.runtimeClasspath) + mainClass = application.mainClass + args = ["-d", temporaryDir, sableCCGrammar] + + doLast { + delete(outputDirs) + // Split the generated files - the .dat files go into resources, the .java files go into java. + copy { + from(temporaryDir) + into("src/main/java") + exclude("**/*.dat") + } + copy { + from(temporaryDir) + into("src/main/resources") + include("**/*.dat") + } + } +} + jar { manifest { attributes([ diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IParser.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IParser.java index 98d239ede5e46101d8dba291da5637716943996c..1dcb9585ca7d56d0f5352788fcb05cc1f424da6b 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IParser.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IParser.java @@ -10,5 +10,5 @@ import java.util.Map; public interface IParser { - public Map<PositionedNode, SourcecodeRange> getMapping(); + public Map<PositionedNode, SourcecodeRange> getMapping(); } diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IToken.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IToken.java index b8ae5da99d66db0636daa871541e0a558e245a06..7dfa0e4cc498024c02d3c49f58cd222e8f063819 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IToken.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/IToken.java @@ -9,15 +9,15 @@ package de.hhu.stups.sablecc.patch; public interface IToken { - public String getText(); + public String getText(); - public void setText(String text); + public void setText(String text); - public int getLine(); + public int getLine(); - public void setLine(int line); + public void setLine(int line); - public int getPos(); + public int getPos(); - public void setPos(int pos); + public void setPos(int pos); } diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/ITokenListContainer.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/ITokenListContainer.java index 8280e1e0f0eb1727adc5e0011eb4a633d9655e96..eb5eb885b4944beaa8dc15105ac33a0b8c2a7670 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/ITokenListContainer.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/ITokenListContainer.java @@ -9,5 +9,5 @@ package de.hhu.stups.sablecc.patch; import java.util.List; public interface ITokenListContainer { - public List<IToken> getTokenList(); + public List<IToken> getTokenList(); } diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/PositionedNode.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/PositionedNode.java index 0af0ce91b157cf7ed18aa3d8d1a7c8d26221e773..dea3bfe839585b1d5d98d425f11f6895041752da 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/PositionedNode.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/PositionedNode.java @@ -7,41 +7,35 @@ package de.hhu.stups.sablecc.patch; public class PositionedNode { - private SourcePosition startPos; - private SourcePosition endPos; - - public SourcePosition getStartPos() { - /* - * Special treatment for tokens because they don't get a position in the - * PositionAspect - */ - if (this instanceof IToken) { - final IToken token = (IToken) this; - return new SourcePosition(token.getLine(), token.getPos()); - } - - return startPos; - } - - public SourcePosition getEndPos() { - /* - * Special treatment for tokens because they don't get a position in the - * PositionAspect - */ - if (this instanceof IToken) { - final IToken token = (IToken) this; - return new SourcePosition(token.getLine(), token.getPos() - + token.getText().length()); - } - - return endPos; - } - - public void setStartPos(final SourcePosition startPos) { - this.startPos = startPos; - } - - public void setEndPos(final SourcePosition endPos) { - this.endPos = endPos; - } + private SourcePosition startPos; + private SourcePosition endPos; + + public PositionedNode(final SourcePosition startPos, final SourcePosition endPos) { + this.startPos = startPos; + this.endPos = endPos; + } + + public PositionedNode() { + this(null, null); + } + + public PositionedNode(final PositionedNode node) { + this(node.startPos, node.endPos); + } + + public SourcePosition getStartPos() { + return startPos; + } + + public SourcePosition getEndPos() { + return endPos; + } + + public void setStartPos(final SourcePosition startPos) { + this.startPos = startPos; + } + + public void setEndPos(final SourcePosition endPos) { + this.endPos = endPos; + } } diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java index 106966f010635c84e4a32c81354579359662a43f..2b3451b2d6d91a1c6475f6f96fc9c6cddbdcf40e 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java @@ -8,33 +8,33 @@ package de.hhu.stups.sablecc.patch; public class SourcePosition implements Comparable<SourcePosition> { - private final int line; + private final int line; - private final int pos; + private final int pos; - public SourcePosition(final int line, final int pos) { - this.line = line; - this.pos = pos; - } + public SourcePosition(final int line, final int pos) { + this.line = line; + this.pos = pos; + } - public int getLine() { - return line; - } + public int getLine() { + return line; + } - public int getPos() { - return pos; - } - - public int compareTo(SourcePosition that) { - if (that.line < line) return 1; - if (that.line > line) return -1; - return pos-that.pos; - } - - @Override - public String toString() { - return "(" + line + "," + pos + ")"; - } - - + public int getPos() { + return pos; + } + + public int compareTo(SourcePosition that) { + if (that.line < line) return 1; + if (that.line > line) return -1; + return pos-that.pos; + } + + @Override + public String toString() { + return "(" + line + "," + pos + ")"; + } + + } diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePositions.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePositions.java index a13acd004bf59fe8ccb7bf884e6dc5f4d2585859..0c30041a68683e38cffc6399ab07abad7f4a570f 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePositions.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePositions.java @@ -11,422 +11,422 @@ import java.util.List; import java.util.Map; public class SourcePositions { - private final List<IToken> tokenList; - private final Map<PositionedNode, SourcecodeRange> positions; - - public SourcePositions(final List<IToken> tokenList, - final Map<PositionedNode, SourcecodeRange> positions) { - this.tokenList = tokenList; - this.positions = positions; - } - - /** - * Returns the {@link SourcecodeRange} of this {@link PositionedNode} or - * {@code null} if no {@link SourcecodeRange} is available. - * - * @param node the node with source code information - * @return the source code range of {@code node} - */ - public SourcecodeRange getSourcecodeRange(final PositionedNode node) { - return positions.get(node); - } - - /** - * Returns the line in which this {@link PositionedNode} begins. The value - * {@code 0} is returned if no sourcecode range is available for this - * {@link PositionedNode}. - * - * @param node the node with source code information - * @return the line where the {@code node} starts - */ - public int getBeginLine(final PositionedNode node) { - if (node instanceof IToken) { - return ((IToken) node).getLine(); - } - - return getBeginLine(getSourcecodeRange(node)); - } - - public int getBeginLine(final SourcecodeRange range) { - if (range != null) { - return tokenList.get(range.getBeginIndex()).getLine(); - } else { - return 0; - } - } - - /** - * Returns the column of the first character of this {@link PositionedNode}, - * i.e. the begin column. The value {@code 0} is returned if no - * sourcecode range is available for this {@link PositionedNode}. - * - * @param node the node with source code information - * @return the begin column of {@code node} - */ - public int getBeginColumn(final PositionedNode node) { - if (node instanceof IToken) { - return ((IToken) node).getPos(); - } - - return getBeginColumn(getSourcecodeRange(node)); - } - - public int getBeginColumn(final SourcecodeRange range) { - if (range != null) { - return tokenList.get(range.getBeginIndex()).getPos(); - } else { - return 0; - } - } - - /** - * Returns the line in which the {@link PositionedNode} ends. The value - * {@code 0} is returned if no sourcecode range is available for this - * {@link PositionedNode}. - * - * @param node the node with source code information - * @return the end line of <code>node</code> - */ - public int getEndLine(final PositionedNode node) { - // TODO handle multi line comments - /* - * if (node instanceof TComment) { final TComment comment = (TComment) - * node; return comment.getLine() + countLineBreaks(comment); } - */ - - if (node instanceof IToken) { - return ((IToken) node).getLine(); - } - - return getEndLine(getSourcecodeRange(node)); - } - - private int getEndLine(final SourcecodeRange range) { - if (range != null) { - return tokenList.get(range.getEndIndex()).getLine(); - } else { - return 0; - } - } - - // private int countLineBreaks(final PositionedNode node) { - // final char[] text = getNodeString(node).toCharArray(); - // int count = 0; - // - // for (int i = 0; i < text.length; i++) { - // if (text[i] == '\n' || text[i] == '\r') { - // count++; - // } - // } - // - // return count; - // } - - /** - * Returns the last column of this {@link PositionedNode}, i.e. the column - * of the last character of the {@link PositionedNode}. The value - * {@code 0} is returned if no sourcecode range is available for this - * {@link PositionedNode}. - * - * @param node the node with source code information - * @return the end column of <code>node</code> - */ - public int getEndColumn(final PositionedNode node) { - // TODO handle multi line comments - /* - * if (node instanceof TComment) { return getEndColumn((TComment) node); - * } - */ - - if (node instanceof IToken) { - final IToken token = (IToken) node; - return token.getPos() + token.getText().length() - 1; - } - - return getEndColumn(getSourcecodeRange(node)); - } - - private int getEndColumn(final SourcecodeRange range) { - if (range != null) { - final IToken token = tokenList.get(range.getEndIndex()); - return token.getPos() + token.getText().length() - 1; - } else { - return 0; - } - } - - /* - * private int getEndColumn(final TComment commentToken) { final String - * asString = commentToken.getText(); final StringTokenizer tokenizer = new - * StringTokenizer(asString, "\n\r"); - * - * // multi line comment if (tokenizer.countTokens() > 1) { String line = - * null; while (tokenizer.hasMoreTokens()) { line = tokenizer.nextToken(); } - * - * if (line == null) { return 0; } - * - * return line.length(); } // single line comment else { return - * commentToken.getPos() + asString.length(); } } - */ - - /** - * Returns the array of {@link IToken}s belonging to this - * {@link PositionedNode}. The array may be empty, if no sourcecode range - * can be determined for this {@link PositionedNode}. - * - * @param node the node with source code information - * @return all tokens of {@code node} - */ - public IToken[] getTokens(final PositionedNode node) { - if (node instanceof IToken) { - return new IToken[] { (IToken) node }; - } - - final SourcecodeRange range = getSourcecodeRange(node); - - if (range != null) { - final int beginIndex = range.getBeginIndex(); - final int endIndex = range.getEndIndex(); - final IToken[] result = new IToken[endIndex - beginIndex + 1]; - - for (int i = 0; i + beginIndex <= endIndex; i++) { - result[i] = tokenList.get(i + beginIndex); - } - - return result; - } else { - return new IToken[0]; - } - } - - public String getNodeString(final PositionedNode node) { - // TODO handle comments - /* - * if (node instanceof TComment) { return ((TComment) node).getText(); } - */ - - return getRangeString(getSourcecodeRange(node)); - } - - public String getRangeString(final SourcecodeRange range) { - final StringBuilder buffer = new StringBuilder(); - - if (range != null) { - final int beginIndex = range.getBeginIndex(); - final int endIndex = range.getEndIndex(); - - for (int i = beginIndex; i <= endIndex; i++) { - buffer.append(tokenList.get(i).getText()); - } - } - - return buffer.toString(); - } - - // TODO handle comments - /* - * - * public IToken getCommentBefore(final PositionedNode node) { final - * SourcecodeRange range = getSourcecodeRange(node); final int beginIndex = - * range.getBeginIndex(); if (beginIndex > 0) { final IToken token = - * tokenList.get(beginIndex - 1); if (token instanceof TComment) { return - * token; } else { return null; } } else { return null; } } - * - * public IToken getCommentAfter(final PositionedNode node) { final - * SourcecodeRange range = getSourcecodeRange(node); final int endIndex = - * range.getEndIndex(); if (endIndex < tokenList.size() - 1) { final IToken - * token = tokenList.get(endIndex + 1); if (token instanceof TComment) { - * return token; } else { return null; } } else { return null; } } public - * IToken[] getIncludedComments(final PositionedNode node) { final - * SourcecodeRange range = getSourcecodeRange(node); - * - * if (range != null) { final int beginIndex = range.getBeginIndex(); final - * int endIndex = range.getEndIndex(); final List<IToken> comments = new - * ArrayList<IToken>(); - * - * for (int i = 0; i + beginIndex <= endIndex; i++) { final IToken token = - * tokenList.get(i + beginIndex); if (token instanceof TComment) { - * comments.add(token); } } - * - * return comments.toArray(new IToken[comments.size()]); } else { return new - * IToken[0]; } } - */ - - public List<IToken> getTokenList() { - return tokenList; - } - - public void replaceMapping(final PositionedNode origNode, - final PositionedNode newNode) { - final SourcecodeRange sourcecodeRange = positions.remove(origNode); - - if (sourcecodeRange != null) { - positions.put(newNode, sourcecodeRange); - } - } - - public PositionedNode getSurroundingNode(final int index) { - if (index < 0 || index >= tokenList.size()) { - return null; - } - - PositionedNode bestNode = null; - int bestBeginIndex = 0; - int bestEndIndex = tokenList.size() - 1; - - // TODO find better solution than searching all? - for (final Iterator<PositionedNode> iterator = positions.keySet() - .iterator(); iterator.hasNext();) { - final PositionedNode node = iterator.next(); - final SourcecodeRange range = positions.get(node); - - final int beginIndex = range.getBeginIndex(); - final int endIndex = range.getEndIndex(); - - if (beginIndex <= index && endIndex >= index - && beginIndex >= bestBeginIndex && endIndex <= bestEndIndex) { - bestNode = node; - bestBeginIndex = beginIndex; - bestEndIndex = endIndex; - } - } - - return bestNode; - } - - /** - * <p> - * Finds the index of the token that belongs to the position. - * </p> - * <p> - * If no token list is available {@code -1} is returned. For - * {@code line < 0} the index {@code 0} is returned. If - * {@code line >= 1 && column < 0} the line number is returned. - * </p> - * <p> - * If the line matches but the requested column is beyond the max. length of - * the line, the last token of this line is returned. The last token of all - * tokens (EOF) is chosen if the requested positions is beyond the - * absolutely last token. - * </p> - * <p> - * <b>Attention</b>: Line and column counting starts at 1! - * </p> - * - * @param line - * line of the position - * @param column - * column of the position - * @return Index in {@link #tokenList} - */ - public int getTokenforPosition(final int line, final int column) { - // Sort out nonsense input - if (tokenList.size() == 0) { - return -1; - } - if (line < 1) { - return 0; - } - if (column < 1) { - return line; - } - - /* - * Shortcut for special case: Position beyond last token - */ - final IToken lastToken = tokenList.get(tokenList.size() - 1); - if (line > lastToken.getLine() - || (line == lastToken.getLine() && column > lastToken.getPos() - + lastToken.getText().length())) { - return tokenList.size() - 1; - } - - int result = -1; - int left = 0; - int right = tokenList.size() - 1; - - while (left <= right && result < 0) { - if (left != right) { - final int currentIndex = left + (right - left) / 2; - - final int lineDiff = line - - tokenList.get(currentIndex).getLine(); - - if (lineDiff > 0) { - // continue in right half - left = Math.min(currentIndex + 1, right); - } else if (lineDiff < 0) { - // continue in left half - right = Math.max(currentIndex - 1, left); - } else { - // we are in the correct line now, switch to linear search - IToken token = tokenList.get(currentIndex); - result = currentIndex; - - final int compare = compareTokenColumn(token, column); - - // move left - if (compare < 0) { - while (compareTokenColumn(token, column) < 0) { - result--; - - if (result < 0) { - break; - } - - token = tokenList.get(result); - } - } - // move right - else if (compare > 0) { - while (compareTokenColumn(token, column) > 0) { - result++; - - if (result > tokenList.size() - 1) { - result = tokenList.size() - 1; - break; - } - - token = tokenList.get(result); - - /* - * Only move as long as line end is not reached. - * This happens when queried for column beyond max - * column of this line. Then we return the index of - * the last token in this line. - */ - if (token.getLine() > line) { - result--; - break; - } - } - } - } - } else { - result = left; - } - } - - return result; - } - - /** - * Compares the token position (within line only) with the column. - * - * @return {@code -1} if {@code column < beginColumn}, - * {@code 1} if {@code endColumn < column} or - * {@code 0} if the column is within the range of the token. - */ - private int compareTokenColumn(final IToken token, final int column) { - final int beginColumn = token.getPos(); - final int endColumn = beginColumn + token.getText().length() - 1; - - if (column < beginColumn) { - return -1; - } else if (endColumn < column) { - return 1; - } else { - return 0; - } - } + private final List<IToken> tokenList; + private final Map<PositionedNode, SourcecodeRange> positions; + + public SourcePositions(final List<IToken> tokenList, + final Map<PositionedNode, SourcecodeRange> positions) { + this.tokenList = tokenList; + this.positions = positions; + } + + /** + * Returns the {@link SourcecodeRange} of this {@link PositionedNode} or + * {@code null} if no {@link SourcecodeRange} is available. + * + * @param node the node with source code information + * @return the source code range of {@code node} + */ + public SourcecodeRange getSourcecodeRange(final PositionedNode node) { + return positions.get(node); + } + + /** + * Returns the line in which this {@link PositionedNode} begins. The value + * {@code 0} is returned if no sourcecode range is available for this + * {@link PositionedNode}. + * + * @param node the node with source code information + * @return the line where the {@code node} starts + */ + public int getBeginLine(final PositionedNode node) { + if (node instanceof IToken) { + return ((IToken) node).getLine(); + } + + return getBeginLine(getSourcecodeRange(node)); + } + + public int getBeginLine(final SourcecodeRange range) { + if (range != null) { + return tokenList.get(range.getBeginIndex()).getLine(); + } else { + return 0; + } + } + + /** + * Returns the column of the first character of this {@link PositionedNode}, + * i.e. the begin column. The value {@code 0} is returned if no + * sourcecode range is available for this {@link PositionedNode}. + * + * @param node the node with source code information + * @return the begin column of {@code node} + */ + public int getBeginColumn(final PositionedNode node) { + if (node instanceof IToken) { + return ((IToken) node).getPos(); + } + + return getBeginColumn(getSourcecodeRange(node)); + } + + public int getBeginColumn(final SourcecodeRange range) { + if (range != null) { + return tokenList.get(range.getBeginIndex()).getPos(); + } else { + return 0; + } + } + + /** + * Returns the line in which the {@link PositionedNode} ends. The value + * {@code 0} is returned if no sourcecode range is available for this + * {@link PositionedNode}. + * + * @param node the node with source code information + * @return the end line of <code>node</code> + */ + public int getEndLine(final PositionedNode node) { + // TODO handle multi line comments + /* + * if (node instanceof TComment) { final TComment comment = (TComment) + * node; return comment.getLine() + countLineBreaks(comment); } + */ + + if (node instanceof IToken) { + return ((IToken) node).getLine(); + } + + return getEndLine(getSourcecodeRange(node)); + } + + private int getEndLine(final SourcecodeRange range) { + if (range != null) { + return tokenList.get(range.getEndIndex()).getLine(); + } else { + return 0; + } + } + + // private int countLineBreaks(final PositionedNode node) { + // final char[] text = getNodeString(node).toCharArray(); + // int count = 0; + // + // for (int i = 0; i < text.length; i++) { + // if (text[i] == '\n' || text[i] == '\r') { + // count++; + // } + // } + // + // return count; + // } + + /** + * Returns the last column of this {@link PositionedNode}, i.e. the column + * of the last character of the {@link PositionedNode}. The value + * {@code 0} is returned if no sourcecode range is available for this + * {@link PositionedNode}. + * + * @param node the node with source code information + * @return the end column of <code>node</code> + */ + public int getEndColumn(final PositionedNode node) { + // TODO handle multi line comments + /* + * if (node instanceof TComment) { return getEndColumn((TComment) node); + * } + */ + + if (node instanceof IToken) { + final IToken token = (IToken) node; + return token.getPos() + token.getText().length() - 1; + } + + return getEndColumn(getSourcecodeRange(node)); + } + + private int getEndColumn(final SourcecodeRange range) { + if (range != null) { + final IToken token = tokenList.get(range.getEndIndex()); + return token.getPos() + token.getText().length() - 1; + } else { + return 0; + } + } + + /* + * private int getEndColumn(final TComment commentToken) { final String + * asString = commentToken.getText(); final StringTokenizer tokenizer = new + * StringTokenizer(asString, "\n\r"); + * + * // multi line comment if (tokenizer.countTokens() > 1) { String line = + * null; while (tokenizer.hasMoreTokens()) { line = tokenizer.nextToken(); } + * + * if (line == null) { return 0; } + * + * return line.length(); } // single line comment else { return + * commentToken.getPos() + asString.length(); } } + */ + + /** + * Returns the array of {@link IToken}s belonging to this + * {@link PositionedNode}. The array may be empty, if no sourcecode range + * can be determined for this {@link PositionedNode}. + * + * @param node the node with source code information + * @return all tokens of {@code node} + */ + public IToken[] getTokens(final PositionedNode node) { + if (node instanceof IToken) { + return new IToken[] { (IToken) node }; + } + + final SourcecodeRange range = getSourcecodeRange(node); + + if (range != null) { + final int beginIndex = range.getBeginIndex(); + final int endIndex = range.getEndIndex(); + final IToken[] result = new IToken[endIndex - beginIndex + 1]; + + for (int i = 0; i + beginIndex <= endIndex; i++) { + result[i] = tokenList.get(i + beginIndex); + } + + return result; + } else { + return new IToken[0]; + } + } + + public String getNodeString(final PositionedNode node) { + // TODO handle comments + /* + * if (node instanceof TComment) { return ((TComment) node).getText(); } + */ + + return getRangeString(getSourcecodeRange(node)); + } + + public String getRangeString(final SourcecodeRange range) { + final StringBuilder buffer = new StringBuilder(); + + if (range != null) { + final int beginIndex = range.getBeginIndex(); + final int endIndex = range.getEndIndex(); + + for (int i = beginIndex; i <= endIndex; i++) { + buffer.append(tokenList.get(i).getText()); + } + } + + return buffer.toString(); + } + + // TODO handle comments + /* + * + * public IToken getCommentBefore(final PositionedNode node) { final + * SourcecodeRange range = getSourcecodeRange(node); final int beginIndex = + * range.getBeginIndex(); if (beginIndex > 0) { final IToken token = + * tokenList.get(beginIndex - 1); if (token instanceof TComment) { return + * token; } else { return null; } } else { return null; } } + * + * public IToken getCommentAfter(final PositionedNode node) { final + * SourcecodeRange range = getSourcecodeRange(node); final int endIndex = + * range.getEndIndex(); if (endIndex < tokenList.size() - 1) { final IToken + * token = tokenList.get(endIndex + 1); if (token instanceof TComment) { + * return token; } else { return null; } } else { return null; } } public + * IToken[] getIncludedComments(final PositionedNode node) { final + * SourcecodeRange range = getSourcecodeRange(node); + * + * if (range != null) { final int beginIndex = range.getBeginIndex(); final + * int endIndex = range.getEndIndex(); final List<IToken> comments = new + * ArrayList<IToken>(); + * + * for (int i = 0; i + beginIndex <= endIndex; i++) { final IToken token = + * tokenList.get(i + beginIndex); if (token instanceof TComment) { + * comments.add(token); } } + * + * return comments.toArray(new IToken[comments.size()]); } else { return new + * IToken[0]; } } + */ + + public List<IToken> getTokenList() { + return tokenList; + } + + public void replaceMapping(final PositionedNode origNode, + final PositionedNode newNode) { + final SourcecodeRange sourcecodeRange = positions.remove(origNode); + + if (sourcecodeRange != null) { + positions.put(newNode, sourcecodeRange); + } + } + + public PositionedNode getSurroundingNode(final int index) { + if (index < 0 || index >= tokenList.size()) { + return null; + } + + PositionedNode bestNode = null; + int bestBeginIndex = 0; + int bestEndIndex = tokenList.size() - 1; + + // TODO find better solution than searching all? + for (final Iterator<PositionedNode> iterator = positions.keySet() + .iterator(); iterator.hasNext();) { + final PositionedNode node = iterator.next(); + final SourcecodeRange range = positions.get(node); + + final int beginIndex = range.getBeginIndex(); + final int endIndex = range.getEndIndex(); + + if (beginIndex <= index && endIndex >= index + && beginIndex >= bestBeginIndex && endIndex <= bestEndIndex) { + bestNode = node; + bestBeginIndex = beginIndex; + bestEndIndex = endIndex; + } + } + + return bestNode; + } + + /** + * <p> + * Finds the index of the token that belongs to the position. + * </p> + * <p> + * If no token list is available {@code -1} is returned. For + * {@code line < 0} the index {@code 0} is returned. If + * {@code line >= 1 && column < 0} the line number is returned. + * </p> + * <p> + * If the line matches but the requested column is beyond the max. length of + * the line, the last token of this line is returned. The last token of all + * tokens (EOF) is chosen if the requested positions is beyond the + * absolutely last token. + * </p> + * <p> + * <b>Attention</b>: Line and column counting starts at 1! + * </p> + * + * @param line + * line of the position + * @param column + * column of the position + * @return Index in {@link #tokenList} + */ + public int getTokenforPosition(final int line, final int column) { + // Sort out nonsense input + if (tokenList.size() == 0) { + return -1; + } + if (line < 1) { + return 0; + } + if (column < 1) { + return line; + } + + /* + * Shortcut for special case: Position beyond last token + */ + final IToken lastToken = tokenList.get(tokenList.size() - 1); + if (line > lastToken.getLine() + || (line == lastToken.getLine() && column > lastToken.getPos() + + lastToken.getText().length())) { + return tokenList.size() - 1; + } + + int result = -1; + int left = 0; + int right = tokenList.size() - 1; + + while (left <= right && result < 0) { + if (left != right) { + final int currentIndex = left + (right - left) / 2; + + final int lineDiff = line + - tokenList.get(currentIndex).getLine(); + + if (lineDiff > 0) { + // continue in right half + left = Math.min(currentIndex + 1, right); + } else if (lineDiff < 0) { + // continue in left half + right = Math.max(currentIndex - 1, left); + } else { + // we are in the correct line now, switch to linear search + IToken token = tokenList.get(currentIndex); + result = currentIndex; + + final int compare = compareTokenColumn(token, column); + + // move left + if (compare < 0) { + while (compareTokenColumn(token, column) < 0) { + result--; + + if (result < 0) { + break; + } + + token = tokenList.get(result); + } + } + // move right + else if (compare > 0) { + while (compareTokenColumn(token, column) > 0) { + result++; + + if (result > tokenList.size() - 1) { + result = tokenList.size() - 1; + break; + } + + token = tokenList.get(result); + + /* + * Only move as long as line end is not reached. + * This happens when queried for column beyond max + * column of this line. Then we return the index of + * the last token in this line. + */ + if (token.getLine() > line) { + result--; + break; + } + } + } + } + } else { + result = left; + } + } + + return result; + } + + /** + * Compares the token position (within line only) with the column. + * + * @return {@code -1} if {@code column < beginColumn}, + * {@code 1} if {@code endColumn < column} or + * {@code 0} if the column is within the range of the token. + */ + private int compareTokenColumn(final IToken token, final int column) { + final int beginColumn = token.getPos(); + final int endColumn = beginColumn + token.getText().length() - 1; + + if (column < beginColumn) { + return -1; + } else if (endColumn < column) { + return 1; + } else { + return 0; + } + } } diff --git a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcecodeRange.java b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcecodeRange.java index e064a453a08f4bdbefe9fe4f79e199b1e5be1858..7f25cd153241510857a2e3f7b3ae2681ab35e8c9 100644 --- a/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcecodeRange.java +++ b/sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcecodeRange.java @@ -7,24 +7,24 @@ package de.hhu.stups.sablecc.patch; public class SourcecodeRange { - private final int beginIndex; - private final int endIndex; + private final int beginIndex; + private final int endIndex; - public SourcecodeRange(final int beginIndex, final int endIndex) { - this.beginIndex = beginIndex; - this.endIndex = endIndex; - } + public SourcecodeRange(final int beginIndex, final int endIndex) { + this.beginIndex = beginIndex; + this.endIndex = endIndex; + } - public int getBeginIndex() { - return beginIndex; - } + public int getBeginIndex() { + return beginIndex; + } - public int getEndIndex() { - return endIndex; - } + public int getEndIndex() { + return endIndex; + } - @Override - public String toString() { - return "(" + beginIndex + "/" + endIndex + ")"; - } + @Override + public String toString() { + return "(" + beginIndex + "/" + endIndex + ")"; + } } diff --git a/src/main/java/org/sablecc/sablecc/AcceptStates.java b/src/main/java/org/sablecc/sablecc/AcceptStates.java index 7bdfe11395fb592645dec42a990f9fbaa46d12b9..33088aac1995565382d416e602a1c599a99114cf 100644 --- a/src/main/java/org/sablecc/sablecc/AcceptStates.java +++ b/src/main/java/org/sablecc/sablecc/AcceptStates.java @@ -7,9 +7,8 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; -import org.sablecc.sablecc.node.*; -import java.util.*; +import org.sablecc.sablecc.analysis.DepthFirstAdapter; +import org.sablecc.sablecc.node.Start; public class AcceptStates extends DepthFirstAdapter { @@ -24,11 +23,11 @@ public class AcceptStates extends DepthFirstAdapter this.stateName = stateName; } + @Override public void caseStart(Start node) { - for(int i = 0; i < dfa.states.size(); i++) + for(DFA.State state : dfa.states) { - DFA.State state = (DFA.State) dfa.states.elementAt(i); state.accept = -1; int accept = -1; diff --git a/src/main/java/org/sablecc/sablecc/AddAstProductions.java b/src/main/java/org/sablecc/sablecc/AddAstProductions.java index 3238138a857887a0a49bc4d8c6d86074faf2da39..5051639d33d1239cbb69d447f2351e777ebae9d8 100644 --- a/src/main/java/org/sablecc/sablecc/AddAstProductions.java +++ b/src/main/java/org/sablecc/sablecc/AddAstProductions.java @@ -7,10 +7,11 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.LinkedList; +import java.util.List; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; /* * AddAstProductions @@ -26,16 +27,17 @@ import java.io.*; public class AddAstProductions extends DepthFirstAdapter { - LinkedList listAstProd = new TypedLinkedList(); + List<PAstProd> listAstProd = new LinkedList<>(); private boolean firstAlt; public AddAstProductions() {} + @Override public void caseAProd(AProd node) { firstAlt = true; - listOfAstAlts = new TypedLinkedList(); + listOfAstAlts = new LinkedList<>(); /* * Here, we assume that if there is no Abstract Syntax Tree Section specified @@ -46,27 +48,29 @@ public class AddAstProductions extends DepthFirstAdapter error(node.getArrow()); } - Object []list_alt = (Object[]) node.getAlts().toArray(); - for(int i=0; i<list_alt.length; i++) - { - ((PAlt)list_alt[i]).apply(this); + PAlt[] list_alt = node.getAlts().toArray(new PAlt[0]); + for (PAlt alt : list_alt) { + alt.apply(this); } AAstProd astProd = new AAstProd(new TId(node.getId().getText()), listOfAstAlts); listAstProd.add(astProd); } + @Override public void outAGrammar(AGrammar node) { node.setAst(new AAst(listAstProd)); } + @Override public void inAAlt(AAlt node) { - listElems = new TypedLinkedList(); + listElems = new LinkedList<>(); processingParsedAlt = true; } + @Override public void inAAltTransform(AAltTransform node) { if(node.getLBrace() != null) @@ -75,9 +79,10 @@ public class AddAstProductions extends DepthFirstAdapter } } + @Override public void outAAlt(AAlt node) { - TId aAltname = node.getAltName() == null ? null : (TId)node.getAltName().clone(); + TId aAltname = node.getAltName() == null ? null : node.getAltName().clone(); AAstAlt astAlt = new AAstAlt(aAltname, listElems); listOfAstAlts.add(astAlt); @@ -86,17 +91,17 @@ public class AddAstProductions extends DepthFirstAdapter boolean processingParsedAlt; + @Override public void inAElem(AElem node) { if(processingParsedAlt) { - AElem tmp = (AElem)node.clone(); - listElems.add(tmp); + listElems.add(node.clone()); } } - LinkedList listElems; - LinkedList listOfAstAlts; + List<PElem> listElems; + List<PAstAlt> listOfAstAlts; public void error(Token token) { diff --git a/src/main/java/org/sablecc/sablecc/AddEventualEmptyTransformationToProductions.java b/src/main/java/org/sablecc/sablecc/AddEventualEmptyTransformationToProductions.java index 3c0d404456f46612798865334944a0ed069b5561..145eafe61bd0aab82adf6c588834d0d657bbd144 100644 --- a/src/main/java/org/sablecc/sablecc/AddEventualEmptyTransformationToProductions.java +++ b/src/main/java/org/sablecc/sablecc/AddEventualEmptyTransformationToProductions.java @@ -7,10 +7,10 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.LinkedList; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; /* * AddEventualEmptyTransformationToProductions @@ -38,9 +38,10 @@ public class AddEventualEmptyTransformationToProductions extends DepthFirstAdapt this.ast_ids = ast_ids; } + @Override public void inAProd(AProd node) { - currentProd = (String)ids.names.get(node); + currentProd = ids.names.get(node); /* If there is no transformation specified for the production * and there is no AST production which has the same name as the current @@ -49,21 +50,22 @@ public class AddEventualEmptyTransformationToProductions extends DepthFirstAdapt if(node.getArrow() == null && ast_ids.ast_prods.get(currentProd) == null ) { node.setArrow(new TArrow(node.getId().getLine(), node.getId().getPos()+node.getId().getText().length() )); - node.setProdTransform(new LinkedList()); + node.setProdTransform(new LinkedList<PElem>()); - AAlt []alts = (AAlt[]) node.getAlts().toArray(new AAlt[0]); + PAlt[] alts = node.getAlts().toArray(new PAlt[0]); - for(int i=0; i<alts.length; i++) + for(PAlt alt : alts) { - alts[i].apply( new DepthFirstAdapter() + alt.apply( new DepthFirstAdapter() { + @Override public void inAAlt(AAlt node) { if(node.getAltTransform() != null && ((AAltTransform)node.getAltTransform()).getTerms().size() > 0) { error(((AAltTransform)node.getAltTransform()).getLBrace()); } - node.setAltTransform( new AAltTransform(new TLBrace(), new LinkedList(), new TRBrace()) ); + node.setAltTransform( new AAltTransform(new TLBrace(), new LinkedList<PTerm>(), new TRBrace()) ); } } ); diff --git a/src/main/java/org/sablecc/sablecc/AddProdTransformAndAltTransform.java b/src/main/java/org/sablecc/sablecc/AddProdTransformAndAltTransform.java index 336a94ef45fc020f4b8351798d6e3b884f2f4b49..590d6a78c129d6917078eb670d061d15130ea8af 100644 --- a/src/main/java/org/sablecc/sablecc/AddProdTransformAndAltTransform.java +++ b/src/main/java/org/sablecc/sablecc/AddProdTransformAndAltTransform.java @@ -7,10 +7,11 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.LinkedList; +import java.util.List; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; /* * AddProdTransformAndAltTransform @@ -30,6 +31,7 @@ public class AddProdTransformAndAltTransform extends DepthFirstAdapter private String currentProdId; private String currentAlt; + @Override public void inAProd(final AProd production) { currentProdId = production.getId().getText(); @@ -37,22 +39,22 @@ public class AddProdTransformAndAltTransform extends DepthFirstAdapter if(production.getArrow() == null) { AElem elem = new AElem(null, new AProductionSpecifier(), new TId(currentProdId), null); - LinkedList listOfProdTransformElem = new LinkedList(); + List<PElem> listOfProdTransformElem = new LinkedList<>(); listOfProdTransformElem.add(elem); production.setProdTransform(listOfProdTransformElem); production.setArrow(new TArrow()); } } - private int i; - private LinkedList list; + private List<PTerm> list; + @Override public void inAAlt(AAlt alt) { if(alt.getAltTransform() == null) { currentAlt = currentProdId; - list = new LinkedList(); + list = new LinkedList<>(); AProdName aProdName = new AProdName(new TId(currentProdId), null); if(alt.getAltName() != null) @@ -62,12 +64,13 @@ public class AddProdTransformAndAltTransform extends DepthFirstAdapter if( alt.getElems().size() > 0 ) { - Object temp[] = alt.getElems().toArray(); + PElem[] temp = alt.getElems().toArray(new PElem[0]); - for(i = 0; i < temp.length; i++) + for(PElem e : temp) { - ((PElem) temp[i]).apply(new DepthFirstAdapter() + e.apply(new DepthFirstAdapter() { + @Override public void caseAElem(AElem elem) { PTerm term; @@ -87,7 +90,7 @@ public class AddProdTransformAndAltTransform extends DepthFirstAdapter if( (elem.getUnOp() != null) && ( (elem.getUnOp() instanceof AStarUnOp) || (elem.getUnOp() instanceof APlusUnOp) ) ) { - LinkedList listP = new LinkedList(); + List<PListTerm> listP = new LinkedList<>(); if( !elemNameExplicitelySpecified && (elem.getSpecifier()!= null) ) { if(elem.getSpecifier() instanceof ATokenSpecifier) @@ -135,7 +138,7 @@ public class AddProdTransformAndAltTransform extends DepthFirstAdapter } ANewTerm newTerm = new ANewTerm(aProdName, new TLPar(), list); - LinkedList lst = new LinkedList(); + List<PTerm> lst = new LinkedList<>(); lst.add(newTerm); alt.setAltTransform(new AAltTransform(new TLBrace(), lst, new TRBrace())); diff --git a/src/main/java/org/sablecc/sablecc/AltTransformAdapter.java b/src/main/java/org/sablecc/sablecc/AltTransformAdapter.java index fc127320fd8f10e726f0aa7da85168fcf9327524..51fd2d0d44d193bc4542205410e50b31f8fa6770 100644 --- a/src/main/java/org/sablecc/sablecc/AltTransformAdapter.java +++ b/src/main/java/org/sablecc/sablecc/AltTransformAdapter.java @@ -7,27 +7,28 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.List; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.io.*; public class AltTransformAdapter extends DepthFirstAdapter { ResolveAltIds altIds; String currentNewAltName; - private Map isElementIsAlist; + private Map<String, String> isElementIsAlist; - private LinkedList listSimpleTermTransform; - private Map simpleTermTransform; - private Map simpleTermOrsimpleListTermTypes; + private List<Node> listSimpleTermTransform; + private Map<Node, String> simpleTermTransform; + private Map<Node, String> simpleTermOrsimpleListTermTypes; - AltTransformAdapter(Map simpleTermTransform, - LinkedList listSimpleTermTransform, + AltTransformAdapter(Map<Node, String> simpleTermTransform, + List<Node> listSimpleTermTransform, String currentNewAltName, - ResolveAltIds altIds, Map isElementIsAlist, - Map simpleTermOrsimpleListTermTypes) + ResolveAltIds altIds, Map<String, String> isElementIsAlist, + Map<Node, String> simpleTermOrsimpleListTermTypes) { this.currentNewAltName = currentNewAltName; this.altIds = altIds; @@ -37,12 +38,13 @@ public class AltTransformAdapter extends DepthFirstAdapter this.simpleTermOrsimpleListTermTypes = simpleTermOrsimpleListTermTypes; } + @Override public void inASimpleTerm(ASimpleTerm node) { String name = node.getId().getText(); - if( !((LinkedList)altIds.alts_elems.get(currentNewAltName)).contains(name) && - !((LinkedList)altIds.alts_elems.get(currentNewAltName)).contains("$"+name) ) + if( !altIds.alts_elems.get(currentNewAltName).contains(name) && + !altIds.alts_elems.get(currentNewAltName).contains("$"+name) ) { node.replaceBy( new ANullTerm() ); } @@ -56,30 +58,31 @@ public class AltTransformAdapter extends DepthFirstAdapter } else { - simpleTermTail = new TId( (String)isElementIsAlist.get(currentNewAltName+name) ); + simpleTermTail = new TId(isElementIsAlist.get(currentNewAltName+name)); } ASimpleTerm asimpleTerm = new ASimpleTerm( node.getSpecifier(), node.getId(), simpleTermTail); if(simpleTermOrsimpleListTermTypes.get(node) != null) { - simpleTermOrsimpleListTermTypes.put(asimpleTerm, (String)simpleTermOrsimpleListTermTypes.get(node)); + simpleTermOrsimpleListTermTypes.put(asimpleTerm, simpleTermOrsimpleListTermTypes.get(node)); } node.replaceBy(asimpleTerm); - simpleTermTransform.put(asimpleTerm, "L"+ResolveIds.name((String)isElementIsAlist.get(currentNewAltName+name)) ); + simpleTermTransform.put(asimpleTerm, "L"+ResolveIds.name(isElementIsAlist.get(currentNewAltName+name)) ); //Terms are added here only if they were implicitely transformed listSimpleTermTransform.add( asimpleTerm ); } } + @Override public void inASimpleListTerm(ASimpleListTerm node) { String name = node.getId().getText(); - if( !((LinkedList)altIds.alts_elems.get(currentNewAltName)).contains(name) && - !((LinkedList)altIds.alts_elems.get(currentNewAltName)).contains("$"+name) ) + if( !altIds.alts_elems.get(currentNewAltName).contains(name) && + !altIds.alts_elems.get(currentNewAltName).contains("$"+name) ) { node.replaceBy( null ); } @@ -93,28 +96,29 @@ public class AltTransformAdapter extends DepthFirstAdapter } else { - simpleTermTail = new TId((String)isElementIsAlist.get(currentNewAltName+name)); + simpleTermTail = new TId(isElementIsAlist.get(currentNewAltName+name)); } TId tid; - tid = ( ((LinkedList)altIds.alts_elems_list_elemName.get(currentNewAltName)).contains(name) ? + tid = ( altIds.alts_elems_list_elemName.get(currentNewAltName).contains(name) ? node.getId() : new TId( "$" + node.getId().getText() ) ); ASimpleListTerm asimpleListTerm = new ASimpleListTerm( node.getSpecifier(), tid, simpleTermTail); if(simpleTermOrsimpleListTermTypes.get(node) != null) { - simpleTermOrsimpleListTermTypes.put(asimpleListTerm, (String)simpleTermOrsimpleListTermTypes.get(node)); + simpleTermOrsimpleListTermTypes.put(asimpleListTerm, simpleTermOrsimpleListTermTypes.get(node)); } node.replaceBy(asimpleListTerm); - simpleTermTransform.put(asimpleListTerm, "L"+ResolveIds.name((String)isElementIsAlist.get(currentNewAltName+name) )); + simpleTermTransform.put(asimpleListTerm, "L"+ResolveIds.name(isElementIsAlist.get(currentNewAltName+name))); //Terms are added here only if they were implicitely transformed listSimpleTermTransform.add( asimpleListTerm ); } } + @Override public void outAListTerm(AListTerm node) { if( (node.getListTerms() != null) && (node.getListTerms().size() > 0) ) @@ -123,7 +127,7 @@ public class AltTransformAdapter extends DepthFirstAdapter if(simpleTermTransform.get(temp[0]) != null) { - String firstTermType = (String)simpleTermTransform.get(temp[0]); + String firstTermType = simpleTermTransform.get(temp[0]); if(firstTermType != null) { diff --git a/src/main/java/org/sablecc/sablecc/AlternativeElementTypes.java b/src/main/java/org/sablecc/sablecc/AlternativeElementTypes.java index 1c74f44b336a7e6dcb0037faeaf9c0f40937eb28..37c9b384f62830792197d6b5a7667fad61e08045 100644 --- a/src/main/java/org/sablecc/sablecc/AlternativeElementTypes.java +++ b/src/main/java/org/sablecc/sablecc/AlternativeElementTypes.java @@ -7,15 +7,15 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; public class AlternativeElementTypes extends DepthFirstAdapter { - private Map altElemTypes = new TypedHashMap(StringCast.instance, - StringCast.instance); + private Map<String, String> altElemTypes = new HashMap<>(); private ResolveIds ids; private String currentAlt; @@ -25,36 +25,40 @@ public class AlternativeElementTypes extends DepthFirstAdapter this.ids = ids; } - public Map getMapOfAltElemType() + public Map<String, String> getMapOfAltElemType() { return altElemTypes; } + @Override public void caseAAst(AAst node) {} + @Override public void caseAProd(final AProd production) { - Object []temp = production.getAlts().toArray(); - for(int i = 0; i<temp.length; i++) + PAlt[] temp = production.getAlts().toArray(new PAlt[0]); + for(PAlt alt : temp) { - ((PAlt)temp[i]).apply(this); + alt.apply(this); } } + @Override public void caseAAlt(AAlt node) { - currentAlt = (String)ids.names.get(node); - Object []temp = node.getElems().toArray(); - for(int i = 0; i<temp.length; i++) + currentAlt = ids.names.get(node); + PElem[] temp = node.getElems().toArray(new PElem[0]); + for(PElem elem : temp) { - ((PElem)temp[i]).apply(this); + elem.apply(this); } } + @Override public void inAElem(AElem node) { - String elemType = (String)ids.elemTypes.get(node); + String elemType = ids.elemTypes.get(node); if(node.getElemName() != null) { diff --git a/src/main/java/org/sablecc/sablecc/BooleanCast.java b/src/main/java/org/sablecc/sablecc/BooleanCast.java deleted file mode 100644 index b14570e4b5d673649f3ca00a42ebeb12a312da4b..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/BooleanCast.java +++ /dev/null @@ -1,23 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class BooleanCast implements Cast -{ - public final static BooleanCast instance = new BooleanCast(); - - private BooleanCast() - {} - - public Object cast(Object o) - { - return (Boolean) o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/Cast.java b/src/main/java/org/sablecc/sablecc/Cast.java deleted file mode 100644 index 3c17b138a5f3cac9ecf5829d6f83785f6697fce3..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/Cast.java +++ /dev/null @@ -1,13 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -public interface Cast -{ - Object cast(Object o); -} diff --git a/src/main/java/org/sablecc/sablecc/CharSet.java b/src/main/java/org/sablecc/sablecc/CharSet.java index b43bd7b820496e530d14e06d0897475db45630ad..f9a8b5a7d0668f72628264a515eacf1b17f71d90 100644 --- a/src/main/java/org/sablecc/sablecc/CharSet.java +++ b/src/main/java/org/sablecc/sablecc/CharSet.java @@ -7,33 +7,34 @@ package org.sablecc.sablecc; -import java.util.*; -import java.util.Enumeration; -import java.util.Vector; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; public class CharSet implements Cloneable { - private final Vector intervals = new Vector(0); + private final List<Interval> intervals = new ArrayList<>(); public CharSet(char c) { - intervals.addElement(new Interval(c, c)); + intervals.add(new Interval(c, c)); } public CharSet(char start, char end) { - intervals.addElement(new Interval(start, end)); + intervals.add(new Interval(start, end)); } - private CharSet(Vector intervals) + private CharSet(Collection<Interval> intervals) { - for(Enumeration e = intervals.elements(); e.hasMoreElements();) + for(Interval i : intervals) { - this.intervals.addElement(((Interval) e.nextElement()).clone()); + this.intervals.add(i.clone()); } } - public Object clone() + @Override + public CharSet clone() { return new CharSet(intervals); } @@ -47,9 +48,9 @@ public class CharSet implements Cloneable while(high >= low) { - int middle = (high + low) / 2; + int middle = (high + low) >>> 1; - interval2 = (Interval) intervals.elementAt(middle); + interval2 = intervals.get(middle); if(interval1.start <= interval2.end) { @@ -70,40 +71,38 @@ public class CharSet implements Cloneable return result; } - private void remove - (Interval interval) + private void remove(Interval interval) { - intervals.removeElement(interval); + intervals.remove(interval); } - private void add - (Interval interval) + private void add(Interval interval) { for(int i = 0; i < intervals.size(); i++) { - Interval iv = (Interval) intervals.elementAt(i); + Interval iv = intervals.get(i); if(iv.start > interval.start) { - intervals.insertElementAt(interval, i); + intervals.add(i, interval); return; } } - intervals.addElement(interval); + intervals.add(interval); } public CharSet union(CharSet chars) { - CharSet result = (CharSet) clone(); + CharSet result = clone(); Interval interval; Interval largeInterval; Interval overlap; - for(Enumeration e = chars.intervals.elements(); e.hasMoreElements();) + for(Interval i : chars.intervals) { - interval = (Interval) ((Interval) e.nextElement()).clone(); + interval = i.clone(); do { @@ -129,14 +128,14 @@ public class CharSet implements Cloneable public CharSet diff(CharSet chars) { - CharSet result = (CharSet) clone(); + CharSet result = clone(); Interval interval; Interval overlap; - for(Enumeration e = chars.intervals.elements(); e.hasMoreElements();) + for(Interval i : chars.intervals) { - interval = (Interval) ((Interval) e.nextElement()).clone(); + interval = i.clone(); do { @@ -160,16 +159,19 @@ public class CharSet implements Cloneable return result; } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); - for(Enumeration e = intervals.elements(); e.hasMoreElements();) + for(Interval i : intervals) { - result.append("[" + e.nextElement() + "] "); + result.append("["); + result.append(i); + result.append("] "); } - return "" + result; + return result.toString(); } public static class Interval implements Cloneable @@ -180,7 +182,8 @@ public class CharSet implements Cloneable this.end = end; } - public Object clone() + @Override + public Interval clone() { return new Interval(start, end); } @@ -195,6 +198,7 @@ public class CharSet implements Cloneable return "" + ((int) c); } + @Override public String toString() { if(start < end) @@ -210,17 +214,4 @@ public class CharSet implements Cloneable public char start; public char end; } - - public static class IntervalCast implements Cast - { - public final static IntervalCast instance = new IntervalCast(); - - private IntervalCast() - {} - - public Object cast(Object o) - { - return (Interval) o; - } - } } diff --git a/src/main/java/org/sablecc/sablecc/ComputeCGNomenclature.java b/src/main/java/org/sablecc/sablecc/ComputeCGNomenclature.java index 4452150d22efa1aea70c86306dd92bc4c46d9190..5047dbbe965e372810a5705b5342d0f5a89f698d 100644 --- a/src/main/java/org/sablecc/sablecc/ComputeCGNomenclature.java +++ b/src/main/java/org/sablecc/sablecc/ComputeCGNomenclature.java @@ -19,10 +19,11 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; public class ComputeCGNomenclature extends DepthFirstAdapter { @@ -31,14 +32,11 @@ public class ComputeCGNomenclature extends DepthFirstAdapter private int counter; private ResolveIds ids; private ResolveProdTransformIds prodTransformIds; - private Map altElemTypes; + private Map<String, String> altElemTypes; - private final Map altTransformElemTypes = new TypedHashMap( - NodeCast.instance, - StringCast.instance); + private final Map<Node, String> altTransformElemTypes = new HashMap<>(); - private final Map termNumbers = new TypedHashMap(NodeCast.instance, - IntegerCast.instance); + private final Map<Node, Integer> termNumbers = new HashMap<>(); public ComputeCGNomenclature(ResolveIds ids, ResolveProdTransformIds prodTransformIds) { @@ -46,31 +44,33 @@ public class ComputeCGNomenclature extends DepthFirstAdapter this.prodTransformIds = prodTransformIds; } - public void setAltElemTypes(Map aMap) + public void setAltElemTypes(Map<String, String> aMap) { this.altElemTypes = aMap; } - public Map getAltTransformElemTypes() + public Map<Node, String> getAltTransformElemTypes() { return altTransformElemTypes; } - public Map getTermNumbers() + public Map<Node, Integer> getTermNumbers() { return termNumbers; } + @Override public void caseAProd(final AProd production) { - currentProd = "P" + ids.name(production.getId().getText()); - Object []temp = production.getAlts().toArray(); - for(int i = 0; i<temp.length; i++) + currentProd = "P" + ResolveIds.name(production.getId().getText()); + PAlt[] temp = production.getAlts().toArray(new PAlt[0]); + for(PAlt alt : temp) { - ((PAlt)temp[i]).apply(this); + alt.apply(this); } } + @Override public void inAAlt(AAlt nodeAlt) { counter = 0; @@ -78,7 +78,7 @@ public class ComputeCGNomenclature extends DepthFirstAdapter if(nodeAlt.getAltName() != null) { currentAlt = "A"+ - ids.name( nodeAlt.getAltName().getText() )+ + ResolveIds.name( nodeAlt.getAltName().getText() )+ currentProd.substring(1); } else @@ -89,12 +89,14 @@ public class ComputeCGNomenclature extends DepthFirstAdapter counter = 0; } + @Override public void caseAAst(AAst node) {} + @Override public void inAElem(AElem node) { - String elemType = (String)ids.elemTypes.get(node); + String elemType = ids.elemTypes.get(node); if(node.getElemName() != null) { @@ -102,31 +104,34 @@ public class ComputeCGNomenclature extends DepthFirstAdapter } } + @Override public void inANewTerm(ANewTerm node) { AProdName aProdName = (AProdName)node.getProdName(); - String type = "P" + ids.name(aProdName.getId().getText()); + String type = "P" + ResolveIds.name(aProdName.getId().getText()); altTransformElemTypes.put(node, type); - termNumbers.put(node, new Integer(++counter)); + termNumbers.put(node, ++counter); } + @Override public void inANewListTerm(ANewListTerm node) { AProdName aProdName = (AProdName)node.getProdName(); - String type = "P" + ids.name(aProdName.getId().getText()); + String type = "P" + ResolveIds.name(aProdName.getId().getText()); altTransformElemTypes.put(node, type); - termNumbers.put(node, new Integer(++counter)); + termNumbers.put(node, ++counter); } + @Override public void outAListTerm(AListTerm node) { if( node.getListTerms().size() > 0 ) { - Object[] temp = node.getListTerms().toArray(); + PListTerm[] temp = node.getListTerms().toArray(new PListTerm[0]); - String firstTermType = (String)altTransformElemTypes.get(temp[0]); + String firstTermType = altTransformElemTypes.get(temp[0]); if(firstTermType != null) { @@ -144,13 +149,14 @@ public class ComputeCGNomenclature extends DepthFirstAdapter { altTransformElemTypes.put(node, "Lnull"); } - termNumbers.put(node, new Integer(++counter)); + termNumbers.put(node, ++counter); } + @Override public void caseASimpleTerm(ASimpleTerm node) { String name; - String elemType = (String) this.altElemTypes.get( currentAlt+"."+node.getId().getText() ); + String elemType = this.altElemTypes.get( currentAlt+"."+node.getId().getText() ); if(node.getSimpleTermTail() == null) { @@ -158,13 +164,13 @@ public class ComputeCGNomenclature extends DepthFirstAdapter if(name.startsWith("P") ) { //add termtail to the simpleterm - node.setSimpleTermTail( (TId)node.getId().clone() ); + node.setSimpleTermTail(node.getId().clone()); } } else { String termTail = node.getSimpleTermTail().getText(); - name = (String)prodTransformIds.prodTransformElemTypesString.get(elemType+"."+termTail); + name = prodTransformIds.prodTransformElemTypesString.get(elemType+"."+termTail); } if(name.endsWith("?")) @@ -173,7 +179,7 @@ public class ComputeCGNomenclature extends DepthFirstAdapter } altTransformElemTypes.put(node, name); - termNumbers.put(node, new Integer(++counter)); + termNumbers.put(node, ++counter); } /* @@ -235,16 +241,18 @@ public class ComputeCGNomenclature extends DepthFirstAdapter termNumbers.put(node, new Integer(++counter)); } */ + @Override public void caseANullTerm(ANullTerm node) { altTransformElemTypes.put(node, "null"); - termNumbers.put(node, new Integer(++counter)); + termNumbers.put(node, ++counter); } + @Override public void caseASimpleListTerm(ASimpleListTerm node) { String name; - String elemType = (String)altElemTypes.get( currentAlt+"."+node.getId().getText() ); + String elemType = altElemTypes.get( currentAlt+"."+node.getId().getText() ); if(node.getSimpleTermTail() == null) { @@ -252,13 +260,13 @@ public class ComputeCGNomenclature extends DepthFirstAdapter if( name.startsWith("P") ) { //add termtail to the simpleterm - node.setSimpleTermTail( (TId)node.getId().clone() ); + node.setSimpleTermTail(node.getId().clone()); } } else { String termTail = node.getSimpleTermTail().getText(); - name = (String)prodTransformIds.prodTransformElemTypesString.get(elemType+"."+termTail); + name = prodTransformIds.prodTransformElemTypesString.get(elemType+"."+termTail); } if(name.endsWith("?")) @@ -266,7 +274,7 @@ public class ComputeCGNomenclature extends DepthFirstAdapter name = name.substring(0, name.length()-1); } altTransformElemTypes.put(node, name); - termNumbers.put(node, new Integer(++counter)); + termNumbers.put(node, ++counter); } /* public void caseASimpleListTerm(ASimpleListTerm node) diff --git a/src/main/java/org/sablecc/sablecc/ComputeInlining.java b/src/main/java/org/sablecc/sablecc/ComputeInlining.java index 7926289b4b5861c7ddf500168a3d33bdef2113b9..6a0b639b24ae69c612cd42d9f9ecce82b38f1237 100644 --- a/src/main/java/org/sablecc/sablecc/ComputeInlining.java +++ b/src/main/java/org/sablecc/sablecc/ComputeInlining.java @@ -7,8 +7,11 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; /* @@ -28,19 +31,17 @@ import org.sablecc.sablecc.node.*; public class ComputeInlining { //Productions implied in a conflict - private Set setOfProdToBeInline; + private Set<String> setOfProdToBeInline; //Map of all productions in the grammar - private Map productionsMap; + private Map<String, AProd> productionsMap; private Start tree; - public ComputeInlining(Set set - , - Map productionsMap, + public ComputeInlining(Set<String> set, + Map<String, AProd> productionsMap, Start tree) { - this.setOfProdToBeInline = set - ; + this.setOfProdToBeInline = set; this.productionsMap = productionsMap; this.tree = tree; } @@ -55,21 +56,20 @@ public class ComputeInlining public boolean computeInlining() { final BooleanEx atLeastOneProductionInlined = new BooleanEx(false); - String []nameOfProds = (String[])setOfProdToBeInline.toArray(new String[0]); - - for(int i=0; i<nameOfProds.length; i++) + for(String nameOfProd : setOfProdToBeInline) { - final AProd prod = (AProd)productionsMap.get(nameOfProds[i]); + final AProd prod = productionsMap.get(nameOfProd); //We proceed inlining only if the production to inline is not recursive //and if it doesn't have more than SableCC.inliningMaxAlts alternatives. if( prod.getAlts().size() <= SableCC.inliningMaxAlts && !isProductionRecursive(prod) ) { //This class construct a special data structure for the production to inline. - final In_Production in_production = new In_Production((AProd)prod.clone()); + final In_Production in_production = new In_Production(prod.clone()); tree.apply(new DepthFirstAdapter() { + @Override public void caseAProd(AProd node) { //We do not inline the production itself. @@ -91,13 +91,12 @@ public class ComputeInlining } } - LinkedList listOfGrammarProds = ((AProductions)((AGrammar)tree.getPGrammar()).getProductions()).getProds(); + List<PProd> listOfGrammarProds = ((AProductions)((AGrammar)tree.getPGrammar()).getProductions()).getProds(); //Once the production is inlined, we do not need it anymore, so we remove it from the grammar. - String[] inlinedProductionsToRemove = (String[])Inlining.productionsToBeRemoved.toArray(new String[0]); - for(int i=0; i<inlinedProductionsToRemove.length; i++) + for(String nameOfProd : Inlining.productionsToBeRemoved) { - listOfGrammarProds.remove(productionsMap.get(inlinedProductionsToRemove[i]) ); + listOfGrammarProds.remove(productionsMap.get(nameOfProd) ); } Inlining.productionsToBeRemoved.clear(); @@ -115,6 +114,7 @@ public class ComputeInlining production.apply(new DepthFirstAdapter() { + @Override public void caseAProd(AProd node) { Object temp[] = node.getAlts().toArray(); @@ -124,6 +124,7 @@ public class ComputeInlining } } + @Override public void caseAAlt(AAlt node) { Object temp[] = node.getElems().toArray(); @@ -133,6 +134,7 @@ public class ComputeInlining } } + @Override public void caseAElem(AElem node) { if(node.getId().getText().equals(currentProdName)) diff --git a/src/main/java/org/sablecc/sablecc/ComputeSimpleTermPosition.java b/src/main/java/org/sablecc/sablecc/ComputeSimpleTermPosition.java index 792f9c487372e60b3d4a58ffde0b591981e40b76..003e60d9839c000e09e210567fda16acadf53e07 100644 --- a/src/main/java/org/sablecc/sablecc/ComputeSimpleTermPosition.java +++ b/src/main/java/org/sablecc/sablecc/ComputeSimpleTermPosition.java @@ -7,10 +7,11 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; public class ComputeSimpleTermPosition extends DepthFirstAdapter { @@ -20,25 +21,23 @@ public class ComputeSimpleTermPosition extends DepthFirstAdapter private ResolveIds ids; private int counter; - public final Map positionsMap = new TypedHashMap( - StringCast.instance, - StringCast.instance); + public final Map<String, String> positionsMap = new HashMap<>(); - public final Map elems_position = new TypedHashMap( - StringCast.instance, - IntegerCast.instance); + public final Map<String, Integer> elems_position = new HashMap<>(); public ComputeSimpleTermPosition(ResolveIds ids) { this.ids = ids; } + @Override public void inAProd(AProd node) { - currentProd = ids.name(node.getId().getText()); + currentProd = ResolveIds.name(node.getId().getText()); ids.names.put(node, currentProd); } + @Override public void inAAlt(AAlt node) { counter = 0; @@ -47,7 +46,7 @@ public class ComputeSimpleTermPosition extends DepthFirstAdapter if(node.getAltName() != null) { currentAlt = "A" + - ids.name( node.getAltName().getText() ) + + ResolveIds.name( node.getAltName().getText() ) + currentProd; } else @@ -58,6 +57,7 @@ public class ComputeSimpleTermPosition extends DepthFirstAdapter ids.names.put(node, currentAlt); } + @Override public void inAElem(AElem node) { if(processingParsedAlt) @@ -72,7 +72,7 @@ public class ComputeSimpleTermPosition extends DepthFirstAdapter currentElemName = currentAlt + "." + node.getId().getText(); } - elems_position.put(currentElemName, new Integer(++counter)); + elems_position.put(currentElemName, ++counter); } if(node.getSpecifier() != null && @@ -81,9 +81,7 @@ public class ComputeSimpleTermPosition extends DepthFirstAdapter return; } - String name = ids.name( node.getId().getText() ); - - String elemType = (String)ids.elemTypes.get(node); + String elemType = ids.elemTypes.get(node); if(processingParsedAlt && elemType.startsWith("P")) { String elemName; @@ -100,6 +98,7 @@ public class ComputeSimpleTermPosition extends DepthFirstAdapter } } + @Override public void outAAlt(AAlt node) { processingParsedAlt = false; diff --git a/src/main/java/org/sablecc/sablecc/ConflictException.java b/src/main/java/org/sablecc/sablecc/ConflictException.java index 9dc3a376edde0b46520b4f2d0a2eee779e4734cf..d3e8db8da4d4d8ea44c1564ea28c976650e605bf 100644 --- a/src/main/java/org/sablecc/sablecc/ConflictException.java +++ b/src/main/java/org/sablecc/sablecc/ConflictException.java @@ -7,20 +7,20 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.node.*; import java.util.Set; +@SuppressWarnings("serial") public class ConflictException extends Exception { - private Set conflictualProductions; + private Set<String> conflictualProductions; - public ConflictException(Set conflictualProductions, String message) + public ConflictException(Set<String> conflictualProductions, String message) { super(message); this.conflictualProductions = conflictualProductions; } - public Set getConflictualProductions() + public Set<String> getConflictualProductions() { return conflictualProductions; } diff --git a/src/main/java/org/sablecc/sablecc/ConstructNFA.java b/src/main/java/org/sablecc/sablecc/ConstructNFA.java index 33c65ecd543bf08c5269c7ce93ddd97e920e9019..15a5708b1f33c08d08ab9fec4f527d320e55f2d0 100644 --- a/src/main/java/org/sablecc/sablecc/ConstructNFA.java +++ b/src/main/java/org/sablecc/sablecc/ConstructNFA.java @@ -7,8 +7,13 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; public class ConstructNFA extends DepthFirstAdapter @@ -16,86 +21,73 @@ public class ConstructNFA extends DepthFirstAdapter private ResolveIds ids; private String stateName; - private int i; + private Map<Node, Object> nodeValues; // values are of type CharSet or NFA + private Map<PTokenDef, NFA> nfasByToken; + private NFA fullNFA; ConstructNFA(ResolveIds ids, String stateName) { this.ids = ids; this.stateName = stateName; - } - - public void outStart(Start node) - { - setOut(node, getOut(node.getPGrammar())); - // free memory - if(getOut(node.getPGrammar()) != null) - setOut(node.getPGrammar(), null); + this.nodeValues = new HashMap<>(); + this.nfasByToken = new HashMap<>(); + this.fullNFA = null; } - public void outAGrammar(AGrammar node) - { - setOut(node, getOut(node.getTokens())); - - // free memory - if(getOut(node.getTokens()) != null) - setOut(node.getTokens(), null); + public NFA getNFA() { + return this.fullNFA; } + @Override public void outAHelperDef(AHelperDef node) { - setOut(node, getOut(node.getRegExp())); + this.nodeValues.put(node, this.nodeValues.get(node.getRegExp())); // free memory - if(getOut(node.getRegExp()) != null) - setOut(node.getRegExp(), null); + this.nodeValues.remove(node.getRegExp()); } + @Override public void outATokens(ATokens node) { - ATokenDef[] tokenDefs = (ATokenDef[]) node.getTokenDefs().toArray(new ATokenDef[0]); - NFA result = null; + PTokenDef[] tokenDefs = node.getTokenDefs().toArray(new PTokenDef[0]); for(int i = tokenDefs.length - 1; i >= 0 ; i--) { - NFA nfa = (NFA) getOut(tokenDefs[i]); + NFA nfa = this.nfasByToken.get(tokenDefs[i]); if(nfa != null) { - if(result == null) + if(fullNFA == null) { - result = nfa; + fullNFA = nfa; } else { - result = nfa.merge(result); + fullNFA = nfa.merge(fullNFA); } // free memory - if(getOut(tokenDefs[i]) != null) - setOut(tokenDefs[i], null); + this.nfasByToken.remove(tokenDefs[i]); } } - - if(result != null) - setOut(node, result); } + @Override public void outATokenDef(ATokenDef node) { - Set set - = (Set) getOut(node.getStateList()); - Object o1 = getOut(node.getRegExp()); + Set<String> set = stateNamesFromStateList(node.getStateList()); + Object o1 = this.nodeValues.get(node.getRegExp()); - if((set - == null) || (set.size() == 0) || set.contains(stateName)) + if(set.isEmpty() || set.contains(stateName)) { //System.out.print("*"); NFA n1 = (o1 instanceof NFA) ? (NFA) o1 : new NFA((CharSet) o1); - String name = (String) ids.names.get(node); + String name = ids.names.get(node); n1.states[n1.states.length - 1].accept = name; - setOut(node, n1); + this.nfasByToken.put(node, n1); } else { @@ -103,17 +95,18 @@ public class ConstructNFA extends DepthFirstAdapter } // free memory - if(getOut(node.getStateList()) != null) - setOut(node.getStateList(), null); - if(getOut(node.getRegExp()) != null) - setOut(node.getRegExp(), null); + this.nodeValues.remove(node.getRegExp()); } - public void outAStateList(AStateList node) + private static Set<String> stateNamesFromStateList(PStateList stateList) { - Set set - = new TreeSet(); - AStateListTail[] stateListTails = (AStateListTail[]) node.getStateLists().toArray(new AStateListTail[0]); + if (stateList == null) { + return Collections.emptySet(); + } + + final AStateList node = (AStateList)stateList; + Set<String> set = new TreeSet<>(); + AStateListTail[] stateListTails = node.getStateLists().toArray(new AStateListTail[0]); for(int i = stateListTails.length - 1; i >= 0 ; i--) { @@ -122,20 +115,20 @@ public class ConstructNFA extends DepthFirstAdapter } set.add(node.getId().getText().toUpperCase()); - setOut(node, set - ); + return set; } + @Override public void outARegExp(ARegExp node) { - AConcat[] concats = (AConcat[]) node.getConcats().toArray(new AConcat[0]); + PConcat[] concats = node.getConcats().toArray(new PConcat[0]); NFA result = null; if(concats.length > 1) { for(int i = concats.length - 1; i >= 0 ; i--) { - Object o = getOut(concats[i]); + Object o = this.nodeValues.get(concats[i]); NFA nfa = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); if(result == null) @@ -148,36 +141,34 @@ public class ConstructNFA extends DepthFirstAdapter } // free memory - if(getOut(concats[i]) != null) - setOut(concats[i], null); + this.nodeValues.remove(concats[i]); } - setOut(node, result); + this.nodeValues.put(node, result); } else if(concats.length == 1) { - setOut(node, getOut(concats[0])); + this.nodeValues.put(node, this.nodeValues.get(concats[0])); // free memory - if(getOut(concats[0]) != null) - setOut(concats[0], null); + this.nodeValues.remove(concats[0]); } } + @Override public void outAConcat(AConcat node) { - AUnExp[] unExps = (AUnExp[]) node.getUnExps().toArray(new AUnExp[0]); + PUnExp[] unExps = node.getUnExps().toArray(new PUnExp[0]); if(unExps.length == 0) { - setOut(node, new NFA()); + this.nodeValues.put(node, new NFA()); } else if(unExps.length == 1) { - setOut(node, getOut(unExps[0])); + this.nodeValues.put(node, this.nodeValues.get(unExps[0])); // free memory - if(getOut(unExps[0]) != null) - setOut(unExps[0], null); + this.nodeValues.remove(unExps[0]); } else { @@ -185,7 +176,7 @@ public class ConstructNFA extends DepthFirstAdapter for(int i = unExps.length - 1; i >= 0 ; i--) { - Object o = getOut(unExps[i]); + Object o = this.nodeValues.get(unExps[i]); NFA nfa = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); if(result == null) @@ -198,220 +189,149 @@ public class ConstructNFA extends DepthFirstAdapter } // free memory - if(getOut(unExps[i]) != null) - setOut(unExps[i], null); + this.nodeValues.remove(unExps[i]); } - setOut(node, result); + this.nodeValues.put(node, result); } } + @Override public void outAUnExp(AUnExp node) { - Object o = getOut(node.getBasic()); + Object o = this.nodeValues.get(node.getBasic()); - char c = ' '; - if(node.getUnOp() != null) - c = ((Character) getOut(node.getUnOp())).charValue(); - - switch(c) + if(node.getUnOp() instanceof AStarUnOp) { - case '*': - { - NFA n = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); - setOut(node, n.zeroOrMore()); - } - break; - case '?': - { - NFA n = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); - setOut(node, n.zeroOrOne()); - } - break; - case '+': - { - NFA n = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); - setOut(node, n.oneOrMore()); - } - break; - default: - { - setOut(node, o); - } - break; + NFA n = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); + this.nodeValues.put(node, n.zeroOrMore()); + } + else if(node.getUnOp() instanceof AQMarkUnOp) + { + NFA n = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); + this.nodeValues.put(node, n.zeroOrOne()); + } + else if(node.getUnOp() instanceof APlusUnOp) + { + NFA n = (o instanceof NFA) ? (NFA) o : new NFA((CharSet) o); + this.nodeValues.put(node, n.oneOrMore()); + } + else + { + this.nodeValues.put(node, o); } // free memory - if(getOut(node.getBasic()) != null) - setOut(node.getBasic(), null); - if(getOut(node.getUnOp()) != null) - setOut(node.getUnOp(), null); + this.nodeValues.remove(node.getBasic()); } + @Override public void outACharBasic(ACharBasic node) { - char c = ((Character) getOut(node.getChar())).charValue(); - setOut(node, new CharSet(c)); - - // free memory - if(getOut(node.getChar()) != null) - setOut(node.getChar(), null); + char c = charValue(node.getChar()); + this.nodeValues.put(node, new CharSet(c)); } + @Override public void outASetBasic(ASetBasic node) { - setOut(node, getOut(node.getSet())); + this.nodeValues.put(node, this.nodeValues.get(node.getSet())); // free memory - if(getOut(node.getSet()) != null) - setOut(node.getSet(), null); + this.nodeValues.remove(node.getSet()); } + @Override public void outAStringBasic(AStringBasic node) { String s = node.getString().getText(); s = s.substring(1, s.length() -1); - setOut(node, new NFA(s)); + this.nodeValues.put(node, new NFA(s)); } + @Override public void outAIdBasic(AIdBasic node) { - Object o = getOut((Node) ids.helpers.get(node.getId().getText())); + Object o = this.nodeValues.get(ids.helpers.get(node.getId().getText())); if(o instanceof NFA) { - setOut(node, ((NFA) o).clone()); + this.nodeValues.put(node, ((NFA) o).clone()); } else { - setOut(node, ((CharSet) o).clone()); + this.nodeValues.put(node, ((CharSet) o).clone()); } } + @Override public void outARegExpBasic(ARegExpBasic node) { - setOut(node, getOut(node.getRegExp())); + this.nodeValues.put(node, this.nodeValues.get(node.getRegExp())); // free memory - if(getOut(node.getRegExp()) != null) - setOut(node.getRegExp(), null); + this.nodeValues.remove(node.getRegExp()); } - public void outACharChar(ACharChar node) - { - setOut(node, new Character(node.getChar().getText().charAt(1))); - } - - public void outADecChar(ADecChar node) - { - setOut(node, new Character((char) Integer.parseInt(node.getDecChar().getText()))); - } - - public void outAHexChar(AHexChar node) - { - setOut(node, new Character((char) - Integer.parseInt(node.getHexChar().getText().substring(2), 16))); + private static char charValue(final PChar node) { + if(node instanceof ACharChar) + { + return ((ACharChar)node).getChar().getText().charAt(1); + } + else if(node instanceof ADecChar) + { + return (char)Integer.parseInt(((ADecChar)node).getDecChar().getText()); + } + else if(node instanceof AHexChar) + { + return (char)Integer.parseInt(((AHexChar)node).getHexChar().getText().substring(2), 16); + } + else + { + throw new IllegalArgumentException("Unhandled char type: " + node.getClass()); + } } + @Override public void outAOperationSet(AOperationSet node) { try { - CharSet cs1 = (CharSet) getOut(node.getLeft()); - CharSet cs2 = (CharSet) getOut(node.getRight()); - char binop = ((Character) getOut(node.getBinOp())).charValue(); + CharSet cs1 = (CharSet) this.nodeValues.get(node.getLeft()); + CharSet cs2 = (CharSet) this.nodeValues.get(node.getRight()); - switch(binop) + if(node.getBinOp() instanceof APlusBinOp) { - case '+': - { - setOut(node, cs1.union(cs2)); - } - break; - case '-': - { - setOut(node, cs1.diff(cs2)); - } - break; + this.nodeValues.put(node, cs1.union(cs2)); + } + else if(node.getBinOp() instanceof AMinusBinOp) + { + this.nodeValues.put(node, cs1.diff(cs2)); } } - catch(Exception e) + catch(RuntimeException e) { - throw new RuntimeException(node + " is invalid."); + throw new RuntimeException(node + " is invalid.", e); } // free memory - if(getOut(node.getLeft()) != null) - setOut(node.getLeft(), null); - if(getOut(node.getBinOp()) != null) - setOut(node.getBinOp(), null); - if(getOut(node.getRight()) != null) - setOut(node.getRight(), null); + this.nodeValues.remove(node.getLeft()); + this.nodeValues.remove(node.getRight()); } + @Override public void outAIntervalSet(AIntervalSet node) { - char c1 = ((Character) getOut(node.getLeft())).charValue(); - char c2 = ((Character) getOut(node.getRight())).charValue(); + char c1 = charValue(node.getLeft()); + char c2 = charValue(node.getRight()); if(c1 > c2) { throw new RuntimeException(node + " is invalid."); } - setOut(node, new CharSet(c1, c2)); - - // free memory - if(getOut(node.getLeft()) != null) - setOut(node.getLeft(), null); - if(getOut(node.getRight()) != null) - setOut(node.getRight(), null); - } - - public void outAStarUnOp(AStarUnOp node) - { - setOut(node, new Character('*')); - } - - public void outAQMarkUnOp(AQMarkUnOp node) - { - setOut(node, new Character('?')); - } - - public void outAPlusUnOp(APlusUnOp node) - { - setOut(node, new Character('+')); - } - - public void outAPlusBinOp(APlusBinOp node) - { - setOut(node, new Character('+')); - } - - public void outAMinusBinOp(AMinusBinOp node) - { - setOut(node, new Character('-')); - } - - public Object getOut(Node node) - { - if(node == null) - { - return null; - } - - return super.getOut(node); - } - - public void setOut(Node node, Object out) - { - if(node == null) - { - throw new NullPointerException(); - } - - super.setOut(node, out); + this.nodeValues.put(node, new CharSet(c1, c2)); } } diff --git a/src/main/java/org/sablecc/sablecc/ConstructParserGenerationDatas.java b/src/main/java/org/sablecc/sablecc/ConstructParserGenerationDatas.java index c14f56ae44d6fa8a4e245f1c256d3bf61c995445..41e525d22071ce5ba261c752203979f98be107a7 100644 --- a/src/main/java/org/sablecc/sablecc/ConstructParserGenerationDatas.java +++ b/src/main/java/org/sablecc/sablecc/ConstructParserGenerationDatas.java @@ -7,8 +7,9 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; public class ConstructParserGenerationDatas extends DepthFirstAdapter @@ -18,42 +19,44 @@ public class ConstructParserGenerationDatas extends DepthFirstAdapter private boolean processingAst; private String currentProd; - private Map alts; + private Map<String, Node> alts; - public ConstructParserGenerationDatas(ResolveIds ids, Map alts) + public ConstructParserGenerationDatas(ResolveIds ids, Map<String, Node> alts) { this.ids = ids; this.alts = alts; } + @Override public void caseAAst(AAst node) {} + @Override public void caseAProd(AProd node) { - currentProd = (String) ids.names.get(node); - AAlt[] alts = (AAlt[])node.getAlts().toArray(new AAlt[0]); - for(int i=0; i<alts.length; i++) + currentProd = ids.names.get(node); + for(PAlt alt : node.getAlts()) { - alts[i].apply(this); + alt.apply(this); } } + @Override public void caseAAlt(AAlt node) { - currentAlt = Grammar.addProduction(currentProd, (String) ids.names.get(node)); + currentAlt = Grammar.addProduction(currentProd, ids.names.get(node)); alts.put(ids.names.get(node), node); - AElem[] temp = (AElem[])node.getElems().toArray(new AElem[0]); - for(int i = 0; i < temp.length; i++) + for(PElem elem : node.getElems()) { - temp[i].apply(this); + elem.apply(this); } } + @Override public void caseAElem(AElem node) { - String name = ids.name(node.getId().getText()); + String name = ResolveIds.name(node.getId().getText()); if(node.getSpecifier() != null) { @@ -68,8 +71,7 @@ public class ConstructParserGenerationDatas extends DepthFirstAdapter } else { - Object token = ids.tokens.get("T" + name); - Object production = ids.prods.get("P" + name); + ATokenDef token = ids.tokens.get("T" + name); if(token != null) { @@ -80,7 +82,7 @@ public class ConstructParserGenerationDatas extends DepthFirstAdapter ids.elemTypes.put(node, "P" + name); } } - name = (String) ids.elemTypes.get(node); + name = ids.elemTypes.get(node); Grammar.addSymbolToProduction(name, currentAlt); } } diff --git a/src/main/java/org/sablecc/sablecc/ConstructProdsMap.java b/src/main/java/org/sablecc/sablecc/ConstructProdsMap.java index cd02575b46d8d4691fa69a2f116ce602ce79fc7a..16b86b8cf87b5669bcbd7286bf19f7401780d070 100644 --- a/src/main/java/org/sablecc/sablecc/ConstructProdsMap.java +++ b/src/main/java/org/sablecc/sablecc/ConstructProdsMap.java @@ -7,18 +7,19 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; -import org.sablecc.sablecc.node.*; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; +import org.sablecc.sablecc.node.AProd; public class ConstructProdsMap extends DepthFirstAdapter { - public Map productionsMap = - new TypedTreeMap(StringCast.instance, - NodeCast.instance); + public Map<String, AProd> productionsMap = new TreeMap<>(); private String currentProd; + @Override public void caseAProd(AProd node) { currentProd = ResolveIds.name(node.getId().getText()); diff --git a/src/main/java/org/sablecc/sablecc/DFA.java b/src/main/java/org/sablecc/sablecc/DFA.java index 3747676983ecd37dabafb1877dd4221d7fd088a3..60edb45f70662ea1de639b51d9963de66a5fe143 100644 --- a/src/main/java/org/sablecc/sablecc/DFA.java +++ b/src/main/java/org/sablecc/sablecc/DFA.java @@ -7,8 +7,10 @@ package org.sablecc.sablecc; -import java.util.Vector; -import java.util.Hashtable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class DFA { @@ -20,17 +22,17 @@ public class DFA } public NFA nfa; - public final Vector states = new Vector(0); - public final Hashtable finder = new Hashtable(1); + public final List<State> states = new ArrayList<>(); + public final Map<IntSet, Integer> finder = new HashMap<>(); private void optimize() { - Vector transitions = new Vector(0); + List<List<DFA.Transition>> transitions = new ArrayList<>(); for(int i = 0; i < states.size(); i++) { - DFA.State state = (DFA.State) states.elementAt(i); - transitions.addElement(new Vector(0)); + DFA.State state = states.get(i); + transitions.add(new ArrayList<DFA.Transition>()); for(int j = 0; j < state.transitions.size(); j++) { @@ -50,15 +52,12 @@ public class DFA if(max < 2) { - ((Vector) transitions.elementAt(i)).addElement( - state.transitions.elementAt(j)); + transitions.get(i).add(state.transitions.get(j)); } else { - DFA.Transition transition1 = - (DFA.Transition) state.transitions.elementAt(j); - DFA.Transition transition2 = - (DFA.Transition) state.transitions.elementAt(j + max - 1); + DFA.Transition transition1 = state.transitions.get(j); + DFA.Transition transition2 = state.transitions.get(j + max - 1); DFA.Transition transition = new DFA.Transition( @@ -67,7 +66,7 @@ public class DFA transition2.interval().end), -2 - st); - ((Vector) transitions.elementAt(i)).addElement(transition); + transitions.get(i).add(transition); j += max - 1; } } @@ -75,25 +74,23 @@ public class DFA for(int i = 0; i < states.size(); i++) { - DFA.State state = (DFA.State) states.elementAt(i); - state.transitions = (Vector) transitions.elementAt(i); + DFA.State state = states.get(i); + state.transitions = transitions.get(i); } } private int match(int st1, int tr, int st2) { - DFA.State state1 = (DFA.State) states.elementAt(st1); - DFA.State state2 = (DFA.State) states.elementAt(st2); + DFA.State state1 = states.get(st1); + DFA.State state2 = states.get(st2); - DFA.Transition first = - (DFA.Transition) state1.transitions.elementAt(tr); + DFA.Transition first = state1.transitions.get(tr); int j = -1; for(int i = 0; i < state2.transitions.size(); i++) { - DFA.Transition transition = - (DFA.Transition) state2.transitions.elementAt(i); + DFA.Transition transition = state2.transitions.get(i); if(transition.match(first)) { @@ -113,11 +110,9 @@ public class DFA while((i < state1.transitions.size()) && (j < state2.transitions.size())) { - DFA.Transition transition1 = - (DFA.Transition) state1.transitions.elementAt(i); + DFA.Transition transition1 = state1.transitions.get(i); - DFA.Transition transition2 = - (DFA.Transition) state2.transitions.elementAt(j); + DFA.Transition transition2 = state2.transitions.get(j); if(!transition1.match(transition2)) { @@ -140,15 +135,15 @@ public class DFA initial.or(eclosure(0)); State state = new State(initial); - states.addElement(state); - finder.put(state.nfaStates, new Integer(0)); + states.add(state); + finder.put(state.nfaStates, 0); int i = -1; while(++i < states.size()) { System.out.print("."); - state = (State) states.elementAt(i); + state = states.get(i); CharSet.Interval interval = new CharSet.Interval((char) 0, (char) 0xffff); @@ -217,21 +212,21 @@ public class DFA if(modified) { destination = eclosure(destination); - Integer dest = (Integer) finder.get(destination); + Integer dest = finder.get(destination); if(dest != null) { - state.transitions.addElement( - new Transition((CharSet.Interval) interval.clone(), dest.intValue())); + state.transitions.add( + new Transition(interval.clone(), dest.intValue())); } else { State s = new State(destination); - states.addElement(s); - finder.put(s.nfaStates, new Integer(states.size() - 1)); + states.add(s); + finder.put(s.nfaStates, states.size() - 1); - state.transitions.addElement( - new Transition((CharSet.Interval) interval.clone(), states.size() - 1)); + state.transitions.add( + new Transition(interval.clone(), states.size() - 1)); } } @@ -255,12 +250,9 @@ public class DFA { System.out.print("."); - IntSet set - = new IntSet(); - eclosure(i, set - ); - eclosures[i] = set - ; + IntSet set = new IntSet(); + eclosure(i, set); + eclosures[i] = set; } System.out.println(); @@ -314,14 +306,17 @@ public class DFA return result; } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for(int i = 0; i < states.size(); i++) { - result.append(i + ": " + states.elementAt(i) + - System.getProperty("line.separator")); + result.append(i); + result.append(": "); + result.append(states.get(i)); + result.append(System.getProperty("line.separator")); } return result.toString(); @@ -335,12 +330,13 @@ public class DFA } public IntSet nfaStates = new IntSet(); - public Vector transitions = new Vector(0); + public List<Transition> transitions = new ArrayList<>(); public int accept; + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); /* for(int i = 0; i < nfaStates.size(); i++) { @@ -353,12 +349,13 @@ public class DFA } }*/ - for(int i = 0; i < transitions.size(); i++) + for(DFA.Transition transition : transitions) { - result.append(transitions.elementAt(i) + ","); + result.append(transition); + result.append(","); } - return result /*+ " " + nfaStates*/ + ""; + return result.toString() /*+ " " + nfaStates*/; } } @@ -388,6 +385,7 @@ public class DFA destination = transition.destination; } + @Override public String toString() { return destination + ":[" + interval() + "]"; diff --git a/src/main/java/org/sablecc/sablecc/DisplayLicense.java b/src/main/java/org/sablecc/sablecc/DisplayLicense.java index 7fae95d3db32ab0462f83179f4c492e1d81471c8..75452da78c7e11502f8a9185b05cf6c15a267a62 100644 --- a/src/main/java/org/sablecc/sablecc/DisplayLicense.java +++ b/src/main/java/org/sablecc/sablecc/DisplayLicense.java @@ -7,7 +7,9 @@ package org.sablecc.sablecc; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; class DisplayLicense { @@ -59,9 +61,9 @@ class DisplayLicense in.close(); System.out.println("---- END OF FILE: COPYING-LESSER ----"); } - catch(Exception e) + catch(IOException | RuntimeException e) { - System.out.println(e); + e.printStackTrace(); System.exit(1); } } diff --git a/src/main/java/org/sablecc/sablecc/GenAlts.java b/src/main/java/org/sablecc/sablecc/GenAlts.java index db62b6d9eb2750bd8eb810d57b093322e81e8d97..e2e706c9ff3be96128ed017a05b2cfa30ee4cd5c 100644 --- a/src/main/java/org/sablecc/sablecc/GenAlts.java +++ b/src/main/java/org/sablecc/sablecc/GenAlts.java @@ -7,10 +7,17 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; public class GenAlts extends DepthFirstAdapter { @@ -18,7 +25,7 @@ public class GenAlts extends DepthFirstAdapter private ResolveAstIds ast_ids; private File pkgDir; private String pkgName; - private List elemList; + private List<ElemInfo> elemList; private String currentProd; ElemInfo info; @@ -35,7 +42,7 @@ public class GenAlts extends DepthFirstAdapter } catch(IOException e) { - throw new RuntimeException("unable to open alternatives.txt."); + throw new RuntimeException("unable to open alternatives.txt.", e); } pkgDir = new File(ast_ids.astIds.pkgDir, "node"); @@ -50,40 +57,47 @@ public class GenAlts extends DepthFirstAdapter } } + @Override public void inAAstProd(AAstProd node) { - currentProd = (String) ast_ids.ast_names.get(node); + currentProd = ast_ids.ast_names.get(node); } + @Override public void inAAstAlt(AAstAlt node) { - elemList = new TypedLinkedList(ElemInfoCast.instance); + elemList = new LinkedList<>(); } + @Override public void caseAProductions(AProductions node) {} + @Override public void inAElem(AElem node) { info = new ElemInfo(); - info.name = (String) ast_ids.ast_names.get(node); - info.type = (String) ast_ids.ast_elemTypes.get(node); + info.name = ast_ids.ast_names.get(node); + info.type = ast_ids.ast_elemTypes.get(node); info.operator = ElemInfo.NONE; if(node.getUnOp() != null) { node.getUnOp().apply(new DepthFirstAdapter() { + @Override public void caseAStarUnOp(AStarUnOp node) { info.operator = ElemInfo.STAR; } + @Override public void caseAQMarkUnOp(AQMarkUnOp node) { info.operator = ElemInfo.QMARK; } + @Override public void caseAPlusUnOp(APlusUnOp node) { info.operator = ElemInfo.PLUS; @@ -95,31 +109,17 @@ public class GenAlts extends DepthFirstAdapter info = null; } + @Override public void outAAstAlt(AAstAlt node) { - String name = (String) ast_ids.ast_names.get(node); + String name = ast_ids.ast_names.get(node); - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, name + ".java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, name + ".java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, name + ".java")))) { boolean hasOperator = false; boolean hasList = false; - for(Iterator i = elemList.iterator(); i.hasNext();) - { - ElemInfo info = (ElemInfo) i.next(); + for(ElemInfo info : elemList) { if(info != null) switch(info.operator) { @@ -143,9 +143,8 @@ public class GenAlts extends DepthFirstAdapter ast_ids.astIds.pkgName.equals("") ? "analysis" : ast_ids.astIds.pkgName + ".analysis", name, currentProd}); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(ElemInfo info : elemList) { - ElemInfo info = (ElemInfo) i.next(); if(info != null) switch(info.operator) { @@ -178,9 +177,9 @@ public class GenAlts extends DepthFirstAdapter macros.apply(file, "ConstructorHeader", new String[] {name}); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(Iterator<ElemInfo> i = elemList.iterator(); i.hasNext();) { - ElemInfo info = (ElemInfo) i.next(); + ElemInfo info = i.next(); if(info != null) switch(info.operator) { @@ -203,10 +202,8 @@ public class GenAlts extends DepthFirstAdapter macros.apply(file, "ConstructorBodyHeader", null); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(ElemInfo info : elemList) { - ElemInfo info = (ElemInfo) i.next(); - if(info != null ) switch(info.operator) { @@ -234,9 +231,9 @@ public class GenAlts extends DepthFirstAdapter macros.apply(file, "CloneHeader", new String[] {name}); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(Iterator<ElemInfo> i = elemList.iterator(); i.hasNext();) { - ElemInfo info = (ElemInfo) i.next(); + ElemInfo info = i.next(); if(info != null) switch(info.operator) { @@ -244,27 +241,25 @@ public class GenAlts extends DepthFirstAdapter case ElemInfo.NONE: { macros.apply(file, "CloneBodyNode", - new String[] {info.type, nodeName(info.name), i.hasNext() ? "," : ""}); + new String[] {info.name, nodeName(info.name)}); } break; case ElemInfo.STAR: case ElemInfo.PLUS: { macros.apply(file, "CloneBodyList", - new String[] {nodeName(info.name), i.hasNext() ? "," : ""}); + new String[] {info.name, nodeName(info.name)}); } break; } } - macros.apply(file, "CloneTail", null); + macros.apply(file, "CloneTail", new String[] {name}); macros.apply(file, "Apply", new String[] {name}); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(ElemInfo info : elemList) { - ElemInfo info = (ElemInfo) i.next(); - if(info != null) switch(info.operator) { @@ -286,10 +281,8 @@ public class GenAlts extends DepthFirstAdapter } macros.apply(file, "ToStringHeader", null); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(ElemInfo info : elemList) { - ElemInfo info = (ElemInfo) i.next(); - if(info != null) switch(info.operator) { @@ -312,10 +305,8 @@ public class GenAlts extends DepthFirstAdapter macros.apply(file, "ToStringTail", null); macros.apply(file, "RemoveChildHeader", null); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(ElemInfo info : elemList) { - ElemInfo info = (ElemInfo) i.next(); - if(info != null) switch(info.operator) { @@ -338,10 +329,8 @@ public class GenAlts extends DepthFirstAdapter macros.apply(file, "RemoveChildTail", null); macros.apply(file, "ReplaceChildHeader", null); - for(Iterator i = elemList.iterator(); i.hasNext();) + for(ElemInfo info : elemList) { - ElemInfo info = (ElemInfo) i.next(); - if(info != null) switch(info.operator) { @@ -368,22 +357,15 @@ public class GenAlts extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, name + ".java").getAbsolutePath()); + new File(pkgDir, name + ".java").getAbsolutePath(), e); } - try - { - file.close(); - } - catch(IOException e) - {} - elemList = null; } public static String nodeName(String s) { - StringBuffer result = new StringBuffer(s); + StringBuilder result = new StringBuilder(s); if(result.length() > 0) { @@ -404,17 +386,4 @@ public class GenAlts extends DepthFirstAdapter String type; int operator; } - - private static class ElemInfoCast implements Cast - { - public final static ElemInfoCast instance = new ElemInfoCast(); - - private ElemInfoCast() - {} - - public Object cast(Object o) - { - return (ElemInfo) o; - } - } } diff --git a/src/main/java/org/sablecc/sablecc/GenAnalyses.java b/src/main/java/org/sablecc/sablecc/GenAnalyses.java index 2e7eb94e7f3194e89920e783e1a212681c859dd6..629a7f4db76bae1f6257787b7c816b0f28435690 100644 --- a/src/main/java/org/sablecc/sablecc/GenAnalyses.java +++ b/src/main/java/org/sablecc/sablecc/GenAnalyses.java @@ -7,10 +7,17 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; public class GenAnalyses extends DepthFirstAdapter { @@ -18,9 +25,9 @@ public class GenAnalyses extends DepthFirstAdapter private ResolveAstIds ast_ids; private File pkgDir; private String pkgName; - private List elemList; - private List altList = new TypedLinkedList(AltInfoCast.instance); - private List tokenList = new TypedLinkedList(StringCast.instance); + private List<ElemInfo> elemList; + private List<AltInfo> altList = new LinkedList<>(); + private List<String> tokenList = new LinkedList<>(); private String mainProduction; ElemInfo info; @@ -37,7 +44,7 @@ public class GenAnalyses extends DepthFirstAdapter } catch(IOException e) { - throw new RuntimeException("unable to open analyses.txt."); + throw new RuntimeException("unable to open analyses.txt.", e); } pkgDir = new File(ast_ids.astIds.pkgDir, "analysis"); @@ -52,33 +59,38 @@ public class GenAnalyses extends DepthFirstAdapter } } + @Override public void inAAstProd(AAstProd node) { if(mainProduction == null) { - mainProduction = (String) ast_ids.ast_names.get(node); + mainProduction = ast_ids.ast_names.get(node); } } + @Override public void inATokenDef(ATokenDef node) { tokenList.add(ast_ids.astIds.names.get(node)); } + @Override public void inAAstAlt(AAstAlt node) { - elemList = new TypedLinkedList(ElemInfoCast.instance); + elemList = new LinkedList<>(); } + @Override public void caseAProductions(AProductions node) {} + @Override public void inAElem(AElem node) { info = new ElemInfo(); - info.name = (String) ast_ids.ast_names.get(node); - info.type = (String) ast_ids.ast_elemTypes.get(node); + info.name = ast_ids.ast_names.get(node); + info.type = ast_ids.ast_elemTypes.get(node); info.operator = ElemInfo.NONE; if(node.getUnOp() != null) @@ -86,16 +98,19 @@ public class GenAnalyses extends DepthFirstAdapter node.getUnOp().apply(new DepthFirstAdapter() { + @Override public void caseAStarUnOp(AStarUnOp node) { info.operator = ElemInfo.STAR; } + @Override public void caseAQMarkUnOp(AQMarkUnOp node) { info.operator = ElemInfo.QMARK; } + @Override public void caseAPlusUnOp(APlusUnOp node) { info.operator = ElemInfo.PLUS; @@ -108,17 +123,19 @@ public class GenAnalyses extends DepthFirstAdapter info = null; } + @Override public void outAAstAlt(AAstAlt node) { AltInfo info = new AltInfo(); - info.name = (String) ast_ids.ast_names.get(node); + info.name = ast_ids.ast_names.get(node); info.elems.addAll(elemList); elemList = null; altList.add(info); } + @Override public void outStart(Start node) { createAnalysis(); @@ -133,20 +150,7 @@ public class GenAnalyses extends DepthFirstAdapter public void createAnalysis() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "Analysis.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "Analysis.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "Analysis.java")))) { macros.apply(file, "AnalysisHeader", new String[] {pkgName, ast_ids.astIds.pkgName.equals("") ? "node" : ast_ids.astIds.pkgName + ".node"}); @@ -155,10 +159,8 @@ public class GenAnalyses extends DepthFirstAdapter { macros.apply(file, "AnalysisStart", null); - for(Iterator i = altList.iterator(); i.hasNext();) + for(AltInfo info : altList) { - AltInfo info = (AltInfo) i.next(); - macros.apply(file, "AnalysisBody", new String[] {info.name}); } @@ -166,10 +168,10 @@ public class GenAnalyses extends DepthFirstAdapter file.newLine(); } - for(Iterator i = tokenList.iterator(); i.hasNext();) + for(String token : tokenList) { macros.apply(file, "AnalysisBody", - new String[] {(String) i.next()}); + new String[] {token}); } macros.apply(file, "AnalysisTail", null); @@ -177,33 +179,13 @@ public class GenAnalyses extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Analysis.java").getAbsolutePath()); + new File(pkgDir, "Analysis.java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } public void createAnalysisAdapter() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "AnalysisAdapter.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "AnalysisAdapter.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "AnalysisAdapter.java")))) { macros.apply(file, "AnalysisAdapterHeader", new String[] {pkgName, ast_ids.astIds.pkgName.equals("") ? "node" : ast_ids.astIds.pkgName + ".node"}); @@ -212,19 +194,17 @@ public class GenAnalyses extends DepthFirstAdapter { macros.apply(file, "AnalysisAdapterStart", null); - for(Iterator i = altList.iterator(); i.hasNext();) + for(AltInfo info : altList) { - AltInfo info = (AltInfo) i.next(); - macros.apply(file, "AnalysisAdapterBody", new String[] {info.name}); } } - for(Iterator i = tokenList.iterator(); i.hasNext();) + for(String token : tokenList) { macros.apply(file, "AnalysisAdapterBody", - new String[] {(String) i.next()}); + new String[] {token}); } macros.apply(file, "AnalysisAdapterTail", null); @@ -232,52 +212,28 @@ public class GenAnalyses extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "AnalysisAdapter.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "AnalysisAdapter.java").getAbsolutePath(), e); } - catch(IOException e) - {} } public void createDepthFirstAdapter() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "DepthFirstAdapter.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "DepthFirstAdapter.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "DepthFirstAdapter.java")))) { macros.apply(file, "DepthFirstAdapterHeader", new String[] {pkgName, ast_ids.astIds.pkgName.equals("") ? "node" : ast_ids.astIds.pkgName + ".node", mainProduction}); - for(Iterator i = altList.iterator(); i.hasNext();) + for(AltInfo info : altList) { - AltInfo info = (AltInfo) i.next(); - macros.apply(file, "DepthFirstAdapterInOut", new String[] {info.name}); macros.apply(file, "DepthFirstAdapterCaseHeader", new String[] {info.name}); - for(Iterator j = info.elems.iterator(); j.hasNext();) + for(ElemInfo eInfo : info.elems) { - ElemInfo eInfo = (ElemInfo) j.next(); - switch(eInfo.operator) { case ElemInfo.QMARK: @@ -307,51 +263,29 @@ public class GenAnalyses extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "DepthFirstAdapter.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "DepthFirstAdapter.java").getAbsolutePath(), e); } - catch(IOException e) - {} } public void createReversedDepthFirstAdapter() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "ReversedDepthFirstAdapter.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "ReversedDepthFirstAdapter.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "ReversedDepthFirstAdapter.java")))) { macros.apply(file, "ReversedDepthFirstAdapterHeader", new String[] {pkgName, ast_ids.astIds.pkgName.equals("") ? "node" : ast_ids.astIds.pkgName + ".node", mainProduction}); - for(Iterator i = altList.iterator(); i.hasNext();) + for(AltInfo info : altList) { - AltInfo info = (AltInfo) i.next(); - macros.apply(file, "DepthFirstAdapterInOut", new String[] {info.name}); macros.apply(file, "DepthFirstAdapterCaseHeader", new String[] {info.name}); - for(ListIterator j = info.elems.listIterator(info.elems.size()); j.hasPrevious();) + for(ListIterator<ElemInfo> j = info.elems.listIterator(info.elems.size()); j.hasPrevious();) { - ElemInfo eInfo = (ElemInfo) j.previous(); + ElemInfo eInfo = j.previous(); switch(eInfo.operator) { @@ -382,15 +316,8 @@ public class GenAnalyses extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "ReversedDepthFirstAdapter.java").getAbsolutePath()); + new File(pkgDir, "ReversedDepthFirstAdapter.java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } private static class ElemInfo @@ -405,35 +332,9 @@ public class GenAnalyses extends DepthFirstAdapter int operator; } - private static class ElemInfoCast implements Cast - { - final static ElemInfoCast instance = new ElemInfoCast(); - - private ElemInfoCast() - {} - - public Object cast(Object o) - { - return (ElemInfo) o; - } - } - private static class AltInfo { String name; - final List elems = new TypedLinkedList(ElemInfoCast.instance); - } - - private static class AltInfoCast implements Cast - { - final static AltInfoCast instance = new AltInfoCast(); - - private AltInfoCast() - {} - - public Object cast(Object o) - { - return (AltInfo) o; - } + final List<ElemInfo> elems = new LinkedList<>(); } } diff --git a/src/main/java/org/sablecc/sablecc/GenLexer.java b/src/main/java/org/sablecc/sablecc/GenLexer.java index 05ea7991187be01a899eb96e527b607b43255006..da9b0ca0ff96c6893c8c11b147735f062ff7d073 100644 --- a/src/main/java/org/sablecc/sablecc/GenLexer.java +++ b/src/main/java/org/sablecc/sablecc/GenLexer.java @@ -7,12 +7,23 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; -import org.sablecc.sablecc.node.*; -import java.io.*; -import java.util.Vector; -import java.util.Enumeration; +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; + +import org.sablecc.sablecc.analysis.AnalysisAdapter; +import org.sablecc.sablecc.node.ATokenDef; +import org.sablecc.sablecc.node.Start; public class GenLexer extends AnalysisAdapter { @@ -35,7 +46,7 @@ public class GenLexer extends AnalysisAdapter } catch(IOException e) { - throw new RuntimeException("unable to open lexer.txt."); + throw new RuntimeException("unable to open lexer.txt.", e); } pkgDir = new File(ids.pkgDir, "lexer"); @@ -50,6 +61,7 @@ public class GenLexer extends AnalysisAdapter } } + @Override public void caseStart(Start tree) { String[] names; @@ -64,10 +76,10 @@ public class GenLexer extends AnalysisAdapter } else { - Iterator iter = ids.stateList.iterator(); + Iterator<String> iter = ids.stateList.iterator(); for(int i = 0; i < numStates; i++) { - names[i] = (String) iter.next(); + names[i] = iter.next(); } } @@ -80,7 +92,7 @@ public class GenLexer extends AnalysisAdapter tree.apply(nfaConstructor); System.out.println(); - NFA nfa = (NFA) nfaConstructor.getOut(tree); + NFA nfa = nfaConstructor.getNFA(); nfaConstructor = null; System.out.println(" - Constructing DFA."); @@ -101,70 +113,36 @@ public class GenLexer extends AnalysisAdapter private void createLexerException() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "LexerException.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "LexerException.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "LexerException.java")))) { macros.apply(file, "LexerException", new String[] {pkgName}); } catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "LexerException.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "LexerException.java").getAbsolutePath(), e); } - catch(IOException e) - {} } private void createLexer() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "Lexer.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "Lexer.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "Lexer.java")))) { String startState = "INITIAL"; if(ids.stateList.size() > 0) { - startState = (String) ids.stateList.getFirst(); + startState = ids.stateList.getFirst(); } macros.apply(file, "LexerHeader", new String[] {pkgName, ids.pkgName.equals("") ? "node" : ids.pkgName + ".node", startState}); - for(ListIterator i = ids.tokenList.listIterator(); i.hasNext();) + for(ListIterator<String> i = ids.tokenList.listIterator(); i.hasNext();) { - String name = (String) i.next(); - Node node = (Node) ids.tokens.get(name); - boolean fixed = ((Boolean) ids.fixedTokens.get(node)) - .booleanValue(); + String name = i.next(); + ATokenDef node = ids.tokens.get(name); + boolean fixed = ids.fixedTokens.get(node); if(fixed) { @@ -177,18 +155,15 @@ public class GenLexer extends AnalysisAdapter new String[] {"" + i.previousIndex(), name}); } - Map map = (Map) transitions.tokenStates.get(node); + Map<String, String> map = transitions.tokenStates.get(node); if(map.size() > 0) { macros.apply(file, "TokenSwitchHeader", null); - for(Iterator j = map.entrySet().iterator(); j.hasNext();) + for(Map.Entry<String, String> entry : map.entrySet()) { - Map.Entry entry = (Map.Entry) j.next(); - macros.apply(file, "TokenCase", - new String[] {ids.stateList.indexOf((String) entry.getKey()) + "", - (String) entry.getValue()}); + new String[] {ids.stateList.indexOf(entry.getKey()) + "", entry.getValue()}); } macros.apply(file, "TokenSwitchTail", null); @@ -199,12 +174,11 @@ public class GenLexer extends AnalysisAdapter macros.apply(file, "LexerBody1"); - for(ListIterator i = ids.tokenList.listIterator(); i.hasNext();) + for(ListIterator<String> i = ids.tokenList.listIterator(); i.hasNext();) { - String name = (String) i.next(); - Node node = (Node) ids.tokens.get(name); - boolean fixed = ((Boolean) ids.fixedTokens.get(node)) - .booleanValue(); + String name = i.next(); + ATokenDef node = ids.tokens.get(name); + boolean fixed = ids.fixedTokens.get(node); if(fixed) { @@ -231,25 +205,21 @@ public class GenLexer extends AnalysisAdapter DFA dfa = acceptStatesArray[accSt].dfa; file.write(" { // " + acceptStatesArray[accSt].stateName + System.getProperty("line.separator")); - Vector outerArray = new Vector(); + List<List<int[]>> outerArray = new ArrayList<>(); - for(int i = 0; i < dfa.states.size(); i++) + for(DFA.State state : dfa.states) { - Vector innerArray = new Vector(); + List<int[]> innerArray = new ArrayList<>(); - DFA.State state = (DFA.State) dfa.states.elementAt(i); file.write(" {"); - for(int j = 0; j < state.transitions.size(); j++) + for(DFA.Transition transition : state.transitions) { - DFA.Transition transition = - (DFA.Transition) state.transitions.elementAt(j); - file.write("{" + ((int) transition.interval().start) + ", " + ((int) transition.interval().end) + ", " + transition.destination + "}, "); - innerArray.addElement(new int[] { + innerArray.add(new int[] { ((int) transition.interval().start), ((int) transition.interval().end), transition.destination}); @@ -257,19 +227,16 @@ public class GenLexer extends AnalysisAdapter file.write("}," + System.getProperty("line.separator")); - outerArray.addElement(innerArray); + outerArray.add(innerArray); } file.write(" }" + System.getProperty("line.separator")); out.writeInt(outerArray.size()); - for(Enumeration e = outerArray.elements(); e.hasMoreElements();) + for(List<int[]> innerArray : outerArray) { - Vector innerArray = (Vector) e.nextElement(); out.writeInt(innerArray.size()); - for(Enumeration n = innerArray.elements(); n.hasMoreElements();) + for(int[] array : innerArray) { - int[] array = (int[]) n.nextElement(); - for(int i = 0; i < 3; i++) { out.writeInt(array[i]); @@ -282,38 +249,34 @@ public class GenLexer extends AnalysisAdapter final int stateNumber = acceptStatesArray.length; - Vector outerArray = new Vector(); + List<List<Integer>> outerArray = new ArrayList<>(); for(int i = 0; i < stateNumber; i++) { DFA dfa = acceptStatesArray[i].dfa; - Vector innerArray = new Vector(); + List<Integer> innerArray = new ArrayList<>(); file.write(" // " + acceptStatesArray[i].stateName + System.getProperty("line.separator")); file.write(" {"); - for(int j = 0; j < dfa.states.size(); j++) + for(DFA.State state : dfa.states) { - DFA.State state = (DFA.State) dfa.states.elementAt(j); - file.write(state.accept + ", "); - innerArray.addElement(new Integer(state.accept)); + innerArray.add(state.accept); } file.write("}," + System.getProperty("line.separator")); - outerArray.addElement(innerArray); + outerArray.add(innerArray); } out.writeInt(outerArray.size()); - for(Enumeration e = outerArray.elements(); e.hasMoreElements();) + for(List<Integer> innerArray : outerArray) { - Vector innerArray = (Vector) e.nextElement(); out.writeInt(innerArray.size()); - for(Enumeration n = innerArray.elements(); n.hasMoreElements();) + for(int i : innerArray) { - Integer i = (Integer) n.nextElement(); - out.writeInt(i.intValue()); + out.writeInt(i); } } out.close(); @@ -326,9 +289,9 @@ public class GenLexer extends AnalysisAdapter if(ids.stateList.size() > 0) { - for(ListIterator i = ids.stateList.listIterator(); i.hasNext();) + for(ListIterator<String> i = ids.stateList.listIterator(); i.hasNext();) { - String s = (String) i.next(); + String s = i.next(); macros.apply(file, "LexerStateBody", new String[] {s, "" + i.previousIndex()}); @@ -347,14 +310,7 @@ public class GenLexer extends AnalysisAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Lexer.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "Lexer.java").getAbsolutePath(), e); } - catch(IOException e) - {} } } diff --git a/src/main/java/org/sablecc/sablecc/GenParser.java b/src/main/java/org/sablecc/sablecc/GenParser.java index 84230dd97dd50e7faeb6e8ce252cf2dea1fca2e7..a927be88d55818ec39027c90583d9f4bbf2c63d9 100644 --- a/src/main/java/org/sablecc/sablecc/GenParser.java +++ b/src/main/java/org/sablecc/sablecc/GenParser.java @@ -7,13 +7,24 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Deque; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.io.*; -import org.sablecc.sablecc.Grammar; -import java.util.Vector; -import java.util.Enumeration; /* * GenParser @@ -67,19 +78,15 @@ public class GenParser extends DepthFirstAdapter //This tree-walker field generate the code of parsing and construction of the AST. GenerateAlternativeCodeForParser aParsedAltAdapter; - private LinkedList listSimpleTermTransform = new LinkedList(); + private List<Node> listSimpleTermTransform = new LinkedList<>(); - public final Map simpleTermTransform = - new TypedHashMap(NodeCast.instance, - StringCast.instance); + public final Map<Node, String> simpleTermTransform = new HashMap<>(); //This map contains Productions which were explicitely transformed in the grammar //Those transformations was specified by the grammar-writer. - private final Map mapProductionTransformations = - new TypedHashMap(StringCast.instance, - ListCast.instance); + private final Map<String, List<PElem>> mapProductionTransformations = new HashMap<>(); - private Map alts; + private Map<String, Node> alts; public GenParser(ResolveIds ids, ResolveAltIds altIds, ResolveTransformIds transformIds, String firstProductionName, boolean processInlining, boolean prettyPrinting, @@ -105,7 +112,7 @@ public class GenParser extends DepthFirstAdapter } catch(IOException e) { - throw new RuntimeException("unable to open parser.txt."); + throw new RuntimeException("unable to open parser.txt.", e); } pkgDir = new File(ids.pkgDir, "parser"); @@ -120,17 +127,19 @@ public class GenParser extends DepthFirstAdapter } } + @Override public void caseStart(Start tree) { tree.getPGrammar().apply(new DepthFirstAdapter() { + @Override public void caseAProd(AProd node) { hasProductions = true; if(node.getProdTransform() != null) { mapProductionTransformations.put("P"+ResolveIds.name(node.getId().getText()), - node.getProdTransform().clone() ); + new LinkedList<>(node.getProdTransform()) ); } } } @@ -175,10 +184,11 @@ public class GenParser extends DepthFirstAdapter { private boolean hasAlternative; + @Override public void caseATokenDef(ATokenDef node) { - String name = (String) ids.names.get(node); - String errorName = (String) ids.errorNames.get(node); + String name = ids.names.get(node); + String errorName = ids.errorNames.get(node); if(!ids.ignTokens.containsKey(name)) { @@ -186,21 +196,24 @@ public class GenParser extends DepthFirstAdapter } } + @Override public void inAProd(AProd node) { hasAlternative = false; } + @Override public void inAAlt(AAlt node) { hasAlternative = true; } + @Override public void outAProd(AProd node) { if(hasAlternative) { - Grammar.addNonterminal((String) ids.names.get(node)); + Grammar.addNonterminal(ids.names.get(node)); } } } @@ -208,7 +221,7 @@ public class GenParser extends DepthFirstAdapter //Construct all necessary informations for generation of the parser. //This map contains all the alternatives of the transformed final grammar - alts = new TypedHashMap(StringCast.instance, NodeCast.instance); + alts = new HashMap<>(); tree.getPGrammar().apply(new ConstructParserGenerationDatas(ids, alts)); @@ -235,7 +248,7 @@ public class GenParser extends DepthFirstAdapter { System.out.println("\nA previous conflict that we've tried to solve by inline some productions inside the grammars cannot be solved that way. The transformed grammar is : "); tree.apply(new PrettyPrinter()); - throw new RuntimeException(ce.getMessage()); + throw new RuntimeException(ce.getMessage(), ce); } System.out.println(); @@ -243,7 +256,7 @@ public class GenParser extends DepthFirstAdapter } else { - throw new RuntimeException(ce.getMessage()); + throw new RuntimeException(ce.getMessage(), ce); } } } @@ -278,41 +291,44 @@ public class GenParser extends DepthFirstAdapter { tree.apply(new DepthFirstAdapter() { + @Override public void caseAProd(AProd node) { - currentProd = ids.name(node.getId().getText()); + currentProd = ResolveIds.name(node.getId().getText()); String name = "P" + currentProd; ids.names.put(node, name); //list of inAAlt code. - Object []list_alt = (Object [])node.getAlts().toArray(); - for(int i = 0; i< list_alt.length; i++) + for(PAlt alt : node.getAlts()) { - ((PAlt)list_alt[i]).apply(this); + alt.apply(this); } } + @Override public void outAHelperDef(AHelperDef node) { String name = node.getId().getText(); ids.names.put(node, name); } + @Override public void outATokenDef(ATokenDef node) { - String name = "T" + ids.name(node.getId().getText()); + String name = "T" + ResolveIds.name(node.getId().getText()); ids.names.put(node, name); } + @Override public void caseAAlt(final AAlt alt) { if(alt.getAltName() != null) { currentAlt = "A" + - ids.name(alt.getAltName().getText()) + + ResolveIds.name(alt.getAltName().getText()) + currentProd; ids.names.put(alt, currentAlt); @@ -323,25 +339,26 @@ public class GenParser extends DepthFirstAdapter ids.names.put(alt, currentAlt); } - AElem list_elem[] = (AElem[]) alt.getElems().toArray(new AElem[0]); - for(int i=0; i<list_elem.length;i++) + for(PElem elem : alt.getElems()) { - list_elem[i].apply(this); + elem.apply(this); } } + @Override public void caseAAst(AAst node) {} + @Override public void caseAElem(final AElem elem) { if(elem.getElemName() != null) { - ids.names.put(elem, ids.name(elem.getElemName().getText()) ); + ids.names.put(elem, ResolveIds.name(elem.getElemName().getText()) ); } else { - ids.names.put(elem, ids.name(elem.getId().getText())); + ids.names.put(elem, ResolveIds.name(elem.getId().getText())); } } } @@ -351,20 +368,7 @@ public class GenParser extends DepthFirstAdapter //Parser.java Generation private void createParser() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "Parser.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "Parser.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "Parser.java")))) { Symbol[] terminals = Symbol.terminals(); Symbol[] nonterminals = Symbol.nonterminals(); @@ -390,8 +394,6 @@ public class GenParser extends DepthFirstAdapter //the node needed to be created at a local point. for(int i = 0; i < (productions.length - 1); i++) { - Node node = (Node) alts.get(productions[i].name); - if(activateFilter && !grammarHasTransformations) { macros.apply(file, "ParserNoInliningReduce", new String[] { @@ -419,15 +421,16 @@ public class GenParser extends DepthFirstAdapter "" + productions[i].index, productions[i].name}); - final Node node = (Node) alts.get(productions[i].name); + final Node node = alts.get(productions[i].name); final BufferedWriter finalFile = file; - final LinkedList stack = new LinkedList(); + final Deque<Element> stack = new LinkedList<>(); node.apply(new DepthFirstAdapter() { private int current; + @Override public void caseAElem(AElem elem) { current++; @@ -438,22 +441,13 @@ public class GenParser extends DepthFirstAdapter } ); - try - { - for(Iterator it = stack.iterator(); it.hasNext();) - { - Element e = (Element) it.next(); - macros.apply(file, e.macro, e.arguments); - } - } - catch(IOException e) + for(Element e : stack) { - throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + macros.apply(file, e.macro, e.arguments); } - String nodeName = (String)ids.names.get(node); - String realnodeName = (String)ids.names.get(node); + String nodeName = ids.names.get(node); + String realnodeName = ids.names.get(node); aParsedAltAdapter = new GenerateAlternativeCodeForParser(pkgDir, nodeName, realnodeName, file, transformIds, CG, CTP, @@ -465,23 +459,23 @@ public class GenParser extends DepthFirstAdapter macros.apply(file, "ParserActionHeader"); - StringBuffer table = new StringBuffer(); + StringBuilder table = new StringBuilder(); DataOutputStream out = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( new File(pkgDir, "parser.dat")))); - Vector outerArray = new Vector(); + List<List<int[]>> outerArray = new ArrayList<>(); //Generating of paring tables for(int i = 0; i < Grammar.action_.length; i++) { - Vector innerArray = new Vector(); + List<int[]> innerArray = new ArrayList<>(); String mostFrequentAction = "ERROR"; int mostFrequentDestination = i; int frequence = 0; - Map map = new TreeMap(IntegerComparator.instance); + Map<Integer, Integer> map = new TreeMap<>(); for(int j = 0; j < Grammar.action_[i].length; j++) { @@ -489,10 +483,10 @@ public class GenParser extends DepthFirstAdapter { if(Grammar.action_[i][j][0] == 1) { - Integer index = new Integer(Grammar.action_[i][j][1]); - Integer count = (Integer) map.get(index); - int freq = count == null ? 0 : count.intValue(); - map.put(index, new Integer(++freq)); + int index = Grammar.action_[i][j][1]; + Integer count = map.get(index); + int freq = count == null ? 0 : count; + map.put(index, ++freq); if(freq > frequence) { frequence = freq; @@ -502,12 +496,14 @@ public class GenParser extends DepthFirstAdapter } } } - table.append("\t\t\t{"); - - table.append("{" + -1 + ", " + - mostFrequentAction + ", " + - mostFrequentDestination + "}, "); - innerArray.addElement( + table.append(" {"); + + table.append("{-1, "); + table.append(mostFrequentAction); + table.append(", "); + table.append(mostFrequentDestination); + table.append("}, "); + innerArray.add( new int[] {-1, mostFrequentAction.equals("ERROR") ? 3 : 1, mostFrequentDestination}); @@ -519,39 +515,47 @@ public class GenParser extends DepthFirstAdapter switch(Grammar.action_[i][j][0]) { case 0: - table.append("{" + j + ", SHIFT, " + Grammar.action_[i][j][1] + "}, "); - innerArray.addElement(new int[] {j, 0, Grammar.action_[i][j][1]}); + table.append("{"); + table.append(j); + table.append(", SHIFT, "); + table.append(Grammar.action_[i][j][1]); + table.append("}, "); + innerArray.add(new int[] {j, 0, Grammar.action_[i][j][1]}); break; case 1: if(Grammar.action_[i][j][1] != mostFrequentDestination) { - table.append("{" + j + ", REDUCE, " + Grammar.action_[i][j][1] + "}, "); - innerArray.addElement(new int[] {j, 1, Grammar.action_[i][j][1]}); + table.append("{"); + table.append(j); + table.append(", REDUCE, "); + table.append(Grammar.action_[i][j][1]); + table.append("}, "); + innerArray.add(new int[] {j, 1, Grammar.action_[i][j][1]}); } break; case 2: - table.append("{" + j + ", ACCEPT, -1}, "); - innerArray.addElement(new int[] {j, 2, -1}); + table.append("{"); + table.append(j); + table.append(", ACCEPT, -1}, "); + innerArray.add(new int[] {j, 2, -1}); break; } } } - table.append("}," + System.getProperty("line.separator")); - outerArray.addElement(innerArray); + table.append("},"); + table.append(System.getProperty("line.separator")); + outerArray.add(innerArray); } - file.write("" + table); + file.write(table.toString()); out.writeInt(outerArray.size()); - for(Enumeration e = outerArray.elements(); e.hasMoreElements();) + for(List<int[]> innerArray : outerArray) { - Vector innerArray = (Vector) e.nextElement(); out.writeInt(innerArray.size()); - for(Enumeration n = innerArray.elements(); n.hasMoreElements();) + for(int[] array : innerArray) { - int[] array = (int[]) n.nextElement(); - for(int i = 0; i < 3; i++) { out.writeInt(array[i]); @@ -563,25 +567,25 @@ public class GenParser extends DepthFirstAdapter macros.apply(file, "ParserGotoHeader"); - table = new StringBuffer(); - outerArray = new Vector(); + table = new StringBuilder(); + outerArray = new ArrayList<>(); for(int j = 0; j < nonterminals.length - 1; j++) { - Vector innerArray = new Vector(); + List<int[]> innerArray = new ArrayList<>(); int mostFrequent = -1; int frequence = 0; - Map map = new TreeMap(IntegerComparator.instance); + Map<Integer, Integer> map = new TreeMap<>(); for(int i = 0; i < Grammar.goto_.length; i++) { if(Grammar.goto_[i][j] != -1) { - Integer index = new Integer(Grammar.goto_[i][j]); - Integer count = (Integer) map.get(index); - int freq = count == null ? 0 : count.intValue(); - map.put(index, new Integer(++freq)); + int index = Grammar.goto_[i][j]; + Integer count = map.get(index); + int freq = count == null ? 0 : count; + map.put(index, ++freq); if(freq > frequence) { frequence = freq; @@ -590,37 +594,41 @@ public class GenParser extends DepthFirstAdapter } } - table.append("\t\t\t{"); + table.append(" {"); - table.append("{" + (-1) + ", " + mostFrequent + "}, "); - innerArray.addElement(new int[] {-1, mostFrequent}); + table.append("{-1, "); + table.append(mostFrequent); + table.append("}, "); + innerArray.add(new int[] {-1, mostFrequent}); for(int i = 0; i < Grammar.goto_.length; i++) { if((Grammar.goto_[i][j] != -1) && (Grammar.goto_[i][j] != mostFrequent)) { - table.append("{" + i + ", " + Grammar.goto_[i][j] + "}, "); - innerArray.addElement(new int[] {i, Grammar.goto_[i][j]}); + table.append("{"); + table.append(i); + table.append(", "); + table.append(Grammar.goto_[i][j]); + table.append("}, "); + innerArray.add(new int[] {i, Grammar.goto_[i][j]}); } } - table.append("}," + System.getProperty("line.separator")); + table.append("},"); + table.append(System.getProperty("line.separator")); - outerArray.addElement(innerArray); + outerArray.add(innerArray); } - file.write("" + table); + file.write(table.toString()); out.writeInt(outerArray.size()); - for(Enumeration e = outerArray.elements(); e.hasMoreElements();) + for(List<int[]> innerArray : outerArray) { - Vector innerArray = (Vector) e.nextElement(); out.writeInt(innerArray.size()); - for(Enumeration n = innerArray.elements(); n.hasMoreElements();) + for(int[] array : innerArray) { - int[] array = (int[]) n.nextElement(); - for(int i = 0; i < 2; i++) { out.writeInt(array[i]); @@ -632,22 +640,19 @@ public class GenParser extends DepthFirstAdapter macros.apply(file, "ParserErrorsHeader"); - table = new StringBuffer(); - StringBuffer index = new StringBuffer(); + table = new StringBuilder(); + StringBuilder index = new StringBuilder(); int nextIndex = 0; - Map errorIndex = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - IntegerCast.instance); + Map<String, Integer> errorIndex = new TreeMap<>(); - outerArray = new Vector(); - Vector indexArray = new Vector(); + List<String> outerArray2 = new ArrayList<>(); + List<Integer> indexArray = new ArrayList<>(); - index.append("\t\t\t"); + index.append(" "); for(int i = 0; i < Grammar.action_.length; i++) { - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); s.append("expecting: "); boolean comma = false; @@ -670,25 +675,29 @@ public class GenParser extends DepthFirstAdapter if(errorIndex.containsKey(s.toString())) { - index.append(errorIndex.get(s.toString()) + ", "); - indexArray.addElement(errorIndex.get(s.toString())); + index.append(errorIndex.get(s.toString())); + index.append(", "); + indexArray.add(errorIndex.get(s.toString())); } else { - table.append("\t\t\t\"" + s + "\"," + System.getProperty("line.separator")); - outerArray.addElement(s.toString()); - errorIndex.put(s.toString(), new Integer(nextIndex)); - indexArray.addElement(new Integer(nextIndex)); - index.append(nextIndex++ + ", "); + table.append(" \""); + table.append(s); + table.append("\","); + table.append(System.getProperty("line.separator")); + outerArray2.add(s.toString()); + errorIndex.put(s.toString(), nextIndex); + indexArray.add(nextIndex); + index.append(nextIndex++); + index.append(", "); } } - file.write("" + table); + file.write(table.toString()); - out.writeInt(outerArray.size()); - for(Enumeration e = outerArray.elements(); e.hasMoreElements();) + out.writeInt(outerArray2.size()); + for(String s : outerArray2) { - String s = (String) e.nextElement(); out.writeInt(s.length()); int length = s.length(); for(int i = 0; i < length; i++) @@ -698,10 +707,9 @@ public class GenParser extends DepthFirstAdapter } out.writeInt(indexArray.size()); - for(Enumeration e = indexArray.elements(); e.hasMoreElements();) + for(int n : indexArray) { - Integer n = (Integer) e.nextElement(); - out.writeInt(n.intValue()); + out.writeInt(n); } out.close(); @@ -709,7 +717,7 @@ public class GenParser extends DepthFirstAdapter macros.apply(file, "ParserErrorsTail"); macros.apply(file, "ParserErrorIndexHeader"); - file.write("" + index); + file.write(index.toString()); macros.apply(file, "ParserErrorIndexTail"); macros.apply(file, "ParserTail"); @@ -717,33 +725,13 @@ public class GenParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } - catch(IOException e) - {} } private void createTokenIndex() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "TokenIndex.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "TokenIndex.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "TokenIndex.java")))) { Symbol[] terminals = Symbol.terminals(); @@ -761,33 +749,13 @@ public class GenParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "TokenIndex.java").getAbsolutePath()); + new File(pkgDir, "TokenIndex.java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } private void createParserException() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "ParserException.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "ParserException.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "ParserException.java")))) { macros.apply(file, "ParserException", new String[] {pkgName, ids.pkgName.equals("") ? "node" : ids.pkgName + ".node"}); @@ -795,48 +763,21 @@ public class GenParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "ParserException.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "ParserException.java").getAbsolutePath(), e); } - catch(IOException e) - {} } private void createState() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "State.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "State.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "State.java")))) { macros.apply(file, "State", new String[] {pkgName}); } catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "State.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "State.java").getAbsolutePath(), e); } - catch(IOException e) - {} } private int count(String name) @@ -846,7 +787,7 @@ public class GenParser extends DepthFirstAdapter return 0; } - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); int i = 1; while((i < name.length()) && diff --git a/src/main/java/org/sablecc/sablecc/GenProds.java b/src/main/java/org/sablecc/sablecc/GenProds.java index 5e47012b49ca94a81c9112c7a0e09f253df98b0d..a327e0a2ce7b0dadcd442a8582b506768c5ff1a8 100644 --- a/src/main/java/org/sablecc/sablecc/GenProds.java +++ b/src/main/java/org/sablecc/sablecc/GenProds.java @@ -7,10 +7,14 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; -import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; +import org.sablecc.sablecc.node.AAstProd; public class GenProds extends DepthFirstAdapter { @@ -18,10 +22,6 @@ public class GenProds extends DepthFirstAdapter private ResolveAstIds ast_ids; private File pkgDir; private String pkgName; - private Map hiddenProds = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); public GenProds(ResolveAstIds ast_ids) { @@ -35,7 +35,7 @@ public class GenProds extends DepthFirstAdapter } catch(IOException e) { - throw new RuntimeException("unable to open productions.txt."); + throw new RuntimeException("unable to open productions.txt.", e); } pkgDir = new File(ast_ids.astIds.pkgDir, "node"); @@ -50,76 +50,37 @@ public class GenProds extends DepthFirstAdapter } } + @Override public void inAAstProd(AAstProd node) { - String name = (String) ast_ids.ast_names.get(node); + String name = ast_ids.ast_names.get(node); createProduction(name); } private void createProduction(String name) { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, name + ".java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, name + ".java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, name + ".java")))) { macros.apply(file, "Production", new String[] {pkgName, name}); } catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, name + ".java").getAbsolutePath()); + new File(pkgDir, name + ".java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } private void createAlternative(String name, String macro, String[] arg) { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, name + ".java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, name + ".java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, name + ".java")))) { macros.apply(file, macro, arg); } catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, name + ".java").getAbsolutePath()); + new File(pkgDir, name + ".java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } } diff --git a/src/main/java/org/sablecc/sablecc/GenTokens.java b/src/main/java/org/sablecc/sablecc/GenTokens.java index dac7d0cf13b7ec77b90ebe12033414ef3f565523..f5abfaaa7e74183283ad3ae9e1885e00a97a536e 100644 --- a/src/main/java/org/sablecc/sablecc/GenTokens.java +++ b/src/main/java/org/sablecc/sablecc/GenTokens.java @@ -7,10 +7,15 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.List; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.io.*; -import java.util.LinkedList; public class GenTokens extends DepthFirstAdapter { @@ -34,7 +39,7 @@ public class GenTokens extends DepthFirstAdapter } catch(IOException e) { - throw new RuntimeException("unable to open tokens.txt."); + throw new RuntimeException("unable to open tokens.txt.", e); } pkgDir = new File(ids.pkgDir, "node"); @@ -49,37 +54,24 @@ public class GenTokens extends DepthFirstAdapter } } + @Override public void inATokenDef(ATokenDef node) { - String name = (String) ids.names.get(node); - - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, name + ".java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, name + ".java").getAbsolutePath()); - } - + String name = ids.names.get(node); text = null; ARegExp regExp = (ARegExp) node.getRegExp(); - LinkedList concats = regExp.getConcats(); + List<PConcat> concats = regExp.getConcats(); if(concats.size() == 1) { - AConcat concat = (AConcat)concats.getFirst(); - LinkedList unExps = concat.getUnExps(); + AConcat concat = (AConcat)concats.get(0); + List<PUnExp> unExps = concat.getUnExps(); if(unExps.size() == 1) { - AUnExp unExp = (AUnExp) unExps.getFirst(); + AUnExp unExp = (AUnExp) unExps.get(0); PBasic basic = unExp.getBasic(); @@ -103,11 +95,11 @@ public class GenTokens extends DepthFirstAdapter } } - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, name + ".java")))) { if(text == null) { - ids.fixedTokens.put(node, new Boolean(false)); + ids.fixedTokens.put(node, false); macros.apply(file, "VariableTextToken", new String[] { pkgName, ids.pkgName.equals("") ? "analysis" : ids.pkgName + ".analysis", @@ -115,7 +107,7 @@ public class GenTokens extends DepthFirstAdapter } else { - ids.fixedTokens.put(node, new Boolean(true)); + ids.fixedTokens.put(node, true); macros.apply(file, "FixedTextToken", new String[] { pkgName, ids.pkgName.equals("") ? "analysis" : ids.pkgName + ".analysis", @@ -127,20 +119,13 @@ public class GenTokens extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, name + ".java").getAbsolutePath()); + new File(pkgDir, name + ".java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } private String processText(String s) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for(int i = 0; i < s.length(); i++) { diff --git a/src/main/java/org/sablecc/sablecc/GenUtils.java b/src/main/java/org/sablecc/sablecc/GenUtils.java index 06ea7360064cea70e8c0b36dd89f537a065666a2..051ab0fccf9a18b90c52a94a82ebe9a7f841c07e 100644 --- a/src/main/java/org/sablecc/sablecc/GenUtils.java +++ b/src/main/java/org/sablecc/sablecc/GenUtils.java @@ -7,10 +7,15 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; -import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; +import org.sablecc.sablecc.node.AAstProd; +import org.sablecc.sablecc.node.Start; public class GenUtils extends DepthFirstAdapter { @@ -32,7 +37,7 @@ public class GenUtils extends DepthFirstAdapter } catch(IOException e) { - throw new RuntimeException("unable to open utils.txt."); + throw new RuntimeException("unable to open utils.txt.", e); } pkgDir = new File(ast_ids.astIds.pkgDir, "node"); @@ -59,14 +64,16 @@ public class GenUtils extends DepthFirstAdapter } */ + @Override public void caseAAstProd(AAstProd node) { if(mainProduction == null) { - mainProduction = (String) ast_ids.ast_names.get(node); + mainProduction = ast_ids.ast_names.get(node); } } + @Override public void outStart(Start node) { if(mainProduction != null) @@ -83,20 +90,7 @@ public class GenUtils extends DepthFirstAdapter public void createStart() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "Start.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "Start.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "Start.java")))) { macros.apply(file, "Start", new String[] {pkgName, ast_ids.astIds.pkgName.equals("") ? "analysis" : ast_ids.astIds.pkgName + ".analysis", @@ -105,33 +99,13 @@ public class GenUtils extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Start.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "Start.java").getAbsolutePath(), e); } - catch(IOException e) - {} } public void createEOF() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "EOF.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "EOF.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "EOF.java")))) { macros.apply(file, "EOF", new String[] {pkgName, ast_ids.astIds.pkgName.equals("") ? "analysis" : ast_ids.astIds.pkgName + ".analysis"}); @@ -139,33 +113,13 @@ public class GenUtils extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "EOF.java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, "EOF.java").getAbsolutePath(), e); } - catch(IOException e) - {} } public void createNode() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "Node.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "Node.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "Node.java")))) { macros.apply(file, "Node", new String[] {pkgName, ast_ids.astIds.pkgName.equals("") ? "analysis" : ast_ids.astIds.pkgName + ".analysis"}); @@ -173,80 +127,33 @@ public class GenUtils extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Node.java").getAbsolutePath()); + new File(pkgDir, "Node.java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } public void createToken() { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, "Token.java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, "Token.java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, "Token.java")))) { macros.apply(file, "Token", new String[] {pkgName}); } catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Token.java").getAbsolutePath()); + new File(pkgDir, "Token.java").getAbsolutePath(), e); } - - try - { - file.close(); - } - catch(IOException e) - {} } public void create(String cls) { - BufferedWriter file; - - try - { - file = new BufferedWriter( - new FileWriter( - new File(pkgDir, cls + ".java"))); - } - catch(IOException e) - { - throw new RuntimeException("Unable to create " + new File(pkgDir, cls + ".java").getAbsolutePath()); - } - - try + try(BufferedWriter file = new BufferedWriter(new FileWriter(new File(pkgDir, cls + ".java")))) { macros.apply(file, cls, new String[] {pkgName}); } catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, cls + ".java").getAbsolutePath()); - } - - try - { - file.close(); + new File(pkgDir, cls + ".java").getAbsolutePath(), e); } - catch(IOException e) - {} } } diff --git a/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java b/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java index 8a532a4d6a9803acc7699a772661eeecabf484b7..a2613bdb60eb04deb8716ac8fb1bddb2cabf6541 100644 --- a/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java +++ b/src/main/java/org/sablecc/sablecc/GenerateAlternativeCodeForParser.java @@ -7,13 +7,14 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.io.*; -import org.sablecc.sablecc.Grammar; -import java.util.Vector; -import java.util.Enumeration; public class GenerateAlternativeCodeForParser extends DepthFirstAdapter { @@ -26,9 +27,11 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter private ComputeCGNomenclature CG; private ComputeSimpleTermPosition CTP; private MacroExpander macros; - private Map simpleTermTransformMap; - private LinkedList listSimpleTermTransform; - private Map simpleTermOrsimpleListTermTypes; + private Map<Node, String> simpleTermTransformMap; + private List<Node> listSimpleTermTransform; + private Map<Node, String> simpleTermOrsimpleListTermTypes; + + private int popCount; GenerateAlternativeCodeForParser(File pkgDir, String aParsedAltName, String raParsedAltName, @@ -36,10 +39,10 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter ResolveTransformIds transformIds, ComputeCGNomenclature CG, ComputeSimpleTermPosition CTP, - Map simpleTermTransformMap, + Map<Node, String> simpleTermTransformMap, MacroExpander macros, - LinkedList listSimpleTermTransform, - Map simpleTermOrsimpleListTermTypes) + List<Node> listSimpleTermTransform, + Map<Node, String> simpleTermOrsimpleListTermTypes) { this.pkgDir = pkgDir; this.file = file; @@ -52,26 +55,33 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter this.macros = macros; this.listSimpleTermTransform = listSimpleTermTransform; this.simpleTermOrsimpleListTermTypes = simpleTermOrsimpleListTermTypes; + + this.popCount = 0; + } + + @Override + public void caseAElem(final AElem node) { + popCount++; } + @Override public void inAAltTransform(AAltTransform node) { - Object temp[] = node.getTerms().toArray(); String type_name; int position; - for(int i = 0; i < temp.length; i++) + for(PTerm term : node.getTerms()) { - if(simpleTermTransformMap.get(temp[i]) != null) + if(simpleTermTransformMap.get(term) != null) { - type_name = (String)simpleTermTransformMap.get(temp[i]); + type_name = simpleTermTransformMap.get(term); } else { - type_name = (String)CG.getAltTransformElemTypes().get(temp[i]); + type_name = CG.getAltTransformElemTypes().get(term); } - position = ((Integer)CG.getTermNumbers().get(temp[i])).intValue(); + position = CG.getTermNumbers().get(term); try { @@ -81,7 +91,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter } else if(type_name.equals("null")) { - macros.apply(file, "ParserNullVariableDeclaration", new String[] {"" + position}); + // No intermediate variable needed for null arguments } else { @@ -91,31 +101,31 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } } } + @Override public void outAAltTransform(AAltTransform node) { - Object temp[] = node.getTerms().toArray(); String type_name; int position; try { - for(int i = 0; i < temp.length; i++) + for(PTerm term : node.getTerms()) { - if(simpleTermTransformMap.get(temp[i]) != null) + if(simpleTermTransformMap.get(term) != null) { - type_name = (String)simpleTermTransformMap.get(temp[i]); + type_name = simpleTermTransformMap.get(term); } else { - type_name = (String)CG.getAltTransformElemTypes().get(temp[i]); + type_name = CG.getAltTransformElemTypes().get(term); } - position = ((Integer)CG.getTermNumbers().get(temp[i])).intValue(); + position = CG.getTermNumbers().get(term); if(type_name.startsWith("L")) { @@ -132,33 +142,35 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter macros.apply(file, "ParserNewBodyListAdd", new String[] {type_name, "" + position}); } + if (popCount > 0) { + // The nodeArrayList variables are numbered starting at 1, so the first popped variable has the number popCount and not popCount-1. + macros.apply(file, "ParserNewCheck", new String[] {String.valueOf(popCount)}); + } macros.apply(file, "ParserNewTail"); } catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } } - public void inAParams(LinkedList list_param) + public void inAParams(List<PTerm> list_param) { String type_name; int position; - Object temp[] = list_param.toArray(); - - for(int i = 0; i < temp.length; i++) + for(PTerm term : list_param) { - if(simpleTermTransformMap.get(temp[i]) != null) + if(simpleTermTransformMap.get(term) != null) { - type_name = (String)simpleTermTransformMap.get(temp[i]); + type_name = simpleTermTransformMap.get(term); } else { - type_name = (String)CG.getAltTransformElemTypes().get(temp[i]); + type_name = CG.getAltTransformElemTypes().get(term); } - position = ((Integer)CG.getTermNumbers().get(temp[i])).intValue(); + position = CG.getTermNumbers().get(term); try { @@ -168,7 +180,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter } else if(type_name.equals("null")) { - macros.apply(file, "ParserNullVariableDeclaration", new String[] {"" + position}); + // No intermediate variable needed for null arguments } else { @@ -178,11 +190,12 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } } } + @Override public void inASimpleTerm(ASimpleTerm node) { try @@ -190,23 +203,24 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter String type_name; if(simpleTermTransformMap.get(node) != null) { - type_name = (String)simpleTermTransformMap.get(node); + type_name = simpleTermTransformMap.get(node); } else { - type_name = (String)CG.getAltTransformElemTypes().get(node); + type_name = CG.getAltTransformElemTypes().get(node); } - int position = ((Integer)CG.getTermNumbers().get(node)).intValue(); + int position = CG.getTermNumbers().get(node).intValue(); String termKey = currentAlt+"."+node.getId().getText(); - int elemPosition = ((Integer)CTP.elems_position.get(termKey)).intValue(); + int elemPosition = CTP.elems_position.get(termKey); int positionMap = 0; if(node.getSimpleTermTail() != null ) { + // FIXME This condition is always false, because listSimpleTermTransform contains ASimpleTerm/ASimpleListTerm and not String! Is it safe to remove this? if( !listSimpleTermTransform.contains(node.getId().getText() ) ) { - String type = (String)CTP.positionsMap.get( realcurrentAlt+"."+node.getId().getText() ); - LinkedList list = (LinkedList)transformIds.getProdTransformIds().prod_transforms.get(type); + String type = CTP.positionsMap.get( realcurrentAlt+"."+node.getId().getText() ); + List<String> list = transformIds.getProdTransformIds().prod_transforms.get(type); if( list.indexOf( node.getSimpleTermTail().getText() ) >= 0 ) { positionMap = list.indexOf( node.getSimpleTermTail().getText() ); @@ -215,8 +229,8 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter if(simpleTermOrsimpleListTermTypes.get(node) != null) { - String type = (String)simpleTermOrsimpleListTermTypes.get(node); - LinkedList list = (LinkedList)transformIds.getProdTransformIds().prod_transforms.get(type); + String type = simpleTermOrsimpleListTermTypes.get(node); + List<String> list = transformIds.getProdTransformIds().prod_transforms.get(type); if( list.indexOf( node.getSimpleTermTail().getText() ) >= 0 ) { positionMap = list.indexOf( node.getSimpleTermTail().getText() ); @@ -250,10 +264,11 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } } + @Override public void inASimpleListTerm(ASimpleListTerm node) { try @@ -261,26 +276,27 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter String type_name; if(simpleTermTransformMap.get(node) != null) { - type_name = (String)simpleTermTransformMap.get(node); + type_name = simpleTermTransformMap.get(node); } else { - type_name = (String)CG.getAltTransformElemTypes().get(node); + type_name = CG.getAltTransformElemTypes().get(node); } String termKey = currentAlt+"."+node.getId().getText(); - int position = ((Integer)CG.getTermNumbers().get(node)).intValue(); + int position = CG.getTermNumbers().get(node); - int elemPosition = ((Integer)CTP.elems_position.get(termKey)).intValue(); + int elemPosition = CTP.elems_position.get(termKey); int positionMap = 0; if(node.getSimpleTermTail() != null ) { + // FIXME This condition is always false, because listSimpleTermTransform contains ASimpleTerm/ASimpleListTerm and not String! Is it safe to remove this? if( !listSimpleTermTransform.contains(node.getId().getText()) ) { - String type = (String)CTP.positionsMap.get( realcurrentAlt+"."+node.getId().getText() ); - LinkedList list = (LinkedList)transformIds.getProdTransformIds().prod_transforms.get(type); + String type = CTP.positionsMap.get( realcurrentAlt+"."+node.getId().getText() ); + List<String> list = transformIds.getProdTransformIds().prod_transforms.get(type); if( list.indexOf( node.getSimpleTermTail().getText() ) >= 0 ) { positionMap = list.indexOf( node.getSimpleTermTail().getText() ); @@ -289,8 +305,8 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter if(simpleTermOrsimpleListTermTypes.get(node) != null) { - String type = (String)simpleTermOrsimpleListTermTypes.get(node); - LinkedList list = (LinkedList)transformIds.getProdTransformIds().prod_transforms.get(type); + String type = simpleTermOrsimpleListTermTypes.get(node); + List<String> list = transformIds.getProdTransformIds().prod_transforms.get(type); if( list.indexOf( node.getSimpleTermTail().getText() ) >= 0 ) { positionMap = list.indexOf( node.getSimpleTermTail().getText() ); @@ -324,10 +340,11 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } } + @Override public void inANewTerm(ANewTerm node) { try @@ -337,11 +354,12 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } inAParams(node.getParams()); } + @Override public void inANewListTerm(ANewListTerm node) { try @@ -351,30 +369,29 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } inAParams(node.getParams()); } + @Override public void inAListTerm(AListTerm node) { try { macros.apply(file, "ParserBraceOpening"); - Object temp[] = node.getListTerms().toArray(); - - for(int i = 0; i < temp.length; i++) + for(PListTerm listTerm : node.getListTerms()) { String type_name; - if(simpleTermTransformMap.get(temp[i]) != null) + if(simpleTermTransformMap.get(listTerm) != null) { - type_name = (String)simpleTermTransformMap.get(temp[i]); + type_name = simpleTermTransformMap.get(listTerm); } else { - type_name = (String)CG.getAltTransformElemTypes().get(temp[i]); + type_name = CG.getAltTransformElemTypes().get(listTerm); } - int position = ((Integer)CG.getTermNumbers().get(temp[i])).intValue(); + int position = CG.getTermNumbers().get(listTerm); if(type_name.startsWith("L")) { @@ -382,7 +399,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter } else if(type_name.equals("null")) { - macros.apply(file, "ParserNullVariableDeclaration", new String[] {"" + position}); + // No intermediate variable needed for null arguments } else { @@ -393,29 +410,29 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } } + @Override public void outAListTerm(AListTerm node) { try { - Object temp[] = node.getListTerms().toArray(); - int listPosition = ((Integer)CG.getTermNumbers().get(node)).intValue(); + int listPosition = CG.getTermNumbers().get(node); - for(int i = 0; i < temp.length; i++) + for(PListTerm listTerm : node.getListTerms()) { String type_name; - if(simpleTermTransformMap.get(temp[i]) != null) + if(simpleTermTransformMap.get(listTerm) != null) { - type_name = (String)simpleTermTransformMap.get(temp[i]); + type_name = simpleTermTransformMap.get(listTerm); } else { - type_name = (String)CG.getAltTransformElemTypes().get(temp[i]); + type_name = CG.getAltTransformElemTypes().get(listTerm); } - int position = ((Integer)CG.getTermNumbers().get(temp[i])).intValue(); + int position = CG.getTermNumbers().get(listTerm); if(!type_name.equals("null")) { @@ -434,22 +451,23 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "Parser.java").getAbsolutePath()); + new File(pkgDir, "Parser.java").getAbsolutePath(), e); } } + @Override public void outANewTerm(ANewTerm node) { - String type_name = (String)CG.getAltTransformElemTypes().get(node); + String type_name; if(simpleTermTransformMap.get(node) != null) { - type_name = (String)simpleTermTransformMap.get(node); + type_name = simpleTermTransformMap.get(node); } else { - type_name = (String)CG.getAltTransformElemTypes().get(node); + type_name = CG.getAltTransformElemTypes().get(node); } - int position = ((Integer)CG.getTermNumbers().get(node)).intValue(); + int position = CG.getTermNumbers().get(node); String newAltName = name((AProdName)node.getProdName()); try @@ -466,25 +484,19 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter if(node.getParams().size() > 0) { - Object temp[] = node.getParams().toArray(); String isNotTheFirstParam = ""; - for(int i = 0; i < temp.length; i++) + for(PTerm term : node.getParams()) { - if(simpleTermTransformMap.get(temp[i]) != null) + if(simpleTermTransformMap.get(term) != null) { - type_name = (String)simpleTermTransformMap.get(temp[i]); + type_name = simpleTermTransformMap.get(term); } else { - type_name = (String)CG.getAltTransformElemTypes().get(temp[i]); - } - position = ((Integer)CG.getTermNumbers().get(temp[i])).intValue(); - - if(i != 0) - { - isNotTheFirstParam = ", "; + type_name = CG.getAltTransformElemTypes().get(term); } + position = CG.getTermNumbers().get(term); if(type_name.equals("null")) { @@ -503,6 +515,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter macros.apply(file, "ParserNew&ListBodyParams", new String[] {isNotTheFirstParam+type_name, ""+position}); } + isNotTheFirstParam = ", "; } } macros.apply(file, "ParserNewBodyNewTail"); @@ -511,22 +524,23 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "TokenIndex.java").getAbsolutePath()); + new File(pkgDir, "TokenIndex.java").getAbsolutePath(), e); } } + @Override public void outANewListTerm(ANewListTerm node) { String type_name; if(simpleTermTransformMap.get(node) != null) { - type_name = (String)simpleTermTransformMap.get(node); + type_name = simpleTermTransformMap.get(node); } else { - type_name = (String)CG.getAltTransformElemTypes().get(node); + type_name = CG.getAltTransformElemTypes().get(node); } - int position = ((Integer)CG.getTermNumbers().get(node)).intValue(); + int position = CG.getTermNumbers().get(node); String newAltName = name((AProdName)node.getProdName()); try { @@ -542,25 +556,19 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter if(node.getParams().size() > 0) { - Object temp[] = node.getParams().toArray(); String isNotTheFirstParam = ""; - for(int i = 0; i < temp.length; i++) + for(PTerm term : node.getParams()) { - if(simpleTermTransformMap.get(temp[i]) != null) + if(simpleTermTransformMap.get(term) != null) { - type_name = (String)simpleTermTransformMap.get(temp[i]); + type_name = simpleTermTransformMap.get(term); } else { - type_name = (String)CG.getAltTransformElemTypes().get(temp[i]); - } - position = ((Integer)CG.getTermNumbers().get(temp[i])).intValue(); - - if(i != 0) - { - isNotTheFirstParam = ", "; + type_name = CG.getAltTransformElemTypes().get(term); } + position = CG.getTermNumbers().get(term); if(type_name.equals("null")) { @@ -578,6 +586,8 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter } macros.apply(file, "ParserNew&ListBodyParams", new String[] {isNotTheFirstParam+type_name, ""+position}); } + + isNotTheFirstParam = ", "; } } macros.apply(file, "ParserNewBodyNewTail"); @@ -586,7 +596,7 @@ public class GenerateAlternativeCodeForParser extends DepthFirstAdapter catch(IOException e) { throw new RuntimeException("An error occured while writing to " + - new File(pkgDir, "TokenIndex.java").getAbsolutePath()); + new File(pkgDir, "TokenIndex.java").getAbsolutePath(), e); } } diff --git a/src/main/java/org/sablecc/sablecc/Grammar.java b/src/main/java/org/sablecc/sablecc/Grammar.java index 77d121b7d21c772c36adb5b32f145915842eda0a..39a835fd719392369eb1d2545c03f13dc33a462f 100644 --- a/src/main/java/org/sablecc/sablecc/Grammar.java +++ b/src/main/java/org/sablecc/sablecc/Grammar.java @@ -7,13 +7,17 @@ package org.sablecc.sablecc; -import java.util.Vector; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; public final class Grammar { - private static TreeMap fastLr0Closure = new TreeMap(); - private static TreeMap fastLr1Closure = new TreeMap(); + private static Map<LR0Item, LR0ItemSet> fastLr0Closure = new TreeMap<>(); + private static Map<LR1Item, LR1ItemSet> fastLr1Closure = new TreeMap<>(); static int startSymbol; static int startProduction; @@ -61,8 +65,8 @@ public final class Grammar public static void reinit() { - fastLr0Closure = new TreeMap(); - fastLr1Closure = new TreeMap(); + fastLr0Closure = new TreeMap<>(); + fastLr1Closure = new TreeMap<>(); startSymbol = 0; startProduction = -1; eof = -1; @@ -86,11 +90,11 @@ public final class Grammar computeFirst(); - LR0ItemSet set - = new LR0ItemSet(); + LR0ItemSet set = new LR0ItemSet(); set.set(new LR0Item(startProduction, 0)); - LR1Collection collection = new LR1Collection(set - ); + LR1Collection collection = new LR1Collection(set); + + System.out.println(" - Computing parse table."); LR0ItemSet[] sets = collection.collection.sets(); Symbol[] terminals = Symbol.terminals(); @@ -99,8 +103,8 @@ public final class Grammar action_ = new int[sets.length][terminals.length - 1][]; goto_ = new int[sets.length][nonterminals.length - 1]; - Set listOfConflictualProds = new HashSet(); - StringBuffer conflictMessage = new StringBuffer(); + Set<String> listOfConflictualProds = new HashSet<>(); + StringBuilder conflictMessage = new StringBuilder(); for(int i = 0; i < sets.length; i++) { @@ -112,9 +116,7 @@ public final class Grammar LR0Item[] items = sets[i].items(); for(int j = 0; j < items.length; j++) { - Symbol[] lookaheads = ((SymbolSet) collection.lookaheads[i]. - get - (items[j])).getSymbols(); + Symbol[] lookaheads = collection.lookaheads[i].get(items[j]).getSymbols(); for(int k = 0; k < lookaheads.length; k++) { @@ -146,7 +148,7 @@ public final class Grammar { production.rightside(items[k].lr0Item.position); } - catch(Exception e) + catch(RuntimeException e) { if(production.leftside != startSymbol) { @@ -162,28 +164,34 @@ public final class Grammar switch(action[0]) { case 0: - conflictMessage.append( - "\n\nshift/reduce conflict in state [stack:" + - collection.collection.names.elementAt(i) + "*] on " + - terminals[j] + " in " + state.toString(terminals[j])); + conflictMessage.append("\n\nshift/reduce conflict in state [stack:"); + conflictMessage.append(collection.collection.names.get(i)); + conflictMessage.append("*] on "); + conflictMessage.append(terminals[j]); + conflictMessage.append(" in "); + conflictMessage.append(state.toString(terminals[j])); /* nothing else to do */ break; case 1: - conflictMessage.append( - "\n\nreduce/reduce conflict in state [stack:" + - collection.collection.names.elementAt(i) + "*] on " + - terminals[j] + " in " + state.toString(terminals[j])); + conflictMessage.append("\n\nreduce/reduce conflict in state [stack:"); + conflictMessage.append(collection.collection.names.get(i)); + conflictMessage.append("*] on "); + conflictMessage.append(terminals[j]); + conflictMessage.append(" in "); + conflictMessage.append(state.toString(terminals[j])); listOfConflictualProds.add(Symbol.symbol(Production.production(action[1]).leftside, false).toString()); break; case 2: - conflictMessage.append( - "\n\nreduce/accept conflict in state [stack:" + - collection.collection.names.elementAt(i) + "*] on " + - terminals[j] + " in " + state.toString(terminals[j])); + conflictMessage.append("\n\nreduce/accept conflict in state [stack:"); + conflictMessage.append(collection.collection.names.get(i)); + conflictMessage.append("*] on "); + conflictMessage.append(terminals[j]); + conflictMessage.append(" in "); + conflictMessage.append(state.toString(terminals[j])); listOfConflictualProds.add(Symbol.symbol(Production.production(action[1]).leftside, false).toString()); break; @@ -211,19 +219,23 @@ public final class Grammar switch(action[0]) { case 0: - conflictMessage.append( - "shift/accept conflict in state [stack:" + - collection.collection.names.elementAt(i) + "*] on " + - terminals[j] + " in " + state); + conflictMessage.append("shift/accept conflict in state [stack:"); + conflictMessage.append(collection.collection.names.get(i)); + conflictMessage.append("*] on "); + conflictMessage.append(terminals[j]); + conflictMessage.append(" in "); + conflictMessage.append(state); /* nothing else to do */ break; case 1: - conflictMessage.append( - "reduce/accept conflict in state [stack:" + - collection.collection.names.elementAt(i) + "*] on " + - terminals[j] + " in " + state); + conflictMessage.append("reduce/accept conflict in state [stack:"); + conflictMessage.append(collection.collection.names.get(i)); + conflictMessage.append("*] on "); + conflictMessage.append(terminals[j]); + conflictMessage.append(" in "); + conflictMessage.append(state); listOfConflictualProds.add(Symbol.symbol(Production.production(action[1]).leftside, false).toString()); @@ -314,8 +326,7 @@ public final class Grammar for(int i = 0; i < productions.length; i++) { - SymbolSet before = - (SymbolSet) FIRST_Nonterminal[productions[i].leftside].clone(); + SymbolSet before = FIRST_Nonterminal[productions[i].leftside].clone(); FIRST_Nonterminal[productions[i].leftside]. or(FIRST(productions[i].rightside())); @@ -405,11 +416,9 @@ public final class Grammar { if(!rightside[j].terminal) { - SymbolSet set - = FIRST(rightside, j + 1); + SymbolSet set = FIRST(rightside, j + 1); set.clearEmpty(); - FOLLOW[rightside[j].index].or(set - ); + FOLLOW[rightside[j].index].or(set); } } } @@ -429,8 +438,7 @@ public final class Grammar { if(!rightside[j].terminal) { - SymbolSet before = - (SymbolSet) FOLLOW[rightside[j].index].clone(); + SymbolSet before = FOLLOW[rightside[j].index].clone(); if(FIRST(rightside, j + 1).getEmpty()) { @@ -456,7 +464,7 @@ public final class Grammar static LR0ItemSet CLOSURE(LR0Item item) { - LR0ItemSet result = (LR0ItemSet) fastLr0Closure.get(item); + LR0ItemSet result = fastLr0Closure.get(item); if(result != null) { @@ -511,8 +519,7 @@ public final class Grammar // private static final SplayTreeMap fastLr0SetClosure = new SplayTreeMap(); - static LR0ItemSet CLOSURE(LR0ItemSet set - ) + static LR0ItemSet CLOSURE(LR0ItemSet set) { LR0ItemSet result = /* @@ -545,7 +552,7 @@ public final class Grammar static LR1ItemSet CLOSURE(LR1Item item) { - LR1ItemSet result = (LR1ItemSet) fastLr1Closure.get(item); + LR1ItemSet result = fastLr1Closure.get(item); if(result != null) { @@ -573,17 +580,16 @@ public final class Grammar if(!symbol.terminal) { - Vector tailVector = new Vector(0); + List<Symbol> tailVector = new ArrayList<>(); for(int k = items[i].lr0Item.position + 1; k < rightside.length; k++) { - tailVector.addElement(rightside[k]); + tailVector.add(rightside[k]); } - tailVector.addElement(Symbol.symbol(items[i].terminal, true)); + tailVector.add(Symbol.symbol(items[i].terminal, true)); - Symbol[] tail = new Symbol[tailVector.size()]; - tailVector.copyInto(tail); + Symbol[] tail = tailVector.toArray(new Symbol[0]); Symbol[] symbols = FIRST(tail).getSymbols(); @@ -622,8 +628,7 @@ public final class Grammar // private static final SplayTreeMap fastLr1SetClosure = new SplayTreeMap(); - static LR1ItemSet CLOSURE(LR1ItemSet set - ) + static LR1ItemSet CLOSURE(LR1ItemSet set) { LR1ItemSet result = /* @@ -655,14 +660,10 @@ public final class Grammar return result; } - static LR0ItemSet GOTO(LR0ItemSet set - , Symbol symbol) + static LR0ItemSet GOTO(LR0ItemSet set, Symbol symbol) { - LR0ItemSet initialset = set - ; - set - = CLOSURE(set - ); + LR0ItemSet initialset = set; + set = CLOSURE(set); LR0ItemSet result = new LR0ItemSet(); // return all items A->xS.y such that A->x.Sy is in set. (S=symbol) diff --git a/src/main/java/org/sablecc/sablecc/In_Production.java b/src/main/java/org/sablecc/sablecc/In_Production.java index 79aedb39dc3b5818d2fe5f2958b861e9f5c972e1..63b00d5c871eae6549dcbd92657b19f690b18355 100644 --- a/src/main/java/org/sablecc/sablecc/In_Production.java +++ b/src/main/java/org/sablecc/sablecc/In_Production.java @@ -7,8 +7,11 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; public class In_Production @@ -22,7 +25,7 @@ public class In_Production { setName(prod.getId().getText()); - AElem[] prodTransforms = (AElem [])prod.getProdTransform().toArray(new AElem[0]); + AElem[] prodTransforms = prod.getProdTransform().toArray(new AElem[0]); prodTransformElems = new String[prodTransforms.length]; for(int i=0; i<prodTransforms.length; i++) @@ -43,7 +46,7 @@ public class In_Production prodTransformElems[0] = new String(" "); } - AAlt[] alts = (AAlt[])prod.getAlts().toArray(new AAlt[0]); + AAlt[] alts = prod.getAlts().toArray(new AAlt[0]); alternatives = new In_Alternative[alts.length]; for(int i=0; i<alts.length; i++) @@ -84,20 +87,20 @@ public class In_Production String name; int nbElems; AElem[] elements; - Map prodTransform_altTransform; + Map<String, Node> prodTransform_altTransform; In_Alternative(AAlt alt, String[] prodTransformElems, String prodName) { setName(alt.getAltName() != null ? alt.getAltName().getText() : ""); elements = new AElem[alt.getElems().size()]; - AElem[] listOfElems = (AElem[]) alt.getElems().toArray(new AElem[0]); + AElem[] listOfElems = alt.getElems().toArray(new AElem[0]); final String newElemName = (name.equals("") ? prodName : prodName + "#" + name ); for(int i=0; i<listOfElems.length; i++) { - AElem tmpElem = (AElem)listOfElems[i].clone(); + AElem tmpElem = listOfElems[i].clone(); if(tmpElem.getElemName() != null) { @@ -113,22 +116,21 @@ public class In_Production nbElems = listOfElems.length; - prodTransform_altTransform = - new TypedHashMap(prodTransformElems.length, - StringCast.instance, - NodeCast.instance); + prodTransform_altTransform = new HashMap<>(prodTransformElems.length); - LinkedList list = ((AAltTransform)alt.getAltTransform()).getTerms(); + List<PTerm> list = ((AAltTransform)alt.getAltTransform()).getTerms(); for(int i=0; i<list.size(); i++) { - PTerm tmpTerm = (PTerm)list.get(i); + PTerm tmpTerm = list.get(i); tmpTerm.apply(new DepthFirstAdapter() { + @Override public void caseASimpleListTerm(ASimpleListTerm node) { node.setId( new TId(newElemName + "#" + node.getId().getText(), node.getId().getLine(), node.getId().getPos()) ); } + @Override public void caseASimpleTerm(ASimpleTerm node) { node.setId( new TId(newElemName + "#" + node.getId().getText(), node.getId().getLine(), node.getId().getPos()) ); @@ -155,7 +157,7 @@ public class In_Production return nbElems; } - Map getProdTransform_AlTransformMap() + Map<String, Node> getProdTransform_AlTransformMap() { return prodTransform_altTransform; } diff --git a/src/main/java/org/sablecc/sablecc/Inlining.java b/src/main/java/org/sablecc/sablecc/Inlining.java index a1361eda85327063dbbe6a6661a53e41d79e36f3..4c6742d6621577d616bfd52b73aa6cea74b69c3c 100644 --- a/src/main/java/org/sablecc/sablecc/Inlining.java +++ b/src/main/java/org/sablecc/sablecc/Inlining.java @@ -16,14 +16,20 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; public class Inlining { - public static HashSet productionsToBeRemoved = - new HashSet(); + public static Set<String> productionsToBeRemoved = new HashSet<>(); private AProd current_production; @@ -42,17 +48,18 @@ public class Inlining */ public boolean inlineProduction() { - AAlt[] alts = (AAlt[])current_production.getAlts().toArray(new AAlt[0]); + PAlt[] alts = current_production.getAlts().toArray(new PAlt[0]); final BooleanEx prodMustBeInlined = new BooleanEx(false); /* We're trying to detect if the current production must be inlined. ie one of its alternatives contains production to inline */ - for(int i=0; i<alts.length; i++) + for(PAlt alt : alts) { - ((PAlt)alts[i]).apply( new DepthFirstAdapter() + alt.apply( new DepthFirstAdapter() { + @Override public void caseAElem(AElem node) { String elem_name = node.getId().getText(); @@ -79,12 +86,12 @@ public class Inlining Once we detect that the production can be inline, we try to inline each of its alternatives. */ - LinkedList listOfAlts = new TypedLinkedList(NodeCast.instance); + List<PAlt> listOfAlts = new LinkedList<>(); for(int i=0; i<alts.length; i++) { - listOfAlts.addAll( inlineAlternative(alts[i]) ); + listOfAlts.addAll( inlineAlternative((AAlt)alts[i]) ); } - /************************************************************************** + /* if( !containsDoubloons(listOfAlts) ) { //list of productions whose inlining was a success. @@ -94,8 +101,8 @@ public class Inlining return true; } return false; - /**************************************************************************/ - listOfAlts = (LinkedList)removeAlternativeDoubloonsFromInlinedProduction(listOfAlts); + //*/ + listOfAlts = removeAlternativeDoubloonsFromInlinedProduction(listOfAlts); //list of productions whose inlining was a success. productionsToBeRemoved.add("P" + ResolveIds.name(prod_to_inline.getName())); @@ -107,32 +114,32 @@ public class Inlining return false; } - List removeAlternativeDoubloonsFromInlinedProduction(List inlinedAlternatives) + List<PAlt> removeAlternativeDoubloonsFromInlinedProduction(List<PAlt> inlinedAlternatives) { - AAlt[] alts = (AAlt [])inlinedAlternatives.toArray(new AAlt[0]); - LinkedList[] theWhole = new LinkedList[alts.length]; + AAlt[] alts = inlinedAlternatives.toArray(new AAlt[0]); + List<?>[] theWhole = new List<?>[alts.length]; - TreeSet indexOfDoublonsAlternatives = new TreeSet(); + Set<Integer> indexOfDoublonsAlternatives = new TreeSet<>(); for(int i=0; i<alts.length; i++) { - LinkedList elems = alts[i].getElems(); - AElem[] arrayOfElems = (AElem []) elems.toArray(new AElem[0]); - LinkedList listOfElems = new TypedLinkedList(StringCast.instance); + List<PElem> elems = alts[i].getElems(); + AElem[] arrayOfElems = elems.toArray(new AElem[0]); + List<String> listOfElems = new LinkedList<>(); for(int j=0; j<arrayOfElems.length; j++) { listOfElems.add(arrayOfElems[j].getId().getText()); } theWhole[i] = listOfElems; - LinkedList currentList = listOfElems; + List<String> currentList = listOfElems; for(int k=0; k<i; k++) { if( currentList.equals(theWhole[k]) ) { //theWhole[k] = null; - indexOfDoublonsAlternatives.add(new Integer(k)); + indexOfDoublonsAlternatives.add(k); } } } @@ -140,9 +147,8 @@ public class Inlining { int i = 0; - for(Iterator iter = indexOfDoublonsAlternatives.iterator(); iter.hasNext();) + for(int index : indexOfDoublonsAlternatives) { - int index = ((Integer)iter.next()).intValue(); //System.out.println("(" + index + "," + i + ")"); inlinedAlternatives.remove( index - i++ ); } @@ -163,7 +169,7 @@ public class Inlining LinkedList listOfElems = new TypedLinkedList(StringCast.instance); for(int j=0; j<arrayOfElems.length; j++) { - listOfElems.add(arrayOfElems[j].getId().getText()); + listOfElems.add(arrayOfElems[j].getId().getText()); } theWhole[i] = listOfElems; @@ -184,9 +190,9 @@ public class Inlining * Inlining of an alternative * */ - public LinkedList inlineAlternative(AAlt alt) + public List<AAlt> inlineAlternative(AAlt alt) { - AElem[] elems = (AElem[])alt.getElems().toArray(new AElem[0]); + AElem[] elems = alt.getElems().toArray(new AElem[0]); String elem_name ; // This list contains the names of elements to inline within an alternative @@ -219,7 +225,7 @@ public class Inlining } } - LinkedList resultingListOfAlts = new TypedLinkedList(); + List<AAlt> resultingListOfAlts = new LinkedList<>(); resultingListOfAlts.add(alt); for(int i=0; i<occurenceOfProductionToInlineWithinTheAlternative; i++) { @@ -233,12 +239,12 @@ public class Inlining /* * whichOccurence is used to number an element within the alternative */ - public LinkedList inline(LinkedList altsList, int whichOccurence) + public List<AAlt> inline(List<AAlt> altsList, int whichOccurence) { - LinkedList resultList = new LinkedList(); - AAlt[] alts = (AAlt[])altsList.toArray(new AAlt[0]); + List<AAlt> resultList = new LinkedList<>(); + AAlt[] alts = altsList.toArray(new AAlt[0]); AAlt aParsed_alt; - Map mapOfNewTermNames; + Map<String, String> mapOfNewTermNames; for(int i=0; i<alts.length; i++) { @@ -246,18 +252,17 @@ public class Inlining for(int j=0; j<prod_to_inline.getNbAlts(); j++) { - mapOfNewTermNames = new TypedHashMap(StringCast.instance, - StringCast.instance); + mapOfNewTermNames = new HashMap<>(); - LinkedList listElems = inlineList(aParsed_alt.getElems(), + List<PElem> listElems = inlineList(aParsed_alt.getElems(), prod_to_inline.getAlternative(j).getElems(), mapOfNewTermNames); - AAltTransform aAltTransform = - (AAltTransform)((AAltTransform)aParsed_alt.getAltTransform()).clone(); - final Map currentMap = prod_to_inline.getAlternative(j).getProdTransform_AlTransformMap(); + AAltTransform aAltTransform = ((AAltTransform)aParsed_alt.getAltTransform()).clone(); + final Map<String, Node> currentMap = prod_to_inline.getAlternative(j).getProdTransform_AlTransformMap(); aAltTransform.apply(new DepthFirstAdapter() { + @Override public void caseASimpleTerm(ASimpleTerm node) { if(node.getId().getText().equals(alt_elem_info) && @@ -273,7 +278,7 @@ public class Inlining termTail = prod_to_inline.getName(); } - PTerm term = (PTerm)((PTerm)currentMap.get(termTail)).clone(); + PTerm term = (PTerm)currentMap.get(termTail).clone(); if(currentMap.get(termTail) != null) { @@ -282,6 +287,7 @@ public class Inlining } } + @Override public void caseASimpleListTerm(final ASimpleListTerm node_) { if(node_.getId().getText().equals(alt_elem_info) && @@ -307,29 +313,31 @@ public class Inlining { term.apply(new DepthFirstAdapter() { + @Override public void caseANewTerm(ANewTerm node) { - node_.replaceBy( new ANewListTerm( (AProdName)node.getProdName().clone(), - (TLPar)node.getLPar().clone(), - (LinkedList)cloneList(node.getParams()) + node_.replaceBy( new ANewListTerm( node.getProdName().clone(), + node.getLPar().clone(), + cloneList(node.getParams()) ) ); } + @Override public void caseASimpleTerm(ASimpleTerm node) { PSpecifier specifier = null; TId simpleTermTail = null; if(node.getSpecifier() != null) { - specifier = (PSpecifier)node.getSpecifier().clone(); + specifier = node.getSpecifier().clone(); } if(node.getSimpleTermTail() != null) { - simpleTermTail = (TId)node.getSimpleTermTail().clone(); + simpleTermTail = node.getSimpleTermTail().clone(); } node_.replaceBy( new ASimpleListTerm( specifier, - (TId)node.getId().clone(), + node.getId().clone(), simpleTermTail ) ); @@ -340,25 +348,18 @@ public class Inlining node_.replaceBy( null ); } + @Override public void caseAListTerm(AListTerm node) { AListTerm parent = (AListTerm)node_.parent(); - LinkedList oldlistTerms = parent.getListTerms(); - LinkedList newlistTerms = new LinkedList(); + List<PListTerm> oldlistTerms = parent.getListTerms(); + List<PListTerm> newlistTerms = new LinkedList<>(); - Object[] oldListTermsArray = (Object[]) oldlistTerms.toArray(); - for(int i=0; i<oldListTermsArray.length; i++) + for(PListTerm oldListTerm : oldlistTerms) { - if(oldListTermsArray[i] != node_) + if(oldListTerm != node_) { - if(oldListTermsArray[i] instanceof PTerm) - { - newlistTerms.add( ((PTerm)oldListTermsArray[i]).clone() ); - } - else - { - newlistTerms.add( ((PListTerm)oldListTermsArray[i]).clone() ); - } + newlistTerms.add(oldListTerm.clone()); } else { @@ -380,7 +381,7 @@ public class Inlining } ); - AAltTransform tmpaAltTransform = (AAltTransform)aAltTransform.clone(); + AAltTransform tmpaAltTransform = aAltTransform.clone(); fixSimpleTermOrSimpleListTermNames(tmpaAltTransform, mapOfNewTermNames); String newAltName; if(aParsed_alt.getAltName() != null) @@ -402,12 +403,12 @@ public class Inlining return resultList; } - public LinkedList inlineList(LinkedList oldElemsList, + public List<PElem> inlineList(List<PElem> oldElemsList, AElem[] inliningProductionsElems, - Map mapOfNewTermNames) + Map<String, String> mapOfNewTermNames) { int position = 0; - AElem[] listElems = (AElem[]) oldElemsList.toArray(new AElem[0]); + AElem[] listElems = oldElemsList.toArray(new AElem[0]); for(int i=0; i<listElems.length; i++) { //We are looking for the position of the element inside the alternative. @@ -427,7 +428,7 @@ public class Inlining } } - LinkedList list = new LinkedList(); + List<PElem> list = new LinkedList<>(); int elemPosition = 1; //Before the inlined element (old alternative elements) @@ -443,19 +444,18 @@ public class Inlining } // After the inlined element (old alternative elements) - for(int i=position+1; i<listElems.length; i++) + for(int i=position+1; i<oldElemsList.size(); i++) { list.add(((AElem)oldElemsList.get(i)).clone()); } - AElem[] listOfAltElems = (AElem[]) list.toArray(new AElem[0]); + AElem[] listOfAltElems = list.toArray(new AElem[0]); for(int i=0; i<listOfAltElems.length; i++) { String old_name = listOfAltElems[i].getId().getText(); - TId elemName = (TId)listOfAltElems[i].getElemName(); + TId elemName = listOfAltElems[i].getElemName(); if(elemName != null) { - elemName = (TId)elemName; old_name = elemName.getText(); } @@ -469,36 +469,38 @@ public class Inlining } private void fixSimpleTermOrSimpleListTermNames(AAltTransform tmpaAltTransform, - final Map mapOldNameNewNames) + final Map<String, String> mapOldNameNewNames) { tmpaAltTransform.apply(new DepthFirstAdapter() { + @Override public void caseASimpleTerm(ASimpleTerm node) { if(mapOldNameNewNames.get(node.getId().getText()) != null) { - node.setId(new TId( (String)mapOldNameNewNames.get(node.getId().getText()) )); + node.setId(new TId(mapOldNameNewNames.get(node.getId().getText()))); } } + @Override public void caseASimpleListTerm(ASimpleListTerm node) { if(mapOldNameNewNames.get(node.getId().getText()) != null) { - node.setId(new TId( (String)mapOldNameNewNames.get(node.getId().getText()) )); + node.setId(new TId(mapOldNameNewNames.get(node.getId().getText()))); } } } ); } - private List cloneList(List list) + @SuppressWarnings("unchecked") + private <T extends Node> List<T> cloneList(List<T> list) { - List clone = new LinkedList(); + List<T> clone = new LinkedList<>(); - for(Iterator i = list.iterator(); i.hasNext();) - { - clone.add(((Node) i.next()).clone()); + for (final T node : list) { + clone.add((T)node.clone()); } return clone; diff --git a/src/main/java/org/sablecc/sablecc/IntSet.java b/src/main/java/org/sablecc/sablecc/IntSet.java index 2c44fd3a277ab34c29ce57d9ed404ffec4e8a0ee..7b799f991c2888ce7cba3d98f06d18007152e80c 100644 --- a/src/main/java/org/sablecc/sablecc/IntSet.java +++ b/src/main/java/org/sablecc/sablecc/IntSet.java @@ -15,17 +15,14 @@ public class IntSet public IntSet() {} - private IntSet(IntSet set - ) + private IntSet(IntSet set) { - elements = (int[]) set.elements.clone(); + elements = set.elements.clone(); } - public void and(IntSet set - ) + public void and(IntSet set) { - if(set - == this) + if(set == this) { return; } @@ -81,11 +78,13 @@ public class IntSet elements = new int[0]; } - public Object clone() + @Override + public IntSet clone() { return new IntSet(this); } + @Override public boolean equals(Object obj) { if(obj == null) @@ -98,8 +97,7 @@ public class IntSet return false; } - IntSet set - = (IntSet) obj; + IntSet set = (IntSet) obj; if(elements.length != set.elements.length) { @@ -117,15 +115,14 @@ public class IntSet return true; } - public boolean get - (int bit) + public boolean get(int bit) { int low = 0; int high = elements.length - 1; while(low <= high) { - int middle = (low + high) / 2; + int middle = (low + high) >>> 1; if(bit < elements[middle]) { @@ -144,6 +141,7 @@ public class IntSet return false; } + @Override public int hashCode() { int result = 0; @@ -156,11 +154,9 @@ public class IntSet return result; } - public void or(IntSet set - ) + public void or(IntSet set) { - if(set - == this) + if(set == this) { return; } @@ -242,11 +238,9 @@ public class IntSet } - public void set - (int bit) + public void set(int bit) { - if(!get - (bit)) + if(!get(bit)) { int[] old = elements; elements = new int[old.length + 1]; @@ -295,9 +289,10 @@ public class IntSet return elements[elements.length - 1] + 1; } + @Override public String toString() { - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); s.append("{"); @@ -321,14 +316,11 @@ public class IntSet return s.toString(); } - public void xor(IntSet set - ) + public void xor(IntSet set) { - if(set - == this) + if(set == this) { - set - = (IntSet) set.clone(); + set = set.clone(); } int length = 0; @@ -384,6 +376,6 @@ public class IntSet public int[] elements() { - return (int[]) elements/*.clone()*/; + return elements/*.clone()*/; } } diff --git a/src/main/java/org/sablecc/sablecc/IntegerCast.java b/src/main/java/org/sablecc/sablecc/IntegerCast.java deleted file mode 100644 index a05df2df304317934103b8e5e9e2546f834274e3..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/IntegerCast.java +++ /dev/null @@ -1,23 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class IntegerCast implements Cast -{ - public final static IntegerCast instance = new IntegerCast(); - - private IntegerCast() - {} - - public Object cast(Object o) - { - return (Integer) o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/IntegerComparator.java b/src/main/java/org/sablecc/sablecc/IntegerComparator.java deleted file mode 100644 index ca5e9a236334f3f4d6e1bccc43ee555ba73afab1..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/IntegerComparator.java +++ /dev/null @@ -1,23 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class IntegerComparator implements Comparator -{ - public final static IntegerComparator instance = new IntegerComparator(); - - private IntegerComparator() - {} - - public int compare(Object o1, Object o2) - { - return ((Integer) o1).intValue() - ((Integer) o2).intValue(); - } -} diff --git a/src/main/java/org/sablecc/sablecc/InternalTransformationsToGrammar.java b/src/main/java/org/sablecc/sablecc/InternalTransformationsToGrammar.java index 2cd0a92b257b449e301625cafea61b1c07eeb31f..49571873505a673de3763a006a711f4b9db0e9e4 100644 --- a/src/main/java/org/sablecc/sablecc/InternalTransformationsToGrammar.java +++ b/src/main/java/org/sablecc/sablecc/InternalTransformationsToGrammar.java @@ -15,10 +15,15 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.AnalysisAdapter; +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.io.*; public class InternalTransformationsToGrammar extends DepthFirstAdapter { @@ -40,25 +45,22 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter int count; int elem; - private LinkedList listSimpleTermTransform; + private List<Node> listSimpleTermTransform; - public final Map simpleTermTransform; - Map mapProductionTransformations; - Map simpleTermOrsimpleListTermTypes; + public final Map<Node, String> simpleTermTransform; + Map<String, List<PElem>> mapProductionTransformations; + Map<Node, String> simpleTermOrsimpleListTermTypes; - private Map isElementIsAlist = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - StringCast.instance); + private Map<String, String> isElementIsAlist = new TreeMap<>(); - private LinkedList listProd; + private List<PProd> listProd; public InternalTransformationsToGrammar(ResolveIds ids, ResolveAltIds altIds, ResolveTransformIds transformIds, - LinkedList listSimpleTermTransform, - Map simpleTermTransform, - Map mapProductionTransformations, - Map simpleTermOrsimpleListTermTypes) + List<Node> listSimpleTermTransform, + Map<Node, String> simpleTermTransform, + Map<String, List<PElem>> mapProductionTransformations, + Map<Node, String> simpleTermOrsimpleListTermTypes) { this.ids = ids; this.altIds = altIds; @@ -69,96 +71,105 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter this.simpleTermOrsimpleListTermTypes = simpleTermOrsimpleListTermTypes; } + @Override public void inAProductions(AProductions node) { listProd = node.getProds(); } - private LinkedList listOfAlts; + private List<PAlt> listOfAlts; + @Override public void inAAst(AAst node) { processingAst = true; } + @Override public void outAAst(AAst node) { processingAst = false; } + @Override public void caseAProd(AProd node) { - currentProd = (String) ids.names.get(node); - listOfAlts = new LinkedList(); + currentProd = ids.names.get(node); + listOfAlts = new LinkedList<>(); - Object[] list_alt = (Object[])node.getAlts().toArray(); - for(int i=0; i<list_alt.length; i++) + for(PAlt alt : node.getAlts()) { - ((PAlt) list_alt[i]).apply(this); + alt.apply(this); } node.setAlts(listOfAlts); } - private LinkedList listElems; + private List<PElem> listElems; private AAlt aParsedAlt; - private LinkedList listElemsAltTransform; + private List<String> listElemsAltTransform; private String currentNewAltName; boolean countElementNecessary; - LinkedList listOfAlternativeElemsWHaveName; + List<String> listOfAlternativeElemsWHaveName; + private final Map<AElem, Integer> elemOperators = new HashMap<>(); + + @Override public void caseAAlt(AAlt node) { count = 1; - currentAltName = (String) ids.names.get(node); + currentAltName = ids.names.get(node); AAltTransform currentAltTransform = (AAltTransform)node.getAltTransform(); - listOfAlternativeElemsWHaveName = new LinkedList(); + listOfAlternativeElemsWHaveName = new LinkedList<>(); node.apply(new DepthFirstAdapter() { + @Override public void inAElem(AElem node) { - InternalTransformationsToGrammar.this.setOut(node, new Integer(NONE)); + InternalTransformationsToGrammar.this.elemOperators.put(node, NONE); } + @Override public void caseAStarUnOp(AStarUnOp node) { count *= 2; - InternalTransformationsToGrammar.this.setOut(node.parent(), new Integer(STAR)); + InternalTransformationsToGrammar.this.elemOperators.put((AElem)node.parent(), STAR); } + @Override public void caseAQMarkUnOp(AQMarkUnOp node) { count *= 2; - InternalTransformationsToGrammar.this.setOut(node.parent(), new Integer(QMARK)); + InternalTransformationsToGrammar.this.elemOperators.put((AElem)node.parent(), QMARK); } + @Override public void caseAPlusUnOp(APlusUnOp node) { - InternalTransformationsToGrammar.this.setOut(node.parent(), new Integer(PLUS)); + InternalTransformationsToGrammar.this.elemOperators.put((AElem)node.parent(), PLUS); } } ); if(count == 1) { - listElems = new LinkedList(); - listElemsAltTransform = new LinkedList(); + listElems = new LinkedList<>(); + listElemsAltTransform = new LinkedList<>(); countElementNecessary = false; - Object temp[] = node.getElems().toArray(); - for(int i = 0; i < temp.length; i++) + for(PElem pElem : node.getElems()) { - Object obj = temp[i]; + final PUnOp unOp = ((AElem)pElem).getUnOp(); - if( ((AElem)obj).getUnOp() != null && - ( ((AElem)obj).getUnOp() instanceof AQMarkUnOp || - ((AElem)obj).getUnOp() instanceof AStarUnOp ) + if( unOp != null && + ( unOp instanceof AQMarkUnOp || + unOp instanceof AStarUnOp ) ) { if(!countElementNecessary) @@ -168,23 +179,23 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter } } - for(int i = 0; i < temp.length; i++) + for(PElem pElem : node.getElems()) { - ((PElem)temp[i]).apply(this); + pElem.apply(this); } TId nameOfAlt = null; if(node.getAltName() != null) { - nameOfAlt = (TId)node.getAltName().clone(); + nameOfAlt = node.getAltName().clone(); } currentNewAltName = currentProd + "." + currentAltName.toLowerCase(); altIds.alts_elems.put(currentNewAltName, listElemsAltTransform); altIds.alts_elems_list_elemName.put(currentNewAltName, listOfAlternativeElemsWHaveName); - AAltTransform altTransform = (AAltTransform)currentAltTransform.clone(); + AAltTransform altTransform = currentAltTransform.clone(); AltTransformAdapter altTransformAdapter = new AltTransformAdapter(simpleTermTransform, listSimpleTermTransform, @@ -207,8 +218,8 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter for(count = 0; count < max; count++) { - listElems = new LinkedList(); - listElemsAltTransform = new LinkedList(); + listElems = new LinkedList<>(); + listElemsAltTransform = new LinkedList<>(); elem = 0; @@ -216,14 +227,13 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter countElementNecessary = false; - Object temp[] = node.getElems().toArray(); - for(int i = 0; i < temp.length; i++) + for(PElem pElem : node.getElems()) { - Object obj = temp[i]; + final PUnOp unOp = ((AElem)pElem).getUnOp(); - if( ((AElem)obj).getUnOp() != null && - ( ((AElem)obj).getUnOp() instanceof AQMarkUnOp || - ((AElem)obj).getUnOp() instanceof AStarUnOp ) + if( unOp != null && + ( unOp instanceof AQMarkUnOp || + unOp instanceof AStarUnOp ) ) { if(!countElementNecessary) @@ -233,15 +243,15 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter } } - for(int i = 0; i < temp.length; i++) + for(PElem pElem : node.getElems()) { - ((PElem)temp[i]).apply(this); + pElem.apply(this); } altIds.alts_elems.put(currentNewAltName, listElemsAltTransform); altIds.alts_elems_list_elemName.put(currentNewAltName, listOfAlternativeElemsWHaveName); - altTransform = (AAltTransform)currentAltTransform.clone(); + altTransform = currentAltTransform.clone(); AltTransformAdapter altTransformAdapter = new AltTransformAdapter(simpleTermTransform, listSimpleTermTransform, @@ -253,7 +263,7 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter aParsedAlt = new AAlt(new TId(currentAltName.toLowerCase()+(count + 1)), listElems, altTransform); String currentAltInlining; - currentAltInlining = "A" + ids.name(aParsedAlt.getAltName().getText()) + currentProd; + currentAltInlining = "A" + ResolveIds.name(aParsedAlt.getAltName().getText()) + currentProd; ids.names.put(aParsedAlt, currentAltInlining); listOfAlts.add(aParsedAlt); @@ -261,15 +271,16 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter } } - LinkedList checkCreationOfXElem = new TypedLinkedList(StringCast.instance); + List<String> checkCreationOfXElem = new LinkedList<>(); //It's also available for Ignored alternatives + @Override public void caseAElem(AElem node) { if(!processingAst) { - int op = ((Integer) getOut(node)).intValue(); - String name = (String) ids.elemTypes.get(node); + int op = this.elemOperators.get(node); + String name = ids.elemTypes.get(node); String numero = (countElementNecessary == true ? ""+(count+1) : "" ); String qMarkOrPlusElemType; String elemNameOfElem = null; @@ -307,11 +318,11 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter aElem = new AElem(aElemName, specifier, new TId(elemName), null); if(elemNameOfElem != null) { - ids.names.put(aElem, ids.name(elemNameOfElem)); + ids.names.put(aElem, ResolveIds.name(elemNameOfElem)); } else { - ids.names.put(aElem, ids.name(elemName)); + ids.names.put(aElem, ResolveIds.name(elemName)); } ok = true; } @@ -321,8 +332,8 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter if((count & (1 << elem)) != 0) { - qMarkOrPlusElemType = (String)ids.elemTypes.get(node); - LinkedList tmpProdTransform = (LinkedList)mapProductionTransformations.get(qMarkOrPlusElemType); + qMarkOrPlusElemType = ids.elemTypes.get(node); + List<PElem> tmpProdTransform = mapProductionTransformations.get(qMarkOrPlusElemType); if(!checkCreationOfXElem.contains("$" + elemName)) { @@ -336,11 +347,11 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter if(elemNameOfElem != null) { - ids.names.put(aElem, ids.name(elemNameOfElem)); + ids.names.put(aElem, ResolveIds.name(elemNameOfElem)); } else { - ids.names.put(aElem, ids.name(elemName)); + ids.names.put(aElem, ResolveIds.name(elemName)); } ok = true; @@ -358,11 +369,11 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter if(elemNameOfElem != null) { - ids.names.put(aElem, ids.name(elemNameOfElem)); + ids.names.put(aElem, ResolveIds.name(elemNameOfElem)); } else { - ids.names.put(aElem, ids.name(elemName)); + ids.names.put(aElem, ResolveIds.name(elemName)); } ok = true; @@ -373,8 +384,8 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter break; case PLUS: { - qMarkOrPlusElemType = (String)ids.elemTypes.get(node); - LinkedList tmpProdTransform = (LinkedList)mapProductionTransformations.get(qMarkOrPlusElemType); + qMarkOrPlusElemType = ids.elemTypes.get(node); + List<PElem> tmpProdTransform = mapProductionTransformations.get(qMarkOrPlusElemType); if(!checkCreationOfXElem.contains("$" + elemName)) { @@ -388,11 +399,11 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter if(elemNameOfElem != null) { - ids.names.put(aElem, ids.name(elemNameOfElem)); + ids.names.put(aElem, ResolveIds.name(elemNameOfElem)); } else { - ids.names.put(aElem, ids.name(elemName)); + ids.names.put(aElem, ResolveIds.name(elemName)); } ok = true; @@ -445,20 +456,20 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter This creates the production :: $elem {-> elem* } - = {nonTerminal} $elem elem {-> [$elem.elem elem] } - | {terminal} elem {-> [elem] } - ; + = {nonTerminal} $elem elem {-> [$elem.elem elem] } + | {terminal} elem {-> [elem] } + ; */ public AProd createXelemProduction(final String name, final String elemTypeName, String XproductionName, - LinkedList nodeProdTransform) + List<PElem> nodeProdTransform) { final String rname = name.substring(1); - LinkedList listOfAltsXelem = new LinkedList(); + List<PAlt> listOfAltsXelem = new LinkedList<>(); if(nodeProdTransform != null) { - nodeProdTransform = (LinkedList)cloneList(nodeProdTransform); + nodeProdTransform = cloneList(nodeProdTransform); //Creation of the production transformation for Xelem //if the production transformation is introduced by the software @@ -467,7 +478,7 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter AElem elem = (AElem)nodeProdTransform.get(0); if(elem.getUnOp() == null && elem.getId().getText().equals(rname)) { - LinkedList elemsProdTransform = new LinkedList(); + List<PElem> elemsProdTransform = new LinkedList<>(); elemsProdTransform.add( new AElem( null, new AProductionSpecifier(), new TId(rname), new AStarUnOp() ) ); nodeProdTransform = elemsProdTransform; } @@ -477,20 +488,19 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter //That means elem is token type else { - String name_resolved = ids.name(name); - - LinkedList elemsProdTransform = new LinkedList(); + List<PElem> elemsProdTransform = new LinkedList<>(); elemsProdTransform.add( new AElem( null, new ATokenSpecifier(), new TId(rname), new AStarUnOp() ) ); nodeProdTransform = elemsProdTransform; } - final LinkedList listProdTransformationOfXelem = new LinkedList(); + final List<String> listProdTransformationOfXelem = new LinkedList<>(); - AElem []temp_listProdTransform = (AElem[])nodeProdTransform.toArray(new AElem[0]); + AElem []temp_listProdTransform = nodeProdTransform.toArray(new AElem[0]); for(int i=0; i<temp_listProdTransform.length; i++) { temp_listProdTransform[i].apply( new DepthFirstAdapter() { + @Override public void caseAElem(AElem node) { //The production transformation needs to have a star operator. @@ -509,19 +519,20 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter } //creation of the first AltTransform node - AElem[] prodTransformElems = (AElem[]) nodeProdTransform.toArray(new AElem[0]); + AElem[] prodTransformElems = nodeProdTransform.toArray(new AElem[0]); - final LinkedList listTerms_first = new LinkedList(); + final List<PTerm> listTerms_first = new LinkedList<>(); for(int i = 0; i < prodTransformElems.length; i++) { prodTransformElems[i].apply(new AnalysisAdapter() { + @Override public void caseAElem(AElem node) { String tmpNodeName = ( (node.getElemName() == null) ? node.getId().getText() : node.getElemName().getText() ); - LinkedList listAListTerm_first = new LinkedList(); + List<PListTerm> listAListTerm_first = new LinkedList<>(); if(elemTypeName.startsWith("T")) { @@ -542,7 +553,7 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter AAltTransform aAltTransform = new AAltTransform(new TLBrace(), listTerms_first, new TRBrace()); //create the first list of elems of an alternative - LinkedList elems = new LinkedList(); + List<PElem> elems = new LinkedList<>(); AElem aElemFirstTobeAdded; //the elem is a token if(elemTypeName.startsWith("T")) @@ -557,25 +568,25 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter //creation of the first alternative AAlt aParsedAlt = new AAlt(new TId("terminal"), elems, aAltTransform); - String terminal_altName = "ATerminal" + ids.name(name); listOfAltsXelem.add(aParsedAlt); //create the second AltTransform node - prodTransformElems = (AElem[]) nodeProdTransform.toArray(new AElem[0]); + prodTransformElems = nodeProdTransform.toArray(new AElem[0]); - final LinkedList listTerms_second = new LinkedList(); + final List<PTerm> listTerms_second = new LinkedList<>(); for(int i = 0; i < prodTransformElems.length; i++) { prodTransformElems[i].apply(new AnalysisAdapter() { + @Override public void caseAElem(AElem node) { String tmpNodeName = ( (node.getElemName() == null) ? node.getId().getText() : node.getElemName().getText() ); - LinkedList listAListTerm_second = new LinkedList(); + List<PListTerm> listAListTerm_second = new LinkedList<>(); listAListTerm_second.add(new ASimpleListTerm(null, new TId(name), new TId(tmpNodeName)) ); @@ -600,7 +611,7 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter aAltTransform = new AAltTransform(new TLBrace(), listTerms_second, new TRBrace()); //creation of the second list of elems of an alternative :: two elems - elems = new LinkedList(); + elems = new LinkedList<>(); //first elem AElem aElemSecondTobeAdded = new AElem(null, new AProductionSpecifier(), new TId(name), null); @@ -619,8 +630,6 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter aParsedAlt = new AAlt(new TId("non_terminal"), elems, aAltTransform); - String nonTerminal_altName = "ANonTerminal" + ids.name(name); - listOfAltsXelem.add(aParsedAlt); AProd prodToReturn = new AProd(new TId(name), new TArrow(), nodeProdTransform, listOfAltsXelem); @@ -630,13 +639,13 @@ public class InternalTransformationsToGrammar extends DepthFirstAdapter return prodToReturn; } - private List cloneList(List list) + @SuppressWarnings("unchecked") + private <T extends Node> List<T> cloneList(List<T> list) { - List clone = new LinkedList(); + List<T> clone = new LinkedList<>(); - for(Iterator i = list.iterator(); i.hasNext();) - { - clone.add(((Node) i.next()).clone()); + for (final T node : list) { + clone.add((T)node.clone()); } return clone; } diff --git a/src/main/java/org/sablecc/sablecc/LR0Collection.java b/src/main/java/org/sablecc/sablecc/LR0Collection.java index 2dca7cd995392af1c2b94586b652c435a5513671..b11bbd5fa8b8ee0a5b76bd9b36882189964b6480 100644 --- a/src/main/java/org/sablecc/sablecc/LR0Collection.java +++ b/src/main/java/org/sablecc/sablecc/LR0Collection.java @@ -7,22 +7,23 @@ package org.sablecc.sablecc; -import java.util.*; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; final class LR0Collection { - private final Vector sets = new Vector(0); - private final TreeMap setIndices = new TreeMap(); - private final Vector GOTO = new Vector(0); - final Vector names = new Vector(0); + private final List<LR0ItemSet> sets = new ArrayList<>(); + private final Map<LR0ItemSet, Integer> setIndices = new TreeMap<>(); + private final List<Map<Symbol, Integer>> GOTO = new ArrayList<>(); + final List<String> names = new ArrayList<>(); - LR0Collection(LR0ItemSet set - ) + LR0Collection(LR0ItemSet set) { - add - (set - , -1, null); + System.out.println(" - Computing LR(0) items."); + + add(set, -1, null); for(int i = 0; i < sets.size(); i++) { @@ -31,43 +32,36 @@ final class LR0Collection for(int j = 0; j < symbols.length; j++) { - addGoto(i, symbols[j], Grammar.GOTO(set - (i), symbols[j])); + addGoto(i, symbols[j], Grammar.GOTO(set(i), symbols[j])); } } System.out.println(); } - private int add - (LR0ItemSet set - , int from, Symbol symbol) + private int add(LR0ItemSet set, int from, Symbol symbol) + { + Integer result = set(set); + + if(result == null) { - Integer result = set - (set - ); + result = sets.size(); - if(result == null) + setIndices.put(set, result); + sets.add(set); + GOTO.add(new TreeMap<Symbol, Integer>()); + if(from == -1) { - result = new Integer(sets.size()); - - setIndices.put(set - , result); - sets.addElement(set - ); - GOTO.addElement(new TreeMap()); - if(from == -1) - { - names.addElement(" "); - } - else - { - names.addElement(names.elementAt(from) + "" + symbol + " "); - } + names.add(" "); + } + else + { + names.add(names.get(from) + "" + symbol + " "); } - - return result.intValue(); } + return result.intValue(); + } + private static LR0ItemSet empty = new LR0ItemSet(); public static void reinit() @@ -79,51 +73,45 @@ final class LR0Collection { if(!to.equals(empty)) { - ((TreeMap) GOTO.elementAt(from)).put(symbol, new Integer(add - (to, from, symbol))); + GOTO.get(from).put(symbol, add(to, from, symbol)); } } - private Integer set - (LR0ItemSet set - ) - { - return (Integer) setIndices.get(set - ); - } + private Integer set(LR0ItemSet set) + { + return setIndices.get(set); + } - private LR0ItemSet set - (int index) + private LR0ItemSet set(int index) { - return (LR0ItemSet) sets.elementAt(index); + return sets.get(index); } LR0ItemSet[] sets() { - LR0ItemSet[] result = new LR0ItemSet[sets.size()]; - sets.copyInto(result); - - return result; + return sets.toArray(new LR0ItemSet[0]); } - Integer GOTO(int set - , Symbol symbol) + Integer GOTO(int set, Symbol symbol) { - return (Integer) ((TreeMap) GOTO.elementAt(set - )).get(symbol); + return GOTO.get(set).get(symbol); } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); - result.append("{[LR0ItemCollection]" + System.getProperty("line.separator")); + result.append("{[LR0ItemCollection]"); + result.append(System.getProperty("line.separator")); LR0ItemSet[] sets = sets(); Symbol[] symbols = Symbol.symbols(); for(int i = 0; i < sets.length; i++) { - result.append(i + ":" + Grammar.CLOSURE(sets[i])); + result.append(i); + result.append(":"); + result.append(Grammar.CLOSURE(sets[i])); result.append(System.getProperty("line.separator")); for(int j = 0; j < symbols.length; j++) diff --git a/src/main/java/org/sablecc/sablecc/LR0Item.java b/src/main/java/org/sablecc/sablecc/LR0Item.java index a6f973b6bd3366a2d5ebadc70c17ede84ad8044a..c607dbc71e15aecd8c19ac33b9170cfaa696a56c 100644 --- a/src/main/java/org/sablecc/sablecc/LR0Item.java +++ b/src/main/java/org/sablecc/sablecc/LR0Item.java @@ -7,9 +7,9 @@ package org.sablecc.sablecc; -import java.util.*; +import java.util.StringTokenizer; -final class LR0Item implements Cloneable, Comparable +final class LR0Item implements Comparable<LR0Item> { final int production; final int position; @@ -20,10 +20,9 @@ final class LR0Item implements Cloneable, Comparable this.position = position; } - public int compareTo(Object object) + @Override + public int compareTo(LR0Item item) { - LR0Item item = (LR0Item) object; - int result = production - item.production; if(result == 0) @@ -34,11 +33,7 @@ final class LR0Item implements Cloneable, Comparable return result; } - public Object clone() - { - return new LR0Item(production, position); - } - + @Override public boolean equals(Object obj) { if((obj == null) || @@ -53,14 +48,16 @@ final class LR0Item implements Cloneable, Comparable (item.position == position); } + @Override public int hashCode() { return (production * 13) ^ (position * 17); } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); String prodStr = (Production.production(production)).toString(); int pos = 0; diff --git a/src/main/java/org/sablecc/sablecc/LR0ItemAndSetPair.java b/src/main/java/org/sablecc/sablecc/LR0ItemAndSetPair.java index a411e589dac83217d303994bb281ae1644ca0581..b14678683f13227d600a6148ef1fc60d1b80a3f8 100644 --- a/src/main/java/org/sablecc/sablecc/LR0ItemAndSetPair.java +++ b/src/main/java/org/sablecc/sablecc/LR0ItemAndSetPair.java @@ -10,14 +10,11 @@ package org.sablecc.sablecc; final class LR0ItemAndSetPair { public final LR0Item item; - public final int set - ; + public final int set; - LR0ItemAndSetPair(LR0Item item, int set - ) + LR0ItemAndSetPair(LR0Item item, int set) { this.item = item; - this.set = set - ; + this.set = set; } } diff --git a/src/main/java/org/sablecc/sablecc/LR0ItemSet.java b/src/main/java/org/sablecc/sablecc/LR0ItemSet.java index d2ca512a967990fbc44c5c6b38bf1cf1a41b5c7e..f8fe908dbef486a4563c4904befb171eb14dcf9c 100644 --- a/src/main/java/org/sablecc/sablecc/LR0ItemSet.java +++ b/src/main/java/org/sablecc/sablecc/LR0ItemSet.java @@ -7,28 +7,26 @@ package org.sablecc.sablecc; -import java.util.*; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; -import java.util.Vector; - -final class LR0ItemSet implements Cloneable, Comparable +final class LR0ItemSet implements Cloneable, Comparable<LR0ItemSet> { - private final TreeMap items; + private final Map<LR0Item, LR0Item> items; private int hashCode; LR0ItemSet() { - items = new TreeMap(); + items = new TreeMap<>(); } - private LR0ItemSet(LR0ItemSet set - ) + private LR0ItemSet(LR0ItemSet set) { - items = (TreeMap) set.items.clone(); + items = new TreeMap<>(set.items); } - void set - (LR0Item item) + void set(LR0Item item) { if(items.put(item, item) == null) { @@ -37,8 +35,7 @@ final class LR0ItemSet implements Cloneable, Comparable } } - boolean get - (LR0Item item) + boolean get(LR0Item item) { return items.get(item) != null; } @@ -48,15 +45,7 @@ final class LR0ItemSet implements Cloneable, Comparable private void computeArray() { - Vector itemVector = new Vector(0); - - for(Iterator e = items.keySet().iterator(); e.hasNext();) - { - itemVector.addElement(e.next()); - } - - items_ = new LR0Item[itemVector.size()]; - itemVector.copyInto(items_); + items_ = items.keySet().toArray(new LR0Item[0]); modified_ = false; } @@ -70,9 +59,10 @@ final class LR0ItemSet implements Cloneable, Comparable return items_; } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append("{"); Production[] productions = Production.productions(); @@ -84,8 +74,7 @@ final class LR0ItemSet implements Cloneable, Comparable for(int j = 0; j <= rightsideLength; j++) { LR0Item item = new LR0Item(productions[i].index, j); - if(get - (item)) + if(get(item)) { if(space) { @@ -106,11 +95,13 @@ final class LR0ItemSet implements Cloneable, Comparable return result.toString(); } - public Object clone() + @Override + public LR0ItemSet clone() { return new LR0ItemSet(this); } + @Override public boolean equals(Object obj) { if((obj == null) || @@ -119,45 +110,30 @@ final class LR0ItemSet implements Cloneable, Comparable return false; } - LR0ItemSet set - = (LR0ItemSet) obj; + LR0ItemSet set = (LR0ItemSet) obj; - if(set.items.size() != items.size()) - { - return false; - } - - for(Iterator e = items.keySet().iterator(); e.hasNext();) - { - if(!set.get((LR0Item) e.next())) - { - return false; - } - } - - return true; + return items.keySet().equals(set.items.keySet()); } + @Override public int hashCode() { return hashCode; } - public int compareTo(Object object) + @Override + public int compareTo(LR0ItemSet set) { - LR0ItemSet set - = (LR0ItemSet) object; - int result = items.size() - set.items.size(); if(result == 0) { - Iterator e = items.keySet().iterator(); - Iterator f = set.items.keySet().iterator(); + Iterator<LR0Item> e = items.keySet().iterator(); + Iterator<LR0Item> f = set.items.keySet().iterator(); while(e.hasNext() && f.hasNext() && (result == 0)) { - result = ((LR0Item) e.next()).compareTo(f.next()); + result = e.next().compareTo(f.next()); } if(result == 0) diff --git a/src/main/java/org/sablecc/sablecc/LR1Collection.java b/src/main/java/org/sablecc/sablecc/LR1Collection.java index cca92462dfab27b5f867eef77a4e99a2cd0fe172..250e24ba8b6a6e06bd7e8906ca76c85eb76a1ee5 100644 --- a/src/main/java/org/sablecc/sablecc/LR1Collection.java +++ b/src/main/java/org/sablecc/sablecc/LR1Collection.java @@ -7,43 +7,48 @@ package org.sablecc.sablecc; -import java.util.Vector; -import java.util.Enumeration; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; final class LR1Collection { final LR0Collection collection; - final TreeMap[] lookaheads; - private final TreeMap[] propagation; + final Map<LR0Item, SymbolSet>[] lookaheads; + private final Map<LR0Item, List<LR0ItemAndSetPair>>[] propagation; - LR1Collection(LR0ItemSet set - ) + LR1Collection(LR0ItemSet set) { - collection = new LR0Collection(set - ); + collection = new LR0Collection(set); + + System.out.println(" - Computing LR(1) items."); // Initialize lookaheads to nothing, propagation to nothing LR0ItemSet[] sets = collection.sets(); - lookaheads = new TreeMap[sets.length]; - propagation = new TreeMap[sets.length]; + @SuppressWarnings("unchecked") + final Map<LR0Item, SymbolSet>[] lookaheadsTemp = (Map<LR0Item, SymbolSet>[])new Map<?, ?>[sets.length]; + lookaheads = lookaheadsTemp; + @SuppressWarnings("unchecked") + final Map<LR0Item, List<LR0ItemAndSetPair>>[] propagationTemp = (Map<LR0Item, List<LR0ItemAndSetPair>>[])new Map<?, ?>[sets.length]; + propagation = propagationTemp; for(int i = 0; i < sets.length; i++) { System.out.print("."); - lookaheads[i] = new TreeMap(); - propagation[i] = new TreeMap(); + lookaheads[i] = new TreeMap<>(); + propagation[i] = new TreeMap<>(); LR0Item[] items = sets[i].items(); for(int j = 0; j < items.length; j++) { lookaheads[i].put(items[j], new SymbolSet()); - propagation[i].put(items[j], new Vector(0)); + propagation[i].put(items[j], new ArrayList<LR0ItemAndSetPair>()); } } System.out.println(); - ((SymbolSet) lookaheads[0].get(set.items()[0])).setTerminal(Grammar.eof); + lookaheads[0].get(set.items()[0]).setTerminal(Grammar.eof); for(int i = 0; i < sets.length; i++) { @@ -73,17 +78,16 @@ final class LR1Collection if(destination != null) { - ((SymbolSet) lookaheads[destination.intValue()]. - get - (new LR0Item(closure[k].lr0Item.production, - closure[k].lr0Item.position + 1))). + lookaheads[destination.intValue()].get + (new LR0Item(closure[k].lr0Item.production, + closure[k].lr0Item.position + 1)). setTerminal(closure[k].terminal); - /*((SymbolSet) lookaheads[collection.GOTO(i, + /*lookaheads[collection.GOTO(i, Production.production(closure[k].lr0Item.production). rightside(closure[k].lr0Item.position)).intValue()]. get(new LR0Item(closure[k].lr0Item.production, - closure[k].lr0Item.position + 1))). + closure[k].lr0Item.position + 1)). setTerminal(closure[k].terminal);*/ } } @@ -101,14 +105,12 @@ final class LR1Collection if(destination != null) { - ((Vector) propagation[i].get(items[j])). - addElement(new LR0ItemAndSetPair( + propagation[i].get(items[j]).add(new LR0ItemAndSetPair( new LR0Item(closure[k].lr0Item.production, closure[k].lr0Item.position + 1), destination.intValue())); - /*((Vector) propagation[i].get(items[j])). - addElement(new LR0ItemAndSetPair( + /*propagation[i].get(items[j]).add(new LR0ItemAndSetPair( new LR0Item(closure[k].lr0Item.production, closure[k].lr0Item.position + 1), collection.GOTO(i, @@ -133,16 +135,11 @@ final class LR1Collection for(int j = 0; j < items.length; j++) { - for(Enumeration e = ((Vector) propagation[i].get(items[j])). - elements(); e.hasMoreElements();) + for(LR0ItemAndSetPair pair : propagation[i].get(items[j])) { - LR0ItemAndSetPair pair = (LR0ItemAndSetPair) e.nextElement(); - - SymbolSet before = (SymbolSet) - ((SymbolSet) lookaheads[pair.set].get(pair.item)).clone(); + SymbolSet before = lookaheads[pair.set].get(pair.item).clone(); - ((SymbolSet) lookaheads[pair.set].get(pair.item)). - or((SymbolSet) lookaheads[i].get(items[j])); + lookaheads[pair.set].get(pair.item).or(lookaheads[i].get(items[j])); if(!before.equals(lookaheads[pair.set].get(pair.item))) { @@ -156,25 +153,31 @@ final class LR1Collection System.out.println(); } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append(collection); result.append(System.getProperty("line.separator")); - result.append("Lookaheads" + System.getProperty("line.separator")); + result.append("Lookaheads"); + result.append(System.getProperty("line.separator")); LR0ItemSet[] sets = collection.sets(); for(int i = 0; i < sets.length; i++) { - result.append(i + ":" + System.getProperty("line.separator")); + result.append(i); + result.append(":"); + result.append(System.getProperty("line.separator")); LR0Item[] items = sets[i].items(); for(int j = 0; j < items.length; j++) { - result.append(items[j] + ":" + lookaheads[i].get(items[j]) + - System.getProperty("line.separator")); + result.append(items[j]); + result.append(":"); + result.append(lookaheads[i].get(items[j])); + result.append(System.getProperty("line.separator")); } } diff --git a/src/main/java/org/sablecc/sablecc/LR1Item.java b/src/main/java/org/sablecc/sablecc/LR1Item.java index 9aadae7597b9cf21022eb70b8afc65334e5ece0e..a69d90a4830adb8a3070decbbec163ddf1c013cd 100644 --- a/src/main/java/org/sablecc/sablecc/LR1Item.java +++ b/src/main/java/org/sablecc/sablecc/LR1Item.java @@ -7,9 +7,7 @@ package org.sablecc.sablecc; -import java.util.*; - -final class LR1Item implements Cloneable, Comparable +final class LR1Item implements Comparable<LR1Item> { final LR0Item lr0Item; final int terminal; @@ -20,11 +18,7 @@ final class LR1Item implements Cloneable, Comparable this.terminal = terminal; } - public Object clone() - { - return new LR1Item(lr0Item, terminal); - } - + @Override public boolean equals(Object obj) { if((obj == null) || @@ -39,11 +33,13 @@ final class LR1Item implements Cloneable, Comparable (item.terminal == terminal); } + @Override public int hashCode() { return lr0Item.hashCode() * (terminal + 1) * 37; } + @Override public String toString() { return lr0Item + ":" + Symbol.symbol(terminal, true); @@ -83,10 +79,9 @@ final class LR1Item implements Cloneable, Comparable } } - public int compareTo(Object object) + @Override + public int compareTo(LR1Item item) { - LR1Item item = (LR1Item) object; - int result = lr0Item.compareTo(item.lr0Item); if(result == 0) diff --git a/src/main/java/org/sablecc/sablecc/LR1ItemSet.java b/src/main/java/org/sablecc/sablecc/LR1ItemSet.java index ba7114d226fed260161c72830348c0054dfb7718..d6a1e6f76b5b963152a60216e9b05e0041c8a189 100644 --- a/src/main/java/org/sablecc/sablecc/LR1ItemSet.java +++ b/src/main/java/org/sablecc/sablecc/LR1ItemSet.java @@ -7,28 +7,29 @@ package org.sablecc.sablecc; -import java.util.*; -import java.util.Vector; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; -final class LR1ItemSet implements Cloneable, Comparable +final class LR1ItemSet implements Cloneable, Comparable<LR1ItemSet> { - private final TreeMap items; + private final Map<LR1Item, LR1Item> items; private int hashCode = 0; LR1ItemSet() { - this.items = new TreeMap(); + this.items = new TreeMap<>(); } - private LR1ItemSet(LR1ItemSet set - ) + private LR1ItemSet(LR1ItemSet set) { - this.items = (TreeMap) set.items.clone(); + this.items = new TreeMap<>(set.items); this.hashCode = set.hashCode; } - void set - (LR1Item item) + void set(LR1Item item) { if(items.put(item, item) == null) { @@ -37,8 +38,7 @@ final class LR1ItemSet implements Cloneable, Comparable } } - boolean get - (LR1Item item) + boolean get(LR1Item item) { return items.get(item) != null; } @@ -48,15 +48,7 @@ final class LR1ItemSet implements Cloneable, Comparable private void computeArray() { - Vector itemVector = new Vector(0); - - for(Iterator e = items.keySet().iterator(); e.hasNext();) - { - itemVector.addElement(e.next()); - } - - items_ = new LR1Item[itemVector.size()]; - itemVector.copyInto(items_); + items_ = items.keySet().toArray(new LR1Item[0]); modified_ = false; } @@ -70,12 +62,15 @@ final class LR1ItemSet implements Cloneable, Comparable return items_; } + @Override public String toString() { String nl = System.getProperty("line.separator"); - StringBuffer result = new StringBuffer(); - result.append("{" + nl + "\t"); + StringBuilder result = new StringBuilder(); + result.append("{"); + result.append(nl); + result.append("\t"); Production[] productions = Production.productions(); Symbol[] terminals = Symbol.terminals(); @@ -91,12 +86,13 @@ final class LR1ItemSet implements Cloneable, Comparable for(int k = 0; k < terminals.length; k++) { LR1Item item = new LR1Item(lr0Item, terminals[k].index); - if(get - (item)) + if(get(item)) { if(comma) { - result.append("," + nl + "\t"); + result.append(","); + result.append(nl); + result.append("\t"); } else { @@ -109,7 +105,8 @@ final class LR1ItemSet implements Cloneable, Comparable } } - result.append(nl + "}"); + result.append(nl); + result.append("}"); return result.toString(); } @@ -120,7 +117,7 @@ final class LR1ItemSet implements Cloneable, Comparable LR1Item[] items = items(); int length = items.length; - TreeSet strings = new TreeSet(); + Set<String> strings = new TreeSet<>(); for(int i = 0; i < length; i++) { @@ -133,11 +130,11 @@ final class LR1ItemSet implements Cloneable, Comparable } } - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append("{"); boolean colon = false; - for(Iterator i = strings.iterator(); i.hasNext(); ) + for(String s : strings) { if(colon) { @@ -151,7 +148,7 @@ final class LR1ItemSet implements Cloneable, Comparable } result.append("\t"); - result.append(i.next()); + result.append(s); } result.append(nl); @@ -160,11 +157,13 @@ final class LR1ItemSet implements Cloneable, Comparable return result.toString(); } - public Object clone() + @Override + public LR1ItemSet clone() { return new LR1ItemSet(this); } + @Override public boolean equals(Object obj) { if((obj == null) || @@ -173,45 +172,30 @@ final class LR1ItemSet implements Cloneable, Comparable return false; } - LR1ItemSet set - = (LR1ItemSet) obj; - - if(set.items.size() != items.size()) - { - return false; - } - - for(Iterator e = items.keySet().iterator(); e.hasNext();) - { - if(!set.get((LR1Item) e.next())) - { - return false; - } - } + LR1ItemSet set = (LR1ItemSet) obj; - return true; + return items.keySet().equals(set.items.keySet()); } + @Override public int hashCode() { return hashCode; } - public int compareTo(Object object) + @Override + public int compareTo(LR1ItemSet set) { - LR1ItemSet set - = (LR1ItemSet) object; - int result = items.size() - set.items.size(); if(result == 0) { - Iterator e = items.keySet().iterator(); - Iterator f = set.items.keySet().iterator(); + Iterator<LR1Item> e = items.keySet().iterator(); + Iterator<LR1Item> f = set.items.keySet().iterator(); while(e.hasNext() && f.hasNext() && (result == 0)) { - result = ((LR1Item) e.next()).compareTo(f.next()); + result = e.next().compareTo(f.next()); } if(result == 0) diff --git a/src/main/java/org/sablecc/sablecc/ListCast.java b/src/main/java/org/sablecc/sablecc/ListCast.java deleted file mode 100644 index f66bd6d866e7d74f9daa9e1f054459d039feae77..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/ListCast.java +++ /dev/null @@ -1,23 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class ListCast implements Cast -{ - public final static ListCast instance = new ListCast(); - - private ListCast() - {} - - public Object cast(Object o) - { - return (List) o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/MacroExpander.java b/src/main/java/org/sablecc/sablecc/MacroExpander.java index 1cc8b667fdad2b72b9ad50baf4482992ccb709a9..424011b8a56873d1b3d359bbd78d205358dfb738 100644 --- a/src/main/java/org/sablecc/sablecc/MacroExpander.java +++ b/src/main/java/org/sablecc/sablecc/MacroExpander.java @@ -7,18 +7,22 @@ package org.sablecc.sablecc; -import java.io.*; -import java.util.*; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.Reader; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.TreeMap; public class MacroExpander { private static final String MACRO = "Macro:"; private static final String lineSeparator = System.getProperty("line.separator"); - private Map macros = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - ListCast.instance); + private Map<String, List<String>> macros = new TreeMap<>(); public MacroExpander(Reader in) throws IOException { @@ -36,7 +40,7 @@ public class MacroExpander if(line.startsWith(MACRO)) { String name = line.substring(MACRO.length()); - List macro = new TypedLinkedList(StringCast.instance); + List<String> macro = new LinkedList<>(); while((line = in.readLine()) != null) { @@ -57,6 +61,7 @@ public class MacroExpander return false; } + @Override public String toString() { return this.getClass().getName() + macros; @@ -69,23 +74,23 @@ public class MacroExpander public void apply(BufferedWriter out, String macroName, String[] arguments) throws IOException { - List macro = (List) macros.get(macroName); + List<String> macro = macros.get(macroName); - for(ListIterator li = macro.listIterator(); li.hasNext();) + for(ListIterator<String> li = macro.listIterator(); li.hasNext();) { if(li.nextIndex() != 0) { out.newLine(); } - String line = (String) li.next(); + String line = li.next(); char c; for(int i = 0; i < line.length(); i++) { if((c = line.charAt(i)) == '$') { - StringBuffer index = new StringBuffer(); + StringBuilder index = new StringBuilder(); while((c = line.charAt(++i)) != '$') { diff --git a/src/main/java/org/sablecc/sablecc/NFA.java b/src/main/java/org/sablecc/sablecc/NFA.java index 8de83cf3edfdfe1fbfb389512814bbce4cdb85f7..162cebb5388041dca3a6c4d496c817741489f6c0 100644 --- a/src/main/java/org/sablecc/sablecc/NFA.java +++ b/src/main/java/org/sablecc/sablecc/NFA.java @@ -7,8 +7,6 @@ package org.sablecc.sablecc; -import java.util.*; - public class NFA implements Cloneable { public State[] states; @@ -269,17 +267,22 @@ public class NFA implements Cloneable return nfa; } - public Object clone() + @Override + public NFA clone() { return new NFA(this); } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); for(int i = 0; i < states.length; i++) { - result.append(i + ":" + states[i] + System.getProperty("line.separator")); + result.append(i); + result.append(":"); + result.append(states[i]); + result.append(System.getProperty("line.separator")); } return result.toString(); } @@ -311,20 +314,25 @@ public class NFA implements Cloneable } } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); if(accept != null) { - result.append("(" + accept + ") "); + result.append("("); + result.append(accept); + result.append(") "); } if(transitions[0] != null) { - result.append(" " + transitions[0]); + result.append(" "); + result.append(transitions[0]); } if(transitions[1] != null) { - result.append(" " + transitions[1]); + result.append(" "); + result.append(transitions[1]); } return result.toString(); } @@ -347,6 +355,7 @@ public class NFA implements Cloneable destination = transition.destination; } + @Override public String toString() { return destination + ":{" + chars + "}"; diff --git a/src/main/java/org/sablecc/sablecc/NoCast.java b/src/main/java/org/sablecc/sablecc/NoCast.java deleted file mode 100644 index 01981302501a7c12daff076d4b845284ee654083..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/NoCast.java +++ /dev/null @@ -1,21 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -public class NoCast implements Cast -{ - public final static NoCast instance = new NoCast(); - - private NoCast() - {} - - public Object cast(Object o) - { - return o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/NodeCast.java b/src/main/java/org/sablecc/sablecc/NodeCast.java deleted file mode 100644 index 202c84b031e4165c3709c4b826189394cfacf5d6..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/NodeCast.java +++ /dev/null @@ -1,24 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; -import org.sablecc.sablecc.node.*; - -public class NodeCast implements Cast -{ - public final static NodeCast instance = new NodeCast(); - - private NodeCast() - {} - - public Object cast(Object o) - { - return (Node) o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/PrettyPrinter.java b/src/main/java/org/sablecc/sablecc/PrettyPrinter.java index 43eb5cf4e9e81b231bad388bbd95ecafd011a5b5..c6ae145b485d5a3e2fa40f82afbcdfbbfe613cf8 100644 --- a/src/main/java/org/sablecc/sablecc/PrettyPrinter.java +++ b/src/main/java/org/sablecc/sablecc/PrettyPrinter.java @@ -7,8 +7,7 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; public class PrettyPrinter extends DepthFirstAdapter @@ -18,17 +17,18 @@ public class PrettyPrinter extends DepthFirstAdapter public static String alternative_INDENT = " " ; public static String alt_transform_INDENT = " " ; + @Override public void caseAProductions(AProductions node) { System.err.println("Productions \n"); - AProd [] prods = - (AProd [])node.getProds().toArray(new AProd[0]); - for(int i = 0; i < prods.length; i++) + PProd[] prods = node.getProds().toArray(new PProd[0]); + for(PProd prod : prods) { - prods[i].apply(this); + prod.apply(this); } } + @Override public void caseAProd(AProd node) { System.err.print(production_INDENT + node.getId().getText()); @@ -40,33 +40,33 @@ public class PrettyPrinter extends DepthFirstAdapter } System.err.println(); - AElem[] elems = (AElem [])node.getProdTransform().toArray(new AElem[0]); + PElem[] elems = node.getProdTransform().toArray(new PElem[0]); //if(node.getArrow() != null) if(elems.length > 0) { System.err.print(prod_transform_INDENT + "{-> "); - for(int i=0; i<elems.length; i++) + for(PElem elem : elems) { - //System.err.print(elems[i] + " "); - elems[i].apply(this); + elem.apply(this); System.err.print(" "); } System.err.println(" } " + hasProdTransform); } - Object[] alts = (Object[])node.getAlts().toArray(); + PAlt[] alts = node.getAlts().toArray(new PAlt[0]); for(int i=0; i<alts.length-1; i++) { - ((PAlt)alts[i]).apply(this); + alts[i].apply(this); System.err.println( " |"); } - ((PAlt)alts[alts.length-1]).apply(this); + alts[alts.length-1].apply(this); System.err.println("\n" + alternative_INDENT + ";\n"); } + @Override public void caseAAlt(AAlt node) { System.err.print("\n" + alternative_INDENT); @@ -76,11 +76,10 @@ public class PrettyPrinter extends DepthFirstAdapter System.err.print("{" + node.getAltName().getText()+"} "); } - AElem[] listElems = (AElem[])node.getElems().toArray(new AElem[0]); - for(int i=0; i<listElems.length; i++) + PElem[] listElems = node.getElems().toArray(new PElem[0]); + for(PElem elem : listElems) { - //System.err.print(listElems[i]); - listElems[i].apply(this); + elem.apply(this); System.err.print(" "); } @@ -90,20 +89,22 @@ public class PrettyPrinter extends DepthFirstAdapter } } + @Override public void caseAAltTransform(AAltTransform node) { System.err.print("\n" + alt_transform_INDENT + "{-> "); - Object []terms = (Object[]) node.getTerms().toArray(); - for(int i=0; i<terms.length; i++) + PTerm[] terms = node.getTerms().toArray(new PTerm[0]); + for(PTerm term : terms) { - ((PTerm)terms[i]).apply(this); + term.apply(this); System.err.print(" "); } System.err.print(" } "); } + @Override public void caseAProdName(AProdName node) { System.err.print(node.getId().getText()); @@ -113,37 +114,40 @@ public class PrettyPrinter extends DepthFirstAdapter } } + @Override public void caseANewTerm(ANewTerm node) { System.err.print("New "); node.getProdName().apply(this); System.err.print(" (" ); - Object []params = node.getParams().toArray(); + PTerm[] params = node.getParams().toArray(new PTerm[0]); if(params.length > 0) { for(int i=0; i<params.length-1; i++) { - ((PTerm)params[i]).apply(this); + params[i].apply(this); System.err.print(", "); } - ((PTerm)params[params.length-1]).apply(this); + params[params.length-1].apply(this); } System.err.print(" )"); } + @Override public void caseAListTerm(AListTerm node) { System.err.print("[ "); - Object []list_terms = node.getListTerms().toArray(); + PListTerm[] list_terms = node.getListTerms().toArray(new PListTerm[0]); - for(int i=0; i<list_terms.length; i++) + for(PListTerm listTerm : list_terms) { - ((PListTerm)list_terms[i]).apply(this); + listTerm.apply(this); } System.err.print(" ]"); } + @Override public void caseASimpleTerm(ASimpleTerm node) { if(node.getSpecifier() != null) @@ -165,30 +169,33 @@ public class PrettyPrinter extends DepthFirstAdapter System.err.print(" "); } + @Override public void caseANullTerm(ANullTerm node) { System.err.print("Null "); } + @Override public void caseANewListTerm(ANewListTerm node) { System.err.print("New "); node.getProdName().apply(this); System.err.print(" (" ); - Object []params = node.getParams().toArray(); + PTerm[] params = node.getParams().toArray(new PTerm[0]); if(params.length > 0) { for(int i=0; i<params.length-1; i++) { - ((PTerm)params[i]).apply(this); + params[i].apply(this); System.err.print(", "); } - ((PTerm)params[params.length-1]).apply(this); + params[params.length-1].apply(this); } System.err.print(" )"); } + @Override public void caseASimpleListTerm(ASimpleListTerm node) { if(node.getSpecifier() != null) @@ -210,23 +217,24 @@ public class PrettyPrinter extends DepthFirstAdapter System.err.print(" "); } + @Override public void caseAAst(AAst node) { System.err.print("Abstract Syntax Tree\n"); - AAstProd [] prods = - (AAstProd [])node.getProds().toArray(new AAstProd[0]); - for(int i = 0; i < prods.length; i++) + PAstProd[] prods = node.getProds().toArray(new PAstProd[0]); + for(PAstProd prod : prods) { - prods[i].apply(this); + prod.apply(this); } } + @Override public void caseAAstProd(AAstProd node) { System.err.println(production_INDENT + node.getId().getText() + " ="); - AAstAlt[] alts = (AAstAlt[])node.getAlts().toArray(new AAstAlt[0]); + PAstAlt[] alts = node.getAlts().toArray(new PAstAlt[0]); for(int i=0; i<alts.length-1; i++) { alts[i].apply(this); @@ -237,6 +245,7 @@ public class PrettyPrinter extends DepthFirstAdapter System.err.println("\n" + alternative_INDENT + ";\n"); } + @Override public void caseAAstAlt(AAstAlt node) { System.err.print(alternative_INDENT); @@ -246,15 +255,15 @@ public class PrettyPrinter extends DepthFirstAdapter System.err.print("{" + node.getAltName().getText()+"} "); } - AElem[] listElems = (AElem[])node.getElems().toArray(new AElem[0]); - for(int i=0; i<listElems.length; i++) + PElem[] listElems = node.getElems().toArray(new PElem[0]); + for(PElem elem : listElems) { - //System.err.print(listElems[i]); - listElems[i].apply(this); + elem.apply(this); System.err.print(" "); } } + @Override public void caseAElem(AElem node) { if(node.getElemName() != null) @@ -279,16 +288,19 @@ public class PrettyPrinter extends DepthFirstAdapter { node.getUnOp().apply(new DepthFirstAdapter() { + @Override public void caseAStarUnOp(AStarUnOp node) { System.err.print("*"); } + @Override public void caseAQMarkUnOp(AQMarkUnOp node) { System.err.print("?"); } + @Override public void caseAPlusUnOp(APlusUnOp node) { System.err.print("+"); diff --git a/src/main/java/org/sablecc/sablecc/Production.java b/src/main/java/org/sablecc/sablecc/Production.java index 9fb1cc1690ce6d03de3716c2ad3da196373aff43..39b16c456972a311c3a1cfe8e9185122ca536d78 100644 --- a/src/main/java/org/sablecc/sablecc/Production.java +++ b/src/main/java/org/sablecc/sablecc/Production.java @@ -7,9 +7,10 @@ package org.sablecc.sablecc; -import java.util.*; -import java.util.Vector; -import java.util.Enumeration; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; final class Production { @@ -17,16 +18,16 @@ final class Production final int index; final String name; - private final Vector rightside = new Vector(); - private static final Vector productions = new Vector(0); - private static TreeMap alternatives_ = new TreeMap(IntegerComparator.instance); + private final List<Symbol> rightside = new ArrayList<>(); + private static final List<Production> productions = new ArrayList<>(); + private static Map<Integer, Production[]> alternatives_ = new TreeMap<>(); private static boolean modified_ = true; private static Production[] productions_; public static void reinit() { - productions.removeAllElements(); - alternatives_ = new TreeMap(IntegerComparator.instance); + productions.clear(); + alternatives_ = new TreeMap<>(); productions_ = null; modified_ = true; productions_ = null; @@ -34,8 +35,7 @@ final class Production private static void computeArray_() { - productions_ = new Production[productions.size()]; - productions.copyInto(productions_); + productions_ = productions.toArray(new Production[0]); modified_ = false; } @@ -44,14 +44,13 @@ final class Production private void computeArray() { - rightside_ = new Symbol[rightside.size()]; - rightside.copyInto(rightside_); + rightside_ = rightside.toArray(new Symbol[0]); modified = false; } Production(int leftside, String name) { - productions.addElement(this); + productions.add(this); this.name = name; this.leftside = leftside; @@ -71,48 +70,45 @@ final class Production void addSymbol(Symbol s) { - rightside.addElement(s); + rightside.add(s); modified = true; modified_ = true; } Symbol rightside(int index) { - return (Symbol) rightside.elementAt(index); + return rightside.get(index); } static Production production(int index) { - return (Production) productions.elementAt(index); + return productions.get(index); } static Production[] alternatives(int nonterminal) { if(modified_) { - alternatives_ = new TreeMap(IntegerComparator.instance); + alternatives_ = new TreeMap<>(); } - Production[] result = (Production[]) alternatives_.get(new Integer(nonterminal)); + Production[] result = alternatives_.get(nonterminal); if(result == null) { - Vector alternatives = new Vector(0); + List<Production> alternatives = new ArrayList<>(); - for(Enumeration e = productions.elements(); e.hasMoreElements();) + for(Production production : productions) { - Production production = (Production) e.nextElement(); - if(production.leftside == nonterminal) { - alternatives.addElement(production); + alternatives.add(production); } } - result = new Production[alternatives.size()]; - alternatives.copyInto(result); + result = alternatives.toArray(new Production[0]); - alternatives_.put(new Integer(nonterminal), result); + alternatives_.put(nonterminal, result); } return result; @@ -128,9 +124,10 @@ final class Production return productions_; } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append(Symbol.symbol(leftside, false)); diff --git a/src/main/java/org/sablecc/sablecc/RecursiveProductionsDetections.java b/src/main/java/org/sablecc/sablecc/RecursiveProductionsDetections.java index c29276e88590ba352014df1748865784739074e8..fd3acd46bdaaa106428d7be301fcf045de345afc 100644 --- a/src/main/java/org/sablecc/sablecc/RecursiveProductionsDetections.java +++ b/src/main/java/org/sablecc/sablecc/RecursiveProductionsDetections.java @@ -7,25 +7,28 @@ package org.sablecc.sablecc; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.LinkedList; +import java.util.List; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; public class RecursiveProductionsDetections extends DepthFirstAdapter { - public LinkedList listOfRecursiveProds = new TypedLinkedList(StringCast.instance); + public List<String> listOfRecursiveProds = new LinkedList<>(); private String currentProd; + @Override public void caseAProd(AProd node) { currentProd = node.getId().getText(); if(!node.getId().getText().startsWith("$")) { - Object []alts = node.getAlts().toArray(); + PAlt[] alts = node.getAlts().toArray(new PAlt[0]); - for(int i=0; i<alts.length; i++) + for(PAlt alt : alts) { - ((PAlt)alts[i]).apply(this); + alt.apply(this); } } else @@ -34,12 +37,13 @@ public class RecursiveProductionsDetections extends DepthFirstAdapter } } + @Override public void caseAAlt(AAlt node) { - Object temp[] = node.getElems().toArray(); - for(int i = 0; i < temp.length; i++) + PElem[] temp = node.getElems().toArray(new PElem[0]); + for(PElem elem : temp) { - ((PElem) temp[i]).apply(this); + elem.apply(this); } } /* @@ -53,6 +57,7 @@ public class RecursiveProductionsDetections extends DepthFirstAdapter } */ + @Override public void caseAElem(AElem node) { if(node.getId().getText().equals(currentProd)) diff --git a/src/main/java/org/sablecc/sablecc/ResolveAltIds.java b/src/main/java/org/sablecc/sablecc/ResolveAltIds.java index e6f42f08556999c86ed43e952bb11d745841f858..fadeb6e4945580d2339a5ce07244feabce063c96 100644 --- a/src/main/java/org/sablecc/sablecc/ResolveAltIds.java +++ b/src/main/java/org/sablecc/sablecc/ResolveAltIds.java @@ -5,7 +5,7 @@ * modification of SableCC. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/** +/* * Last Modification date : 03-11-2003 * Remove the checking of question mark and + operator * for production tranformations @@ -17,54 +17,42 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; -/* - * ResolveAltIds - * +/** * This class computes semantic verifications for AST alternatives * section. The same thing is done by ResolveIds class for Productions * section. */ - public class ResolveAltIds extends DepthFirstAdapter { public ResolveIds ids; //Map of alternatives elements which are not list : // ie not followed by * or + operator. - public Map alts_elems = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - ListCast.instance); + public Map<String, List<String>> alts_elems = new TreeMap<>(); //Map of only alternatives elements which are list : //followed by * or + operator. - public Map alts_elems_list = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - ListCast.instance); + public Map<String, List<String>> alts_elems_list = new TreeMap<>(); //Map of all alternatives elements. Elements name are stored //if it is specified otherwise, it is its id. //(elem = elem_name? specifier? id un_op?) - public Map alts_elemsGlobal = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - ListCast.instance); + public Map<String, List<String>> alts_elemsGlobal = new TreeMap<>(); //Map of all alternatives elements which have explicit name. - public Map alts_elems_list_elemName = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - ListCast.instance); + public Map<String, List<String>> alts_elems_list_elemName = new TreeMap<>(); - private LinkedList listElemsGlobal; - private LinkedList listElems; - private LinkedList listElemslist; + private List<String> listElemsGlobal; + private List<String> listElems; + private List<String> listElemslist; String currentAlt; @@ -81,14 +69,12 @@ public class ResolveAltIds extends DepthFirstAdapter * list of productions transformations elements */ + @Override public void caseAProd(AProd node) { - AElem []temp = (AElem[]) node.getProdTransform().toArray(new AElem[0]); - - Object []list_alts = node.getAlts().toArray(); - for(int j=0; j<list_alts.length; j++) + for(PAlt alt : node.getAlts()) { - ((PAlt)list_alts[j]).apply(this); + alt.apply(this); } } @@ -96,23 +82,23 @@ public class ResolveAltIds extends DepthFirstAdapter * Here, a map which associate the current alternative with the list of elems * is created. */ + @Override public void caseAAlt(AAlt alt) { //contains all the elements in the alternative, no matter if they are list or not - listElemsGlobal = new LinkedList(); + listElemsGlobal = new LinkedList<>(); //contains only single (without operator * or +) element of the alternative. - listElems = new LinkedList(); + listElems = new LinkedList<>(); //contains only element of the alternative which are list(operator * or +). - listElemslist = new LinkedList(); + listElemslist = new LinkedList<>(); - currentAlt = (String)ids.names.get(alt); + currentAlt = ids.names.get(alt); - AElem[] list_elems = (AElem[])alt.getElems().toArray(new AElem[0]); - for(int i=0; i<list_elems.length; i++) + for(PElem elem : alt.getElems()) { - list_elems[i].apply(this); + elem.apply(this); } alts_elemsGlobal.put(currentAlt, listElemsGlobal); @@ -120,6 +106,7 @@ public class ResolveAltIds extends DepthFirstAdapter alts_elems_list.put(currentAlt, listElemslist); } + @Override public void caseAElem(final AElem elem) { blist = false; @@ -144,12 +131,14 @@ public class ResolveAltIds extends DepthFirstAdapter //This method is overriding in order to not allow ASt traversal to visit //AST elements. + @Override public void caseAAst(AAst node) {} + @Override public String toString() { - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); String nl = System.getProperty("line.separator"); s.append("Alternative elements : "); diff --git a/src/main/java/org/sablecc/sablecc/ResolveAstIds.java b/src/main/java/org/sablecc/sablecc/ResolveAstIds.java index a0613dfc373240d7f4de635f30c425e0ac79335f..cc98cbf1ee301440d8eb02a2bd0eb8a6ae544ee4 100644 --- a/src/main/java/org/sablecc/sablecc/ResolveAstIds.java +++ b/src/main/java/org/sablecc/sablecc/ResolveAstIds.java @@ -7,21 +7,15 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; /* - * ResolveAstIds - * - * This class computes basic semantic verifications for AST alternatives - * section. The same thing is done by ResolveIds class for Productions - * section. It makes sure that there is no conflictual names and it also - * constructs few symbol tables necessary in the rest of the code. - */ - -/** * Last Modification date : 18-10-2004 * correct AST alternative element error bug (error2()) * Now only tokens and AST section's productions can be used in @@ -32,34 +26,27 @@ import java.io.*; * */ +/** + * This class computes basic semantic verifications for AST alternatives + * section. The same thing is done by ResolveIds class for Productions + * section. It makes sure that there is no conflictual names and it also + * constructs few symbol tables necessary in the rest of the code. + */ public class ResolveAstIds extends DepthFirstAdapter { //Map of AST productions. The AST production node can be obtained //by giving the name of this production // Example :: PAstProd is the name of the declared the following productions // ast_prod = id equal [alts]:ast_alt* semicolon; - public final Map ast_prods = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); + public final Map<String, AAstProd> ast_prods = new TreeMap<>(); //Same thing that above for AST alternatives. - public final Map ast_alts = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); + public final Map<String, AAstAlt> ast_alts = new TreeMap<>(); //Same thing that above for AST alternatives elements. - public final Map ast_elems = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); + public final Map<String, AElem> ast_elems = new TreeMap<>(); //Map of all names of AST productions. //They are essentially used to generate AST node classes. - public final Map ast_names = new TypedHashMap( - NodeCast.instance, - StringCast.instance); - public final Map ast_elemTypes = new TypedHashMap( - NodeCast.instance, - StringCast.instance); + public final Map<Node, String> ast_names = new HashMap<>(); + public final Map<Node, String> ast_elemTypes = new HashMap<>(); public ResolveIds astIds; private String firstAstProduction; @@ -78,19 +65,21 @@ public class ResolveAstIds extends DepthFirstAdapter return firstAstProduction; } + @Override public void inAAst(AAst node) { - LinkedList listProds = node.getProds(); + List<PAstProd> listProds = node.getProds(); if(listProds.size() > 0) { - AAstProd firstAstProd = (AAstProd)listProds.getFirst(); - firstAstProduction = "P" + astIds.name(firstAstProd.getId().getText()); + AAstProd firstAstProd = (AAstProd)listProds.get(0); + firstAstProduction = "P" + ResolveIds.name(firstAstProd.getId().getText()); } } + @Override public void inAAstProd(AAstProd node) { - currentProd = astIds.name(node.getId().getText()); + currentProd = ResolveIds.name(node.getId().getText()); String name = "P" + currentProd; @@ -101,13 +90,14 @@ public class ResolveAstIds extends DepthFirstAdapter ast_names.put(node, name); } + @Override public void inAAstAlt(final AAstAlt alt) { if(alt.getAltName() != null) { currentAlt = "A" + - astIds.name(alt.getAltName().getText()) + + ResolveIds.name(alt.getAltName().getText()) + currentProd; if(ast_alts.put(currentAlt, alt) != null) @@ -129,9 +119,11 @@ public class ResolveAstIds extends DepthFirstAdapter } //Only Abstract Syntax Tree section is concerned by the visitor here. + @Override public void caseAProductions(AProductions node) {} + @Override public void caseAElem(final AElem elem) { String name; @@ -147,7 +139,7 @@ public class ResolveAstIds extends DepthFirstAdapter } elem_name = tid.getText(); - name = currentAlt + "." + astIds.name(elem_name); + name = currentAlt + "." + ResolveIds.name(elem_name); if(ast_elems.put(name, elem) != null) { @@ -159,16 +151,18 @@ public class ResolveAstIds extends DepthFirstAdapter error5(tid); } - ast_names.put(elem, astIds.name(elem_name)); + ast_names.put(elem, ResolveIds.name(elem_name)); } + @Override public void outAAstProd(AAstProd prod) { prod.apply(new DepthFirstAdapter() { + @Override public void caseAElem(AElem node) { - String name = astIds.name(node.getId().getText()); + String name = ResolveIds.name(node.getId().getText()); if(node.getSpecifier() != null) { @@ -183,7 +177,7 @@ public class ResolveAstIds extends DepthFirstAdapter } else { - Object token = astIds.tokens.get("T" + name); + ATokenDef token = astIds.tokens.get("T" + name); if(token != null) { @@ -199,13 +193,15 @@ public class ResolveAstIds extends DepthFirstAdapter ); } + @Override public void outAAst(AAst prod) { prod.apply(new DepthFirstAdapter() { + @Override public void caseAElem(AElem node) { - String name = astIds.name(node.getId().getText()); + String name = ResolveIds.name(node.getId().getText()); if(node.getSpecifier() != null) { @@ -234,10 +230,10 @@ public class ResolveAstIds extends DepthFirstAdapter } else { - Object token = astIds.tokens.get("T" + name); - Object ignToken = astIds.ignTokens.get("T" + name); + ATokenDef token = astIds.tokens.get("T" + name); + Node ignToken = astIds.ignTokens.get("T" + name); //Object production = astIds.prods.get("P" + name); - Object ast_production = ast_prods.get("P" + name); + AAstProd ast_production = ast_prods.get("P" + name); //if() if((token == null) && (ast_production == null)) { @@ -272,7 +268,8 @@ public class ResolveAstIds extends DepthFirstAdapter ); } - public void defaultcase(Node node) + @Override + public void defaultCase(Node node) { if(node instanceof Token) { @@ -324,9 +321,10 @@ public class ResolveAstIds extends DepthFirstAdapter "class is an invalid element name."); } + @Override public String toString() { - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); String nl = System.getProperty("line.separator"); s.append("Productions:"); diff --git a/src/main/java/org/sablecc/sablecc/ResolveIds.java b/src/main/java/org/sablecc/sablecc/ResolveIds.java index cfc425603b5bca11af95a953b82282aefc66c755..27cc669d0488ebe74dfb267be19bc445166427a0 100644 --- a/src/main/java/org/sablecc/sablecc/ResolveIds.java +++ b/src/main/java/org/sablecc/sablecc/ResolveIds.java @@ -7,69 +7,43 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.io.File; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; public class ResolveIds extends DepthFirstAdapter { - public final Map helpers = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); - public final Map states = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); - public final Map tokens = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); - public final Map ignTokens = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); - public final Map prods = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); - - public final Map alts = new TypedHashMap( - StringCast.instance, - NodeCast.instance); - - public final Map elems = new TypedHashMap( - StringCast.instance, - NodeCast.instance); - - public final Map names = new TypedHashMap( - NodeCast.instance, - StringCast.instance); - - public final Map errorNames = new TypedHashMap( - NodeCast.instance, - StringCast.instance); - public final Map elemTypes = new TypedHashMap( - NodeCast.instance, - StringCast.instance); - - public final Map altsElemNameTypes = new TypedHashMap( - StringCast.instance, - StringCast.instance); + public final Map<String, AHelperDef> helpers = new TreeMap<>(); + public final Map<String, Node> states = new TreeMap<>(); + public final Map<String, ATokenDef> tokens = new TreeMap<>(); + public final Map<String, Node> ignTokens = new TreeMap<>(); + public final Map<String, AProd> prods = new TreeMap<>(); + + public final Map<String, AAlt> alts = new HashMap<>(); + + public final Map<String, AElem> elems = new HashMap<>(); + + public final Map<Node, String> names = new HashMap<>(); + + public final Map<Node, String> errorNames = new HashMap<>(); + public final Map<Node, String> elemTypes = new HashMap<>(); + + public final Map<String, String> altsElemNameTypes = new HashMap<>(); // This map will serve for simpleTerm and simplelistTerm type within an altTransform // Inside an altTransform, one would look at this map to know its type. (P... or T...) - public final Map altsElemTypes = new TypedHashMap( - StringCast.instance, - StringCast.instance); + public final Map<String, String> altsElemTypes = new HashMap<>(); - public final Map fixedTokens = new TypedHashMap( - NodeCast.instance, - BooleanCast.instance); + public final Map<ATokenDef, Boolean> fixedTokens = new HashMap<>(); - public final List tokenList = new TypedLinkedList(StringCast.instance); - public final LinkedList stateList = new TypedLinkedList(StringCast.instance); + public final List<String> tokenList = new LinkedList<>(); + public final LinkedList<String> stateList = new LinkedList<>(); public File pkgDir; public String pkgName = ""; @@ -86,9 +60,10 @@ public class ResolveIds extends DepthFirstAdapter pkgDir = currentDir; } + @Override public void inAGrammar(AGrammar node) { - TPkgId[] temp = (TPkgId []) node.getPackage().toArray(new TPkgId[0]); + TPkgId[] temp = node.getPackage().toArray(new TPkgId[0]); if(temp.length > 0) { pkgName = temp[0].getText(); @@ -110,6 +85,7 @@ public class ResolveIds extends DepthFirstAdapter } } + @Override public void caseAProd(AProd node) { //inAProd code. @@ -124,13 +100,14 @@ public class ResolveIds extends DepthFirstAdapter names.put(node, name); //list of inAAlt code. - Object []list_alt = (Object [])node.getAlts().toArray(); - for(int i = 0; i< list_alt.length; i++) + PAlt[] list_alt = node.getAlts().toArray(new PAlt[0]); + for(PAlt alt : list_alt) { - ((PAlt)list_alt[i]).apply(this); + alt.apply(this); } } + @Override public void caseAIdBasic(AIdBasic node) { String name = node.getId().getText(); @@ -142,6 +119,7 @@ public class ResolveIds extends DepthFirstAdapter } } + @Override public void outAHelperDef(AHelperDef node) { String name = node.getId().getText(); @@ -156,6 +134,7 @@ public class ResolveIds extends DepthFirstAdapter names.put(node, name); } + @Override public void outATokenDef(ATokenDef node) { String name = "T" + name(node.getId().getText()); @@ -173,62 +152,62 @@ public class ResolveIds extends DepthFirstAdapter if(node.getLookAhead() != null) { - Token token = (Token) node.getSlash(); + Token token = node.getSlash(); throw new RuntimeException( "[" + token.getLine() + "," + token.getPos() + "] " + "Look ahead not yet supported."); } } + @Override public void inAStates(AStates node) { - Object [] list_id = (Object[]) node.getListId().toArray(); + TId[] list_id = node.getListId().toArray(new TId[0]); String name; - for(int i=0; i<list_id.length; i++) + for(TId id : list_id) { - name = ((TId)list_id[i]).getText().toUpperCase(); + name = id.getText().toUpperCase(); - if(states.put(name, list_id[i]) != null) + if(states.put(name, id) != null) { - error((TId)list_id[i], name); + error(id, name); } - names.put(list_id[i], name); + names.put(id, name); stateList.add(name); } } + @Override public void inAIgnTokens(AIgnTokens node) { - Object [] list_id = (Object[]) node.getListId().toArray(); + TId[] list_id = node.getListId().toArray(new TId[0]); String name; - for(int i=0; i<list_id.length; i++) + for(TId id : list_id) { - name = "T" + name(((TId)list_id[i]).getText()); + name = "T" + name(id.getText()); if(tokens.get(name) == null) { - error2((TId)list_id[i], name); + error2(id, name); } - if(ignTokens.put(name, list_id[i]) != null) + if(ignTokens.put(name, id) != null) { - error((TId)list_id[i], name); + error(id, name); } - names.put(list_id[i], name); + names.put(id, name); } } - private Map stateMap; + private Map<String, Node> stateMap; + @Override public void inAStateList(AStateList node) { - stateMap = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NodeCast.instance); + stateMap = new TreeMap<>(); String name = node.getId().getText().toUpperCase(); @@ -243,11 +222,13 @@ public class ResolveIds extends DepthFirstAdapter } } + @Override public void outAStateList(AStateList node) { stateMap = null; } + @Override public void inAStateListTail(AStateListTail node) { String name = node.getId().getText().toUpperCase(); @@ -263,6 +244,7 @@ public class ResolveIds extends DepthFirstAdapter } } + @Override public void inATransition(ATransition node) { String name = node.getId().getText().toUpperCase(); @@ -273,6 +255,7 @@ public class ResolveIds extends DepthFirstAdapter } } + @Override public void caseAAlt(final AAlt alt) { if(alt.getAltName() != null) @@ -301,15 +284,16 @@ public class ResolveIds extends DepthFirstAdapter names.put(alt, currentAlt); } - AElem list_elem[] = (AElem[]) alt.getElems().toArray(new AElem[0]); - for(int i=0; i<list_elem.length;i++) + PElem[] list_elem = alt.getElems().toArray(new PElem[0]); + for(PElem elem : list_elem) { - list_elem[i].apply(this); + elem.apply(this); } } - public void defaultcase(Node node) + @Override + public void defaultCase(Node node) { if(node instanceof Token) { @@ -319,9 +303,11 @@ public class ResolveIds extends DepthFirstAdapter } } + @Override public void caseAAst(AAst node) {} + @Override public void caseAElem(final AElem elem) { if(elem.getElemName() != null) @@ -360,23 +346,26 @@ public class ResolveIds extends DepthFirstAdapter } } + @Override public void outAProductions(AProductions prod) { prod.apply(new DepthFirstAdapter() { + @Override public void caseAProd(AProd node) { //inAProd code. currentProd = name(node.getId().getText()); //list of inAAlt code. - Object []list_alt = (Object [])node.getAlts().toArray(); - for(int i = 0; i< list_alt.length; i++) + PAlt[] list_alt = node.getAlts().toArray(new PAlt[0]); + for(PAlt alt : list_alt) { - ((PAlt)list_alt[i]).apply(this); + alt.apply(this); } } + @Override public void caseAAlt(final AAlt alt) { if(alt.getAltName() != null) @@ -388,13 +377,14 @@ public class ResolveIds extends DepthFirstAdapter currentAlt = "A" + currentProd; } - AElem[] list_elem = (AElem[]) alt.getElems().toArray(new AElem[0]); - for(int i=0; i<list_elem.length;i++) + PElem[] list_elem = alt.getElems().toArray(new PElem[0]); + for(PElem elem : list_elem) { - list_elem[i].apply(this); + elem.apply(this); } } + @Override public void caseAElem(AElem node) { String name = name(node.getId().getText()); @@ -461,9 +451,9 @@ public class ResolveIds extends DepthFirstAdapter } else { - Object token = tokens.get("T" + name); - Object ignToken = ignTokens.get("T" + name); - Object production = prods.get("P" + name); + ATokenDef token = tokens.get("T" + name); + Node ignToken = ignTokens.get("T" + name); + AProd production = prods.get("P" + name); if((token == null) && (production == null)) { @@ -518,7 +508,7 @@ public class ResolveIds extends DepthFirstAdapter public static String name(String s) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); boolean upcase = true; int length = s.length(); char c; @@ -554,7 +544,7 @@ public class ResolveIds extends DepthFirstAdapter public static String errorName(String s) { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); int length = s.length(); char c; @@ -627,9 +617,10 @@ public class ResolveIds extends DepthFirstAdapter "class is an invalid element name."); } + @Override public String toString() { - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); String nl = System.getProperty("line.separator"); s.append("Helpers:"); diff --git a/src/main/java/org/sablecc/sablecc/ResolveProdTransformIds.java b/src/main/java/org/sablecc/sablecc/ResolveProdTransformIds.java index ab242d12baa5cbee14522621124375961dd1f559..8a310c7edace8222c8d18dfe7e3052af849c2c92 100644 --- a/src/main/java/org/sablecc/sablecc/ResolveProdTransformIds.java +++ b/src/main/java/org/sablecc/sablecc/ResolveProdTransformIds.java @@ -7,10 +7,14 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; /* * ResolveProdTransformIds @@ -25,62 +29,53 @@ public class ResolveProdTransformIds extends DepthFirstAdapter { private ResolveAstIds transformIds; - private LinkedList listElems; + private List<String> listElems; private String prod_name; - public LinkedList listProdTransformList = new LinkedList(); - private LinkedList listProdTransformContainsList; + public List<String> listProdTransformList = new LinkedList<>(); + private List<String> listProdTransformContainsList; //Map of production transformation element type. The key of this map //is the node of this element in the AST. - public final Map prodTransformElemTypes = new TypedHashMap( - NoCast.instance, - StringCast.instance); + public final Map<Object, String> prodTransformElemTypes = new HashMap<>(); //This map contains the same information as the other one just above. //But the keys for this map are String ("ProdName.ElemTransformationName") - public final Map prodTransformElemTypesString = new TypedHashMap( - StringCast.instance, - StringCast.instance); + public final Map<String, String> prodTransformElemTypesString = new HashMap<>(); //Map of Productions which transformations contains list elements. - public Map mapProdTransformContainsList = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - ListCast.instance); + public Map<String, List<String>> mapProdTransformContainsList = new TreeMap<>(); //Map of all Production transformations elements. - public final Map prod_transforms = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - NoCast.instance); + public final Map<String, List<String>> prod_transforms = new TreeMap<>(); public ResolveProdTransformIds(ResolveAstIds ids) { transformIds = ids; } + @Override public void caseAProd(final AProd production) { - prod_name = (String)transformIds.astIds.names.get(production); + prod_name = transformIds.astIds.names.get(production); - AElem temp[] = - (AElem [])production.getProdTransform().toArray(new AElem[0]); + PElem[] temp = production.getProdTransform().toArray(new PElem[0]); - listProdTransformContainsList = new LinkedList(); + listProdTransformContainsList = new LinkedList<>(); - listElems = new LinkedList(); + listElems = new LinkedList<>(); if( temp.length > 1 ) { listProdTransformList.add(prod_name); } - for(int i=0; i<temp.length; i++) + for(PElem elem : temp) { - ((PElem) temp[i]).apply(new DepthFirstAdapter() + elem.apply(new DepthFirstAdapter() { + @Override public void caseAElem(AElem node) { String rname = node.getId().getText(); @@ -137,7 +132,7 @@ public class ResolveProdTransformIds extends DepthFirstAdapter error3(node.getId(), "T" + name); } - /*****************************************************/ + //***************************************************** String type_name = name; if( (node.getUnOp() instanceof AStarUnOp) || (node.getUnOp() instanceof AQMarkUnOp) ) @@ -178,7 +173,7 @@ public class ResolveProdTransformIds extends DepthFirstAdapter error5(node.getId(), "P" + name); } - /*****************************************************/ + //***************************************************** String type_name = name; if( (node.getUnOp() instanceof AStarUnOp) || (node.getUnOp() instanceof AQMarkUnOp) ) @@ -215,10 +210,9 @@ public class ResolveProdTransformIds extends DepthFirstAdapter } else { - Object token = transformIds.astIds.tokens.get("T" + name); - Object ignToken = transformIds.astIds.ignTokens.get("T" + name); - Object production = transformIds.astIds.prods.get("P" + name); - Object ast_production = transformIds.ast_prods.get("P" + name); + ATokenDef token = transformIds.astIds.tokens.get("T" + name); + AProd production = transformIds.astIds.prods.get("P" + name); + AAstProd ast_production = transformIds.ast_prods.get("P" + name); if((token == null) && (ast_production == null) && (production == null)) { @@ -235,7 +229,7 @@ public class ResolveProdTransformIds extends DepthFirstAdapter error4(node.getId(), "P" + name + " and T" + name); } - /*****************************************************/ + //***************************************************** String type_name = name; if( (node.getUnOp() instanceof AStarUnOp) || (node.getUnOp() instanceof AQMarkUnOp) ) @@ -277,7 +271,7 @@ public class ResolveProdTransformIds extends DepthFirstAdapter error5(node.getId(), node.getId().getText()); } - /*****************************************************/ + //***************************************************** String type_name = name; if( (node.getUnOp() instanceof AStarUnOp) || (node.getUnOp() instanceof AQMarkUnOp) ) diff --git a/src/main/java/org/sablecc/sablecc/ResolveTransformIds.java b/src/main/java/org/sablecc/sablecc/ResolveTransformIds.java index d7089fcf2dd8afdc6d130954fb267fb7dbdd2564..6b84e677ad13b142d1815ac38ff8f506601ac518 100644 --- a/src/main/java/org/sablecc/sablecc/ResolveTransformIds.java +++ b/src/main/java/org/sablecc/sablecc/ResolveTransformIds.java @@ -11,10 +11,14 @@ */ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; -import java.io.*; /* * ResolveTransformIds @@ -41,17 +45,11 @@ public class ResolveTransformIds extends DepthFirstAdapter private String currentAstProdName; //This Map contains the type of any term of alternative transformation(altTransform) - public final Map altTransformElemTypes = new TypedHashMap( - NodeCast.instance, - StringCast.instance); + public final Map<Node, String> altTransformElemTypes = new HashMap<>(); - public final Map mapSimpleTermProdTransformation = new TypedHashMap( - StringCast.instance, - ListCast.instance); + public final Map<String, List<String>> mapSimpleTermProdTransformation = new HashMap<>(); - public final Map simpleTermOrsimpleListTermTypes = new TypedHashMap( - NodeCast.instance, - StringCast.instance); + public final Map<Node, String> simpleTermOrsimpleListTermTypes = new HashMap<>(); public ResolveTransformIds(ResolveAstIds ast_ids, ResolveAltIds alt_ids, ResolveProdTransformIds p_ids) { @@ -65,10 +63,11 @@ public class ResolveTransformIds extends DepthFirstAdapter return prodTransformIds; } + @Override public void inAProd(final AProd production) { nbTransformProd = 0; - currentProd = (String)altIds.ids.names.get(production); + currentProd = altIds.ids.names.get(production); if(production.getArrow() != null) { @@ -76,20 +75,22 @@ public class ResolveTransformIds extends DepthFirstAdapter } } - private LinkedList listCurrentAltGlobal; - private LinkedList listCurrentAlt; - private LinkedList listOfListCurrentAlt; + private List<String> listCurrentAltGlobal; + private List<String> listCurrentAlt; + private List<String> listOfListCurrentAlt; + @Override public void inAAlt(AAlt nodeAlt) { nbTransformAlt = 0; - currentAlt = (String)altIds.ids.names.get(nodeAlt); - listCurrentAltGlobal = (LinkedList)((LinkedList)altIds.alts_elemsGlobal.get(currentAlt)).clone(); - listCurrentAlt = (LinkedList)((LinkedList)altIds.alts_elems.get(currentAlt)).clone(); - listOfListCurrentAlt = (LinkedList)((LinkedList)altIds.alts_elems_list.get(currentAlt)).clone(); + currentAlt = altIds.ids.names.get(nodeAlt); + listCurrentAltGlobal = new LinkedList<>(altIds.alts_elemsGlobal.get(currentAlt)); + listCurrentAlt = new LinkedList<>(altIds.alts_elems.get(currentAlt)); + listOfListCurrentAlt = new LinkedList<>(altIds.alts_elems_list.get(currentAlt)); } + @Override public void inAAltTransform(AAltTransform node) { if(node.getTerms().size() == 0) @@ -102,6 +103,7 @@ public class ResolveTransformIds extends DepthFirstAdapter } } + @Override public void outAAltTransform(AAltTransform node) { if(nbTransformAlt != nbTransformProd) @@ -110,6 +112,7 @@ public class ResolveTransformIds extends DepthFirstAdapter } } + @Override public void outAAlt(AAlt node) { lastSimpleTerm = null; @@ -120,9 +123,9 @@ public class ResolveTransformIds extends DepthFirstAdapter mapSimpleTermProdTransformation.clear(); } + @Override public void outANewTerm(ANewTerm node) { - LinkedList list = (LinkedList)prodTransformIds.prod_transforms.get(currentProd); AProdName prodNameNode = (AProdName)node.getProdName(); currentAstProd = "P" + ResolveIds.name(prodNameNode.getId().getText()); @@ -165,9 +168,9 @@ public class ResolveTransformIds extends DepthFirstAdapter } int sizeAstAlt = 0; - if( ((AAstAlt)transformIds.ast_alts.get(currentAstAlt) ).getElems() != null) + if( transformIds.ast_alts.get(currentAstAlt).getElems() != null) { - sizeAstAlt = ( (LinkedList)((AAstAlt)transformIds.ast_alts.get(currentAstAlt) ).getElems()).size(); + sizeAstAlt = transformIds.ast_alts.get(currentAstAlt).getElems().size(); } if(sizeNewTerm != sizeAstAlt) @@ -181,20 +184,20 @@ public class ResolveTransformIds extends DepthFirstAdapter altTransformElemTypes.put(node, type); - AAstAlt astAlt = (AAstAlt)transformIds.ast_alts.get(currentAstAlt); + AAstAlt astAlt = transformIds.ast_alts.get(currentAstAlt); if(node.getParams().size() > 0 && astAlt.getElems().size() > 0) { - Object elemsTable[] = astAlt.getElems().toArray(); - Object paramsTable[] = node.getParams().toArray(); + PElem[] elemsTable = astAlt.getElems().toArray(new PElem[0]); + PTerm[] paramsTable = node.getParams().toArray(new PTerm[0]); String termType, elemType; //here, we're checking the type compabitlity between for a new node creation for(int j=0; j<elemsTable.length; j++) { - termType = (String)altTransformElemTypes.get(paramsTable[j]); - elemType = (String)transformIds.ast_elemTypes.get(elemsTable[j]); + termType = altTransformElemTypes.get(paramsTable[j]); + elemType = transformIds.ast_elemTypes.get(elemsTable[j]); PUnOp eventual_ast_alt_elemOperator = ((AElem)elemsTable[j]).getUnOp(); @@ -210,9 +213,9 @@ public class ResolveTransformIds extends DepthFirstAdapter } + @Override public void outANewListTerm(ANewListTerm node) { - LinkedList list = (LinkedList)prodTransformIds.prod_transforms.get(currentProd); AProdName prodNameNode = (AProdName)node.getProdName(); currentAstProdName = prodNameNode.getId().getText(); @@ -255,9 +258,9 @@ public class ResolveTransformIds extends DepthFirstAdapter } int sizeAstAlt = 0; - if( ((AAstAlt)transformIds.ast_alts.get(currentAstAlt) ).getElems() != null) + if( transformIds.ast_alts.get(currentAstAlt).getElems() != null) { - sizeAstAlt = ( (LinkedList)((AAstAlt)transformIds.ast_alts.get(currentAstAlt) ).getElems()).size(); + sizeAstAlt = transformIds.ast_alts.get(currentAstAlt).getElems().size(); } if(sizeNewTerm != sizeAstAlt) @@ -271,20 +274,20 @@ public class ResolveTransformIds extends DepthFirstAdapter altTransformElemTypes.put(node, type); - AAstAlt astAlt = (AAstAlt)transformIds.ast_alts.get(currentAstAlt); + AAstAlt astAlt = transformIds.ast_alts.get(currentAstAlt); if(node.getParams().size() > 0 && astAlt.getElems().size() > 0) { - Object elemsTable[] = astAlt.getElems().toArray(); - Object paramsTable[] = node.getParams().toArray(); + PElem[] elemsTable = astAlt.getElems().toArray(new PElem[0]); + PTerm[] paramsTable = node.getParams().toArray(new PTerm[0]); String termType, elemType; //here, we're checking the type compabitlity between for a new node creation for(int j=0; j<elemsTable.length; j++) { - termType = (String)altTransformElemTypes.get(paramsTable[j]); - elemType = (String)transformIds.ast_elemTypes.get(elemsTable[j]); + termType = altTransformElemTypes.get(paramsTable[j]); + elemType = transformIds.ast_elemTypes.get(elemsTable[j]); PUnOp elemOp = ((AElem)elemsTable[j]).getUnOp(); @@ -300,12 +303,13 @@ public class ResolveTransformIds extends DepthFirstAdapter } } + @Override public void outAListTerm(AListTerm node) { if( (node.getListTerms() != null) && (node.getListTerms().size() != 0) ) { - Object temp[] = node.getListTerms().toArray(); - String firstTermType = (String)altTransformElemTypes.get(temp[0]); + PListTerm[] temp = node.getListTerms().toArray(new PListTerm[0]); + String firstTermType = altTransformElemTypes.get(temp[0]); if(firstTermType.endsWith("?")) { firstTermType = firstTermType.substring(0, firstTermType.length()-1); @@ -313,7 +317,7 @@ public class ResolveTransformIds extends DepthFirstAdapter for(int i=1; i<temp.length; i++) { - String termType = (String)altTransformElemTypes.get(temp[i]); + String termType = altTransformElemTypes.get(temp[i]); if(termType.endsWith("?")) { termType = termType.substring(0, termType.length()-1); @@ -340,15 +344,16 @@ public class ResolveTransformIds extends DepthFirstAdapter } } - private LinkedList listL; - private LinkedList listP; + private List<String> listL; + private List<String> listP; private String lastSimpleTerm; + @Override public void inASimpleTerm(ASimpleTerm node) { String name = node.getId().getText(); - String typeOfExplicitElemName = (String)transformIds.astIds.altsElemNameTypes.get( currentAlt+"."+node.getId().getText() ); - String alternativeElemType = (String)transformIds.astIds.altsElemTypes.get( currentAlt+"."+node.getId().getText() ); + String typeOfExplicitElemName = transformIds.astIds.altsElemNameTypes.get( currentAlt+"."+node.getId().getText() ); + String alternativeElemType = transformIds.astIds.altsElemTypes.get( currentAlt+"."+node.getId().getText() ); boolean okTermtail = false; String tmpName = name; @@ -359,12 +364,9 @@ public class ResolveTransformIds extends DepthFirstAdapter } else { - ListIterator iter = null; - iter = listCurrentAltGlobal.listIterator(); - - while(iter.hasNext()) + for(Iterator<String> iter = listCurrentAltGlobal.iterator(); iter.hasNext();) { - if( name.equals((String)iter.next()) ) + if( name.equals(iter.next()) ) { if( node.getSimpleTermTail() == null ) { @@ -381,12 +383,9 @@ public class ResolveTransformIds extends DepthFirstAdapter } else { - ListIterator iter = null; - iter = listCurrentAlt.listIterator(); - - while(iter.hasNext()) + for(Iterator<String> iter = listCurrentAlt.iterator(); iter.hasNext();) { - if( name.equals((String)iter.next()) ) + if( name.equals(iter.next()) ) { if( node.getSimpleTermTail() == null ) { @@ -426,27 +425,27 @@ public class ResolveTransformIds extends DepthFirstAdapter { if(prodTransformIds.prod_transforms.get(typeOfExplicitElemName) != null) { - listL = (LinkedList)((LinkedList)prodTransformIds.prod_transforms.get(typeOfExplicitElemName)).clone(); + listL = new LinkedList<>(prodTransformIds.prod_transforms.get(typeOfExplicitElemName)); mapSimpleTermProdTransformation.put(currentAlt+"."+tmpName, listL); } } else { - listL = (LinkedList)mapSimpleTermProdTransformation.get(currentAlt+"."+tmpName); + listL = mapSimpleTermProdTransformation.get(currentAlt+"."+tmpName); } } if( mapSimpleTermProdTransformation.get(currentAlt+".P"+tmpName) == null ) { - listP = (LinkedList)prodTransformIds.prod_transforms.get(name); + listP = prodTransformIds.prod_transforms.get(name); if(prodTransformIds.prod_transforms.get(name) != null) { - listP = (LinkedList)((LinkedList)prodTransformIds.prod_transforms.get(name)).clone(); + listP = new LinkedList<>(prodTransformIds.prod_transforms.get(name)); mapSimpleTermProdTransformation.put(currentAlt+".P"+tmpName, listP); } } else { - listP = (LinkedList)mapSimpleTermProdTransformation.get(currentAlt+".P"+tmpName); + listP = mapSimpleTermProdTransformation.get(currentAlt+".P"+tmpName); } listCurrentAlt.remove(lastSimpleTerm); @@ -454,7 +453,7 @@ public class ResolveTransformIds extends DepthFirstAdapter boolean blistL = false; - if( ( (typeOfExplicitElemName != null) && (listL!= null) && (listL.size()==1) && ResolveIds.name((String)listL.getFirst()).equals(typeOfExplicitElemName.substring(1)) ) || + if( ( (typeOfExplicitElemName != null) && (listL!= null) && (listL.size()==1) && ResolveIds.name(listL.get(0)).equals(typeOfExplicitElemName.substring(1)) ) || ( (typeOfExplicitElemName == null) && (listP!= null) && (listP.size()==1) && listP.contains(node.getId().getText()) ) ) { blistL = true; @@ -487,17 +486,13 @@ public class ResolveTransformIds extends DepthFirstAdapter } else { - ListIterator iter = null; - if(listL != null) { - iter = listL.listIterator(); - position = listL.indexOf(strTermTail); - while(iter.hasNext()) + for(Iterator<String> iter = listL.listIterator(); iter.hasNext();) { - if( strTermTail.equals((String)iter.next()) ) + if( strTermTail.equals(iter.next()) ) { iter.remove(); break; @@ -507,13 +502,11 @@ public class ResolveTransformIds extends DepthFirstAdapter if(listP != null) { - iter = listP.listIterator(); - position = listP.indexOf(strTermTail); - while(iter.hasNext()) + for(Iterator<String> iter = listP.listIterator(); iter.hasNext();) { - if( strTermTail.equals((String)iter.next()) ) + if( strTermTail.equals(iter.next()) ) { iter.remove(); break; @@ -524,19 +517,6 @@ public class ResolveTransformIds extends DepthFirstAdapter } } - if(node.getSimpleTermTail() != null) - { - String termtail = node.getSimpleTermTail().getText(); - LinkedList listProdContains = null; - if(typeOfExplicitElemName != null) - { - listProdContains = (LinkedList)prodTransformIds.mapProdTransformContainsList.get(typeOfExplicitElemName); - } - else - { - listProdContains = (LinkedList)prodTransformIds.mapProdTransformContainsList.get("P" + ResolveIds.name(node.getId().getText())); - } - } //The Type of the element without his eventual termtail (term.termtail :: (type of term)) if(typeOfExplicitElemName != null) { @@ -562,7 +542,7 @@ public class ResolveTransformIds extends DepthFirstAdapter alternativeElemType = alternativeElemType.substring(0, alternativeElemType.length()-1); qmark_op = true; } - String typeOfTerm = (String)prodTransformIds.prodTransformElemTypesString.get(alternativeElemType+"."+termTail); + String typeOfTerm = prodTransformIds.prodTransformElemTypesString.get(alternativeElemType+"."+termTail); // The substring is done because we want to ensures that lists term should be wrapped by square brackets if(typeOfTerm.startsWith("L")) @@ -578,16 +558,18 @@ public class ResolveTransformIds extends DepthFirstAdapter } } + @Override public void caseANullTerm(ANullTerm node) { altTransformElemTypes.put(node, "Null"); } + @Override public void inASimpleListTerm(ASimpleListTerm node) { String name = node.getId().getText(); - String typeOfExplicitElemName = (String)transformIds.astIds.altsElemNameTypes.get( currentAlt+"."+node.getId().getText() ); - String alternativeElemType = (String)transformIds.astIds.altsElemTypes.get( currentAlt+"."+node.getId().getText() ); + String typeOfExplicitElemName = transformIds.astIds.altsElemNameTypes.get( currentAlt+"."+node.getId().getText() ); + String alternativeElemType = transformIds.astIds.altsElemTypes.get( currentAlt+"."+node.getId().getText() ); String strTermTail; String tmpName = name; @@ -597,12 +579,9 @@ public class ResolveTransformIds extends DepthFirstAdapter } else { - ListIterator iter = null; - iter = listCurrentAltGlobal.listIterator(); - - while(iter.hasNext()) + for(Iterator<String> iter = listCurrentAltGlobal.iterator(); iter.hasNext();) { - if( name.equals((String)iter.next()) ) + if( name.equals(iter.next()) ) { if( node.getSimpleTermTail() == null ) { @@ -619,19 +598,19 @@ public class ResolveTransformIds extends DepthFirstAdapter } else { - ListIterator iter = null; + Iterator<String> iter = null; if( (listCurrentAlt != null) && listCurrentAlt.contains(name) ) { - iter = listCurrentAlt.listIterator(); + iter = listCurrentAlt.iterator(); } else if( (listOfListCurrentAlt != null) && listOfListCurrentAlt.contains(name) ) { - iter = listOfListCurrentAlt.listIterator(); + iter = listOfListCurrentAlt.iterator(); } while(iter.hasNext()) { - if( name.equals((String)iter.next()) ) + if( name.equals(iter.next()) ) { if( node.getSimpleTermTail() == null ) { @@ -669,27 +648,27 @@ public class ResolveTransformIds extends DepthFirstAdapter { if(prodTransformIds.prod_transforms.get(typeOfExplicitElemName) != null) { - listL = (LinkedList)((LinkedList)prodTransformIds.prod_transforms.get(typeOfExplicitElemName)).clone(); + listL = new LinkedList<>(prodTransformIds.prod_transforms.get(typeOfExplicitElemName)); mapSimpleTermProdTransformation.put(currentAlt+"."+tmpName, listL); } } else { - listL = (LinkedList)mapSimpleTermProdTransformation.get(currentAlt+"."+tmpName); + listL = mapSimpleTermProdTransformation.get(currentAlt+"."+tmpName); } } if( mapSimpleTermProdTransformation.get(currentAlt+".P"+tmpName) == null ) { - listP = (LinkedList)prodTransformIds.prod_transforms.get(name); + listP = prodTransformIds.prod_transforms.get(name); if(prodTransformIds.prod_transforms.get(name) != null) { - listP = (LinkedList)((LinkedList)prodTransformIds.prod_transforms.get(name)).clone(); + listP = new LinkedList<>(prodTransformIds.prod_transforms.get(name)); mapSimpleTermProdTransformation.put(currentAlt+".P"+tmpName, listP); } } else { - listP = (LinkedList)mapSimpleTermProdTransformation.get(currentAlt+".P"+tmpName); + listP = mapSimpleTermProdTransformation.get(currentAlt+".P"+tmpName); } listCurrentAlt.remove(lastSimpleTerm); @@ -697,7 +676,7 @@ public class ResolveTransformIds extends DepthFirstAdapter boolean blistL = false; - if( ( (typeOfExplicitElemName != null) && (listL!= null) && (listL.size()==1) && ResolveIds.name((String)listL.getFirst()).equals(typeOfExplicitElemName.substring(1)) ) || + if( ( (typeOfExplicitElemName != null) && (listL!= null) && (listL.size()==1) && ResolveIds.name(listL.get(0)).equals(typeOfExplicitElemName.substring(1)) ) || ( (typeOfExplicitElemName == null) && (listP!= null) && (listP.size()==1) && listP.contains(node.getId().getText()) ) ) { blistL = true; @@ -729,17 +708,13 @@ public class ResolveTransformIds extends DepthFirstAdapter } else { - ListIterator iter = null; - if(listL != null) { - iter = listL.listIterator(); - position = listL.indexOf(strTermTail); - while(iter.hasNext()) + for(Iterator<String> iter = listL.iterator(); iter.hasNext();) { - if( strTermTail.equals((String)iter.next()) ) + if( strTermTail.equals(iter.next()) ) { iter.remove(); break; @@ -749,13 +724,11 @@ public class ResolveTransformIds extends DepthFirstAdapter if(listP != null) { - iter = listP.listIterator(); - position = listP.indexOf(strTermTail); - while(iter.hasNext()) + for(Iterator<String> iter = listP.iterator(); iter.hasNext();) { - if( strTermTail.equals((String)iter.next()) ) + if( strTermTail.equals(iter.next()) ) { iter.remove(); break; @@ -765,25 +738,6 @@ public class ResolveTransformIds extends DepthFirstAdapter } } - if(node.getSimpleTermTail() != null) - { - String termtail = node.getSimpleTermTail().getText(); - LinkedList listProdContains = null; - LinkedList prodContains = null; - if(typeOfExplicitElemName != null) - { - listProdContains = (LinkedList)prodTransformIds.mapProdTransformContainsList.get(typeOfExplicitElemName); - prodContains = (LinkedList)prodTransformIds.prod_transforms.get(typeOfExplicitElemName); - } - else - { - listProdContains = (LinkedList)prodTransformIds.mapProdTransformContainsList.get("P" + ResolveIds.name(node.getId().getText())); - prodContains = (LinkedList)prodTransformIds.prod_transforms.get("P" + ResolveIds.name(node.getId().getText())); - } - - LinkedList lst = (LinkedList)altIds.alts_elems_list.get(currentAlt); - } - //The Type of the element without his eventual termtail (term.termtail :: (type of term)) if(typeOfExplicitElemName != null) @@ -810,7 +764,7 @@ public class ResolveTransformIds extends DepthFirstAdapter alternativeElemType = alternativeElemType.substring(0, alternativeElemType.length()-1); qmark_op = true; } - String typeOfTerm = (String)prodTransformIds.prodTransformElemTypesString.get(alternativeElemType+"."+termTail); + String typeOfTerm = prodTransformIds.prodTransformElemTypesString.get(alternativeElemType+"."+termTail); // The substring is done because we want to ensures that lists term should be wrapped by square brackets if(typeOfTerm.startsWith("L")) @@ -826,14 +780,15 @@ public class ResolveTransformIds extends DepthFirstAdapter } } - private Object curr_prodTransformElems[]; + private Object[] curr_prodTransformElems; private boolean curr_prod_has_prodTransform; private boolean firstProduction = false; + @Override public void outAProductions(AProductions node) { - LinkedList list = node.getProds(); - AProd prod = (AProd)list.getFirst(); + List<PProd> list = node.getProds(); + AProd prod = (AProd)list.get(0); firstProduction = true; if( prodTransformIds.listProdTransformList.contains("P"+ ResolveIds.name( prod.getId().getText()) ) ) @@ -841,15 +796,15 @@ public class ResolveTransformIds extends DepthFirstAdapter error_0(prod.getId()); } - Object temp[] = node.getProds().toArray(); - for(int i = 0; i < temp.length; i++) + PProd[] temp = node.getProds().toArray(new PProd[0]); + for(PProd p : temp) { - - ((PProd) temp[i]).apply(new DepthFirstAdapter() + p.apply(new DepthFirstAdapter() { + @Override public void inAProd(AProd production) { - LinkedList prodTransform = production.getProdTransform(); + List<PElem> prodTransform = production.getProdTransform(); String prodTransformElemType = ""; curr_prodTransformElems = null; curr_prod_has_prodTransform = false; @@ -858,22 +813,22 @@ public class ResolveTransformIds extends DepthFirstAdapter { curr_prod_has_prodTransform = true; curr_prodTransformElems = prodTransform.toArray(); - prodTransformElemType = (String)prodTransformIds.prodTransformElemTypes.get(curr_prodTransformElems[0]); + prodTransformElemType = prodTransformIds.prodTransformElemTypes.get(curr_prodTransformElems[0]); } else if(production.getArrow() == null) { curr_prod_has_prodTransform = false; - String []tab = new String[1]; + String[] tab = new String[1]; tab[0] = "P" + ResolveIds.name(production.getId().getText()); - curr_prodTransformElems = (Object[])tab; + curr_prodTransformElems = tab; prodTransformElemType = (String)curr_prodTransformElems[0]; } else { curr_prod_has_prodTransform = false; - String []tab = new String[1]; + String[] tab = new String[1]; tab[0] = "nothing"; - curr_prodTransformElems = (Object[])tab; + curr_prodTransformElems = tab; prodTransformIds.prodTransformElemTypes.put(prodTransform, "nothing"); prodTransformElemType = (String)curr_prodTransformElems[0]; } @@ -888,9 +843,10 @@ public class ResolveTransformIds extends DepthFirstAdapter } } + @Override public void inAAltTransform(AAltTransform node) { - Object curr_altTransformTerms[] = node.getTerms().toArray(); + PTerm[] curr_altTransformTerms = node.getTerms().toArray(new PTerm[0]); for(int k = 0; k < curr_altTransformTerms.length; k++) { @@ -898,13 +854,13 @@ public class ResolveTransformIds extends DepthFirstAdapter if(curr_prod_has_prodTransform) { - prodTransformElemType = (String)prodTransformIds.prodTransformElemTypes.get(curr_prodTransformElems[k]); + prodTransformElemType = prodTransformIds.prodTransformElemTypes.get(curr_prodTransformElems[k]); } else { prodTransformElemType = (String)curr_prodTransformElems[k]; } - altTransformTermType = (String)altTransformElemTypes.get(curr_altTransformTerms[k]); + altTransformTermType = altTransformElemTypes.get(curr_altTransformTerms[k]); PUnOp elemOp = ((AElem)curr_prodTransformElems[k]).getUnOp(); @@ -921,7 +877,7 @@ public class ResolveTransformIds extends DepthFirstAdapter if(curr_altTransformTerms.length == 0) { String prodTransformElemType = (String)curr_prodTransformElems[0]; - String altTransformTermType = (String)altTransformElemTypes.get(node); + String altTransformTermType = altTransformElemTypes.get(node); if(!prodTransformElemType.equals(altTransformTermType)) { error10(node.getLBrace(), prodTransformElemType, altTransformTermType); @@ -1080,9 +1036,10 @@ public class ResolveTransformIds extends DepthFirstAdapter "The first production's transformation must be only one elements without an operator."); } + @Override public String toString() { - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); String nl = System.getProperty("line.separator"); s.append("ast_elems"); diff --git a/src/main/java/org/sablecc/sablecc/SableCC.java b/src/main/java/org/sablecc/sablecc/SableCC.java index 3c80cb626ed821872cef3501ce4e949035dba5a5..2ed2bb3e4b9a89799401c4688217bc4d3f1f11b7 100644 --- a/src/main/java/org/sablecc/sablecc/SableCC.java +++ b/src/main/java/org/sablecc/sablecc/SableCC.java @@ -7,265 +7,270 @@ package org.sablecc.sablecc; -import java.io.*; -import java.awt.*; -import java.util.*; -import org.sablecc.sablecc.node.*; -import org.sablecc.sablecc.analysis.*; -import org.sablecc.sablecc.lexer.*; -import org.sablecc.sablecc.parser.*; -import java.util.Vector; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.PushbackReader; +import java.util.ArrayList; +import java.util.List; + +import org.sablecc.sablecc.lexer.Lexer; +import org.sablecc.sablecc.lexer.LexerException; +import org.sablecc.sablecc.node.AGrammar; +import org.sablecc.sablecc.node.Start; +import org.sablecc.sablecc.parser.Parser; +import org.sablecc.sablecc.parser.ParserException; public class SableCC { - private static boolean processInlining = true; - static int inliningMaxAlts = 20; - private static boolean prettyPrinting = false; - - private static final String OPT_LICENSE = "--license"; - private static final String OPT_D = "-d"; - private static final String OPT_NO_INLINE = "--no-inline"; - private static final String OPT_INLINE_MAX_ALTS = "--inline-max-alts"; - private static final String OPT_PRETTY_PRINT = "--pretty-print"; - - private static void displayCopyright() { - System.out.println(); - System.out.println("SableCC version " + Version.VERSION - + " HHU Version"); - System.out - .println("Copyright (C) 1997-2003 Etienne M. Gagnon <etienne.gagnon@uqam.ca> and"); - System.out.println("others. All rights reserved."); - System.out.println(); - System.out - .println("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); - System.out - .println("and you are welcome to redistribute it under certain conditions."); - System.out.println(); - System.out.println("Type 'sablecc -license' to view"); - System.out.println("the complete copyright notice and license."); - System.out.println(); - } - - private static void displayUsage() { - System.out.println("Usage:"); - System.out.println(" sablecc [" + OPT_D + " destination] [" - + OPT_NO_INLINE + "] [" + OPT_INLINE_MAX_ALTS + " number] [" - + OPT_PRETTY_PRINT + "] filename [filename]..."); - System.out.println(" sablecc " + OPT_LICENSE); - } - - public static void main(String[] arguments) { - String d_option = null; - Vector filename = new Vector(); - - if (arguments.length == 0) { - displayCopyright(); - displayUsage(); - System.exit(1); - } - - if ((arguments.length == 1) && (arguments[0].equals(OPT_LICENSE))) { - new DisplayLicense(); - System.exit(0); - } - - displayCopyright(); - - { - int arg = 0; - while (arg < arguments.length) { - if (arguments[arg].equals(OPT_D)) { - if ((d_option == null) && (++arg < arguments.length)) { - d_option = arguments[arg]; - } else { - displayUsage(); - System.exit(1); - } - } else if (arguments[arg].equals(OPT_NO_INLINE)) { - processInlining = false; - } - /* - * A production is not inlined if it has more than - * inliningMaxAlts alternatives. The default value is 20. - */ - else if (arguments[arg].equals(OPT_INLINE_MAX_ALTS)) { - try { - inliningMaxAlts = Integer.parseInt(arguments[++arg]); - } catch (Exception e) { - displayUsage(); - System.exit(1); - } - } - /* - * if prettyprint flag is set to true, only the transformed - * grammar is printed on standard output - */ - else if (arguments[arg].equals(OPT_PRETTY_PRINT)) { - prettyPrinting = true; - } else { - filename.addElement(arguments[arg]); - } - arg++; - } - - if (filename.size() == 0) { - displayUsage(); - System.exit(1); - } - } - - try { - for (int i = 0; i < filename.size(); i++) { - processGrammar((String) filename.elementAt(i), d_option); - } - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - System.exit(0); - } - - /** - * The main method for processing grammar file and generating the - * parser/lexer. - * - * @param grammar - * input grammar file name - * @param destDir - * output directory name - */ - public static void processGrammar(String grammar, String destDir) - throws Exception { - File in; - File dir; - - in = new File(grammar); - in = new File(in.getAbsolutePath()); - - if (destDir == null) { - dir = new File(in.getParent()); - } else { - dir = new File(destDir); - dir = new File(dir.getAbsolutePath()); - } - - processGrammar(in, dir); - } - - /** - * The main method for processing grammar file and generating the - * parser/lexer. - * - * @param in - * input grammar file - * @param dir - * output directory - */ - public static void processGrammar(File in, File dir) throws Exception { - if (!in.exists()) { - System.out.println("ERROR: grammar file " + in.getName() - + " does not exist."); - System.exit(1); - } - if (!dir.exists()) { - System.out.println("ERROR: destination directory " + dir.getName() - + " does not exist."); - System.exit(1); - } - - // re-initialize all static structures in the engine - LR0Collection.reinit(); - Symbol.reinit(); - Production.reinit(); - Grammar.reinit(); - - System.out.println("\n -- Generating parser for " + in.getName() - + " in " + dir.getPath()); - - FileReader temp = new FileReader(in); - - // Build the AST - Start tree = new Parser(new Lexer(new PushbackReader( - temp = new FileReader(in), 1000))).parse(); - - temp.close(); - - boolean hasTransformations = false; - - if (((AGrammar) tree.getPGrammar()).getAst() == null) { - System.out - .println("Adding productions and alternative of section AST."); - // AddAstProductions astProductions = new AddAstProductions(); - tree.apply(new AddAstProductions()); - } else { - hasTransformations = true; - } - - System.out.println("Verifying identifiers."); - ResolveIds ids = new ResolveIds(dir); - tree.apply(ids); - - System.out.println("Verifying ast identifiers."); - ResolveAstIds ast_ids = new ResolveAstIds(ids); - tree.apply(ast_ids); - - System.out - .println("Adding empty productions and empty alternative transformation if necessary."); - tree.apply(new AddEventualEmptyTransformationToProductions(ids, ast_ids)); - - System.out - .println("Adding productions and alternative transformation if necessary."); - AddProdTransformAndAltTransform adds = new AddProdTransformAndAltTransform(); - tree.apply(adds); - /* - * System.out.println( - * "Replacing AST + operator by * and removing ? operator if necessary" - * ); tree.apply( new AstTransformations() ); - */ - System.out.println("computing alternative symbol table identifiers."); - ResolveAltIds alt_ids = new ResolveAltIds(ids); - tree.apply(alt_ids); - - System.out.println("Verifying production transform identifiers."); - ResolveProdTransformIds ptransform_ids = new ResolveProdTransformIds( - ast_ids); - tree.apply(ptransform_ids); - - System.out.println("Verifying ast alternatives transform identifiers."); - ResolveTransformIds transform_ids = new ResolveTransformIds(ast_ids, - alt_ids, ptransform_ids); - tree.apply(transform_ids); - - System.out.println("Generating token classes."); - tree.apply(new GenTokens(ids)); - - System.out.println("Generating production classes."); - tree.apply(new GenProds(ast_ids)); - - System.out.println("Generating alternative classes."); - tree.apply(new GenAlts(ast_ids)); - - System.out.println("Generating analysis classes."); - tree.apply(new GenAnalyses(ast_ids)); - - System.out.println("Generating utility classes."); - tree.apply(new GenUtils(ast_ids)); - - try { - System.out.println("Generating the lexer."); - tree.apply(new GenLexer(ids)); - } catch (Exception e) { - System.out.println(e.getMessage()); - throw e; - } - - try { - System.out.println("Generating the parser."); - tree.apply(new GenParser(ids, alt_ids, transform_ids, ast_ids - .getFirstAstProduction(), processInlining, prettyPrinting, - hasTransformations)); - } catch (Exception e) { - System.out.println(e.getMessage()); - throw e; - } - } + private static boolean processInlining = true; + static int inliningMaxAlts = 20; + private static boolean prettyPrinting = false; + + private static final String OPT_LICENSE = "--license"; + private static final String OPT_D = "-d"; + private static final String OPT_NO_INLINE = "--no-inline"; + private static final String OPT_INLINE_MAX_ALTS = "--inline-max-alts"; + private static final String OPT_PRETTY_PRINT = "--pretty-print"; + + private static void displayCopyright() { + System.out.println(); + System.out.println("SableCC version " + Version.VERSION + + " HHU Version"); + System.out + .println("Copyright (C) 1997-2003 Etienne M. Gagnon <etienne.gagnon@uqam.ca> and"); + System.out.println("others. All rights reserved."); + System.out.println(); + System.out + .println("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); + System.out + .println("and you are welcome to redistribute it under certain conditions."); + System.out.println(); + System.out.println("Type 'sablecc -license' to view"); + System.out.println("the complete copyright notice and license."); + System.out.println(); + } + + private static void displayUsage() { + System.out.println("Usage:"); + System.out.println(" sablecc [" + OPT_D + " destination] [" + + OPT_NO_INLINE + "] [" + OPT_INLINE_MAX_ALTS + " number] [" + + OPT_PRETTY_PRINT + "] filename [filename]..."); + System.out.println(" sablecc " + OPT_LICENSE); + } + + public static void main(String[] arguments) { + String d_option = null; + List<String> filename = new ArrayList<>(); + + if (arguments.length == 0) { + displayCopyright(); + displayUsage(); + System.exit(1); + } + + if ((arguments.length == 1) && (arguments[0].equals(OPT_LICENSE))) { + new DisplayLicense(); + System.exit(0); + } + + displayCopyright(); + + { + int arg = 0; + while (arg < arguments.length) { + if (arguments[arg].equals(OPT_D)) { + if ((d_option == null) && (++arg < arguments.length)) { + d_option = arguments[arg]; + } else { + displayUsage(); + System.exit(1); + } + } else if (arguments[arg].equals(OPT_NO_INLINE)) { + processInlining = false; + } + /* + * A production is not inlined if it has more than + * inliningMaxAlts alternatives. The default value is 20. + */ + else if (arguments[arg].equals(OPT_INLINE_MAX_ALTS)) { + try { + inliningMaxAlts = Integer.parseInt(arguments[++arg]); + } catch (RuntimeException e) { + displayUsage(); + System.exit(1); + } + } + /* + * if prettyprint flag is set to true, only the transformed + * grammar is printed on standard output + */ + else if (arguments[arg].equals(OPT_PRETTY_PRINT)) { + prettyPrinting = true; + } else { + filename.add(arguments[arg]); + } + arg++; + } + + if (filename.size() == 0) { + displayUsage(); + System.exit(1); + } + } + + try { + for (int i = 0; i < filename.size(); i++) { + processGrammar(filename.get(i), d_option); + } + } catch (IOException | LexerException | ParserException | RuntimeException e) { + e.printStackTrace(); + System.exit(1); + } + System.exit(0); + } + + /** + * The main method for processing grammar file and generating the + * parser/lexer. + * + * @param grammar + * input grammar file name + * @param destDir + * output directory name + */ + public static void processGrammar(String grammar, String destDir) + throws IOException, LexerException, ParserException { + File in; + File dir; + + in = new File(grammar); + in = new File(in.getAbsolutePath()); + + if (destDir == null) { + dir = new File(in.getParent()); + } else { + dir = new File(destDir); + dir = new File(dir.getAbsolutePath()); + } + + processGrammar(in, dir); + } + + /** + * The main method for processing grammar file and generating the + * parser/lexer. + * + * @param in + * input grammar file + * @param dir + * output directory + */ + public static void processGrammar(File in, File dir) throws IOException, LexerException, ParserException { + if (!in.exists()) { + System.out.println("ERROR: grammar file " + in.getName() + + " does not exist."); + System.exit(1); + } + if (!dir.exists()) { + System.out.println("ERROR: destination directory " + dir.getName() + + " does not exist."); + System.exit(1); + } + + // re-initialize all static structures in the engine + LR0Collection.reinit(); + Symbol.reinit(); + Production.reinit(); + Grammar.reinit(); + + System.out.println("\n -- Generating parser for " + in.getName() + + " in " + dir.getPath()); + + FileReader temp = new FileReader(in); + + // Build the AST + Start tree = new Parser(new Lexer(new PushbackReader( + temp = new FileReader(in), 1000))).parse(); + + temp.close(); + + boolean hasTransformations = false; + + if (((AGrammar) tree.getPGrammar()).getAst() == null) { + System.out + .println("Adding productions and alternative of section AST."); + // AddAstProductions astProductions = new AddAstProductions(); + tree.apply(new AddAstProductions()); + } else { + hasTransformations = true; + } + + System.out.println("Verifying identifiers."); + ResolveIds ids = new ResolveIds(dir); + tree.apply(ids); + + System.out.println("Verifying ast identifiers."); + ResolveAstIds ast_ids = new ResolveAstIds(ids); + tree.apply(ast_ids); + + System.out + .println("Adding empty productions and empty alternative transformation if necessary."); + tree.apply(new AddEventualEmptyTransformationToProductions(ids, ast_ids)); + + System.out + .println("Adding productions and alternative transformation if necessary."); + AddProdTransformAndAltTransform adds = new AddProdTransformAndAltTransform(); + tree.apply(adds); + /* + * System.out.println( + * "Replacing AST + operator by * and removing ? operator if necessary" + * ); tree.apply( new AstTransformations() ); + */ + System.out.println("computing alternative symbol table identifiers."); + ResolveAltIds alt_ids = new ResolveAltIds(ids); + tree.apply(alt_ids); + + System.out.println("Verifying production transform identifiers."); + ResolveProdTransformIds ptransform_ids = new ResolveProdTransformIds( + ast_ids); + tree.apply(ptransform_ids); + + System.out.println("Verifying ast alternatives transform identifiers."); + ResolveTransformIds transform_ids = new ResolveTransformIds(ast_ids, + alt_ids, ptransform_ids); + tree.apply(transform_ids); + + System.out.println("Generating token classes."); + tree.apply(new GenTokens(ids)); + + System.out.println("Generating production classes."); + tree.apply(new GenProds(ast_ids)); + + System.out.println("Generating alternative classes."); + tree.apply(new GenAlts(ast_ids)); + + System.out.println("Generating analysis classes."); + tree.apply(new GenAnalyses(ast_ids)); + + System.out.println("Generating utility classes."); + tree.apply(new GenUtils(ast_ids)); + + try { + System.out.println("Generating the lexer."); + tree.apply(new GenLexer(ids)); + } catch (RuntimeException e) { + System.out.println(e.getMessage()); + throw e; + } + + try { + System.out.println("Generating the parser."); + tree.apply(new GenParser(ids, alt_ids, transform_ids, ast_ids + .getFirstAstProduction(), processInlining, prettyPrinting, + hasTransformations)); + } catch (RuntimeException e) { + System.out.println(e.getMessage()); + throw e; + } + } } diff --git a/src/main/java/org/sablecc/sablecc/StringCast.java b/src/main/java/org/sablecc/sablecc/StringCast.java deleted file mode 100644 index 63c9a86ec13f05214a2c2881f66550361eca268f..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/StringCast.java +++ /dev/null @@ -1,23 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class StringCast implements Cast -{ - public final static StringCast instance = new StringCast(); - - private StringCast() - {} - - public Object cast(Object o) - { - return (String) o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/StringComparator.java b/src/main/java/org/sablecc/sablecc/StringComparator.java deleted file mode 100644 index ab7fb2f5358ca9486d6502ac92ad767e6ec614db..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/StringComparator.java +++ /dev/null @@ -1,23 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class StringComparator implements Comparator -{ - public final static StringComparator instance = new StringComparator(); - - private StringComparator() - {} - - public int compare(Object o1, Object o2) - { - return ((String) o1).compareTo((String) o2); - } -} diff --git a/src/main/java/org/sablecc/sablecc/Symbol.java b/src/main/java/org/sablecc/sablecc/Symbol.java index bc10c42c7498ac148c0b4d61fdbe97b086c78375..583639b3edb20a8bdff28bc3898dac4d4b6a954e 100644 --- a/src/main/java/org/sablecc/sablecc/Symbol.java +++ b/src/main/java/org/sablecc/sablecc/Symbol.java @@ -7,14 +7,16 @@ package org.sablecc.sablecc; -import java.util.*; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; -final class Symbol implements Comparable +final class Symbol implements Comparable<Symbol> { - private static Vector terminals; - private static Vector nonterminals; - private static TreeMap names; + private static List<Symbol> terminals; + private static List<Symbol> nonterminals; + private static Map<String, Symbol> names; private static boolean modified_ = true; private static Symbol[] symbols_; @@ -39,12 +41,12 @@ final class Symbol implements Comparable if(terminal) { - terminals.addElement(this); + terminals.add(this); this.index = terminals.indexOf(this); } else { - nonterminals.addElement(this); + nonterminals.add(this); this.index = nonterminals.indexOf(this); } @@ -57,9 +59,9 @@ final class Symbol implements Comparable public static void reinit() { - terminals = new Vector(); - nonterminals = new Vector(); - names = new TreeMap(StringComparator.instance); + terminals = new ArrayList<>(); + nonterminals = new ArrayList<>(); + names = new TreeMap<>(); modified_ = true; symbols_ = null; terminals_ = null; @@ -68,29 +70,27 @@ final class Symbol implements Comparable static Symbol symbol(String name) { - return (Symbol) names.get(name); + return names.get(name); } static Symbol symbol(int index, boolean terminal) { if(terminal) { - return (Symbol) terminals.elementAt(index); + return terminals.get(index); } else { - return (Symbol) nonterminals.elementAt(index); + return nonterminals.get(index); } } private static void computeArrays() { symbols_ = new Symbol[terminals.size() + nonterminals.size()]; - terminals_ = new Symbol[terminals.size()]; - nonterminals_ = new Symbol[nonterminals.size()]; + terminals_ = terminals.toArray(new Symbol[0]); + nonterminals_ = nonterminals.toArray(new Symbol[0]); - terminals.copyInto(terminals_); - nonterminals.copyInto(nonterminals_); System.arraycopy(terminals_, 0, symbols_, 0, terminals_.length); System.arraycopy(nonterminals_, 0, symbols_, terminals_.length, nonterminals_.length); @@ -127,15 +127,15 @@ final class Symbol implements Comparable return nonterminals_; } + @Override public String toString() { return name; } - public int compareTo(Object object) + @Override + public int compareTo(Symbol symbol) { - Symbol symbol = (Symbol) object; - if(terminal ^ symbol.terminal) { if(terminal) diff --git a/src/main/java/org/sablecc/sablecc/SymbolSet.java b/src/main/java/org/sablecc/sablecc/SymbolSet.java index f46e113be2e0c43b7241def6cfe20bb747fb5b98..c179bd9f5d6e413ba125015c9f4714afd677721a 100644 --- a/src/main/java/org/sablecc/sablecc/SymbolSet.java +++ b/src/main/java/org/sablecc/sablecc/SymbolSet.java @@ -7,8 +7,8 @@ package org.sablecc.sablecc; -import java.util.*; -import java.util.Vector; +import java.util.ArrayList; +import java.util.List; final class SymbolSet implements Cloneable { @@ -21,22 +21,21 @@ final class SymbolSet implements Cloneable private void computeArray() { - Vector symbols = new Vector(0); + List<Symbol> symbols = new ArrayList<>(); int[] elements = terminals.elements(); for(int i = 0; i < elements.length; i++) { - symbols.addElement(Symbol.symbol(elements[i], true)); + symbols.add(Symbol.symbol(elements[i], true)); } elements = nonterminals.elements(); for(int i = 0; i < elements.length; i++) { - symbols.addElement(Symbol.symbol(elements[i], false)); + symbols.add(Symbol.symbol(elements[i], false)); } - this.symbols = new Symbol[symbols.size()]; - symbols.copyInto(this.symbols); + this.symbols = symbols.toArray(new Symbol[0]); modified = false; } @@ -47,11 +46,10 @@ final class SymbolSet implements Cloneable this.nonterminals= new IntSet(); } - private SymbolSet(SymbolSet set - ) + private SymbolSet(SymbolSet set) { - this.terminals = (IntSet) set.terminals.clone(); - this.nonterminals = (IntSet) set.nonterminals.clone(); + this.terminals = set.terminals.clone(); + this.nonterminals = set.nonterminals.clone(); this.empty = set.empty; } @@ -130,11 +128,13 @@ final class SymbolSet implements Cloneable modified = true; } + @Override public int hashCode() { - return terminals.hashCode() + nonterminals.hashCode() + new Boolean(empty).hashCode(); + return terminals.hashCode() + nonterminals.hashCode() + Boolean.valueOf(empty).hashCode(); } + @Override public boolean equals(Object obj) { if((obj == null) || @@ -160,9 +160,10 @@ final class SymbolSet implements Cloneable return symbols; } + @Override public String toString() { - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); result.append("{"); Symbol[] symbols = getSymbols(); @@ -200,7 +201,8 @@ final class SymbolSet implements Cloneable return result.toString(); } - public Object clone() + @Override + public SymbolSet clone() { return new SymbolSet(this); } diff --git a/src/main/java/org/sablecc/sablecc/Transitions.java b/src/main/java/org/sablecc/sablecc/Transitions.java index 817c7541e01037a56be45bc4aa94ba50b486f4cf..e612a83ae812a23fe697aa56889422b76ae02e8f 100644 --- a/src/main/java/org/sablecc/sablecc/Transitions.java +++ b/src/main/java/org/sablecc/sablecc/Transitions.java @@ -7,20 +7,22 @@ package org.sablecc.sablecc; -import org.sablecc.sablecc.analysis.*; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import org.sablecc.sablecc.analysis.DepthFirstAdapter; import org.sablecc.sablecc.node.*; -import java.util.*; public class Transitions extends DepthFirstAdapter { - public final Map tokenStates = new TypedHashMap( - NodeCast.instance, - NoCast.instance); + public final Map<ATokenDef, Map<String, String>> tokenStates = new HashMap<>(); private String state; private String transition; - private Map map; + private Map<String, String> map; + @Override public void caseAStateList(AStateList node) { inAStateList(node); @@ -36,47 +38,51 @@ public class Transitions extends DepthFirstAdapter outAStateList(node); // We moved this... { - Object temp[] = node.getStateLists().toArray(); - for(int i = 0; i < temp.length; i++) + PStateListTail[] temp = node.getStateLists().toArray(new PStateListTail[0]); + for(PStateListTail tail : temp) { - ((PStateListTail) temp[i]).apply(this); + tail.apply(this); } } } + @Override public void inATokenDef(ATokenDef node) { - map = new TypedTreeMap( - StringComparator.instance, - StringCast.instance, - StringCast.instance); + map = new TreeMap<>(); } + @Override public void inAStateList(AStateList node) { state = transition = node.getId().getText().toUpperCase(); } + @Override public void inAStateListTail(AStateListTail node) { state = transition = node.getId().getText().toUpperCase(); } + @Override public void outATransition(ATransition node) { transition = node.getId().getText().toUpperCase(); } + @Override public void outAStateList(AStateList node) { map.put(state, transition); } + @Override public void outAStateListTail(AStateListTail node) { map.put(state, transition); } + @Override public void outATokenDef(ATokenDef node) { tokenStates.put(node, map); diff --git a/src/main/java/org/sablecc/sablecc/TypedHashMap.java b/src/main/java/org/sablecc/sablecc/TypedHashMap.java deleted file mode 100644 index 0a20b3f52fcd6e95a9d6aa9959c1dec36ed16fad..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/TypedHashMap.java +++ /dev/null @@ -1,175 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class TypedHashMap extends HashMap -{ - private Cast keyCast; - private Cast valueCast; - private Set entries; - - public TypedHashMap() - { - super(); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - } - - public TypedHashMap(int initialCapacity, Cast keyCast, Cast valueCast) - { - super(initialCapacity); - - this.keyCast = keyCast; - this.valueCast = valueCast; - } - - public TypedHashMap(Map map) - { - super(); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - - Map.Entry[] entries = (Map.Entry[]) map.entrySet().toArray(new Map.Entry[0]); - for(int i = 0; i < entries.length; i++) - { - this.put(entries[i].getKey(),entries[i].getValue()); - } - - } - - public TypedHashMap(Cast keyCast, Cast valueCast) - { - super(); - - this.keyCast = keyCast; - this.valueCast = valueCast; - } - - public Object clone() - { - return new TypedHashMap(this, keyCast, valueCast); - } - - public TypedHashMap(Map map, Cast keyCast, Cast valueCast) - { - super(); - - this.keyCast = keyCast; - this.valueCast = valueCast; - - Map.Entry[] entries = (Map.Entry[]) map.entrySet().toArray(new Map.Entry[0]); - for(int i = 0; i < entries.length; i++) - { - this.put(entries[i].getKey(),entries[i].getValue()); - } - - } - - public Cast getKeyCast() - { - return keyCast; - } - - public Cast getValueCast() - { - return valueCast; - } - - public Set entrySet() - { - if(entries == null) - { - entries = new EntrySet(super.entrySet()); - } - - return entries; - } - - public Object put(Object key, Object value) - { - return super.put(keyCast.cast(key), valueCast.cast(value)); - } - - private class EntrySet extends AbstractSet - { - private Set set - ; - - EntrySet(Set set - ) - { - this.set = set - ; - } - - public int size() - { - return set.size(); - } - - public Iterator iterator() - { - return new EntryIterator(set.iterator()); - } - } - - private class EntryIterator implements Iterator - { - private Iterator iterator; - - EntryIterator(Iterator iterator) - { - this.iterator = iterator; - } - - public boolean hasNext() - { - return iterator.hasNext(); - } - - public Object next() - { - return new TypedEntry((Map.Entry) iterator.next()); - } - - public void remove - () - { - iterator.remove(); - } - } - - private class TypedEntry implements Map.Entry - { - private Map.Entry entry; - - TypedEntry(Map.Entry entry) - { - this.entry = entry; - } - - public Object getKey() - { - return entry.getKey(); - } - - public Object getValue() - { - return entry.getValue(); - } - - public Object setValue(Object value) - { - return entry.setValue(valueCast.cast(value)); - } - } -} diff --git a/src/main/java/org/sablecc/sablecc/TypedLinkedList.java b/src/main/java/org/sablecc/sablecc/TypedLinkedList.java deleted file mode 100644 index 2e1494bad8b5a8537325fc5296c5762582bab957..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/TypedLinkedList.java +++ /dev/null @@ -1,121 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class TypedLinkedList extends LinkedList -{ - Cast cast; - - public TypedLinkedList() - { - super(); - - cast = NoCast.instance; - } - - public TypedLinkedList(Collection c) - { - super(c); - - cast = NoCast.instance; - } - - public TypedLinkedList(Cast cast) - { - super(); - - this.cast = cast; - } - - public TypedLinkedList(Collection c, Cast cast) - { - super(c); - - this.cast = cast; - } - - public Cast getCast() - { - return cast; - } - - public void addFirst(Object o) - { - super.addFirst(cast.cast(o)); - } - - public void addLast(Object o) - { - super.addLast(cast.cast(o)); - } - - public ListIterator listIterator(int index) - { - return new TypedLinkedListIterator(super.listIterator(index)); - } - - private class TypedLinkedListIterator implements ListIterator - { - ListIterator iterator; - - TypedLinkedListIterator(ListIterator iterator) - { - this.iterator = iterator; - } - - public boolean hasNext() - { - return iterator.hasNext(); - } - - public Object next() - { - return iterator.next(); - } - - public boolean hasPrevious() - { - return iterator.hasPrevious(); - } - - public Object previous() - { - return iterator.previous(); - } - - public int nextIndex() - { - return iterator.nextIndex(); - } - - public int previousIndex() - { - return iterator.previousIndex(); - } - - public void remove - () - { - iterator.remove(); - } - - public void set - (Object o) - { - iterator.set(cast.cast(o)); - } - - public void add - (Object o) - { - iterator.add(cast.cast(o)); - } - } -} diff --git a/src/main/java/org/sablecc/sablecc/TypedTreeMap.java b/src/main/java/org/sablecc/sablecc/TypedTreeMap.java deleted file mode 100644 index e0b3ec21b2d536d4c69201c846024161f1dbcac8..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/TypedTreeMap.java +++ /dev/null @@ -1,251 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * This file is part of SableCC. * - * See the file "LICENSE" for copyright information and the * - * terms and conditions for copying, distribution and * - * modification of SableCC. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -package org.sablecc.sablecc; - -import java.util.*; - -public class TypedTreeMap extends TreeMap -{ - private Cast keyCast; - private Cast valueCast; - private Set entries; - - public TypedTreeMap() - { - super(); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - } - - public TypedTreeMap(Comparator comparator) - { - super(comparator); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - } - - public TypedTreeMap(Map map) - { - super(); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - - Map.Entry[] entries = (Map.Entry[])map.entrySet().toArray(new Map.Entry[0]); - for(int i=0; i < entries.length; i++) - { - this.put(entries[i].getKey(),entries[i].getValue()); - } - } - - /* - public TypedTreeMap(Map map) - { - super(map); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - } - */ - - public TypedTreeMap(SortedMap smap) - { - super(smap.comparator()); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - - Map.Entry[] entries = (Map.Entry[])smap.entrySet().toArray(new Map.Entry[0]); - for(int i=0; i < entries.length; i++) - { - this.put(entries[i].getKey(),entries[i].getValue()); - } - - } - /* - public TypedTreeMap(SortedMap smap) - { - super(smap); - - keyCast = NoCast.instance; - valueCast = NoCast.instance; - } - */ - - public TypedTreeMap(Cast keyCast, Cast valueCast) - { - super(); - - this.keyCast = keyCast; - this.valueCast = valueCast; - } - - public TypedTreeMap(Comparator comparator, Cast keyCast, Cast valueCast) - { - super(comparator); - - this.keyCast = keyCast; - this.valueCast = valueCast; - } - - public Object clone() - { - return new TypedTreeMap(this, keyCast, valueCast); - } - - public TypedTreeMap(Map map, Cast keyCast, Cast valueCast) - { - super(); - - this.keyCast = keyCast; - this.valueCast = valueCast; - - Map.Entry[] entries = (Map.Entry[])map.entrySet().toArray(new Map.Entry[0]); - for(int i=0; i < entries.length; i++) - { - this.put(entries[i].getKey(),entries[i].getValue()); - } - - } - - /* - public TypedTreeMap(Map map, Cast keyCast, Cast valueCast) - { - super(map); - - this.keyCast = keyCast; - this.valueCast = valueCast; - } - */ - - public TypedTreeMap(SortedMap smap, Cast keyCast, Cast valueCast) - { - super(smap.comparator()); - - this.keyCast = keyCast; - this.valueCast = valueCast; - - Map.Entry[] entries = (Map.Entry[])smap.entrySet().toArray(new Map.Entry[0]); - for(int i=0; i < entries.length; i++) - { - this.put(entries[i].getKey(),entries[i].getValue()); - } - - } - - /* - public TypedTreeMap(SortedMap smap, Cast keyCast, Cast valueCast) - { - super(smap); - - this.keyCast = keyCast; - this.valueCast = valueCast; - } - */ - - public Cast getKeyCast() - { - return keyCast; - } - - public Cast getValueCast() - { - return valueCast; - } - - public Set entrySet() - { - if(entries == null) - { - entries = new EntrySet(super.entrySet()); - } - - return entries; - } - - public Object put(Object key, Object value) - { - return super.put(keyCast.cast(key), valueCast.cast(value)); - } - - private class EntrySet extends AbstractSet - { - private Set set - ; - - EntrySet(Set set - ) - { - this.set = set - ; - } - - public int size() - { - return set.size(); - } - - public Iterator iterator() - { - return new EntryIterator(set.iterator()); - } - } - - private class EntryIterator implements Iterator - { - private Iterator iterator; - - EntryIterator(Iterator iterator) - { - this.iterator = iterator; - } - - public boolean hasNext() - { - return iterator.hasNext(); - } - - public Object next() - { - return new TypedEntry((Map.Entry) iterator.next()); - } - - public void remove - () - { - iterator.remove(); - } - } - - private class TypedEntry implements Map.Entry - { - private Map.Entry entry; - - TypedEntry(Map.Entry entry) - { - this.entry = entry; - } - - public Object getKey() - { - return entry.getKey(); - } - - public Object getValue() - { - return entry.getValue(); - } - - public Object setValue(Object value) - { - return entry.setValue(valueCast.cast(value)); - } - } -} diff --git a/src/main/java/org/sablecc/sablecc/analysis/Analysis.java b/src/main/java/org/sablecc/sablecc/analysis/Analysis.java index ebd36386bb541d8aaeca56e5181e9eb662fab9ca..bd6623f34ce80085653286105b10c091fb537cab 100644 --- a/src/main/java/org/sablecc/sablecc/analysis/Analysis.java +++ b/src/main/java/org/sablecc/sablecc/analysis/Analysis.java @@ -6,97 +6,116 @@ import org.sablecc.sablecc.node.*; public interface Analysis extends Switch { - Object getIn(Node node); - void setIn(Node node, Object in); - Object getOut(Node node); - void setOut(Node node, Object out); + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + Object getIn(Node node); - void caseStart(Start node); - void caseAGrammar(AGrammar node); - void caseAHelpers(AHelpers node); - void caseAHelperDef(AHelperDef node); - void caseAStates(AStates node); - void caseATokens(ATokens node); - void caseATokenDef(ATokenDef node); - void caseAStateList(AStateList node); - void caseAStateListTail(AStateListTail node); - void caseATransition(ATransition node); - void caseAIgnTokens(AIgnTokens node); - void caseARegExp(ARegExp node); - void caseAConcat(AConcat node); - void caseAUnExp(AUnExp node); - void caseACharBasic(ACharBasic node); - void caseASetBasic(ASetBasic node); - void caseAStringBasic(AStringBasic node); - void caseAIdBasic(AIdBasic node); - void caseARegExpBasic(ARegExpBasic node); - void caseACharChar(ACharChar node); - void caseADecChar(ADecChar node); - void caseAHexChar(AHexChar node); - void caseAOperationSet(AOperationSet node); - void caseAIntervalSet(AIntervalSet node); - void caseAStarUnOp(AStarUnOp node); - void caseAQMarkUnOp(AQMarkUnOp node); - void caseAPlusUnOp(APlusUnOp node); - void caseAPlusBinOp(APlusBinOp node); - void caseAMinusBinOp(AMinusBinOp node); - void caseAProductions(AProductions node); - void caseAProd(AProd node); - void caseAAlt(AAlt node); - void caseAAltTransform(AAltTransform node); - void caseANewTerm(ANewTerm node); - void caseAListTerm(AListTerm node); - void caseASimpleTerm(ASimpleTerm node); - void caseANullTerm(ANullTerm node); - void caseANewListTerm(ANewListTerm node); - void caseASimpleListTerm(ASimpleListTerm node); - void caseAProdName(AProdName node); - void caseAElem(AElem node); - void caseATokenSpecifier(ATokenSpecifier node); - void caseAProductionSpecifier(AProductionSpecifier node); - void caseAAst(AAst node); - void caseAAstProd(AAstProd node); - void caseAAstAlt(AAstAlt node); + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + void setIn(Node node, Object o); - void caseTPkgId(TPkgId node); - void caseTPackage(TPackage node); - void caseTStates(TStates node); - void caseTHelpers(THelpers node); - void caseTTokens(TTokens node); - void caseTIgnored(TIgnored node); - void caseTProductions(TProductions node); - void caseTAbstract(TAbstract node); - void caseTSyntax(TSyntax node); - void caseTTree(TTree node); - void caseTNew(TNew node); - void caseTNull(TNull node); - void caseTTokenSpecifier(TTokenSpecifier node); - void caseTProductionSpecifier(TProductionSpecifier node); - void caseTDot(TDot node); - void caseTDDot(TDDot node); - void caseTSemicolon(TSemicolon node); - void caseTEqual(TEqual node); - void caseTLBkt(TLBkt node); - void caseTRBkt(TRBkt node); - void caseTLPar(TLPar node); - void caseTRPar(TRPar node); - void caseTLBrace(TLBrace node); - void caseTRBrace(TRBrace node); - void caseTPlus(TPlus node); - void caseTMinus(TMinus node); - void caseTQMark(TQMark node); - void caseTStar(TStar node); - void caseTBar(TBar node); - void caseTComma(TComma node); - void caseTSlash(TSlash node); - void caseTArrow(TArrow node); - void caseTColon(TColon node); - void caseTId(TId node); - void caseTChar(TChar node); - void caseTDecChar(TDecChar node); - void caseTHexChar(THexChar node); - void caseTString(TString node); - void caseTBlank(TBlank node); - void caseTComment(TComment node); - void caseEOF(EOF node); + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + Object getOut(Node node); + + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + void setOut(Node node, Object o); + + void caseStart(Start node); + void caseAGrammar(AGrammar node); + void caseAHelpers(AHelpers node); + void caseAHelperDef(AHelperDef node); + void caseAStates(AStates node); + void caseATokens(ATokens node); + void caseATokenDef(ATokenDef node); + void caseAStateList(AStateList node); + void caseAStateListTail(AStateListTail node); + void caseATransition(ATransition node); + void caseAIgnTokens(AIgnTokens node); + void caseARegExp(ARegExp node); + void caseAConcat(AConcat node); + void caseAUnExp(AUnExp node); + void caseACharBasic(ACharBasic node); + void caseASetBasic(ASetBasic node); + void caseAStringBasic(AStringBasic node); + void caseAIdBasic(AIdBasic node); + void caseARegExpBasic(ARegExpBasic node); + void caseACharChar(ACharChar node); + void caseADecChar(ADecChar node); + void caseAHexChar(AHexChar node); + void caseAOperationSet(AOperationSet node); + void caseAIntervalSet(AIntervalSet node); + void caseAStarUnOp(AStarUnOp node); + void caseAQMarkUnOp(AQMarkUnOp node); + void caseAPlusUnOp(APlusUnOp node); + void caseAPlusBinOp(APlusBinOp node); + void caseAMinusBinOp(AMinusBinOp node); + void caseAProductions(AProductions node); + void caseAProd(AProd node); + void caseAAlt(AAlt node); + void caseAAltTransform(AAltTransform node); + void caseANewTerm(ANewTerm node); + void caseAListTerm(AListTerm node); + void caseASimpleTerm(ASimpleTerm node); + void caseANullTerm(ANullTerm node); + void caseANewListTerm(ANewListTerm node); + void caseASimpleListTerm(ASimpleListTerm node); + void caseAProdName(AProdName node); + void caseAElem(AElem node); + void caseATokenSpecifier(ATokenSpecifier node); + void caseAProductionSpecifier(AProductionSpecifier node); + void caseAAst(AAst node); + void caseAAstProd(AAstProd node); + void caseAAstAlt(AAstAlt node); + + void caseTPkgId(TPkgId node); + void caseTPackage(TPackage node); + void caseTStates(TStates node); + void caseTHelpers(THelpers node); + void caseTTokens(TTokens node); + void caseTIgnored(TIgnored node); + void caseTProductions(TProductions node); + void caseTAbstract(TAbstract node); + void caseTSyntax(TSyntax node); + void caseTTree(TTree node); + void caseTNew(TNew node); + void caseTNull(TNull node); + void caseTTokenSpecifier(TTokenSpecifier node); + void caseTProductionSpecifier(TProductionSpecifier node); + void caseTDot(TDot node); + void caseTDDot(TDDot node); + void caseTSemicolon(TSemicolon node); + void caseTEqual(TEqual node); + void caseTLBkt(TLBkt node); + void caseTRBkt(TRBkt node); + void caseTLPar(TLPar node); + void caseTRPar(TRPar node); + void caseTLBrace(TLBrace node); + void caseTRBrace(TRBrace node); + void caseTPlus(TPlus node); + void caseTMinus(TMinus node); + void caseTQMark(TQMark node); + void caseTStar(TStar node); + void caseTBar(TBar node); + void caseTComma(TComma node); + void caseTSlash(TSlash node); + void caseTArrow(TArrow node); + void caseTColon(TColon node); + void caseTId(TId node); + void caseTChar(TChar node); + void caseTDecChar(TDecChar node); + void caseTHexChar(THexChar node); + void caseTString(TString node); + void caseTBlank(TBlank node); + void caseTComment(TComment node); + void caseEOF(EOF node); } diff --git a/src/main/java/org/sablecc/sablecc/analysis/AnalysisAdapter.java b/src/main/java/org/sablecc/sablecc/analysis/AnalysisAdapter.java index b128fdfc95f36d982254cba18c1ccf7b4e0480a7..9a756d94c1735dc12b47ac2104c3306eaa20ff8d 100644 --- a/src/main/java/org/sablecc/sablecc/analysis/AnalysisAdapter.java +++ b/src/main/java/org/sablecc/sablecc/analysis/AnalysisAdapter.java @@ -7,497 +7,616 @@ import org.sablecc.sablecc.node.*; public class AnalysisAdapter implements Analysis { - private Hashtable in; - private Hashtable out; + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + private Hashtable<Node,Object> in; + + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + private Hashtable<Node,Object> out; + + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override + public Object getIn(Node node) + { + if(this.in == null) + { + return null; + } + + return this.in.get(node); + } - public Object getIn(Node node) - { - if(in == null) + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override + public void setIn(Node node, Object o) { - return null; + if(this.in == null) + { + this.in = new Hashtable<Node,Object>(1); + } + + if(o != null) + { + this.in.put(node, o); + } + else + { + this.in.remove(node); + } } - return in.get(node); - } + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override + public Object getOut(Node node) + { + if(this.out == null) + { + return null; + } + + return this.out.get(node); + } - public void setIn(Node node, Object in) - { - if(this.in == null) + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override + public void setOut(Node node, Object o) { - this.in = new Hashtable(1); + if(this.out == null) + { + this.out = new Hashtable<Node,Object>(1); + } + + if(o != null) + { + this.out.put(node, o); + } + else + { + this.out.remove(node); + } } - if(in != null) + @Override + public void caseStart(Start node) { - this.in.put(node, in); + defaultCase(node); } - else + + @Override + public void caseAGrammar(AGrammar node) { - this.in.remove(node); + defaultCase(node); } - } - public Object getOut(Node node) - { - if(out == null) + @Override + public void caseAHelpers(AHelpers node) { - return null; + defaultCase(node); } - return out.get(node); - } + @Override + public void caseAHelperDef(AHelperDef node) + { + defaultCase(node); + } - public void setOut(Node node, Object out) - { - if(this.out == null) + @Override + public void caseAStates(AStates node) { - this.out = new Hashtable(1); + defaultCase(node); } - if(out != null) + @Override + public void caseATokens(ATokens node) { - this.out.put(node, out); + defaultCase(node); } - else + + @Override + public void caseATokenDef(ATokenDef node) { - this.out.remove(node); + defaultCase(node); } - } - public void caseStart(Start node) - { - defaultCase(node); - } - public void caseAGrammar(AGrammar node) - { - defaultCase(node); - } + @Override + public void caseAStateList(AStateList node) + { + defaultCase(node); + } - public void caseAHelpers(AHelpers node) - { - defaultCase(node); - } + @Override + public void caseAStateListTail(AStateListTail node) + { + defaultCase(node); + } - public void caseAHelperDef(AHelperDef node) - { - defaultCase(node); - } + @Override + public void caseATransition(ATransition node) + { + defaultCase(node); + } - public void caseAStates(AStates node) - { - defaultCase(node); - } + @Override + public void caseAIgnTokens(AIgnTokens node) + { + defaultCase(node); + } - public void caseATokens(ATokens node) - { - defaultCase(node); - } + @Override + public void caseARegExp(ARegExp node) + { + defaultCase(node); + } - public void caseATokenDef(ATokenDef node) - { - defaultCase(node); - } + @Override + public void caseAConcat(AConcat node) + { + defaultCase(node); + } - public void caseAStateList(AStateList node) - { - defaultCase(node); - } + @Override + public void caseAUnExp(AUnExp node) + { + defaultCase(node); + } - public void caseAStateListTail(AStateListTail node) - { - defaultCase(node); - } + @Override + public void caseACharBasic(ACharBasic node) + { + defaultCase(node); + } - public void caseATransition(ATransition node) - { - defaultCase(node); - } + @Override + public void caseASetBasic(ASetBasic node) + { + defaultCase(node); + } - public void caseAIgnTokens(AIgnTokens node) - { - defaultCase(node); - } + @Override + public void caseAStringBasic(AStringBasic node) + { + defaultCase(node); + } - public void caseARegExp(ARegExp node) - { - defaultCase(node); - } + @Override + public void caseAIdBasic(AIdBasic node) + { + defaultCase(node); + } + + @Override + public void caseARegExpBasic(ARegExpBasic node) + { + defaultCase(node); + } + + @Override + public void caseACharChar(ACharChar node) + { + defaultCase(node); + } + + @Override + public void caseADecChar(ADecChar node) + { + defaultCase(node); + } + + @Override + public void caseAHexChar(AHexChar node) + { + defaultCase(node); + } + + @Override + public void caseAOperationSet(AOperationSet node) + { + defaultCase(node); + } + + @Override + public void caseAIntervalSet(AIntervalSet node) + { + defaultCase(node); + } - public void caseAConcat(AConcat node) - { - defaultCase(node); - } - - public void caseAUnExp(AUnExp node) - { - defaultCase(node); - } - - public void caseACharBasic(ACharBasic node) - { - defaultCase(node); - } - - public void caseASetBasic(ASetBasic node) - { - defaultCase(node); - } - - public void caseAStringBasic(AStringBasic node) - { - defaultCase(node); - } - - public void caseAIdBasic(AIdBasic node) - { - defaultCase(node); - } - - public void caseARegExpBasic(ARegExpBasic node) - { - defaultCase(node); - } - - public void caseACharChar(ACharChar node) - { - defaultCase(node); - } - - public void caseADecChar(ADecChar node) - { - defaultCase(node); - } - - public void caseAHexChar(AHexChar node) - { - defaultCase(node); - } - - public void caseAOperationSet(AOperationSet node) - { - defaultCase(node); - } - - public void caseAIntervalSet(AIntervalSet node) - { - defaultCase(node); - } - - public void caseAStarUnOp(AStarUnOp node) - { - defaultCase(node); - } - - public void caseAQMarkUnOp(AQMarkUnOp node) - { - defaultCase(node); - } - - public void caseAPlusUnOp(APlusUnOp node) - { - defaultCase(node); - } - - public void caseAPlusBinOp(APlusBinOp node) - { - defaultCase(node); - } - - public void caseAMinusBinOp(AMinusBinOp node) - { - defaultCase(node); - } - - public void caseAProductions(AProductions node) - { - defaultCase(node); - } - - public void caseAProd(AProd node) - { - defaultCase(node); - } - - public void caseAAlt(AAlt node) - { - defaultCase(node); - } - - public void caseAAltTransform(AAltTransform node) - { - defaultCase(node); - } - - public void caseANewTerm(ANewTerm node) - { - defaultCase(node); - } - - public void caseAListTerm(AListTerm node) - { - defaultCase(node); - } - - public void caseASimpleTerm(ASimpleTerm node) - { - defaultCase(node); - } - - public void caseANullTerm(ANullTerm node) - { - defaultCase(node); - } - - public void caseANewListTerm(ANewListTerm node) - { - defaultCase(node); - } - - public void caseASimpleListTerm(ASimpleListTerm node) - { - defaultCase(node); - } - - public void caseAProdName(AProdName node) - { - defaultCase(node); - } - - public void caseAElem(AElem node) - { - defaultCase(node); - } - - public void caseATokenSpecifier(ATokenSpecifier node) - { - defaultCase(node); - } - - public void caseAProductionSpecifier(AProductionSpecifier node) - { - defaultCase(node); - } - - public void caseAAst(AAst node) - { - defaultCase(node); - } - - public void caseAAstProd(AAstProd node) - { - defaultCase(node); - } - - public void caseAAstAlt(AAstAlt node) - { - defaultCase(node); - } - - public void caseTPkgId(TPkgId node) - { - defaultCase(node); - } - - public void caseTPackage(TPackage node) - { - defaultCase(node); - } - - public void caseTStates(TStates node) - { - defaultCase(node); - } - - public void caseTHelpers(THelpers node) - { - defaultCase(node); - } - - public void caseTTokens(TTokens node) - { - defaultCase(node); - } - - public void caseTIgnored(TIgnored node) - { - defaultCase(node); - } - - public void caseTProductions(TProductions node) - { - defaultCase(node); - } - - public void caseTAbstract(TAbstract node) - { - defaultCase(node); - } - - public void caseTSyntax(TSyntax node) - { - defaultCase(node); - } - - public void caseTTree(TTree node) - { - defaultCase(node); - } - - public void caseTNew(TNew node) - { - defaultCase(node); - } - - public void caseTNull(TNull node) - { - defaultCase(node); - } - - public void caseTTokenSpecifier(TTokenSpecifier node) - { - defaultCase(node); - } - - public void caseTProductionSpecifier(TProductionSpecifier node) - { - defaultCase(node); - } - - public void caseTDot(TDot node) - { - defaultCase(node); - } - - public void caseTDDot(TDDot node) - { - defaultCase(node); - } - - public void caseTSemicolon(TSemicolon node) - { - defaultCase(node); - } - - public void caseTEqual(TEqual node) - { - defaultCase(node); - } - - public void caseTLBkt(TLBkt node) - { - defaultCase(node); - } - - public void caseTRBkt(TRBkt node) - { - defaultCase(node); - } - - public void caseTLPar(TLPar node) - { - defaultCase(node); - } - - public void caseTRPar(TRPar node) - { - defaultCase(node); - } - - public void caseTLBrace(TLBrace node) - { - defaultCase(node); - } - - public void caseTRBrace(TRBrace node) - { - defaultCase(node); - } - - public void caseTPlus(TPlus node) - { - defaultCase(node); - } - - public void caseTMinus(TMinus node) - { - defaultCase(node); - } - - public void caseTQMark(TQMark node) - { - defaultCase(node); - } - - public void caseTStar(TStar node) - { - defaultCase(node); - } - - public void caseTBar(TBar node) - { - defaultCase(node); - } - - public void caseTComma(TComma node) - { - defaultCase(node); - } - - public void caseTSlash(TSlash node) - { - defaultCase(node); - } - - public void caseTArrow(TArrow node) - { - defaultCase(node); - } - - public void caseTColon(TColon node) - { - defaultCase(node); - } - - public void caseTId(TId node) - { - defaultCase(node); - } - - public void caseTChar(TChar node) - { - defaultCase(node); - } - - public void caseTDecChar(TDecChar node) - { - defaultCase(node); - } - - public void caseTHexChar(THexChar node) - { - defaultCase(node); - } - - public void caseTString(TString node) - { - defaultCase(node); - } - - public void caseTBlank(TBlank node) - { - defaultCase(node); - } - - public void caseTComment(TComment node) - { - defaultCase(node); - } - - public void caseEOF(EOF node) - { - defaultCase(node); - } - - public void defaultCase(Node node) - {} + @Override + public void caseAStarUnOp(AStarUnOp node) + { + defaultCase(node); + } + + @Override + public void caseAQMarkUnOp(AQMarkUnOp node) + { + defaultCase(node); + } + + @Override + public void caseAPlusUnOp(APlusUnOp node) + { + defaultCase(node); + } + + @Override + public void caseAPlusBinOp(APlusBinOp node) + { + defaultCase(node); + } + + @Override + public void caseAMinusBinOp(AMinusBinOp node) + { + defaultCase(node); + } + + @Override + public void caseAProductions(AProductions node) + { + defaultCase(node); + } + + @Override + public void caseAProd(AProd node) + { + defaultCase(node); + } + + @Override + public void caseAAlt(AAlt node) + { + defaultCase(node); + } + + @Override + public void caseAAltTransform(AAltTransform node) + { + defaultCase(node); + } + + @Override + public void caseANewTerm(ANewTerm node) + { + defaultCase(node); + } + + @Override + public void caseAListTerm(AListTerm node) + { + defaultCase(node); + } + + @Override + public void caseASimpleTerm(ASimpleTerm node) + { + defaultCase(node); + } + + @Override + public void caseANullTerm(ANullTerm node) + { + defaultCase(node); + } + + @Override + public void caseANewListTerm(ANewListTerm node) + { + defaultCase(node); + } + + @Override + public void caseASimpleListTerm(ASimpleListTerm node) + { + defaultCase(node); + } + + @Override + public void caseAProdName(AProdName node) + { + defaultCase(node); + } + + @Override + public void caseAElem(AElem node) + { + defaultCase(node); + } + + @Override + public void caseATokenSpecifier(ATokenSpecifier node) + { + defaultCase(node); + } + + @Override + public void caseAProductionSpecifier(AProductionSpecifier node) + { + defaultCase(node); + } + + @Override + public void caseAAst(AAst node) + { + defaultCase(node); + } + + @Override + public void caseAAstProd(AAstProd node) + { + defaultCase(node); + } + + @Override + public void caseAAstAlt(AAstAlt node) + { + defaultCase(node); + } + + @Override + public void caseTPkgId(TPkgId node) + { + defaultCase(node); + } + + @Override + public void caseTPackage(TPackage node) + { + defaultCase(node); + } + + @Override + public void caseTStates(TStates node) + { + defaultCase(node); + } + + @Override + public void caseTHelpers(THelpers node) + { + defaultCase(node); + } + + @Override + public void caseTTokens(TTokens node) + { + defaultCase(node); + } + + @Override + public void caseTIgnored(TIgnored node) + { + defaultCase(node); + } + + @Override + public void caseTProductions(TProductions node) + { + defaultCase(node); + } + + @Override + public void caseTAbstract(TAbstract node) + { + defaultCase(node); + } + + @Override + public void caseTSyntax(TSyntax node) + { + defaultCase(node); + } + + @Override + public void caseTTree(TTree node) + { + defaultCase(node); + } + + @Override + public void caseTNew(TNew node) + { + defaultCase(node); + } + + @Override + public void caseTNull(TNull node) + { + defaultCase(node); + } + + @Override + public void caseTTokenSpecifier(TTokenSpecifier node) + { + defaultCase(node); + } + + @Override + public void caseTProductionSpecifier(TProductionSpecifier node) + { + defaultCase(node); + } + + @Override + public void caseTDot(TDot node) + { + defaultCase(node); + } + + @Override + public void caseTDDot(TDDot node) + { + defaultCase(node); + } + + @Override + public void caseTSemicolon(TSemicolon node) + { + defaultCase(node); + } + + @Override + public void caseTEqual(TEqual node) + { + defaultCase(node); + } + + @Override + public void caseTLBkt(TLBkt node) + { + defaultCase(node); + } + + @Override + public void caseTRBkt(TRBkt node) + { + defaultCase(node); + } + + @Override + public void caseTLPar(TLPar node) + { + defaultCase(node); + } + + @Override + public void caseTRPar(TRPar node) + { + defaultCase(node); + } + + @Override + public void caseTLBrace(TLBrace node) + { + defaultCase(node); + } + + @Override + public void caseTRBrace(TRBrace node) + { + defaultCase(node); + } + + @Override + public void caseTPlus(TPlus node) + { + defaultCase(node); + } + + @Override + public void caseTMinus(TMinus node) + { + defaultCase(node); + } + + @Override + public void caseTQMark(TQMark node) + { + defaultCase(node); + } + + @Override + public void caseTStar(TStar node) + { + defaultCase(node); + } + + @Override + public void caseTBar(TBar node) + { + defaultCase(node); + } + + @Override + public void caseTComma(TComma node) + { + defaultCase(node); + } + + @Override + public void caseTSlash(TSlash node) + { + defaultCase(node); + } + + @Override + public void caseTArrow(TArrow node) + { + defaultCase(node); + } + + @Override + public void caseTColon(TColon node) + { + defaultCase(node); + } + + @Override + public void caseTId(TId node) + { + defaultCase(node); + } + + @Override + public void caseTChar(TChar node) + { + defaultCase(node); + } + + @Override + public void caseTDecChar(TDecChar node) + { + defaultCase(node); + } + + @Override + public void caseTHexChar(THexChar node) + { + defaultCase(node); + } + + @Override + public void caseTString(TString node) + { + defaultCase(node); + } + + @Override + public void caseTBlank(TBlank node) + { + defaultCase(node); + } + + @Override + public void caseTComment(TComment node) + { + defaultCase(node); + } + + @Override + public void caseEOF(EOF node) + { + defaultCase(node); + } + + public void defaultCase(Node node) + { + // do nothing + } } diff --git a/src/main/java/org/sablecc/sablecc/analysis/DepthFirstAdapter.java b/src/main/java/org/sablecc/sablecc/analysis/DepthFirstAdapter.java index 156967d9f0f68dd3a679151e58111432f27ddd6d..b90d621221adefe97b7f67bfa492400699e354e2 100644 --- a/src/main/java/org/sablecc/sablecc/analysis/DepthFirstAdapter.java +++ b/src/main/java/org/sablecc/sablecc/analysis/DepthFirstAdapter.java @@ -7,1124 +7,1177 @@ import org.sablecc.sablecc.node.*; public class DepthFirstAdapter extends AnalysisAdapter { - public void inStart(Start node) - { - defaultIn(node); - } - public void outStart(Start node) - { - defaultOut(node); - } + final List<Void> dummy = new ArrayList<Void>(); - public void defaultIn(Node node) - {} - - public void defaultOut(Node node) - {} - - public void caseStart(Start node) - { - inStart(node); - node.getPGrammar().apply(this); - node.getEOF().apply(this); - outStart(node); - } - - public void inAGrammar(AGrammar node) - { - defaultIn(node); - } - - public void outAGrammar(AGrammar node) - { - defaultOut(node); - } - - public void caseAGrammar(AGrammar node) - { - inAGrammar(node); + public void inStart(Start node) { - Object temp[] = node.getPackage().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((TPkgId) temp[i]).apply(this); - } + defaultIn(node); } - if(node.getHelpers() != null) + + public void outStart(Start node) { - node.getHelpers().apply(this); + defaultOut(node); } - if(node.getStates() != null) + + public void defaultIn(Node node) { - node.getStates().apply(this); + // Do nothing } - if(node.getTokens() != null) + + public void defaultOut(Node node) { - node.getTokens().apply(this); + // Do nothing } - if(node.getIgnTokens() != null) + + @Override + public void caseStart(Start node) { - node.getIgnTokens().apply(this); + inStart(node); + node.getPGrammar().apply(this); + node.getEOF().apply(this); + outStart(node); } - if(node.getProductions() != null) + + public void inAGrammar(AGrammar node) { - node.getProductions().apply(this); + defaultIn(node); } - if(node.getAst() != null) + + public void outAGrammar(AGrammar node) { - node.getAst().apply(this); + defaultOut(node); } - outAGrammar(node); - } - - public void inAHelpers(AHelpers node) - { - defaultIn(node); - } - - public void outAHelpers(AHelpers node) - { - defaultOut(node); - } - public void caseAHelpers(AHelpers node) - { - inAHelpers(node); + @Override + public void caseAGrammar(AGrammar node) { - Object temp[] = node.getHelperDefs().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PHelperDef) temp[i]).apply(this); - } + inAGrammar(node); + { + List<TPkgId> copy = new ArrayList<TPkgId>(node.getPackage()); + for(TPkgId e : copy) + { + e.apply(this); + } + } + if(node.getHelpers() != null) + { + node.getHelpers().apply(this); + } + if(node.getStates() != null) + { + node.getStates().apply(this); + } + if(node.getTokens() != null) + { + node.getTokens().apply(this); + } + if(node.getIgnTokens() != null) + { + node.getIgnTokens().apply(this); + } + if(node.getProductions() != null) + { + node.getProductions().apply(this); + } + if(node.getAst() != null) + { + node.getAst().apply(this); + } + outAGrammar(node); } - outAHelpers(node); - } - public void inAHelperDef(AHelperDef node) - { - defaultIn(node); - } - - public void outAHelperDef(AHelperDef node) - { - defaultOut(node); - } - - public void caseAHelperDef(AHelperDef node) - { - inAHelperDef(node); - if(node.getId() != null) + public void inAHelpers(AHelpers node) { - node.getId().apply(this); + defaultIn(node); } - if(node.getRegExp() != null) + + public void outAHelpers(AHelpers node) { - node.getRegExp().apply(this); + defaultOut(node); } - outAHelperDef(node); - } - public void inAStates(AStates node) - { - defaultIn(node); - } - - public void outAStates(AStates node) - { - defaultOut(node); - } - - public void caseAStates(AStates node) - { - inAStates(node); + @Override + public void caseAHelpers(AHelpers node) { - Object temp[] = node.getListId().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((TId) temp[i]).apply(this); - } + inAHelpers(node); + { + List<PHelperDef> copy = new ArrayList<PHelperDef>(node.getHelperDefs()); + for(PHelperDef e : copy) + { + e.apply(this); + } + } + outAHelpers(node); } - outAStates(node); - } - - public void inATokens(ATokens node) - { - defaultIn(node); - } - public void outATokens(ATokens node) - { - defaultOut(node); - } - - public void caseATokens(ATokens node) - { - inATokens(node); + public void inAHelperDef(AHelperDef node) { - Object temp[] = node.getTokenDefs().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PTokenDef) temp[i]).apply(this); - } + defaultIn(node); } - outATokens(node); - } - - public void inATokenDef(ATokenDef node) - { - defaultIn(node); - } - - public void outATokenDef(ATokenDef node) - { - defaultOut(node); - } - public void caseATokenDef(ATokenDef node) - { - inATokenDef(node); - if(node.getStateList() != null) + public void outAHelperDef(AHelperDef node) { - node.getStateList().apply(this); + defaultOut(node); } - if(node.getId() != null) + + @Override + public void caseAHelperDef(AHelperDef node) { - node.getId().apply(this); + inAHelperDef(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getRegExp() != null) + { + node.getRegExp().apply(this); + } + outAHelperDef(node); } - if(node.getRegExp() != null) + + public void inAStates(AStates node) { - node.getRegExp().apply(this); + defaultIn(node); } - if(node.getSlash() != null) + + public void outAStates(AStates node) { - node.getSlash().apply(this); + defaultOut(node); } - if(node.getLookAhead() != null) + + @Override + public void caseAStates(AStates node) { - node.getLookAhead().apply(this); + inAStates(node); + { + List<TId> copy = new ArrayList<TId>(node.getListId()); + for(TId e : copy) + { + e.apply(this); + } + } + outAStates(node); } - outATokenDef(node); - } - - public void inAStateList(AStateList node) - { - defaultIn(node); - } - public void outAStateList(AStateList node) - { - defaultOut(node); - } - - public void caseAStateList(AStateList node) - { - inAStateList(node); - if(node.getId() != null) + public void inATokens(ATokens node) { - node.getId().apply(this); + defaultIn(node); } - if(node.getTransition() != null) + + public void outATokens(ATokens node) { - node.getTransition().apply(this); + defaultOut(node); } + + @Override + public void caseATokens(ATokens node) { - Object temp[] = node.getStateLists().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PStateListTail) temp[i]).apply(this); - } + inATokens(node); + { + List<PTokenDef> copy = new ArrayList<PTokenDef>(node.getTokenDefs()); + for(PTokenDef e : copy) + { + e.apply(this); + } + } + outATokens(node); } - outAStateList(node); - } - - public void inAStateListTail(AStateListTail node) - { - defaultIn(node); - } - - public void outAStateListTail(AStateListTail node) - { - defaultOut(node); - } - public void caseAStateListTail(AStateListTail node) - { - inAStateListTail(node); - if(node.getId() != null) + public void inATokenDef(ATokenDef node) { - node.getId().apply(this); + defaultIn(node); } - if(node.getTransition() != null) + + public void outATokenDef(ATokenDef node) { - node.getTransition().apply(this); + defaultOut(node); } - outAStateListTail(node); - } - - public void inATransition(ATransition node) - { - defaultIn(node); - } - - public void outATransition(ATransition node) - { - defaultOut(node); - } - public void caseATransition(ATransition node) - { - inATransition(node); - if(node.getId() != null) + @Override + public void caseATokenDef(ATokenDef node) { - node.getId().apply(this); + inATokenDef(node); + if(node.getStateList() != null) + { + node.getStateList().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getRegExp() != null) + { + node.getRegExp().apply(this); + } + if(node.getSlash() != null) + { + node.getSlash().apply(this); + } + if(node.getLookAhead() != null) + { + node.getLookAhead().apply(this); + } + outATokenDef(node); } - outATransition(node); - } - public void inAIgnTokens(AIgnTokens node) - { - defaultIn(node); - } - - public void outAIgnTokens(AIgnTokens node) - { - defaultOut(node); - } - - public void caseAIgnTokens(AIgnTokens node) - { - inAIgnTokens(node); + public void inAStateList(AStateList node) { - Object temp[] = node.getListId().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((TId) temp[i]).apply(this); - } + defaultIn(node); } - outAIgnTokens(node); - } - - public void inARegExp(ARegExp node) - { - defaultIn(node); - } - public void outARegExp(ARegExp node) - { - defaultOut(node); - } - - public void caseARegExp(ARegExp node) - { - inARegExp(node); + public void outAStateList(AStateList node) { - Object temp[] = node.getConcats().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PConcat) temp[i]).apply(this); - } + defaultOut(node); } - outARegExp(node); - } - - public void inAConcat(AConcat node) - { - defaultIn(node); - } - - public void outAConcat(AConcat node) - { - defaultOut(node); - } - public void caseAConcat(AConcat node) - { - inAConcat(node); + @Override + public void caseAStateList(AStateList node) { - Object temp[] = node.getUnExps().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PUnExp) temp[i]).apply(this); - } + inAStateList(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getTransition() != null) + { + node.getTransition().apply(this); + } + { + List<PStateListTail> copy = new ArrayList<PStateListTail>(node.getStateLists()); + for(PStateListTail e : copy) + { + e.apply(this); + } + } + outAStateList(node); } - outAConcat(node); - } - public void inAUnExp(AUnExp node) - { - defaultIn(node); - } - - public void outAUnExp(AUnExp node) - { - defaultOut(node); - } - - public void caseAUnExp(AUnExp node) - { - inAUnExp(node); - if(node.getBasic() != null) - { - node.getBasic().apply(this); - } - if(node.getUnOp() != null) - { - node.getUnOp().apply(this); + public void inAStateListTail(AStateListTail node) + { + defaultIn(node); } - outAUnExp(node); - } - public void inACharBasic(ACharBasic node) - { - defaultIn(node); - } - - public void outACharBasic(ACharBasic node) - { - defaultOut(node); - } - - public void caseACharBasic(ACharBasic node) - { - inACharBasic(node); - if(node.getChar() != null) - { - node.getChar().apply(this); + public void outAStateListTail(AStateListTail node) + { + defaultOut(node); } - outACharBasic(node); - } - public void inASetBasic(ASetBasic node) - { - defaultIn(node); - } - - public void outASetBasic(ASetBasic node) - { - defaultOut(node); - } - - public void caseASetBasic(ASetBasic node) - { - inASetBasic(node); - if(node.getSet() != null) + @Override + public void caseAStateListTail(AStateListTail node) { - node.getSet().apply(this); + inAStateListTail(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getTransition() != null) + { + node.getTransition().apply(this); + } + outAStateListTail(node); } - outASetBasic(node); - } - - public void inAStringBasic(AStringBasic node) - { - defaultIn(node); - } - public void outAStringBasic(AStringBasic node) - { - defaultOut(node); - } - - public void caseAStringBasic(AStringBasic node) - { - inAStringBasic(node); - if(node.getString() != null) + public void inATransition(ATransition node) { - node.getString().apply(this); + defaultIn(node); } - outAStringBasic(node); - } - public void inAIdBasic(AIdBasic node) - { - defaultIn(node); - } + public void outATransition(ATransition node) + { + defaultOut(node); + } - public void outAIdBasic(AIdBasic node) - { - defaultOut(node); - } + @Override + public void caseATransition(ATransition node) + { + inATransition(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + outATransition(node); + } - public void caseAIdBasic(AIdBasic node) - { - inAIdBasic(node); - if(node.getId() != null) + public void inAIgnTokens(AIgnTokens node) { - node.getId().apply(this); + defaultIn(node); } - outAIdBasic(node); - } - public void inARegExpBasic(ARegExpBasic node) - { - defaultIn(node); - } + public void outAIgnTokens(AIgnTokens node) + { + defaultOut(node); + } - public void outARegExpBasic(ARegExpBasic node) - { - defaultOut(node); - } + @Override + public void caseAIgnTokens(AIgnTokens node) + { + inAIgnTokens(node); + { + List<TId> copy = new ArrayList<TId>(node.getListId()); + for(TId e : copy) + { + e.apply(this); + } + } + outAIgnTokens(node); + } - public void caseARegExpBasic(ARegExpBasic node) - { - inARegExpBasic(node); - if(node.getRegExp() != null) + public void inARegExp(ARegExp node) { - node.getRegExp().apply(this); + defaultIn(node); } - outARegExpBasic(node); - } - public void inACharChar(ACharChar node) - { - defaultIn(node); - } + public void outARegExp(ARegExp node) + { + defaultOut(node); + } - public void outACharChar(ACharChar node) - { - defaultOut(node); - } + @Override + public void caseARegExp(ARegExp node) + { + inARegExp(node); + { + List<PConcat> copy = new ArrayList<PConcat>(node.getConcats()); + for(PConcat e : copy) + { + e.apply(this); + } + } + outARegExp(node); + } - public void caseACharChar(ACharChar node) - { - inACharChar(node); - if(node.getChar() != null) + public void inAConcat(AConcat node) { - node.getChar().apply(this); + defaultIn(node); } - outACharChar(node); - } - public void inADecChar(ADecChar node) - { - defaultIn(node); - } + public void outAConcat(AConcat node) + { + defaultOut(node); + } - public void outADecChar(ADecChar node) - { - defaultOut(node); - } + @Override + public void caseAConcat(AConcat node) + { + inAConcat(node); + { + List<PUnExp> copy = new ArrayList<PUnExp>(node.getUnExps()); + for(PUnExp e : copy) + { + e.apply(this); + } + } + outAConcat(node); + } - public void caseADecChar(ADecChar node) - { - inADecChar(node); - if(node.getDecChar() != null) + public void inAUnExp(AUnExp node) { - node.getDecChar().apply(this); + defaultIn(node); } - outADecChar(node); - } - public void inAHexChar(AHexChar node) - { - defaultIn(node); - } + public void outAUnExp(AUnExp node) + { + defaultOut(node); + } - public void outAHexChar(AHexChar node) - { - defaultOut(node); - } + @Override + public void caseAUnExp(AUnExp node) + { + inAUnExp(node); + if(node.getBasic() != null) + { + node.getBasic().apply(this); + } + if(node.getUnOp() != null) + { + node.getUnOp().apply(this); + } + outAUnExp(node); + } - public void caseAHexChar(AHexChar node) - { - inAHexChar(node); - if(node.getHexChar() != null) + public void inACharBasic(ACharBasic node) { - node.getHexChar().apply(this); + defaultIn(node); } - outAHexChar(node); - } - public void inAOperationSet(AOperationSet node) - { - defaultIn(node); - } + public void outACharBasic(ACharBasic node) + { + defaultOut(node); + } - public void outAOperationSet(AOperationSet node) - { - defaultOut(node); - } + @Override + public void caseACharBasic(ACharBasic node) + { + inACharBasic(node); + if(node.getChar() != null) + { + node.getChar().apply(this); + } + outACharBasic(node); + } - public void caseAOperationSet(AOperationSet node) - { - inAOperationSet(node); - if(node.getLeft() != null) + public void inASetBasic(ASetBasic node) { - node.getLeft().apply(this); + defaultIn(node); } - if(node.getBinOp() != null) + + public void outASetBasic(ASetBasic node) { - node.getBinOp().apply(this); + defaultOut(node); } - if(node.getRight() != null) + + @Override + public void caseASetBasic(ASetBasic node) { - node.getRight().apply(this); + inASetBasic(node); + if(node.getSet() != null) + { + node.getSet().apply(this); + } + outASetBasic(node); } - outAOperationSet(node); - } - public void inAIntervalSet(AIntervalSet node) - { - defaultIn(node); - } + public void inAStringBasic(AStringBasic node) + { + defaultIn(node); + } - public void outAIntervalSet(AIntervalSet node) - { - defaultOut(node); - } + public void outAStringBasic(AStringBasic node) + { + defaultOut(node); + } - public void caseAIntervalSet(AIntervalSet node) - { - inAIntervalSet(node); - if(node.getLeft() != null) + @Override + public void caseAStringBasic(AStringBasic node) { - node.getLeft().apply(this); + inAStringBasic(node); + if(node.getString() != null) + { + node.getString().apply(this); + } + outAStringBasic(node); } - if(node.getRight() != null) + + public void inAIdBasic(AIdBasic node) { - node.getRight().apply(this); + defaultIn(node); } - outAIntervalSet(node); - } - public void inAStarUnOp(AStarUnOp node) - { - defaultIn(node); - } + public void outAIdBasic(AIdBasic node) + { + defaultOut(node); + } - public void outAStarUnOp(AStarUnOp node) - { - defaultOut(node); - } + @Override + public void caseAIdBasic(AIdBasic node) + { + inAIdBasic(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + outAIdBasic(node); + } - public void caseAStarUnOp(AStarUnOp node) - { - inAStarUnOp(node); - if(node.getStar() != null) + public void inARegExpBasic(ARegExpBasic node) { - node.getStar().apply(this); + defaultIn(node); } - outAStarUnOp(node); - } - public void inAQMarkUnOp(AQMarkUnOp node) - { - defaultIn(node); - } + public void outARegExpBasic(ARegExpBasic node) + { + defaultOut(node); + } - public void outAQMarkUnOp(AQMarkUnOp node) - { - defaultOut(node); - } + @Override + public void caseARegExpBasic(ARegExpBasic node) + { + inARegExpBasic(node); + if(node.getRegExp() != null) + { + node.getRegExp().apply(this); + } + outARegExpBasic(node); + } - public void caseAQMarkUnOp(AQMarkUnOp node) - { - inAQMarkUnOp(node); - if(node.getQMark() != null) + public void inACharChar(ACharChar node) { - node.getQMark().apply(this); + defaultIn(node); } - outAQMarkUnOp(node); - } - public void inAPlusUnOp(APlusUnOp node) - { - defaultIn(node); - } + public void outACharChar(ACharChar node) + { + defaultOut(node); + } - public void outAPlusUnOp(APlusUnOp node) - { - defaultOut(node); - } + @Override + public void caseACharChar(ACharChar node) + { + inACharChar(node); + if(node.getChar() != null) + { + node.getChar().apply(this); + } + outACharChar(node); + } - public void caseAPlusUnOp(APlusUnOp node) - { - inAPlusUnOp(node); - if(node.getPlus() != null) + public void inADecChar(ADecChar node) { - node.getPlus().apply(this); + defaultIn(node); } - outAPlusUnOp(node); - } - public void inAPlusBinOp(APlusBinOp node) - { - defaultIn(node); - } + public void outADecChar(ADecChar node) + { + defaultOut(node); + } - public void outAPlusBinOp(APlusBinOp node) - { - defaultOut(node); - } + @Override + public void caseADecChar(ADecChar node) + { + inADecChar(node); + if(node.getDecChar() != null) + { + node.getDecChar().apply(this); + } + outADecChar(node); + } - public void caseAPlusBinOp(APlusBinOp node) - { - inAPlusBinOp(node); - outAPlusBinOp(node); - } + public void inAHexChar(AHexChar node) + { + defaultIn(node); + } - public void inAMinusBinOp(AMinusBinOp node) - { - defaultIn(node); - } + public void outAHexChar(AHexChar node) + { + defaultOut(node); + } - public void outAMinusBinOp(AMinusBinOp node) - { - defaultOut(node); - } + @Override + public void caseAHexChar(AHexChar node) + { + inAHexChar(node); + if(node.getHexChar() != null) + { + node.getHexChar().apply(this); + } + outAHexChar(node); + } - public void caseAMinusBinOp(AMinusBinOp node) - { - inAMinusBinOp(node); - outAMinusBinOp(node); - } + public void inAOperationSet(AOperationSet node) + { + defaultIn(node); + } - public void inAProductions(AProductions node) - { - defaultIn(node); - } + public void outAOperationSet(AOperationSet node) + { + defaultOut(node); + } - public void outAProductions(AProductions node) - { - defaultOut(node); - } + @Override + public void caseAOperationSet(AOperationSet node) + { + inAOperationSet(node); + if(node.getLeft() != null) + { + node.getLeft().apply(this); + } + if(node.getBinOp() != null) + { + node.getBinOp().apply(this); + } + if(node.getRight() != null) + { + node.getRight().apply(this); + } + outAOperationSet(node); + } - public void caseAProductions(AProductions node) - { - inAProductions(node); + public void inAIntervalSet(AIntervalSet node) { - Object temp[] = node.getProds().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PProd) temp[i]).apply(this); - } + defaultIn(node); } - outAProductions(node); - } - public void inAProd(AProd node) - { - defaultIn(node); - } + public void outAIntervalSet(AIntervalSet node) + { + defaultOut(node); + } - public void outAProd(AProd node) - { - defaultOut(node); - } + @Override + public void caseAIntervalSet(AIntervalSet node) + { + inAIntervalSet(node); + if(node.getLeft() != null) + { + node.getLeft().apply(this); + } + if(node.getRight() != null) + { + node.getRight().apply(this); + } + outAIntervalSet(node); + } - public void caseAProd(AProd node) - { - inAProd(node); - if(node.getId() != null) + public void inAStarUnOp(AStarUnOp node) { - node.getId().apply(this); + defaultIn(node); } - if(node.getArrow() != null) + + public void outAStarUnOp(AStarUnOp node) { - node.getArrow().apply(this); + defaultOut(node); } + + @Override + public void caseAStarUnOp(AStarUnOp node) { - Object temp[] = node.getProdTransform().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PElem) temp[i]).apply(this); - } + inAStarUnOp(node); + if(node.getStar() != null) + { + node.getStar().apply(this); + } + outAStarUnOp(node); } + + public void inAQMarkUnOp(AQMarkUnOp node) { - Object temp[] = node.getAlts().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PAlt) temp[i]).apply(this); - } + defaultIn(node); } - outAProd(node); - } - public void inAAlt(AAlt node) - { - defaultIn(node); - } + public void outAQMarkUnOp(AQMarkUnOp node) + { + defaultOut(node); + } - public void outAAlt(AAlt node) - { - defaultOut(node); - } + @Override + public void caseAQMarkUnOp(AQMarkUnOp node) + { + inAQMarkUnOp(node); + if(node.getQMark() != null) + { + node.getQMark().apply(this); + } + outAQMarkUnOp(node); + } - public void caseAAlt(AAlt node) - { - inAAlt(node); - if(node.getAltName() != null) + public void inAPlusUnOp(APlusUnOp node) { - node.getAltName().apply(this); + defaultIn(node); } + + public void outAPlusUnOp(APlusUnOp node) { - Object temp[] = node.getElems().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PElem) temp[i]).apply(this); - } + defaultOut(node); } - if(node.getAltTransform() != null) + + @Override + public void caseAPlusUnOp(APlusUnOp node) { - node.getAltTransform().apply(this); + inAPlusUnOp(node); + if(node.getPlus() != null) + { + node.getPlus().apply(this); + } + outAPlusUnOp(node); } - outAAlt(node); - } - public void inAAltTransform(AAltTransform node) - { - defaultIn(node); - } + public void inAPlusBinOp(APlusBinOp node) + { + defaultIn(node); + } - public void outAAltTransform(AAltTransform node) - { - defaultOut(node); - } + public void outAPlusBinOp(APlusBinOp node) + { + defaultOut(node); + } - public void caseAAltTransform(AAltTransform node) - { - inAAltTransform(node); - if(node.getLBrace() != null) + @Override + public void caseAPlusBinOp(APlusBinOp node) { - node.getLBrace().apply(this); + inAPlusBinOp(node); + outAPlusBinOp(node); } + + public void inAMinusBinOp(AMinusBinOp node) { - Object temp[] = node.getTerms().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PTerm) temp[i]).apply(this); - } + defaultIn(node); } - if(node.getRBrace() != null) + + public void outAMinusBinOp(AMinusBinOp node) { - node.getRBrace().apply(this); + defaultOut(node); } - outAAltTransform(node); - } - public void inANewTerm(ANewTerm node) - { - defaultIn(node); - } + @Override + public void caseAMinusBinOp(AMinusBinOp node) + { + inAMinusBinOp(node); + outAMinusBinOp(node); + } - public void outANewTerm(ANewTerm node) - { - defaultOut(node); - } + public void inAProductions(AProductions node) + { + defaultIn(node); + } - public void caseANewTerm(ANewTerm node) - { - inANewTerm(node); - if(node.getProdName() != null) + public void outAProductions(AProductions node) { - node.getProdName().apply(this); + defaultOut(node); } - if(node.getLPar() != null) + + @Override + public void caseAProductions(AProductions node) { - node.getLPar().apply(this); + inAProductions(node); + { + List<PProd> copy = new ArrayList<PProd>(node.getProds()); + for(PProd e : copy) + { + e.apply(this); + } + } + outAProductions(node); } + + public void inAProd(AProd node) { - Object temp[] = node.getParams().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PTerm) temp[i]).apply(this); - } + defaultIn(node); } - outANewTerm(node); - } - public void inAListTerm(AListTerm node) - { - defaultIn(node); - } + public void outAProd(AProd node) + { + defaultOut(node); + } - public void outAListTerm(AListTerm node) - { - defaultOut(node); - } + @Override + public void caseAProd(AProd node) + { + inAProd(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getArrow() != null) + { + node.getArrow().apply(this); + } + { + List<PElem> copy = new ArrayList<PElem>(node.getProdTransform()); + for(PElem e : copy) + { + e.apply(this); + } + } + { + List<PAlt> copy = new ArrayList<PAlt>(node.getAlts()); + for(PAlt e : copy) + { + e.apply(this); + } + } + outAProd(node); + } - public void caseAListTerm(AListTerm node) - { - inAListTerm(node); - if(node.getLBkt() != null) + public void inAAlt(AAlt node) { - node.getLBkt().apply(this); + defaultIn(node); } + + public void outAAlt(AAlt node) { - Object temp[] = node.getListTerms().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PListTerm) temp[i]).apply(this); - } + defaultOut(node); } - outAListTerm(node); - } - public void inASimpleTerm(ASimpleTerm node) - { - defaultIn(node); - } + @Override + public void caseAAlt(AAlt node) + { + inAAlt(node); + if(node.getAltName() != null) + { + node.getAltName().apply(this); + } + { + List<PElem> copy = new ArrayList<PElem>(node.getElems()); + for(PElem e : copy) + { + e.apply(this); + } + } + if(node.getAltTransform() != null) + { + node.getAltTransform().apply(this); + } + outAAlt(node); + } - public void outASimpleTerm(ASimpleTerm node) - { - defaultOut(node); - } + public void inAAltTransform(AAltTransform node) + { + defaultIn(node); + } - public void caseASimpleTerm(ASimpleTerm node) - { - inASimpleTerm(node); - if(node.getSpecifier() != null) + public void outAAltTransform(AAltTransform node) { - node.getSpecifier().apply(this); + defaultOut(node); } - if(node.getId() != null) + + @Override + public void caseAAltTransform(AAltTransform node) { - node.getId().apply(this); + inAAltTransform(node); + if(node.getLBrace() != null) + { + node.getLBrace().apply(this); + } + { + List<PTerm> copy = new ArrayList<PTerm>(node.getTerms()); + for(PTerm e : copy) + { + e.apply(this); + } + } + if(node.getRBrace() != null) + { + node.getRBrace().apply(this); + } + outAAltTransform(node); } - if(node.getSimpleTermTail() != null) + + public void inANewTerm(ANewTerm node) { - node.getSimpleTermTail().apply(this); + defaultIn(node); } - outASimpleTerm(node); - } - public void inANullTerm(ANullTerm node) - { - defaultIn(node); - } + public void outANewTerm(ANewTerm node) + { + defaultOut(node); + } - public void outANullTerm(ANullTerm node) - { - defaultOut(node); - } + @Override + public void caseANewTerm(ANewTerm node) + { + inANewTerm(node); + if(node.getProdName() != null) + { + node.getProdName().apply(this); + } + if(node.getLPar() != null) + { + node.getLPar().apply(this); + } + { + List<PTerm> copy = new ArrayList<PTerm>(node.getParams()); + for(PTerm e : copy) + { + e.apply(this); + } + } + outANewTerm(node); + } - public void caseANullTerm(ANullTerm node) - { - inANullTerm(node); - outANullTerm(node); - } + public void inAListTerm(AListTerm node) + { + defaultIn(node); + } - public void inANewListTerm(ANewListTerm node) - { - defaultIn(node); - } + public void outAListTerm(AListTerm node) + { + defaultOut(node); + } - public void outANewListTerm(ANewListTerm node) - { - defaultOut(node); - } + @Override + public void caseAListTerm(AListTerm node) + { + inAListTerm(node); + if(node.getLBkt() != null) + { + node.getLBkt().apply(this); + } + { + List<PListTerm> copy = new ArrayList<PListTerm>(node.getListTerms()); + for(PListTerm e : copy) + { + e.apply(this); + } + } + outAListTerm(node); + } - public void caseANewListTerm(ANewListTerm node) - { - inANewListTerm(node); - if(node.getProdName() != null) + public void inASimpleTerm(ASimpleTerm node) { - node.getProdName().apply(this); + defaultIn(node); } - if(node.getLPar() != null) + + public void outASimpleTerm(ASimpleTerm node) { - node.getLPar().apply(this); + defaultOut(node); } + + @Override + public void caseASimpleTerm(ASimpleTerm node) { - Object temp[] = node.getParams().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PTerm) temp[i]).apply(this); - } + inASimpleTerm(node); + if(node.getSpecifier() != null) + { + node.getSpecifier().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getSimpleTermTail() != null) + { + node.getSimpleTermTail().apply(this); + } + outASimpleTerm(node); } - outANewListTerm(node); - } - public void inASimpleListTerm(ASimpleListTerm node) - { - defaultIn(node); - } + public void inANullTerm(ANullTerm node) + { + defaultIn(node); + } - public void outASimpleListTerm(ASimpleListTerm node) - { - defaultOut(node); - } + public void outANullTerm(ANullTerm node) + { + defaultOut(node); + } - public void caseASimpleListTerm(ASimpleListTerm node) - { - inASimpleListTerm(node); - if(node.getSpecifier() != null) + @Override + public void caseANullTerm(ANullTerm node) { - node.getSpecifier().apply(this); + inANullTerm(node); + outANullTerm(node); } - if(node.getId() != null) + + public void inANewListTerm(ANewListTerm node) { - node.getId().apply(this); + defaultIn(node); } - if(node.getSimpleTermTail() != null) + + public void outANewListTerm(ANewListTerm node) { - node.getSimpleTermTail().apply(this); + defaultOut(node); } - outASimpleListTerm(node); - } - public void inAProdName(AProdName node) - { - defaultIn(node); - } + @Override + public void caseANewListTerm(ANewListTerm node) + { + inANewListTerm(node); + if(node.getProdName() != null) + { + node.getProdName().apply(this); + } + if(node.getLPar() != null) + { + node.getLPar().apply(this); + } + { + List<PTerm> copy = new ArrayList<PTerm>(node.getParams()); + for(PTerm e : copy) + { + e.apply(this); + } + } + outANewListTerm(node); + } - public void outAProdName(AProdName node) - { - defaultOut(node); - } + public void inASimpleListTerm(ASimpleListTerm node) + { + defaultIn(node); + } - public void caseAProdName(AProdName node) - { - inAProdName(node); - if(node.getId() != null) + public void outASimpleListTerm(ASimpleListTerm node) { - node.getId().apply(this); + defaultOut(node); } - if(node.getProdNameTail() != null) + + @Override + public void caseASimpleListTerm(ASimpleListTerm node) { - node.getProdNameTail().apply(this); + inASimpleListTerm(node); + if(node.getSpecifier() != null) + { + node.getSpecifier().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getSimpleTermTail() != null) + { + node.getSimpleTermTail().apply(this); + } + outASimpleListTerm(node); } - outAProdName(node); - } - public void inAElem(AElem node) - { - defaultIn(node); - } + public void inAProdName(AProdName node) + { + defaultIn(node); + } - public void outAElem(AElem node) - { - defaultOut(node); - } + public void outAProdName(AProdName node) + { + defaultOut(node); + } - public void caseAElem(AElem node) - { - inAElem(node); - if(node.getElemName() != null) + @Override + public void caseAProdName(AProdName node) { - node.getElemName().apply(this); + inAProdName(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getProdNameTail() != null) + { + node.getProdNameTail().apply(this); + } + outAProdName(node); } - if(node.getSpecifier() != null) + + public void inAElem(AElem node) { - node.getSpecifier().apply(this); + defaultIn(node); } - if(node.getId() != null) + + public void outAElem(AElem node) { - node.getId().apply(this); + defaultOut(node); } - if(node.getUnOp() != null) + + @Override + public void caseAElem(AElem node) { - node.getUnOp().apply(this); + inAElem(node); + if(node.getElemName() != null) + { + node.getElemName().apply(this); + } + if(node.getSpecifier() != null) + { + node.getSpecifier().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getUnOp() != null) + { + node.getUnOp().apply(this); + } + outAElem(node); } - outAElem(node); - } - public void inATokenSpecifier(ATokenSpecifier node) - { - defaultIn(node); - } + public void inATokenSpecifier(ATokenSpecifier node) + { + defaultIn(node); + } - public void outATokenSpecifier(ATokenSpecifier node) - { - defaultOut(node); - } + public void outATokenSpecifier(ATokenSpecifier node) + { + defaultOut(node); + } - public void caseATokenSpecifier(ATokenSpecifier node) - { - inATokenSpecifier(node); - outATokenSpecifier(node); - } + @Override + public void caseATokenSpecifier(ATokenSpecifier node) + { + inATokenSpecifier(node); + outATokenSpecifier(node); + } - public void inAProductionSpecifier(AProductionSpecifier node) - { - defaultIn(node); - } + public void inAProductionSpecifier(AProductionSpecifier node) + { + defaultIn(node); + } - public void outAProductionSpecifier(AProductionSpecifier node) - { - defaultOut(node); - } + public void outAProductionSpecifier(AProductionSpecifier node) + { + defaultOut(node); + } - public void caseAProductionSpecifier(AProductionSpecifier node) - { - inAProductionSpecifier(node); - outAProductionSpecifier(node); - } + @Override + public void caseAProductionSpecifier(AProductionSpecifier node) + { + inAProductionSpecifier(node); + outAProductionSpecifier(node); + } - public void inAAst(AAst node) - { - defaultIn(node); - } + public void inAAst(AAst node) + { + defaultIn(node); + } - public void outAAst(AAst node) - { - defaultOut(node); - } + public void outAAst(AAst node) + { + defaultOut(node); + } - public void caseAAst(AAst node) - { - inAAst(node); + @Override + public void caseAAst(AAst node) { - Object temp[] = node.getProds().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PAstProd) temp[i]).apply(this); - } + inAAst(node); + { + List<PAstProd> copy = new ArrayList<PAstProd>(node.getProds()); + for(PAstProd e : copy) + { + e.apply(this); + } + } + outAAst(node); } - outAAst(node); - } - public void inAAstProd(AAstProd node) - { - defaultIn(node); - } + public void inAAstProd(AAstProd node) + { + defaultIn(node); + } - public void outAAstProd(AAstProd node) - { - defaultOut(node); - } + public void outAAstProd(AAstProd node) + { + defaultOut(node); + } - public void caseAAstProd(AAstProd node) - { - inAAstProd(node); - if(node.getId() != null) + @Override + public void caseAAstProd(AAstProd node) { - node.getId().apply(this); + inAAstProd(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + { + List<PAstAlt> copy = new ArrayList<PAstAlt>(node.getAlts()); + for(PAstAlt e : copy) + { + e.apply(this); + } + } + outAAstProd(node); } + + public void inAAstAlt(AAstAlt node) { - Object temp[] = node.getAlts().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PAstAlt) temp[i]).apply(this); - } + defaultIn(node); } - outAAstProd(node); - } - public void inAAstAlt(AAstAlt node) - { - defaultIn(node); - } + public void outAAstAlt(AAstAlt node) + { + defaultOut(node); + } - public void outAAstAlt(AAstAlt node) - { - defaultOut(node); - } - - public void caseAAstAlt(AAstAlt node) - { - inAAstAlt(node); - if(node.getAltName() != null) - { - node.getAltName().apply(this); - } - { - Object temp[] = node.getElems().toArray(); - for(int i = 0; i < temp.length; i++) - { - ((PElem) temp[i]).apply(this); - } - } - outAAstAlt(node); - } + @Override + public void caseAAstAlt(AAstAlt node) + { + inAAstAlt(node); + if(node.getAltName() != null) + { + node.getAltName().apply(this); + } + { + List<PElem> copy = new ArrayList<PElem>(node.getElems()); + for(PElem e : copy) + { + e.apply(this); + } + } + outAAstAlt(node); + } } diff --git a/src/main/java/org/sablecc/sablecc/analysis/ReversedDepthFirstAdapter.java b/src/main/java/org/sablecc/sablecc/analysis/ReversedDepthFirstAdapter.java index b5401ebbac9e4ef3abd0f5620ef2b2b9c2c42b8e..64c1d6f43dd3fce4bdd3294fc526ad9e9ccbcd38 100644 --- a/src/main/java/org/sablecc/sablecc/analysis/ReversedDepthFirstAdapter.java +++ b/src/main/java/org/sablecc/sablecc/analysis/ReversedDepthFirstAdapter.java @@ -2,1128 +2,1201 @@ package org.sablecc.sablecc.analysis; +import java.util.*; import org.sablecc.sablecc.node.*; + public class ReversedDepthFirstAdapter extends AnalysisAdapter { - public void inStart(Start node) - { - defaultIn(node); - } - - public void outStart(Start node) - { - defaultOut(node); - } - - public void defaultIn(Node node) - {} - - public void defaultOut(Node node) - {} - - public void caseStart(Start node) - { - inStart(node); - node.getEOF().apply(this); - node.getPGrammar().apply(this); - outStart(node); - } - - public void inAGrammar(AGrammar node) - { - defaultIn(node); - } - - public void outAGrammar(AGrammar node) - { - defaultOut(node); - } + final List<Void> dummy = new ArrayList<Void>(); - public void caseAGrammar(AGrammar node) - { - inAGrammar(node); - if(node.getAst() != null) + public void inStart(Start node) { - node.getAst().apply(this); + defaultIn(node); } - if(node.getProductions() != null) + + public void outStart(Start node) { - node.getProductions().apply(this); + defaultOut(node); } - if(node.getIgnTokens() != null) + + public void defaultIn(Node node) { - node.getIgnTokens().apply(this); + // Do nothing } - if(node.getTokens() != null) + + public void defaultOut(Node node) { - node.getTokens().apply(this); + // Do nothing } - if(node.getStates() != null) + + @Override + public void caseStart(Start node) { - node.getStates().apply(this); + inStart(node); + node.getEOF().apply(this); + node.getPGrammar().apply(this); + outStart(node); } - if(node.getHelpers() != null) + + public void inAGrammar(AGrammar node) { - node.getHelpers().apply(this); + defaultIn(node); } + + public void outAGrammar(AGrammar node) { - Object temp[] = node.getPackage().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((TPkgId) temp[i]).apply(this); - } + defaultOut(node); } - outAGrammar(node); - } - public void inAHelpers(AHelpers node) - { - defaultIn(node); - } - - public void outAHelpers(AHelpers node) - { - defaultOut(node); - } - - public void caseAHelpers(AHelpers node) - { - inAHelpers(node); + @Override + public void caseAGrammar(AGrammar node) { - Object temp[] = node.getHelperDefs().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PHelperDef) temp[i]).apply(this); - } + inAGrammar(node); + if(node.getAst() != null) + { + node.getAst().apply(this); + } + if(node.getProductions() != null) + { + node.getProductions().apply(this); + } + if(node.getIgnTokens() != null) + { + node.getIgnTokens().apply(this); + } + if(node.getTokens() != null) + { + node.getTokens().apply(this); + } + if(node.getStates() != null) + { + node.getStates().apply(this); + } + if(node.getHelpers() != null) + { + node.getHelpers().apply(this); + } + { + List<TPkgId> copy = new ArrayList<TPkgId>(node.getPackage()); + Collections.reverse(copy); + for(TPkgId e : copy) + { + e.apply(this); + } + } + outAGrammar(node); } - outAHelpers(node); - } - - public void inAHelperDef(AHelperDef node) - { - defaultIn(node); - } - public void outAHelperDef(AHelperDef node) - { - defaultOut(node); - } - - public void caseAHelperDef(AHelperDef node) - { - inAHelperDef(node); - if(node.getRegExp() != null) + public void inAHelpers(AHelpers node) { - node.getRegExp().apply(this); + defaultIn(node); } - if(node.getId() != null) + + public void outAHelpers(AHelpers node) { - node.getId().apply(this); + defaultOut(node); } - outAHelperDef(node); - } - - public void inAStates(AStates node) - { - defaultIn(node); - } - public void outAStates(AStates node) - { - defaultOut(node); - } - - public void caseAStates(AStates node) - { - inAStates(node); + @Override + public void caseAHelpers(AHelpers node) { - Object temp[] = node.getListId().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((TId) temp[i]).apply(this); - } + inAHelpers(node); + { + List<PHelperDef> copy = new ArrayList<PHelperDef>(node.getHelperDefs()); + Collections.reverse(copy); + for(PHelperDef e : copy) + { + e.apply(this); + } + } + outAHelpers(node); } - outAStates(node); - } - - public void inATokens(ATokens node) - { - defaultIn(node); - } - - public void outATokens(ATokens node) - { - defaultOut(node); - } - public void caseATokens(ATokens node) - { - inATokens(node); + public void inAHelperDef(AHelperDef node) { - Object temp[] = node.getTokenDefs().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PTokenDef) temp[i]).apply(this); - } + defaultIn(node); } - outATokens(node); - } - public void inATokenDef(ATokenDef node) - { - defaultIn(node); - } - - public void outATokenDef(ATokenDef node) - { - defaultOut(node); - } - - public void caseATokenDef(ATokenDef node) - { - inATokenDef(node); - if(node.getLookAhead() != null) + public void outAHelperDef(AHelperDef node) { - node.getLookAhead().apply(this); + defaultOut(node); } - if(node.getSlash() != null) + + @Override + public void caseAHelperDef(AHelperDef node) { - node.getSlash().apply(this); + inAHelperDef(node); + if(node.getRegExp() != null) + { + node.getRegExp().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + outAHelperDef(node); } - if(node.getRegExp() != null) + + public void inAStates(AStates node) { - node.getRegExp().apply(this); + defaultIn(node); } - if(node.getId() != null) + + public void outAStates(AStates node) { - node.getId().apply(this); + defaultOut(node); } - if(node.getStateList() != null) + + @Override + public void caseAStates(AStates node) { - node.getStateList().apply(this); + inAStates(node); + { + List<TId> copy = new ArrayList<TId>(node.getListId()); + Collections.reverse(copy); + for(TId e : copy) + { + e.apply(this); + } + } + outAStates(node); } - outATokenDef(node); - } - - public void inAStateList(AStateList node) - { - defaultIn(node); - } - public void outAStateList(AStateList node) - { - defaultOut(node); - } - - public void caseAStateList(AStateList node) - { - inAStateList(node); + public void inATokens(ATokens node) { - Object temp[] = node.getStateLists().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PStateListTail) temp[i]).apply(this); - } + defaultIn(node); } - if(node.getTransition() != null) + + public void outATokens(ATokens node) { - node.getTransition().apply(this); + defaultOut(node); } - if(node.getId() != null) + + @Override + public void caseATokens(ATokens node) { - node.getId().apply(this); + inATokens(node); + { + List<PTokenDef> copy = new ArrayList<PTokenDef>(node.getTokenDefs()); + Collections.reverse(copy); + for(PTokenDef e : copy) + { + e.apply(this); + } + } + outATokens(node); } - outAStateList(node); - } - public void inAStateListTail(AStateListTail node) - { - defaultIn(node); - } - - public void outAStateListTail(AStateListTail node) - { - defaultOut(node); - } - - public void caseAStateListTail(AStateListTail node) - { - inAStateListTail(node); - if(node.getTransition() != null) + public void inATokenDef(ATokenDef node) { - node.getTransition().apply(this); + defaultIn(node); } - if(node.getId() != null) + + public void outATokenDef(ATokenDef node) { - node.getId().apply(this); + defaultOut(node); } - outAStateListTail(node); - } - public void inATransition(ATransition node) - { - defaultIn(node); - } - - public void outATransition(ATransition node) - { - defaultOut(node); - } - - public void caseATransition(ATransition node) - { - inATransition(node); - if(node.getId() != null) + @Override + public void caseATokenDef(ATokenDef node) { - node.getId().apply(this); + inATokenDef(node); + if(node.getLookAhead() != null) + { + node.getLookAhead().apply(this); + } + if(node.getSlash() != null) + { + node.getSlash().apply(this); + } + if(node.getRegExp() != null) + { + node.getRegExp().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getStateList() != null) + { + node.getStateList().apply(this); + } + outATokenDef(node); } - outATransition(node); - } - - public void inAIgnTokens(AIgnTokens node) - { - defaultIn(node); - } - public void outAIgnTokens(AIgnTokens node) - { - defaultOut(node); - } - - public void caseAIgnTokens(AIgnTokens node) - { - inAIgnTokens(node); + public void inAStateList(AStateList node) { - Object temp[] = node.getListId().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((TId) temp[i]).apply(this); - } + defaultIn(node); } - outAIgnTokens(node); - } - - public void inARegExp(ARegExp node) - { - defaultIn(node); - } - - public void outARegExp(ARegExp node) - { - defaultOut(node); - } - public void caseARegExp(ARegExp node) - { - inARegExp(node); + public void outAStateList(AStateList node) { - Object temp[] = node.getConcats().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PConcat) temp[i]).apply(this); - } + defaultOut(node); } - outARegExp(node); - } - public void inAConcat(AConcat node) - { - defaultIn(node); - } - - public void outAConcat(AConcat node) - { - defaultOut(node); - } - - public void caseAConcat(AConcat node) - { - inAConcat(node); + @Override + public void caseAStateList(AStateList node) { - Object temp[] = node.getUnExps().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PUnExp) temp[i]).apply(this); - } + inAStateList(node); + { + List<PStateListTail> copy = new ArrayList<PStateListTail>(node.getStateLists()); + Collections.reverse(copy); + for(PStateListTail e : copy) + { + e.apply(this); + } + } + if(node.getTransition() != null) + { + node.getTransition().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + outAStateList(node); } - outAConcat(node); - } - - public void inAUnExp(AUnExp node) - { - defaultIn(node); - } - public void outAUnExp(AUnExp node) - { - defaultOut(node); - } - - public void caseAUnExp(AUnExp node) - { - inAUnExp(node); - if(node.getUnOp() != null) - { - node.getUnOp().apply(this); - } - if(node.getBasic() != null) - { - node.getBasic().apply(this); + public void inAStateListTail(AStateListTail node) + { + defaultIn(node); } - outAUnExp(node); - } - public void inACharBasic(ACharBasic node) - { - defaultIn(node); - } - - public void outACharBasic(ACharBasic node) - { - defaultOut(node); - } - - public void caseACharBasic(ACharBasic node) - { - inACharBasic(node); - if(node.getChar() != null) - { - node.getChar().apply(this); + public void outAStateListTail(AStateListTail node) + { + defaultOut(node); } - outACharBasic(node); - } - - public void inASetBasic(ASetBasic node) - { - defaultIn(node); - } - public void outASetBasic(ASetBasic node) - { - defaultOut(node); - } - - public void caseASetBasic(ASetBasic node) - { - inASetBasic(node); - if(node.getSet() != null) + @Override + public void caseAStateListTail(AStateListTail node) { - node.getSet().apply(this); + inAStateListTail(node); + if(node.getTransition() != null) + { + node.getTransition().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + outAStateListTail(node); } - outASetBasic(node); - } - - public void inAStringBasic(AStringBasic node) - { - defaultIn(node); - } - - public void outAStringBasic(AStringBasic node) - { - defaultOut(node); - } - public void caseAStringBasic(AStringBasic node) - { - inAStringBasic(node); - if(node.getString() != null) + public void inATransition(ATransition node) { - node.getString().apply(this); + defaultIn(node); } - outAStringBasic(node); - } - public void inAIdBasic(AIdBasic node) - { - defaultIn(node); - } + public void outATransition(ATransition node) + { + defaultOut(node); + } - public void outAIdBasic(AIdBasic node) - { - defaultOut(node); - } + @Override + public void caseATransition(ATransition node) + { + inATransition(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + outATransition(node); + } - public void caseAIdBasic(AIdBasic node) - { - inAIdBasic(node); - if(node.getId() != null) + public void inAIgnTokens(AIgnTokens node) { - node.getId().apply(this); + defaultIn(node); } - outAIdBasic(node); - } - public void inARegExpBasic(ARegExpBasic node) - { - defaultIn(node); - } + public void outAIgnTokens(AIgnTokens node) + { + defaultOut(node); + } - public void outARegExpBasic(ARegExpBasic node) - { - defaultOut(node); - } + @Override + public void caseAIgnTokens(AIgnTokens node) + { + inAIgnTokens(node); + { + List<TId> copy = new ArrayList<TId>(node.getListId()); + Collections.reverse(copy); + for(TId e : copy) + { + e.apply(this); + } + } + outAIgnTokens(node); + } - public void caseARegExpBasic(ARegExpBasic node) - { - inARegExpBasic(node); - if(node.getRegExp() != null) + public void inARegExp(ARegExp node) { - node.getRegExp().apply(this); + defaultIn(node); } - outARegExpBasic(node); - } - public void inACharChar(ACharChar node) - { - defaultIn(node); - } + public void outARegExp(ARegExp node) + { + defaultOut(node); + } - public void outACharChar(ACharChar node) - { - defaultOut(node); - } + @Override + public void caseARegExp(ARegExp node) + { + inARegExp(node); + { + List<PConcat> copy = new ArrayList<PConcat>(node.getConcats()); + Collections.reverse(copy); + for(PConcat e : copy) + { + e.apply(this); + } + } + outARegExp(node); + } - public void caseACharChar(ACharChar node) - { - inACharChar(node); - if(node.getChar() != null) + public void inAConcat(AConcat node) { - node.getChar().apply(this); + defaultIn(node); } - outACharChar(node); - } - public void inADecChar(ADecChar node) - { - defaultIn(node); - } + public void outAConcat(AConcat node) + { + defaultOut(node); + } - public void outADecChar(ADecChar node) - { - defaultOut(node); - } + @Override + public void caseAConcat(AConcat node) + { + inAConcat(node); + { + List<PUnExp> copy = new ArrayList<PUnExp>(node.getUnExps()); + Collections.reverse(copy); + for(PUnExp e : copy) + { + e.apply(this); + } + } + outAConcat(node); + } - public void caseADecChar(ADecChar node) - { - inADecChar(node); - if(node.getDecChar() != null) + public void inAUnExp(AUnExp node) { - node.getDecChar().apply(this); + defaultIn(node); } - outADecChar(node); - } - public void inAHexChar(AHexChar node) - { - defaultIn(node); - } + public void outAUnExp(AUnExp node) + { + defaultOut(node); + } - public void outAHexChar(AHexChar node) - { - defaultOut(node); - } + @Override + public void caseAUnExp(AUnExp node) + { + inAUnExp(node); + if(node.getUnOp() != null) + { + node.getUnOp().apply(this); + } + if(node.getBasic() != null) + { + node.getBasic().apply(this); + } + outAUnExp(node); + } - public void caseAHexChar(AHexChar node) - { - inAHexChar(node); - if(node.getHexChar() != null) + public void inACharBasic(ACharBasic node) { - node.getHexChar().apply(this); + defaultIn(node); } - outAHexChar(node); - } - public void inAOperationSet(AOperationSet node) - { - defaultIn(node); - } + public void outACharBasic(ACharBasic node) + { + defaultOut(node); + } - public void outAOperationSet(AOperationSet node) - { - defaultOut(node); - } + @Override + public void caseACharBasic(ACharBasic node) + { + inACharBasic(node); + if(node.getChar() != null) + { + node.getChar().apply(this); + } + outACharBasic(node); + } - public void caseAOperationSet(AOperationSet node) - { - inAOperationSet(node); - if(node.getRight() != null) + public void inASetBasic(ASetBasic node) { - node.getRight().apply(this); + defaultIn(node); } - if(node.getBinOp() != null) + + public void outASetBasic(ASetBasic node) { - node.getBinOp().apply(this); + defaultOut(node); } - if(node.getLeft() != null) + + @Override + public void caseASetBasic(ASetBasic node) { - node.getLeft().apply(this); + inASetBasic(node); + if(node.getSet() != null) + { + node.getSet().apply(this); + } + outASetBasic(node); } - outAOperationSet(node); - } - public void inAIntervalSet(AIntervalSet node) - { - defaultIn(node); - } + public void inAStringBasic(AStringBasic node) + { + defaultIn(node); + } - public void outAIntervalSet(AIntervalSet node) - { - defaultOut(node); - } + public void outAStringBasic(AStringBasic node) + { + defaultOut(node); + } - public void caseAIntervalSet(AIntervalSet node) - { - inAIntervalSet(node); - if(node.getRight() != null) + @Override + public void caseAStringBasic(AStringBasic node) { - node.getRight().apply(this); + inAStringBasic(node); + if(node.getString() != null) + { + node.getString().apply(this); + } + outAStringBasic(node); } - if(node.getLeft() != null) + + public void inAIdBasic(AIdBasic node) { - node.getLeft().apply(this); + defaultIn(node); } - outAIntervalSet(node); - } - public void inAStarUnOp(AStarUnOp node) - { - defaultIn(node); - } + public void outAIdBasic(AIdBasic node) + { + defaultOut(node); + } - public void outAStarUnOp(AStarUnOp node) - { - defaultOut(node); - } + @Override + public void caseAIdBasic(AIdBasic node) + { + inAIdBasic(node); + if(node.getId() != null) + { + node.getId().apply(this); + } + outAIdBasic(node); + } - public void caseAStarUnOp(AStarUnOp node) - { - inAStarUnOp(node); - if(node.getStar() != null) + public void inARegExpBasic(ARegExpBasic node) { - node.getStar().apply(this); + defaultIn(node); } - outAStarUnOp(node); - } - public void inAQMarkUnOp(AQMarkUnOp node) - { - defaultIn(node); - } + public void outARegExpBasic(ARegExpBasic node) + { + defaultOut(node); + } - public void outAQMarkUnOp(AQMarkUnOp node) - { - defaultOut(node); - } + @Override + public void caseARegExpBasic(ARegExpBasic node) + { + inARegExpBasic(node); + if(node.getRegExp() != null) + { + node.getRegExp().apply(this); + } + outARegExpBasic(node); + } - public void caseAQMarkUnOp(AQMarkUnOp node) - { - inAQMarkUnOp(node); - if(node.getQMark() != null) + public void inACharChar(ACharChar node) { - node.getQMark().apply(this); + defaultIn(node); } - outAQMarkUnOp(node); - } - public void inAPlusUnOp(APlusUnOp node) - { - defaultIn(node); - } + public void outACharChar(ACharChar node) + { + defaultOut(node); + } - public void outAPlusUnOp(APlusUnOp node) - { - defaultOut(node); - } + @Override + public void caseACharChar(ACharChar node) + { + inACharChar(node); + if(node.getChar() != null) + { + node.getChar().apply(this); + } + outACharChar(node); + } - public void caseAPlusUnOp(APlusUnOp node) - { - inAPlusUnOp(node); - if(node.getPlus() != null) + public void inADecChar(ADecChar node) { - node.getPlus().apply(this); + defaultIn(node); } - outAPlusUnOp(node); - } - public void inAPlusBinOp(APlusBinOp node) - { - defaultIn(node); - } + public void outADecChar(ADecChar node) + { + defaultOut(node); + } - public void outAPlusBinOp(APlusBinOp node) - { - defaultOut(node); - } + @Override + public void caseADecChar(ADecChar node) + { + inADecChar(node); + if(node.getDecChar() != null) + { + node.getDecChar().apply(this); + } + outADecChar(node); + } - public void caseAPlusBinOp(APlusBinOp node) - { - inAPlusBinOp(node); - outAPlusBinOp(node); - } + public void inAHexChar(AHexChar node) + { + defaultIn(node); + } - public void inAMinusBinOp(AMinusBinOp node) - { - defaultIn(node); - } + public void outAHexChar(AHexChar node) + { + defaultOut(node); + } - public void outAMinusBinOp(AMinusBinOp node) - { - defaultOut(node); - } + @Override + public void caseAHexChar(AHexChar node) + { + inAHexChar(node); + if(node.getHexChar() != null) + { + node.getHexChar().apply(this); + } + outAHexChar(node); + } - public void caseAMinusBinOp(AMinusBinOp node) - { - inAMinusBinOp(node); - outAMinusBinOp(node); - } + public void inAOperationSet(AOperationSet node) + { + defaultIn(node); + } - public void inAProductions(AProductions node) - { - defaultIn(node); - } + public void outAOperationSet(AOperationSet node) + { + defaultOut(node); + } - public void outAProductions(AProductions node) - { - defaultOut(node); - } + @Override + public void caseAOperationSet(AOperationSet node) + { + inAOperationSet(node); + if(node.getRight() != null) + { + node.getRight().apply(this); + } + if(node.getBinOp() != null) + { + node.getBinOp().apply(this); + } + if(node.getLeft() != null) + { + node.getLeft().apply(this); + } + outAOperationSet(node); + } - public void caseAProductions(AProductions node) - { - inAProductions(node); + public void inAIntervalSet(AIntervalSet node) { - Object temp[] = node.getProds().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PProd) temp[i]).apply(this); - } + defaultIn(node); } - outAProductions(node); - } - public void inAProd(AProd node) - { - defaultIn(node); - } + public void outAIntervalSet(AIntervalSet node) + { + defaultOut(node); + } - public void outAProd(AProd node) - { - defaultOut(node); - } + @Override + public void caseAIntervalSet(AIntervalSet node) + { + inAIntervalSet(node); + if(node.getRight() != null) + { + node.getRight().apply(this); + } + if(node.getLeft() != null) + { + node.getLeft().apply(this); + } + outAIntervalSet(node); + } - public void caseAProd(AProd node) - { - inAProd(node); + public void inAStarUnOp(AStarUnOp node) { - Object temp[] = node.getAlts().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PAlt) temp[i]).apply(this); - } + defaultIn(node); } + + public void outAStarUnOp(AStarUnOp node) { - Object temp[] = node.getProdTransform().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PElem) temp[i]).apply(this); - } + defaultOut(node); } - if(node.getArrow() != null) + + @Override + public void caseAStarUnOp(AStarUnOp node) { - node.getArrow().apply(this); + inAStarUnOp(node); + if(node.getStar() != null) + { + node.getStar().apply(this); + } + outAStarUnOp(node); } - if(node.getId() != null) + + public void inAQMarkUnOp(AQMarkUnOp node) { - node.getId().apply(this); + defaultIn(node); } - outAProd(node); - } - public void inAAlt(AAlt node) - { - defaultIn(node); - } + public void outAQMarkUnOp(AQMarkUnOp node) + { + defaultOut(node); + } - public void outAAlt(AAlt node) - { - defaultOut(node); - } + @Override + public void caseAQMarkUnOp(AQMarkUnOp node) + { + inAQMarkUnOp(node); + if(node.getQMark() != null) + { + node.getQMark().apply(this); + } + outAQMarkUnOp(node); + } - public void caseAAlt(AAlt node) - { - inAAlt(node); - if(node.getAltTransform() != null) + public void inAPlusUnOp(APlusUnOp node) { - node.getAltTransform().apply(this); + defaultIn(node); } + + public void outAPlusUnOp(APlusUnOp node) { - Object temp[] = node.getElems().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PElem) temp[i]).apply(this); - } + defaultOut(node); } - if(node.getAltName() != null) + + @Override + public void caseAPlusUnOp(APlusUnOp node) { - node.getAltName().apply(this); + inAPlusUnOp(node); + if(node.getPlus() != null) + { + node.getPlus().apply(this); + } + outAPlusUnOp(node); } - outAAlt(node); - } - public void inAAltTransform(AAltTransform node) - { - defaultIn(node); - } + public void inAPlusBinOp(APlusBinOp node) + { + defaultIn(node); + } - public void outAAltTransform(AAltTransform node) - { - defaultOut(node); - } + public void outAPlusBinOp(APlusBinOp node) + { + defaultOut(node); + } - public void caseAAltTransform(AAltTransform node) - { - inAAltTransform(node); - if(node.getRBrace() != null) + @Override + public void caseAPlusBinOp(APlusBinOp node) { - node.getRBrace().apply(this); + inAPlusBinOp(node); + outAPlusBinOp(node); } + + public void inAMinusBinOp(AMinusBinOp node) { - Object temp[] = node.getTerms().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PTerm) temp[i]).apply(this); - } + defaultIn(node); } - if(node.getLBrace() != null) + + public void outAMinusBinOp(AMinusBinOp node) { - node.getLBrace().apply(this); + defaultOut(node); } - outAAltTransform(node); - } - public void inANewTerm(ANewTerm node) - { - defaultIn(node); - } + @Override + public void caseAMinusBinOp(AMinusBinOp node) + { + inAMinusBinOp(node); + outAMinusBinOp(node); + } - public void outANewTerm(ANewTerm node) - { - defaultOut(node); - } + public void inAProductions(AProductions node) + { + defaultIn(node); + } - public void caseANewTerm(ANewTerm node) - { - inANewTerm(node); + public void outAProductions(AProductions node) { - Object temp[] = node.getParams().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PTerm) temp[i]).apply(this); - } + defaultOut(node); } - if(node.getLPar() != null) + + @Override + public void caseAProductions(AProductions node) { - node.getLPar().apply(this); + inAProductions(node); + { + List<PProd> copy = new ArrayList<PProd>(node.getProds()); + Collections.reverse(copy); + for(PProd e : copy) + { + e.apply(this); + } + } + outAProductions(node); } - if(node.getProdName() != null) + + public void inAProd(AProd node) { - node.getProdName().apply(this); + defaultIn(node); } - outANewTerm(node); - } - public void inAListTerm(AListTerm node) - { - defaultIn(node); - } + public void outAProd(AProd node) + { + defaultOut(node); + } - public void outAListTerm(AListTerm node) - { - defaultOut(node); - } + @Override + public void caseAProd(AProd node) + { + inAProd(node); + { + List<PAlt> copy = new ArrayList<PAlt>(node.getAlts()); + Collections.reverse(copy); + for(PAlt e : copy) + { + e.apply(this); + } + } + { + List<PElem> copy = new ArrayList<PElem>(node.getProdTransform()); + Collections.reverse(copy); + for(PElem e : copy) + { + e.apply(this); + } + } + if(node.getArrow() != null) + { + node.getArrow().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + outAProd(node); + } - public void caseAListTerm(AListTerm node) - { - inAListTerm(node); + public void inAAlt(AAlt node) { - Object temp[] = node.getListTerms().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PListTerm) temp[i]).apply(this); - } + defaultIn(node); } - if(node.getLBkt() != null) + + public void outAAlt(AAlt node) { - node.getLBkt().apply(this); + defaultOut(node); } - outAListTerm(node); - } - public void inASimpleTerm(ASimpleTerm node) - { - defaultIn(node); - } + @Override + public void caseAAlt(AAlt node) + { + inAAlt(node); + if(node.getAltTransform() != null) + { + node.getAltTransform().apply(this); + } + { + List<PElem> copy = new ArrayList<PElem>(node.getElems()); + Collections.reverse(copy); + for(PElem e : copy) + { + e.apply(this); + } + } + if(node.getAltName() != null) + { + node.getAltName().apply(this); + } + outAAlt(node); + } - public void outASimpleTerm(ASimpleTerm node) - { - defaultOut(node); - } + public void inAAltTransform(AAltTransform node) + { + defaultIn(node); + } - public void caseASimpleTerm(ASimpleTerm node) - { - inASimpleTerm(node); - if(node.getSimpleTermTail() != null) + public void outAAltTransform(AAltTransform node) { - node.getSimpleTermTail().apply(this); + defaultOut(node); } - if(node.getId() != null) + + @Override + public void caseAAltTransform(AAltTransform node) { - node.getId().apply(this); + inAAltTransform(node); + if(node.getRBrace() != null) + { + node.getRBrace().apply(this); + } + { + List<PTerm> copy = new ArrayList<PTerm>(node.getTerms()); + Collections.reverse(copy); + for(PTerm e : copy) + { + e.apply(this); + } + } + if(node.getLBrace() != null) + { + node.getLBrace().apply(this); + } + outAAltTransform(node); } - if(node.getSpecifier() != null) + + public void inANewTerm(ANewTerm node) { - node.getSpecifier().apply(this); + defaultIn(node); } - outASimpleTerm(node); - } - public void inANullTerm(ANullTerm node) - { - defaultIn(node); - } + public void outANewTerm(ANewTerm node) + { + defaultOut(node); + } - public void outANullTerm(ANullTerm node) - { - defaultOut(node); - } + @Override + public void caseANewTerm(ANewTerm node) + { + inANewTerm(node); + { + List<PTerm> copy = new ArrayList<PTerm>(node.getParams()); + Collections.reverse(copy); + for(PTerm e : copy) + { + e.apply(this); + } + } + if(node.getLPar() != null) + { + node.getLPar().apply(this); + } + if(node.getProdName() != null) + { + node.getProdName().apply(this); + } + outANewTerm(node); + } - public void caseANullTerm(ANullTerm node) - { - inANullTerm(node); - outANullTerm(node); - } + public void inAListTerm(AListTerm node) + { + defaultIn(node); + } - public void inANewListTerm(ANewListTerm node) - { - defaultIn(node); - } + public void outAListTerm(AListTerm node) + { + defaultOut(node); + } - public void outANewListTerm(ANewListTerm node) - { - defaultOut(node); - } + @Override + public void caseAListTerm(AListTerm node) + { + inAListTerm(node); + { + List<PListTerm> copy = new ArrayList<PListTerm>(node.getListTerms()); + Collections.reverse(copy); + for(PListTerm e : copy) + { + e.apply(this); + } + } + if(node.getLBkt() != null) + { + node.getLBkt().apply(this); + } + outAListTerm(node); + } - public void caseANewListTerm(ANewListTerm node) - { - inANewListTerm(node); + public void inASimpleTerm(ASimpleTerm node) { - Object temp[] = node.getParams().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PTerm) temp[i]).apply(this); - } + defaultIn(node); } - if(node.getLPar() != null) + + public void outASimpleTerm(ASimpleTerm node) { - node.getLPar().apply(this); + defaultOut(node); } - if(node.getProdName() != null) + + @Override + public void caseASimpleTerm(ASimpleTerm node) { - node.getProdName().apply(this); + inASimpleTerm(node); + if(node.getSimpleTermTail() != null) + { + node.getSimpleTermTail().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getSpecifier() != null) + { + node.getSpecifier().apply(this); + } + outASimpleTerm(node); } - outANewListTerm(node); - } - public void inASimpleListTerm(ASimpleListTerm node) - { - defaultIn(node); - } + public void inANullTerm(ANullTerm node) + { + defaultIn(node); + } - public void outASimpleListTerm(ASimpleListTerm node) - { - defaultOut(node); - } + public void outANullTerm(ANullTerm node) + { + defaultOut(node); + } - public void caseASimpleListTerm(ASimpleListTerm node) - { - inASimpleListTerm(node); - if(node.getSimpleTermTail() != null) + @Override + public void caseANullTerm(ANullTerm node) { - node.getSimpleTermTail().apply(this); + inANullTerm(node); + outANullTerm(node); } - if(node.getId() != null) + + public void inANewListTerm(ANewListTerm node) { - node.getId().apply(this); + defaultIn(node); } - if(node.getSpecifier() != null) + + public void outANewListTerm(ANewListTerm node) { - node.getSpecifier().apply(this); + defaultOut(node); } - outASimpleListTerm(node); - } - public void inAProdName(AProdName node) - { - defaultIn(node); - } + @Override + public void caseANewListTerm(ANewListTerm node) + { + inANewListTerm(node); + { + List<PTerm> copy = new ArrayList<PTerm>(node.getParams()); + Collections.reverse(copy); + for(PTerm e : copy) + { + e.apply(this); + } + } + if(node.getLPar() != null) + { + node.getLPar().apply(this); + } + if(node.getProdName() != null) + { + node.getProdName().apply(this); + } + outANewListTerm(node); + } - public void outAProdName(AProdName node) - { - defaultOut(node); - } + public void inASimpleListTerm(ASimpleListTerm node) + { + defaultIn(node); + } - public void caseAProdName(AProdName node) - { - inAProdName(node); - if(node.getProdNameTail() != null) + public void outASimpleListTerm(ASimpleListTerm node) { - node.getProdNameTail().apply(this); + defaultOut(node); } - if(node.getId() != null) + + @Override + public void caseASimpleListTerm(ASimpleListTerm node) { - node.getId().apply(this); + inASimpleListTerm(node); + if(node.getSimpleTermTail() != null) + { + node.getSimpleTermTail().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getSpecifier() != null) + { + node.getSpecifier().apply(this); + } + outASimpleListTerm(node); } - outAProdName(node); - } - public void inAElem(AElem node) - { - defaultIn(node); - } + public void inAProdName(AProdName node) + { + defaultIn(node); + } - public void outAElem(AElem node) - { - defaultOut(node); - } + public void outAProdName(AProdName node) + { + defaultOut(node); + } - public void caseAElem(AElem node) - { - inAElem(node); - if(node.getUnOp() != null) + @Override + public void caseAProdName(AProdName node) { - node.getUnOp().apply(this); + inAProdName(node); + if(node.getProdNameTail() != null) + { + node.getProdNameTail().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + outAProdName(node); } - if(node.getId() != null) + + public void inAElem(AElem node) { - node.getId().apply(this); + defaultIn(node); } - if(node.getSpecifier() != null) + + public void outAElem(AElem node) { - node.getSpecifier().apply(this); + defaultOut(node); } - if(node.getElemName() != null) + + @Override + public void caseAElem(AElem node) { - node.getElemName().apply(this); + inAElem(node); + if(node.getUnOp() != null) + { + node.getUnOp().apply(this); + } + if(node.getId() != null) + { + node.getId().apply(this); + } + if(node.getSpecifier() != null) + { + node.getSpecifier().apply(this); + } + if(node.getElemName() != null) + { + node.getElemName().apply(this); + } + outAElem(node); } - outAElem(node); - } - public void inATokenSpecifier(ATokenSpecifier node) - { - defaultIn(node); - } + public void inATokenSpecifier(ATokenSpecifier node) + { + defaultIn(node); + } - public void outATokenSpecifier(ATokenSpecifier node) - { - defaultOut(node); - } + public void outATokenSpecifier(ATokenSpecifier node) + { + defaultOut(node); + } - public void caseATokenSpecifier(ATokenSpecifier node) - { - inATokenSpecifier(node); - outATokenSpecifier(node); - } + @Override + public void caseATokenSpecifier(ATokenSpecifier node) + { + inATokenSpecifier(node); + outATokenSpecifier(node); + } - public void inAProductionSpecifier(AProductionSpecifier node) - { - defaultIn(node); - } + public void inAProductionSpecifier(AProductionSpecifier node) + { + defaultIn(node); + } - public void outAProductionSpecifier(AProductionSpecifier node) - { - defaultOut(node); - } + public void outAProductionSpecifier(AProductionSpecifier node) + { + defaultOut(node); + } - public void caseAProductionSpecifier(AProductionSpecifier node) - { - inAProductionSpecifier(node); - outAProductionSpecifier(node); - } + @Override + public void caseAProductionSpecifier(AProductionSpecifier node) + { + inAProductionSpecifier(node); + outAProductionSpecifier(node); + } - public void inAAst(AAst node) - { - defaultIn(node); - } + public void inAAst(AAst node) + { + defaultIn(node); + } - public void outAAst(AAst node) - { - defaultOut(node); - } + public void outAAst(AAst node) + { + defaultOut(node); + } - public void caseAAst(AAst node) - { - inAAst(node); + @Override + public void caseAAst(AAst node) { - Object temp[] = node.getProds().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PAstProd) temp[i]).apply(this); - } + inAAst(node); + { + List<PAstProd> copy = new ArrayList<PAstProd>(node.getProds()); + Collections.reverse(copy); + for(PAstProd e : copy) + { + e.apply(this); + } + } + outAAst(node); } - outAAst(node); - } - public void inAAstProd(AAstProd node) - { - defaultIn(node); - } + public void inAAstProd(AAstProd node) + { + defaultIn(node); + } - public void outAAstProd(AAstProd node) - { - defaultOut(node); - } + public void outAAstProd(AAstProd node) + { + defaultOut(node); + } - public void caseAAstProd(AAstProd node) - { - inAAstProd(node); + @Override + public void caseAAstProd(AAstProd node) { - Object temp[] = node.getAlts().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PAstAlt) temp[i]).apply(this); - } + inAAstProd(node); + { + List<PAstAlt> copy = new ArrayList<PAstAlt>(node.getAlts()); + Collections.reverse(copy); + for(PAstAlt e : copy) + { + e.apply(this); + } + } + if(node.getId() != null) + { + node.getId().apply(this); + } + outAAstProd(node); } - if(node.getId() != null) + + public void inAAstAlt(AAstAlt node) { - node.getId().apply(this); + defaultIn(node); } - outAAstProd(node); - } - public void inAAstAlt(AAstAlt node) - { - defaultIn(node); - } + public void outAAstAlt(AAstAlt node) + { + defaultOut(node); + } - public void outAAstAlt(AAstAlt node) - { - defaultOut(node); - } - - public void caseAAstAlt(AAstAlt node) - { - inAAstAlt(node); - { - Object temp[] = node.getElems().toArray(); - for(int i = temp.length - 1; i >= 0; i--) - { - ((PElem) temp[i]).apply(this); - } - } - if(node.getAltName() != null) - { - node.getAltName().apply(this); - } - outAAstAlt(node); - } + @Override + public void caseAAstAlt(AAstAlt node) + { + inAAstAlt(node); + { + List<PElem> copy = new ArrayList<PElem>(node.getElems()); + Collections.reverse(copy); + for(PElem e : copy) + { + e.apply(this); + } + } + if(node.getAltName() != null) + { + node.getAltName().apply(this); + } + outAAstAlt(node); + } } diff --git a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java index cb7c7bb4720cf9a0c3922ffdc60f8ba7193c403d..3eafaec1931e12d2f44e3aae8263f8295de4a35c 100644 --- a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java +++ b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java @@ -5,1149 +5,1055 @@ package org.sablecc.sablecc.lexer; import java.io.*; import java.util.*; import org.sablecc.sablecc.node.*; +import de.hhu.stups.sablecc.patch.*; +import java.util.concurrent.LinkedBlockingQueue; -public class Lexer +@SuppressWarnings({"unused"}) +public class Lexer implements ITokenListContainer { - protected Token token; - protected State state = State.NORMAL; + protected Token token; + protected State state = State.NORMAL; - private PushbackReader in; - private int line; - private int pos; - private boolean cr; - private boolean eof; - private final StringBuffer text = new StringBuffer(); + private PushbackReader in; + protected int line; + protected int pos; + private boolean cr; + private boolean eof; + private final StringBuilder text = new StringBuilder(); - protected void filter() throws LexerException, IOException - {} + private List<IToken> tokenList; + private final Queue<IToken> nextList = new LinkedBlockingQueue<IToken>(); - public Lexer(PushbackReader in) - { - this.in = in; - } - - public Token peek() throws LexerException, IOException - { - while(token == null) - { - token = getToken(); - filter(); + public Queue<IToken> getNextList() { + return nextList; } - return token; - } + @Override + public List<IToken> getTokenList() { + return tokenList; + } - public Token next() throws LexerException, IOException - { - while(token == null) - { - token = getToken(); - filter(); + private void setToken(Token t) { + token = t; } - Token result = token; - token = null; - return result; - } - protected Token getToken() throws IOException, LexerException - { - int dfa_state = 0; + public void setTokenList(final List<IToken> list) { + tokenList = list; + } + - int start_pos = pos; - int start_line = line; + protected void filter() throws LexerException, IOException + { + // Do nothing + } - int accept_state = -1; - int accept_token = -1; - int accept_length = -1; - int accept_pos = -1; - int accept_line = -1; + protected void filterWrap() throws LexerException, IOException + { + filter(); + if (token != null) { + getTokenList().add(token); + nextList.add(token); + } + } - int[][][] gotoTable = this.gotoTable[state.id()]; - int[] accept = this.accept[state.id()]; - text.setLength(0); - while(true) + public Lexer(PushbackReader in) { - int c = getChar(); + this.in = in; + setTokenList(new ArrayList<IToken>()); + } - if(c != -1) - { - switch(c) + public Token peek() throws LexerException, IOException + { + while(this.token == null) { - case 10: - if(cr) - { - cr = false; - } - else - { - line++; - pos = 0; - } - break; - case 13: - case 8232: // Unicode line separator - case 8233: // Unicode paragraph separator - line++; - pos = 0; - cr = true; - break; - default: - pos++; - cr = false; - break; - }; + this.setToken(getToken()); + filterWrap(); + } - text.append((char) c); + return (Token) nextList.peek(); + } - do + public Token next() throws LexerException, IOException + { + while(this.token == null) { - int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state; + this.setToken(getToken()); + filterWrap(); + } - dfa_state = -1; + Token result = (Token) nextList.poll(); + this.setToken(null); + return result; + } - int[][] tmp1 = gotoTable[oldState]; - int low = 0; - int high = tmp1.length - 1; + protected Token getToken() throws IOException, LexerException + { + int dfa_state = 0; - while(low <= high) - { - int middle = (low + high) / 2; - int[] tmp2 = tmp1[middle]; + int start_pos = this.pos; + int start_line = this.line; - if(c < tmp2[0]) - { - high = middle - 1; - } - else if(c > tmp2[1]) - { - low = middle + 1; - } - else - { - dfa_state = tmp2[2]; - break; - } - } - } - while(dfa_state < -1); - } - else - { - dfa_state = -1; - } + int accept_state = -1; + int accept_token = -1; + int accept_length = -1; + int accept_pos = -1; + int accept_line = -1; - if(dfa_state >= 0) - { - if(accept[dfa_state] != -1) - { - accept_state = dfa_state; - accept_token = accept[dfa_state]; - accept_length = text.length(); - accept_pos = pos; - accept_line = line; - } - } - else - { - if(accept_state != -1) + int[][][] gotoTable = Lexer.gotoTable[this.state.id()]; + int[] accept = Lexer.accept[this.state.id()]; + this.text.setLength(0); + + while(true) { - switch(accept_token) - { - case 0: - { - Token token = new0( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - switch(state.id()) - { - case 1: - state = State.PACKAGE; - break; - } - return token; - } - case 1: - { - Token token = new1( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - switch(state.id()) - { - case 0: - state = State.PACKAGE; - break; - } - return token; - } - case 2: - { - Token token = new2( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 3: - { - Token token = new3( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 4: - { - Token token = new4( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 5: - { - Token token = new5( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 6: - { - Token token = new6( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 7: - { - Token token = new7( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 8: - { - Token token = new8( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 9: - { - Token token = new9( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 10: - { - Token token = new10( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 11: - { - Token token = new11( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 12: - { - Token token = new12( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 13: - { - Token token = new13( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 14: - { - Token token = new14( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 15: - { - Token token = new15( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 16: - { - Token token = new16( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - switch(state.id()) - { - case 0: - state = State.NORMAL; - break; - case 1: - state = State.NORMAL; - break; - } - return token; - } - case 17: - { - Token token = new17( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 18: - { - Token token = new18( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 19: - { - Token token = new19( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 20: - { - Token token = new20( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 21: - { - Token token = new21( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 22: - { - Token token = new22( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 23: - { - Token token = new23( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 24: - { - Token token = new24( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 25: - { - Token token = new25( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 26: - { - Token token = new26( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 27: - { - Token token = new27( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 28: - { - Token token = new28( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 29: - { - Token token = new29( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 30: - { - Token token = new30( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 31: - { - Token token = new31( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 32: - { - Token token = new32( - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 33: - { - Token token = new33( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 34: - { - Token token = new34( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 35: - { - Token token = new35( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; - } - case 36: + int c = getChar(); + + if(c != -1) { - Token token = new36( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; + switch(c) + { + case 10: + if(this.cr) + { + this.cr = false; + } + else + { + this.line++; + this.pos = 0; + } + break; + case 13: + case 8232: // Unicode line separator + case 8233: // Unicode paragraph separator + this.line++; + this.pos = 0; + this.cr = true; + break; + default: + this.pos++; + this.cr = false; + break; + } + + this.text.append((char) c); + + do + { + int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state; + + dfa_state = -1; + + int[][] tmp1 = gotoTable[oldState]; + int low = 0; + int high = tmp1.length - 1; + + // find next DFA state depending on character c + // an entry {Low, Up, Id} -> means if Low <= c <= Up -> goto state Id + while(low <= high) + { + int middle = (low + high) >>> 1; + int[] tmp2 = tmp1[middle]; + + if(c < tmp2[0]) + { + high = middle - 1; + } + else if(c > tmp2[1]) + { + low = middle + 1; + } + else + { + dfa_state = tmp2[2]; + break; + } + } + } while(dfa_state < -1); } - case 37: + else { - Token token = new37( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; + dfa_state = -1; } - case 38: + + if(dfa_state >= 0) { - Token token = new38( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; + if(accept[dfa_state] != -1) + { + accept_state = dfa_state; + accept_token = accept[dfa_state]; + accept_length = this.text.length(); + accept_pos = this.pos; + accept_line = this.line; + } } - case 39: + else { - Token token = new39( - getText(accept_length), - start_line + 1, - start_pos + 1); - pushBack(accept_length); - pos = accept_pos; - line = accept_line; - return token; + if(accept_state != -1) + { + switch(accept_token) + { + case 0: + { + Token token = new0( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + switch(state.id()) + { + case 1: state = State.PACKAGE; break; + } + return token; + } + case 1: + { + Token token = new1( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + switch(state.id()) + { + case 0: state = State.PACKAGE; break; + } + return token; + } + case 2: + { + Token token = new2( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 3: + { + Token token = new3( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 4: + { + Token token = new4( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 5: + { + Token token = new5( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 6: + { + Token token = new6( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 7: + { + Token token = new7( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 8: + { + Token token = new8( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 9: + { + Token token = new9( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 10: + { + Token token = new10( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 11: + { + Token token = new11( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 12: + { + Token token = new12( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 13: + { + Token token = new13( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 14: + { + Token token = new14( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 15: + { + Token token = new15( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 16: + { + Token token = new16( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + switch(state.id()) + { + case 0: state = State.NORMAL; break; + case 1: state = State.NORMAL; break; + } + return token; + } + case 17: + { + Token token = new17( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 18: + { + Token token = new18( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 19: + { + Token token = new19( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 20: + { + Token token = new20( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 21: + { + Token token = new21( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 22: + { + Token token = new22( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 23: + { + Token token = new23( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 24: + { + Token token = new24( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 25: + { + Token token = new25( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 26: + { + Token token = new26( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 27: + { + Token token = new27( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 28: + { + Token token = new28( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 29: + { + Token token = new29( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 30: + { + Token token = new30( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 31: + { + Token token = new31( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 32: + { + Token token = new32( + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 33: + { + Token token = new33( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 34: + { + Token token = new34( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 35: + { + Token token = new35( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 36: + { + Token token = new36( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 37: + { + Token token = new37( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 38: + { + Token token = new38( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + case 39: + { + Token token = new39( + getText(accept_length), + start_line + 1, + start_pos + 1); + pushBack(accept_length); + this.pos = accept_pos; + this.line = accept_line; + return token; + } + } + } + else + { + if(this.text.length() > 0) + { + throw new LexerException( + "[" + (start_line + 1) + "," + (start_pos + 1) + "]" + + " Unknown token: " + this.text); + } + + EOF token = new EOF( + start_line + 1, + start_pos + 1); + return token; + } } - } - } - else - { - if(text.length() > 0) - { - throw new LexerException( - "[" + (start_line + 1) + "," + (start_pos + 1) + "]" + - " Unknown token: " + text); - } - else - { - EOF token = new EOF( - start_line + 1, - start_pos + 1); - return token; - } } - } } - } - Token new0(String text, int line, int pos) - { - return new TPkgId(text, line, pos); - } - Token new1(int line, int pos) - { - return new TPackage(line, pos); - } - Token new2(int line, int pos) - { - return new TStates(line, pos); - } - Token new3(int line, int pos) - { - return new THelpers(line, pos); - } - Token new4(int line, int pos) - { - return new TTokens(line, pos); - } - Token new5(int line, int pos) - { - return new TIgnored(line, pos); - } - Token new6(int line, int pos) - { - return new TProductions(line, pos); - } - Token new7(int line, int pos) - { - return new TAbstract(line, pos); - } - Token new8(int line, int pos) - { - return new TSyntax(line, pos); - } - Token new9(int line, int pos) - { - return new TTree(line, pos); - } - Token new10(int line, int pos) - { - return new TNew(line, pos); - } - Token new11(int line, int pos) - { - return new TNull(line, pos); - } - Token new12(int line, int pos) - { - return new TTokenSpecifier(line, pos); - } - Token new13(int line, int pos) - { - return new TProductionSpecifier(line, pos); - } - Token new14(int line, int pos) - { - return new TDot(line, pos); - } - Token new15(int line, int pos) - { - return new TDDot(line, pos); - } - Token new16(int line, int pos) - { - return new TSemicolon(line, pos); - } - Token new17(int line, int pos) - { - return new TEqual(line, pos); - } - Token new18(int line, int pos) - { - return new TLBkt(line, pos); - } - Token new19(int line, int pos) - { - return new TRBkt(line, pos); - } - Token new20(int line, int pos) - { - return new TLPar(line, pos); - } - Token new21(int line, int pos) - { - return new TRPar(line, pos); - } - Token new22(int line, int pos) - { - return new TLBrace(line, pos); - } - Token new23(int line, int pos) - { - return new TRBrace(line, pos); - } - Token new24(int line, int pos) - { - return new TPlus(line, pos); - } - Token new25(int line, int pos) - { - return new TMinus(line, pos); - } - Token new26(int line, int pos) - { - return new TQMark(line, pos); - } - Token new27(int line, int pos) - { - return new TStar(line, pos); - } - Token new28(int line, int pos) - { - return new TBar(line, pos); - } - Token new29(int line, int pos) - { - return new TComma(line, pos); - } - Token new30(int line, int pos) - { - return new TSlash(line, pos); - } - Token new31(int line, int pos) - { - return new TArrow(line, pos); - } - Token new32(int line, int pos) - { - return new TColon(line, pos); - } - Token new33(String text, int line, int pos) - { - return new TId(text, line, pos); - } - Token new34(String text, int line, int pos) - { - return new TChar(text, line, pos); - } - Token new35(String text, int line, int pos) - { - return new TDecChar(text, line, pos); - } - Token new36(String text, int line, int pos) - { - return new THexChar(text, line, pos); - } - Token new37(String text, int line, int pos) - { - return new TString(text, line, pos); - } - Token new38(String text, int line, int pos) - { - return new TBlank(text, line, pos); - } - Token new39(String text, int line, int pos) - { - return new TComment(text, line, pos); - } + Token new0(String text, int line, int pos) { return new TPkgId(text, line, pos); } + Token new1(int line, int pos) { return new TPackage(line, pos); } + Token new2(int line, int pos) { return new TStates(line, pos); } + Token new3(int line, int pos) { return new THelpers(line, pos); } + Token new4(int line, int pos) { return new TTokens(line, pos); } + Token new5(int line, int pos) { return new TIgnored(line, pos); } + Token new6(int line, int pos) { return new TProductions(line, pos); } + Token new7(int line, int pos) { return new TAbstract(line, pos); } + Token new8(int line, int pos) { return new TSyntax(line, pos); } + Token new9(int line, int pos) { return new TTree(line, pos); } + Token new10(int line, int pos) { return new TNew(line, pos); } + Token new11(int line, int pos) { return new TNull(line, pos); } + Token new12(int line, int pos) { return new TTokenSpecifier(line, pos); } + Token new13(int line, int pos) { return new TProductionSpecifier(line, pos); } + Token new14(int line, int pos) { return new TDot(line, pos); } + Token new15(int line, int pos) { return new TDDot(line, pos); } + Token new16(int line, int pos) { return new TSemicolon(line, pos); } + Token new17(int line, int pos) { return new TEqual(line, pos); } + Token new18(int line, int pos) { return new TLBkt(line, pos); } + Token new19(int line, int pos) { return new TRBkt(line, pos); } + Token new20(int line, int pos) { return new TLPar(line, pos); } + Token new21(int line, int pos) { return new TRPar(line, pos); } + Token new22(int line, int pos) { return new TLBrace(line, pos); } + Token new23(int line, int pos) { return new TRBrace(line, pos); } + Token new24(int line, int pos) { return new TPlus(line, pos); } + Token new25(int line, int pos) { return new TMinus(line, pos); } + Token new26(int line, int pos) { return new TQMark(line, pos); } + Token new27(int line, int pos) { return new TStar(line, pos); } + Token new28(int line, int pos) { return new TBar(line, pos); } + Token new29(int line, int pos) { return new TComma(line, pos); } + Token new30(int line, int pos) { return new TSlash(line, pos); } + Token new31(int line, int pos) { return new TArrow(line, pos); } + Token new32(int line, int pos) { return new TColon(line, pos); } + Token new33(String text, int line, int pos) { return new TId(text, line, pos); } + Token new34(String text, int line, int pos) { return new TChar(text, line, pos); } + Token new35(String text, int line, int pos) { return new TDecChar(text, line, pos); } + Token new36(String text, int line, int pos) { return new THexChar(text, line, pos); } + Token new37(String text, int line, int pos) { return new TString(text, line, pos); } + Token new38(String text, int line, int pos) { return new TBlank(text, line, pos); } + Token new39(String text, int line, int pos) { return new TComment(text, line, pos); } - private int getChar() throws IOException - { - if(eof) + private int getChar() throws IOException { - return -1; - } + if(this.eof) + { + return -1; + } - int result = in.read(); + int result = this.in.read(); - if(result == -1) - { - eof = true; - } + if(result == -1) + { + this.eof = true; + } - return result; - } + return result; + } - private void pushBack(int acceptLength) throws IOException - { - int length = text.length(); - for(int i = length - 1; i >= acceptLength; i--) + private void pushBack(int acceptLength) throws IOException { - eof = false; + int length = this.text.length(); + for(int i = length - 1; i >= acceptLength; i--) + { + this.eof = false; - in.unread(text.charAt(i)); + this.in.unread(this.text.charAt(i)); + } } - } - protected void unread(Token token) throws IOException - { - String text = token.getText(); - int length = text.length(); - - for(int i = length - 1; i >= 0; i--) + protected void unread(Token token) throws IOException { - eof = false; + String text = token.getText(); + int length = text.length(); - in.unread(text.charAt(i)); - } + for(int i = length - 1; i >= 0; i--) + { + this.eof = false; - pos = token.getPos() - 1; - line = token.getLine() - 1; - } + this.in.unread(text.charAt(i)); + } - private String getText(int acceptLength) - { - StringBuffer s = new StringBuffer(acceptLength); - for(int i = 0; i < acceptLength; i++) + this.pos = token.getPos() - 1; + this.line = token.getLine() - 1; + } + + private String getText(int acceptLength) { - s.append(text.charAt(i)); + return this.text.substring(0, acceptLength); } - return s.toString(); - } + private static int[][][][] gotoTable; +/* { + { // NORMAL + {{9, 9, 1}, {10, 10, 2}, {13, 13, 3}, {32, 32, 4}, {39, 39, 5}, {40, 40, 6}, {41, 41, 7}, {42, 42, 8}, {43, 43, 9}, {44, 44, 10}, {45, 45, 11}, {46, 46, 12}, {47, 47, 13}, {48, 48, 14}, {49, 57, 15}, {58, 58, 16}, {59, 59, 17}, {61, 61, 18}, {63, 63, 19}, {65, 65, 20}, {72, 72, 21}, {73, 73, 22}, {78, 78, 23}, {80, 80, 24}, {83, 83, 25}, {84, 84, 26}, {91, 91, 27}, {93, 93, 28}, {97, 122, 29}, {123, 123, 30}, {124, 124, 31}, {125, 125, 32}, }, + {{9, 32, -2}, }, + {{9, 32, -2}, }, + {{9, 9, 1}, {10, 10, 33}, {13, 32, -2}, }, + {{9, 32, -2}, }, + {{0, 9, 34}, {11, 12, 34}, {14, 38, 34}, {39, 39, 35}, {40, 65535, 34}, }, + {}, + {}, + {}, + {}, + {}, + {{62, 62, 36}, }, + {{46, 46, 37}, }, + {{42, 42, 38}, {47, 47, 39}, }, + {{48, 57, 15}, {88, 88, 40}, {120, 120, 41}, }, + {{48, 57, 15}, }, + {}, + {}, + {}, + {}, + {{98, 98, 42}, }, + {{101, 101, 43}, }, + {{103, 103, 44}, }, + {{101, 101, 45}, {117, 117, 46}, }, + {{97, 97, 47}, {114, 114, 48}, }, + {{116, 116, 49}, {121, 121, 50}, }, + {{111, 111, 51}, {114, 114, 52}, }, + {}, + {}, + {{48, 57, 53}, {95, 95, 54}, {97, 122, 55}, }, + {}, + {}, + {}, + {{9, 32, -2}, }, + {{0, 9, 56}, {11, 12, 56}, {14, 38, 56}, {39, 39, 57}, {40, 65535, 56}, }, + {{39, 39, 58}, }, + {}, + {}, + {{0, 41, 59}, {42, 42, 60}, {43, 65535, 59}, }, + {{0, 9, 61}, {10, 10, 62}, {11, 12, 61}, {13, 13, 63}, {14, 65535, 61}, }, + {{48, 57, 64}, {65, 70, 64}, {97, 102, 64}, }, + {{48, 102, -42}, }, + {{115, 115, 65}, }, + {{108, 108, 66}, }, + {{110, 110, 67}, }, + {{119, 119, 68}, }, + {{108, 108, 69}, }, + {{99, 99, 70}, }, + {{111, 111, 71}, }, + {{97, 97, 72}, }, + {{110, 110, 73}, }, + {{107, 107, 74}, }, + {{101, 101, 75}, }, + {{48, 122, -31}, }, + {{97, 122, 76}, }, + {{48, 122, -31}, }, + {{0, 38, -36}, {39, 39, 77}, {40, 65535, 56}, }, + {}, + {}, + {{0, 65535, -40}, }, + {{0, 41, 78}, {42, 42, 60}, {43, 46, 78}, {47, 47, 79}, {48, 65535, 78}, }, + {{0, 65535, -41}, }, + {}, + {{10, 10, 80}, }, + {{48, 102, -42}, }, + {{116, 116, 81}, }, + {{112, 112, 82}, }, + {{111, 111, 83}, }, + {}, + {{108, 108, 84}, }, + {{107, 107, 85}, }, + {{100, 100, 86}, }, + {{116, 116, 87}, }, + {{116, 116, 88}, }, + {{101, 101, 89}, }, + {{101, 101, 90}, }, + {{48, 57, 91}, {95, 95, 54}, {97, 122, 92}, }, + {}, + {{0, 41, 93}, {42, 42, 94}, {43, 65535, 93}, }, + {}, + {}, + {{114, 114, 95}, }, + {{101, 101, 96}, }, + {{114, 114, 97}, }, + {}, + {{97, 97, 98}, }, + {{117, 117, 99}, }, + {{101, 101, 100}, }, + {{97, 97, 101}, }, + {{110, 110, 102}, }, + {}, + {{48, 122, -78}, }, + {{48, 122, -78}, }, + {{0, 65535, -80}, }, + {{0, 41, 78}, {42, 42, 94}, {43, 65535, -62}, }, + {{97, 97, 103}, }, + {{114, 114, 104}, }, + {{101, 101, 105}, }, + {{103, 103, 106}, }, + {{99, 99, 107}, }, + {{115, 115, 108}, }, + {{120, 120, 109}, }, + {{115, 115, 110}, }, + {{99, 99, 111}, }, + {{115, 115, 112}, }, + {{100, 100, 113}, }, + {{101, 101, 114}, }, + {{116, 116, 115}, }, + {}, + {}, + {}, + {{116, 116, 116}, }, + {}, + {}, + {}, + {{105, 105, 117}, }, + {}, + {{111, 111, 118}, }, + {{110, 110, 119}, }, + {{115, 115, 120}, }, + {}, + } + { // PACKAGE + {{9, 9, 1}, {10, 10, 2}, {13, 13, 3}, {32, 32, 4}, {36, 36, 5}, {39, 39, 6}, {40, 40, 7}, {41, 41, 8}, {42, 42, 9}, {43, 43, 10}, {44, 44, 11}, {45, 45, 12}, {46, 46, 13}, {47, 47, 14}, {48, 48, 15}, {49, 57, 16}, {58, 58, 17}, {59, 59, 18}, {61, 61, 19}, {63, 63, 20}, {65, 65, 21}, {66, 71, 22}, {72, 72, 23}, {73, 73, 24}, {74, 77, 22}, {78, 78, 25}, {79, 79, 22}, {80, 80, 26}, {81, 82, 22}, {83, 83, 27}, {84, 84, 28}, {85, 90, 22}, {91, 91, 29}, {93, 93, 30}, {95, 95, 31}, {97, 122, 32}, {123, 123, 33}, {124, 124, 34}, {125, 125, 35}, }, + {{9, 32, -2}, }, + {{9, 32, -2}, }, + {{9, 9, 1}, {10, 10, 36}, {13, 32, -2}, }, + {{9, 32, -2}, }, + {{36, 36, 37}, {48, 57, 38}, {65, 90, 39}, {95, 95, 40}, {97, 122, 41}, }, + {{0, 9, 42}, {11, 12, 42}, {14, 38, 42}, {39, 39, 43}, {40, 65535, 42}, }, + {}, + {}, + {}, + {}, + {}, + {{62, 62, 44}, }, + {{46, 46, 45}, }, + {{42, 42, 46}, {47, 47, 47}, }, + {{48, 57, 16}, {88, 88, 48}, {120, 120, 49}, }, + {{48, 57, 16}, }, + {}, + {}, + {}, + {}, + {{36, 95, -7}, {97, 97, 41}, {98, 98, 50}, {99, 122, 41}, }, + {{36, 122, -7}, }, + {{36, 95, -7}, {97, 100, 41}, {101, 101, 51}, {102, 122, 41}, }, + {{36, 95, -7}, {97, 102, 41}, {103, 103, 52}, {104, 122, 41}, }, + {{36, 100, -25}, {101, 101, 53}, {102, 116, 41}, {117, 117, 54}, {118, 122, 41}, }, + {{36, 95, -7}, {97, 113, 41}, {114, 114, 55}, {115, 122, 41}, }, + {{36, 95, -7}, {97, 115, 41}, {116, 116, 56}, {117, 120, 41}, {121, 121, 57}, {122, 122, 41}, }, + {{36, 95, -7}, {97, 110, 41}, {111, 111, 58}, {112, 113, 41}, {114, 114, 59}, {115, 122, 41}, }, + {}, + {}, + {{36, 122, -7}, }, + {{36, 36, 37}, {48, 57, 60}, {65, 90, 39}, {95, 95, 61}, {97, 122, 62}, }, + {}, + {}, + {}, + {{9, 32, -2}, }, + {{36, 122, -7}, }, + {{36, 122, -7}, }, + {{36, 122, -7}, }, + {{36, 122, -7}, }, + {{36, 122, -7}, }, + {{0, 9, 63}, {11, 12, 63}, {14, 38, 63}, {39, 39, 64}, {40, 65535, 63}, }, + {{39, 39, 65}, }, + {}, + {}, + {{0, 41, 66}, {42, 42, 67}, {43, 65535, 66}, }, + {{0, 9, 68}, {10, 10, 69}, {11, 12, 68}, {13, 13, 70}, {14, 65535, 68}, }, + {{48, 57, 71}, {65, 70, 71}, {97, 102, 71}, }, + {{48, 102, -50}, }, + {{36, 95, -7}, {97, 114, 41}, {115, 115, 72}, {116, 122, 41}, }, + {{36, 95, -7}, {97, 107, 41}, {108, 108, 73}, {109, 122, 41}, }, + {{36, 95, -7}, {97, 109, 41}, {110, 110, 74}, {111, 122, 41}, }, + {{36, 95, -7}, {97, 118, 41}, {119, 119, 75}, {120, 122, 41}, }, + {{36, 107, -53}, {108, 108, 76}, {109, 122, 41}, }, + {{36, 110, -30}, {111, 111, 77}, {112, 122, 41}, }, + {{36, 95, -7}, {97, 97, 78}, {98, 122, 41}, }, + {{36, 109, -54}, {110, 110, 79}, {111, 122, 41}, }, + {{36, 95, -7}, {97, 106, 41}, {107, 107, 80}, {108, 122, 41}, }, + {{36, 100, -25}, {101, 101, 81}, {102, 122, 41}, }, + {{36, 122, -34}, }, + {{36, 95, -7}, {97, 122, 82}, }, + {{36, 122, -34}, }, + {{0, 38, -44}, {39, 39, 83}, {40, 65535, 63}, }, + {}, + {}, + {{0, 65535, -48}, }, + {{0, 41, 84}, {42, 42, 67}, {43, 46, 84}, {47, 47, 85}, {48, 65535, 84}, }, + {{0, 65535, -49}, }, + {}, + {{10, 10, 86}, }, + {{48, 102, -50}, }, + {{36, 115, -29}, {116, 116, 87}, {117, 122, 41}, }, + {{36, 95, -7}, {97, 111, 41}, {112, 112, 88}, {113, 122, 41}, }, + {{36, 110, -30}, {111, 111, 89}, {112, 122, 41}, }, + {{36, 122, -7}, }, + {{36, 107, -53}, {108, 108, 90}, {109, 122, 41}, }, + {{36, 95, -7}, {97, 99, 41}, {100, 100, 91}, {101, 122, 41}, }, + {{36, 115, -29}, {116, 116, 92}, {117, 122, 41}, }, + {{36, 115, -29}, {116, 116, 93}, {117, 122, 41}, }, + {{36, 100, -25}, {101, 101, 94}, {102, 122, 41}, }, + {{36, 100, -25}, {101, 101, 95}, {102, 122, 41}, }, + {{36, 36, 37}, {48, 57, 96}, {65, 95, -34}, {97, 122, 97}, }, + {}, + {{0, 41, 98}, {42, 42, 99}, {43, 65535, 98}, }, + {}, + {}, + {{36, 113, -28}, {114, 114, 100}, {115, 122, 41}, }, + {{36, 100, -25}, {101, 101, 101}, {102, 122, 41}, }, + {{36, 113, -28}, {114, 114, 102}, {115, 122, 41}, }, + {{36, 122, -7}, }, + {{36, 95, -7}, {97, 116, 41}, {117, 117, 103}, {118, 122, 41}, }, + {{36, 100, -25}, {101, 101, 104}, {102, 122, 41}, }, + {{36, 95, -7}, {97, 97, 105}, {98, 122, 41}, }, + {{36, 109, -54}, {110, 110, 106}, {111, 122, 41}, }, + {{36, 122, -7}, }, + {{36, 122, -84}, }, + {{36, 122, -84}, }, + {{0, 65535, -86}, }, + {{0, 41, 84}, {42, 42, 99}, {43, 65535, -69}, }, + {{36, 95, -7}, {97, 97, 107}, {98, 122, 41}, }, + {{36, 113, -28}, {114, 114, 108}, {115, 122, 41}, }, + {{36, 100, -25}, {101, 101, 109}, {102, 122, 41}, }, + {{36, 95, -7}, {97, 98, 41}, {99, 99, 110}, {100, 122, 41}, }, + {{36, 114, -52}, {115, 115, 111}, {116, 122, 41}, }, + {{36, 95, -7}, {97, 119, 41}, {120, 120, 112}, {121, 122, 41}, }, + {{36, 114, -52}, {115, 115, 113}, {116, 122, 41}, }, + {{36, 98, -105}, {99, 99, 114}, {100, 122, 41}, }, + {{36, 114, -52}, {115, 115, 115}, {116, 122, 41}, }, + {{36, 99, -79}, {100, 100, 116}, {101, 122, 41}, }, + {{36, 115, -29}, {116, 116, 117}, {117, 122, 41}, }, + {{36, 122, -7}, }, + {{36, 122, -7}, }, + {{36, 122, -7}, }, + {{36, 115, -29}, {116, 116, 118}, {117, 122, 41}, }, + {{36, 122, -7}, }, + {{36, 122, -7}, }, + {{36, 95, -7}, {97, 104, 41}, {105, 105, 119}, {106, 122, 41}, }, + {{36, 122, -7}, }, + {{36, 110, -30}, {111, 111, 120}, {112, 122, 41}, }, + {{36, 109, -54}, {110, 110, 121}, {111, 122, 41}, }, + {{36, 114, -52}, {115, 115, 122}, {116, 122, 41}, }, + {{36, 122, -7}, }, + } + };*/ + + private static int[][] accept; +/* { + // NORMAL + {-1, 38, 38, 38, 38, -1, 20, 21, 27, 24, 29, 25, 14, 30, 35, 35, 32, 16, 17, 26, -1, -1, -1, -1, 13, -1, 12, 18, 19, 33, 22, 28, 23, 38, -1, -1, 31, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 33, -1, 34, 34, -1, -1, -1, 39, 39, 36, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, 33, 37, -1, 39, 39, -1, -1, -1, 11, -1, -1, -1, -1, -1, 9, 33, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 8, 4, -1, 3, 5, 1, -1, 7, -1, -1, -1, 6, }, + // PACKAGE + {-1, 38, 38, 38, 38, 0, -1, 20, 21, 27, 24, 29, 25, 14, 30, 35, 35, 32, 16, 17, 26, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 0, 0, 22, 28, 23, 38, 0, 0, 0, 0, 0, -1, -1, 31, 15, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 34, 34, -1, -1, -1, 39, 39, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, -1, 39, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - private static int[][][][] gotoTable; - /* { - { // NORMAL - {{9, 9, 1}, {10, 10, 2}, {13, 13, 3}, {32, 32, 4}, {39, 39, 5}, {40, 40, 6}, {41, 41, 7}, {42, 42, 8}, {43, 43, 9}, {44, 44, 10}, {45, 45, 11}, {46, 46, 12}, {47, 47, 13}, {48, 48, 14}, {49, 57, 15}, {58, 58, 16}, {59, 59, 17}, {61, 61, 18}, {63, 63, 19}, {65, 65, 20}, {72, 72, 21}, {73, 73, 22}, {78, 78, 23}, {80, 80, 24}, {83, 83, 25}, {84, 84, 26}, {91, 91, 27}, {93, 93, 28}, {97, 122, 29}, {123, 123, 30}, {124, 124, 31}, {125, 125, 32}, }, - {{9, 32, -2}, }, - {{9, 32, -2}, }, - {{9, 9, 1}, {10, 10, 33}, {13, 32, -2}, }, - {{9, 32, -2}, }, - {{0, 9, 34}, {11, 12, 34}, {14, 38, 34}, {39, 39, 35}, {40, 65535, 34}, }, - {}, - {}, - {}, - {}, - {}, - {{62, 62, 36}, }, - {{46, 46, 37}, }, - {{42, 42, 38}, {47, 47, 39}, }, - {{48, 57, 15}, {88, 88, 40}, {120, 120, 41}, }, - {{48, 57, 15}, }, - {}, - {}, - {}, - {}, - {{98, 98, 42}, }, - {{101, 101, 43}, }, - {{103, 103, 44}, }, - {{101, 101, 45}, {117, 117, 46}, }, - {{97, 97, 47}, {114, 114, 48}, }, - {{116, 116, 49}, {121, 121, 50}, }, - {{111, 111, 51}, {114, 114, 52}, }, - {}, - {}, - {{48, 57, 53}, {95, 95, 54}, {97, 122, 55}, }, - {}, - {}, - {}, - {{9, 32, -2}, }, - {{0, 9, 56}, {11, 12, 56}, {14, 38, 56}, {39, 39, 57}, {40, 65535, 56}, }, - {{39, 39, 58}, }, - {}, - {}, - {{0, 41, 59}, {42, 42, 60}, {43, 65535, 59}, }, - {{0, 9, 61}, {10, 10, 62}, {11, 12, 61}, {13, 13, 63}, {14, 65535, 61}, }, - {{48, 57, 64}, {65, 70, 64}, {97, 102, 64}, }, - {{48, 102, -42}, }, - {{115, 115, 65}, }, - {{108, 108, 66}, }, - {{110, 110, 67}, }, - {{119, 119, 68}, }, - {{108, 108, 69}, }, - {{99, 99, 70}, }, - {{111, 111, 71}, }, - {{97, 97, 72}, }, - {{110, 110, 73}, }, - {{107, 107, 74}, }, - {{101, 101, 75}, }, - {{48, 122, -31}, }, - {{97, 122, 76}, }, - {{48, 122, -31}, }, - {{0, 38, -36}, {39, 39, 77}, {40, 65535, 56}, }, - {}, - {}, - {{0, 65535, -40}, }, - {{0, 41, 78}, {42, 42, 60}, {43, 46, 78}, {47, 47, 79}, {48, 65535, 78}, }, - {{0, 65535, -41}, }, - {}, - {{10, 10, 80}, }, - {{48, 102, -42}, }, - {{116, 116, 81}, }, - {{112, 112, 82}, }, - {{111, 111, 83}, }, - {}, - {{108, 108, 84}, }, - {{107, 107, 85}, }, - {{100, 100, 86}, }, - {{116, 116, 87}, }, - {{116, 116, 88}, }, - {{101, 101, 89}, }, - {{101, 101, 90}, }, - {{48, 57, 91}, {95, 95, 54}, {97, 122, 92}, }, - {}, - {{0, 41, 93}, {42, 42, 94}, {43, 65535, 93}, }, - {}, - {}, - {{114, 114, 95}, }, - {{101, 101, 96}, }, - {{114, 114, 97}, }, - {}, - {{97, 97, 98}, }, - {{117, 117, 99}, }, - {{101, 101, 100}, }, - {{97, 97, 101}, }, - {{110, 110, 102}, }, - {}, - {{48, 122, -78}, }, - {{48, 122, -78}, }, - {{0, 65535, -80}, }, - {{0, 41, 78}, {42, 42, 94}, {43, 65535, -62}, }, - {{97, 97, 103}, }, - {{114, 114, 104}, }, - {{101, 101, 105}, }, - {{103, 103, 106}, }, - {{99, 99, 107}, }, - {{115, 115, 108}, }, - {{120, 120, 109}, }, - {{115, 115, 110}, }, - {{99, 99, 111}, }, - {{115, 115, 112}, }, - {{100, 100, 113}, }, - {{101, 101, 114}, }, - {{116, 116, 115}, }, - {}, - {}, - {}, - {{116, 116, 116}, }, - {}, - {}, - {}, - {{105, 105, 117}, }, - {}, - {{111, 111, 118}, }, - {{110, 110, 119}, }, - {{115, 115, 120}, }, - {}, - } - { // PACKAGE - {{9, 9, 1}, {10, 10, 2}, {13, 13, 3}, {32, 32, 4}, {36, 36, 5}, {39, 39, 6}, {40, 40, 7}, {41, 41, 8}, {42, 42, 9}, {43, 43, 10}, {44, 44, 11}, {45, 45, 12}, {46, 46, 13}, {47, 47, 14}, {48, 48, 15}, {49, 57, 16}, {58, 58, 17}, {59, 59, 18}, {61, 61, 19}, {63, 63, 20}, {65, 65, 21}, {66, 71, 22}, {72, 72, 23}, {73, 73, 24}, {74, 77, 22}, {78, 78, 25}, {79, 79, 22}, {80, 80, 26}, {81, 82, 22}, {83, 83, 27}, {84, 84, 28}, {85, 90, 22}, {91, 91, 29}, {93, 93, 30}, {95, 95, 31}, {97, 122, 32}, {123, 123, 33}, {124, 124, 34}, {125, 125, 35}, }, - {{9, 32, -2}, }, - {{9, 32, -2}, }, - {{9, 9, 1}, {10, 10, 36}, {13, 32, -2}, }, - {{9, 32, -2}, }, - {{36, 36, 37}, {48, 57, 38}, {65, 90, 39}, {95, 95, 40}, {97, 122, 41}, }, - {{0, 9, 42}, {11, 12, 42}, {14, 38, 42}, {39, 39, 43}, {40, 65535, 42}, }, - {}, - {}, - {}, - {}, - {}, - {{62, 62, 44}, }, - {{46, 46, 45}, }, - {{42, 42, 46}, {47, 47, 47}, }, - {{48, 57, 16}, {88, 88, 48}, {120, 120, 49}, }, - {{48, 57, 16}, }, - {}, - {}, - {}, - {}, - {{36, 95, -7}, {97, 97, 41}, {98, 98, 50}, {99, 122, 41}, }, - {{36, 122, -7}, }, - {{36, 95, -7}, {97, 100, 41}, {101, 101, 51}, {102, 122, 41}, }, - {{36, 95, -7}, {97, 102, 41}, {103, 103, 52}, {104, 122, 41}, }, - {{36, 100, -25}, {101, 101, 53}, {102, 116, 41}, {117, 117, 54}, {118, 122, 41}, }, - {{36, 95, -7}, {97, 113, 41}, {114, 114, 55}, {115, 122, 41}, }, - {{36, 95, -7}, {97, 115, 41}, {116, 116, 56}, {117, 120, 41}, {121, 121, 57}, {122, 122, 41}, }, - {{36, 95, -7}, {97, 110, 41}, {111, 111, 58}, {112, 113, 41}, {114, 114, 59}, {115, 122, 41}, }, - {}, - {}, - {{36, 122, -7}, }, - {{36, 36, 37}, {48, 57, 60}, {65, 90, 39}, {95, 95, 61}, {97, 122, 62}, }, - {}, - {}, - {}, - {{9, 32, -2}, }, - {{36, 122, -7}, }, - {{36, 122, -7}, }, - {{36, 122, -7}, }, - {{36, 122, -7}, }, - {{36, 122, -7}, }, - {{0, 9, 63}, {11, 12, 63}, {14, 38, 63}, {39, 39, 64}, {40, 65535, 63}, }, - {{39, 39, 65}, }, - {}, - {}, - {{0, 41, 66}, {42, 42, 67}, {43, 65535, 66}, }, - {{0, 9, 68}, {10, 10, 69}, {11, 12, 68}, {13, 13, 70}, {14, 65535, 68}, }, - {{48, 57, 71}, {65, 70, 71}, {97, 102, 71}, }, - {{48, 102, -50}, }, - {{36, 95, -7}, {97, 114, 41}, {115, 115, 72}, {116, 122, 41}, }, - {{36, 95, -7}, {97, 107, 41}, {108, 108, 73}, {109, 122, 41}, }, - {{36, 95, -7}, {97, 109, 41}, {110, 110, 74}, {111, 122, 41}, }, - {{36, 95, -7}, {97, 118, 41}, {119, 119, 75}, {120, 122, 41}, }, - {{36, 107, -53}, {108, 108, 76}, {109, 122, 41}, }, - {{36, 110, -30}, {111, 111, 77}, {112, 122, 41}, }, - {{36, 95, -7}, {97, 97, 78}, {98, 122, 41}, }, - {{36, 109, -54}, {110, 110, 79}, {111, 122, 41}, }, - {{36, 95, -7}, {97, 106, 41}, {107, 107, 80}, {108, 122, 41}, }, - {{36, 100, -25}, {101, 101, 81}, {102, 122, 41}, }, - {{36, 122, -34}, }, - {{36, 95, -7}, {97, 122, 82}, }, - {{36, 122, -34}, }, - {{0, 38, -44}, {39, 39, 83}, {40, 65535, 63}, }, - {}, - {}, - {{0, 65535, -48}, }, - {{0, 41, 84}, {42, 42, 67}, {43, 46, 84}, {47, 47, 85}, {48, 65535, 84}, }, - {{0, 65535, -49}, }, - {}, - {{10, 10, 86}, }, - {{48, 102, -50}, }, - {{36, 115, -29}, {116, 116, 87}, {117, 122, 41}, }, - {{36, 95, -7}, {97, 111, 41}, {112, 112, 88}, {113, 122, 41}, }, - {{36, 110, -30}, {111, 111, 89}, {112, 122, 41}, }, - {{36, 122, -7}, }, - {{36, 107, -53}, {108, 108, 90}, {109, 122, 41}, }, - {{36, 95, -7}, {97, 99, 41}, {100, 100, 91}, {101, 122, 41}, }, - {{36, 115, -29}, {116, 116, 92}, {117, 122, 41}, }, - {{36, 115, -29}, {116, 116, 93}, {117, 122, 41}, }, - {{36, 100, -25}, {101, 101, 94}, {102, 122, 41}, }, - {{36, 100, -25}, {101, 101, 95}, {102, 122, 41}, }, - {{36, 36, 37}, {48, 57, 96}, {65, 95, -34}, {97, 122, 97}, }, - {}, - {{0, 41, 98}, {42, 42, 99}, {43, 65535, 98}, }, - {}, - {}, - {{36, 113, -28}, {114, 114, 100}, {115, 122, 41}, }, - {{36, 100, -25}, {101, 101, 101}, {102, 122, 41}, }, - {{36, 113, -28}, {114, 114, 102}, {115, 122, 41}, }, - {{36, 122, -7}, }, - {{36, 95, -7}, {97, 116, 41}, {117, 117, 103}, {118, 122, 41}, }, - {{36, 100, -25}, {101, 101, 104}, {102, 122, 41}, }, - {{36, 95, -7}, {97, 97, 105}, {98, 122, 41}, }, - {{36, 109, -54}, {110, 110, 106}, {111, 122, 41}, }, - {{36, 122, -7}, }, - {{36, 122, -84}, }, - {{36, 122, -84}, }, - {{0, 65535, -86}, }, - {{0, 41, 84}, {42, 42, 99}, {43, 65535, -69}, }, - {{36, 95, -7}, {97, 97, 107}, {98, 122, 41}, }, - {{36, 113, -28}, {114, 114, 108}, {115, 122, 41}, }, - {{36, 100, -25}, {101, 101, 109}, {102, 122, 41}, }, - {{36, 95, -7}, {97, 98, 41}, {99, 99, 110}, {100, 122, 41}, }, - {{36, 114, -52}, {115, 115, 111}, {116, 122, 41}, }, - {{36, 95, -7}, {97, 119, 41}, {120, 120, 112}, {121, 122, 41}, }, - {{36, 114, -52}, {115, 115, 113}, {116, 122, 41}, }, - {{36, 98, -105}, {99, 99, 114}, {100, 122, 41}, }, - {{36, 114, -52}, {115, 115, 115}, {116, 122, 41}, }, - {{36, 99, -79}, {100, 100, 116}, {101, 122, 41}, }, - {{36, 115, -29}, {116, 116, 117}, {117, 122, 41}, }, - {{36, 122, -7}, }, - {{36, 122, -7}, }, - {{36, 122, -7}, }, - {{36, 115, -29}, {116, 116, 118}, {117, 122, 41}, }, - {{36, 122, -7}, }, - {{36, 122, -7}, }, - {{36, 95, -7}, {97, 104, 41}, {105, 105, 119}, {106, 122, 41}, }, - {{36, 122, -7}, }, - {{36, 110, -30}, {111, 111, 120}, {112, 122, 41}, }, - {{36, 109, -54}, {110, 110, 121}, {111, 122, 41}, }, - {{36, 114, -52}, {115, 115, 122}, {116, 122, 41}, }, - {{36, 122, -7}, }, - } - };*/ + };*/ - private static int[][] accept; - /* { - // NORMAL - {-1, 38, 38, 38, 38, -1, 20, 21, 27, 24, 29, 25, 14, 30, 35, 35, 32, 16, 17, 26, -1, -1, -1, -1, 13, -1, 12, 18, 19, 33, 22, 28, 23, 38, -1, -1, 31, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 33, -1, 34, 34, -1, -1, -1, 39, 39, 36, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, 33, 37, -1, 39, 39, -1, -1, -1, 11, -1, -1, -1, -1, -1, 9, 33, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 8, 4, -1, 3, 5, 1, -1, 7, -1, -1, -1, 6, }, - // PACKAGE - {-1, 38, 38, 38, 38, 0, -1, 20, 21, 27, 24, 29, 25, 14, 30, 35, 35, 32, 16, 17, 26, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 0, 0, 22, 28, 23, 38, 0, 0, 0, 0, 0, -1, -1, 31, 15, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 34, 34, -1, -1, -1, 39, 39, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, -1, 39, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - - };*/ + public static class State + { + public final static State NORMAL = new State(0); + public final static State PACKAGE = new State(1); - public static class State - { - public final static State NORMAL = new State(0); - public final static State PACKAGE = new State(1); + private int id; - private int id; + private State(int id) + { + this.id = id; + } - private State(int id) - { - this.id = id; + public int id() + { + return this.id; + } } - public int id() + static { - return id; - } - } + try + { + InputStream resStream = Lexer.class.getResourceAsStream("lexer.dat"); + if(resStream == null) + { + throw new RuntimeException("The file \"lexer.dat\" is missing."); + } + DataInputStream s = new DataInputStream(new BufferedInputStream(resStream)); - static - { - try - { - DataInputStream s = new DataInputStream( - new BufferedInputStream( - Lexer.class.getResourceAsStream("lexer.dat"))); + // read gotoTable + int length = s.readInt(); + gotoTable = new int[length][][][]; + for(int i = 0; i < gotoTable.length; i++) + { + length = s.readInt(); + gotoTable[i] = new int[length][][]; + for(int j = 0; j < gotoTable[i].length; j++) + { + length = s.readInt(); + gotoTable[i][j] = new int[length][3]; + for(int k = 0; k < gotoTable[i][j].length; k++) + { + for(int l = 0; l < 3; l++) + { + gotoTable[i][j][k][l] = s.readInt(); + } + } + } + } - // read gotoTable - int length = s.readInt(); - gotoTable = new int[length][][][]; - for(int i = 0; i < gotoTable.length; i++) - { - length = s.readInt(); - gotoTable[i] = new int[length][][]; - for(int j = 0; j < gotoTable[i].length; j++) - { - length = s.readInt(); - gotoTable[i][j] = new int[length][3]; - for(int k = 0; k < gotoTable[i][j].length; k++) - { - for(int l = 0; l < 3; l++) + // read accept + length = s.readInt(); + accept = new int[length][]; + for(int i = 0; i < accept.length; i++) { - gotoTable[i][j][k][l] = s.readInt(); + length = s.readInt(); + accept[i] = new int[length]; + for(int j = 0; j < accept[i].length; j++) + { + accept[i][j] = s.readInt(); + } } - } - } - } - // read accept - length = s.readInt(); - accept = new int[length][]; - for(int i = 0; i < accept.length; i++) - { - length = s.readInt(); - accept[i] = new int[length]; - for(int j = 0; j < accept[i].length; j++) + s.close(); + } + catch(IOException e) { - accept[i][j] = s.readInt(); + throw new RuntimeException("The file \"lexer.dat\" is either missing or corrupted.", e); } - } - - s.close(); - } - catch(Exception e) - { - throw new RuntimeException("The file \"lexer.dat\" is either missing or corrupted."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/lexer/LexerException.java b/src/main/java/org/sablecc/sablecc/lexer/LexerException.java index 3e888e4f7476f46e642d0dc3014f5434386d10ac..9ae73de75599db94002bc36552904cd6cd2b6adf 100644 --- a/src/main/java/org/sablecc/sablecc/lexer/LexerException.java +++ b/src/main/java/org/sablecc/sablecc/lexer/LexerException.java @@ -2,10 +2,11 @@ package org.sablecc.sablecc.lexer; +@SuppressWarnings({"serial"}) public class LexerException extends Exception { - public LexerException(String message) - { - super(message); - } + public LexerException(String message) + { + super(message); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AAlt.java b/src/main/java/org/sablecc/sablecc/node/AAlt.java index 97b1e8c2bea3a4c284edb644c6081bf2f74a7d53..144ab37c8b6026ac8124a54fcd0c01b4488abd2c 100644 --- a/src/main/java/org/sablecc/sablecc/node/AAlt.java +++ b/src/main/java/org/sablecc/sablecc/node/AAlt.java @@ -5,185 +5,194 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AAlt extends PAlt { - private TId _altName_; - private final LinkedList _elems_ = new TypedLinkedList(new Elems_Cast()); - private PAltTransform _altTransform_; - - public AAlt() - {} + private TId _altName_; + private final LinkedList<PElem> _elems_ = new LinkedList<PElem>(); + private PAltTransform _altTransform_; - public AAlt( - TId _altName_, - List _elems_, - PAltTransform _altTransform_) - { - setAltName(_altName_); + public AAlt() + { + // Constructor + } + public AAlt( + TId _altName_, + List<PElem> _elems_, + PAltTransform _altTransform_) { - this._elems_.clear(); - this._elems_.addAll(_elems_); + // Constructor + setAltName(_altName_); + + setElems(_elems_); + + setAltTransform(_altTransform_); + } - setAltTransform(_altTransform_); - - } - public Object clone() - { - return new AAlt( - (TId) cloneNode(_altName_), - cloneList(_elems_), - (PAltTransform) cloneNode(_altTransform_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAAlt(this); - } - - public TId getAltName() - { - return _altName_; - } - - public void setAltName(TId node) - { - if(_altName_ != null) + public AAlt(AAlt node) { - _altName_.parent(null); + super(node); + setAltName(cloneNode(node._altName_)); + setElems(cloneList(node._elems_)); + setAltTransform(cloneNode(node._altTransform_)); } - if(node != null) + @Override + public AAlt clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + return new AAlt(this); + } - node.parent(this); + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAAlt(this); } - _altName_ = node; - } + public TId getAltName() + { + return this._altName_; + } - public LinkedList getElems() - { - return _elems_; - } + public void setAltName(TId node) + { + if(this._altName_ != null) + { + this._altName_.parent(null); + } - public void setElems(List list) - { - _elems_.clear(); - _elems_.addAll(list); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - public PAltTransform getAltTransform() - { - return _altTransform_; - } + node.parent(this); + } - public void setAltTransform(PAltTransform node) - { - if(_altTransform_ != null) - { - _altTransform_.parent(null); + this._altName_ = node; } - if(node != null) + public LinkedList<PElem> getElems() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._elems_; } - _altTransform_ = node; - } + public void setElems(List<PElem> list) + { + for(PElem e : this._elems_) + { + e.parent(null); + } + this._elems_.clear(); - public String toString() - { - return "" - + toString(_altName_) - + toString(_elems_) - + toString(_altTransform_); - } + for(PElem e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } - void removeChild(Node child) - { - if(_altName_ == child) - { - _altName_ = null; - return; + e.parent(this); + this._elems_.add(e); + } } - if(_elems_.remove(child)) + public PAltTransform getAltTransform() { - return; + return this._altTransform_; } - if(_altTransform_ == child) + public void setAltTransform(PAltTransform node) { - _altTransform_ = null; - return; - } + if(this._altTransform_ != null) + { + this._altTransform_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - } + node.parent(this); + } + + this._altTransform_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_altName_ == oldChild) + @Override + public String toString() { - setAltName((TId) newChild); - return; + return "" + + toString(this._altName_) + + toString(this._elems_) + + toString(this._altTransform_); } - for(ListIterator i = _elems_.listIterator(); i.hasNext();) + @Override + void removeChild(Node child) { - if(i.next() == oldChild) - { - if(newChild != null) + // Remove child + if(this._altName_ == child) { - i.set(newChild); - oldChild.parent(null); - return; + this._altName_ = null; + return; } - i.remove(); - oldChild.parent(null); - return; - } - } + if(this._elems_.remove(child)) + { + return; + } - if(_altTransform_ == oldChild) - { - setAltTransform((PAltTransform) newChild); - return; - } + if(this._altTransform_ == child) + { + this._altTransform_ = null; + return; + } - } + throw new RuntimeException("Not a child."); + } - private class Elems_Cast implements Cast - { - public Object cast(Object o) + @Override + void replaceChild(Node oldChild, Node newChild) { - PElem node = (PElem) o; + // Replace child + if(this._altName_ == oldChild) + { + setAltName((TId) newChild); + return; + } - if((node.parent() != null) && - (node.parent() != AAlt.this)) - { - node.parent().removeChild(node); - } + for(ListIterator<PElem> i = this._elems_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PElem) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - if((node.parent() == null) || - (node.parent() != AAlt.this)) - { - node.parent(AAlt.this); - } + if(this._altTransform_ == oldChild) + { + setAltTransform((PAltTransform) newChild); + return; + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AAltTransform.java b/src/main/java/org/sablecc/sablecc/node/AAltTransform.java index 2cd658db4e855488e1d29be852c299301affece3..16c9d4d0bd2a81f4c7a9eb46321a683afe78222a 100644 --- a/src/main/java/org/sablecc/sablecc/node/AAltTransform.java +++ b/src/main/java/org/sablecc/sablecc/node/AAltTransform.java @@ -5,185 +5,194 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AAltTransform extends PAltTransform { - private TLBrace _lBrace_; - private final LinkedList _terms_ = new TypedLinkedList(new Terms_Cast()); - private TRBrace _rBrace_; - - public AAltTransform() - {} + private TLBrace _lBrace_; + private final LinkedList<PTerm> _terms_ = new LinkedList<PTerm>(); + private TRBrace _rBrace_; - public AAltTransform( - TLBrace _lBrace_, - List _terms_, - TRBrace _rBrace_) - { - setLBrace(_lBrace_); + public AAltTransform() + { + // Constructor + } + public AAltTransform( + TLBrace _lBrace_, + List<PTerm> _terms_, + TRBrace _rBrace_) { - this._terms_.clear(); - this._terms_.addAll(_terms_); + // Constructor + setLBrace(_lBrace_); + + setTerms(_terms_); + + setRBrace(_rBrace_); + } - setRBrace(_rBrace_); - - } - public Object clone() - { - return new AAltTransform( - (TLBrace) cloneNode(_lBrace_), - cloneList(_terms_), - (TRBrace) cloneNode(_rBrace_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAAltTransform(this); - } - - public TLBrace getLBrace() - { - return _lBrace_; - } - - public void setLBrace(TLBrace node) - { - if(_lBrace_ != null) + public AAltTransform(AAltTransform node) { - _lBrace_.parent(null); + super(node); + setLBrace(cloneNode(node._lBrace_)); + setTerms(cloneList(node._terms_)); + setRBrace(cloneNode(node._rBrace_)); } - if(node != null) + @Override + public AAltTransform clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + return new AAltTransform(this); + } - node.parent(this); + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAAltTransform(this); } - _lBrace_ = node; - } + public TLBrace getLBrace() + { + return this._lBrace_; + } - public LinkedList getTerms() - { - return _terms_; - } + public void setLBrace(TLBrace node) + { + if(this._lBrace_ != null) + { + this._lBrace_.parent(null); + } - public void setTerms(List list) - { - _terms_.clear(); - _terms_.addAll(list); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - public TRBrace getRBrace() - { - return _rBrace_; - } + node.parent(this); + } - public void setRBrace(TRBrace node) - { - if(_rBrace_ != null) - { - _rBrace_.parent(null); + this._lBrace_ = node; } - if(node != null) + public LinkedList<PTerm> getTerms() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._terms_; } - _rBrace_ = node; - } + public void setTerms(List<PTerm> list) + { + for(PTerm e : this._terms_) + { + e.parent(null); + } + this._terms_.clear(); - public String toString() - { - return "" - + toString(_lBrace_) - + toString(_terms_) - + toString(_rBrace_); - } + for(PTerm e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } - void removeChild(Node child) - { - if(_lBrace_ == child) - { - _lBrace_ = null; - return; + e.parent(this); + this._terms_.add(e); + } } - if(_terms_.remove(child)) + public TRBrace getRBrace() { - return; + return this._rBrace_; } - if(_rBrace_ == child) + public void setRBrace(TRBrace node) { - _rBrace_ = null; - return; - } + if(this._rBrace_ != null) + { + this._rBrace_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - } + node.parent(this); + } + + this._rBrace_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_lBrace_ == oldChild) + @Override + public String toString() { - setLBrace((TLBrace) newChild); - return; + return "" + + toString(this._lBrace_) + + toString(this._terms_) + + toString(this._rBrace_); } - for(ListIterator i = _terms_.listIterator(); i.hasNext();) + @Override + void removeChild(Node child) { - if(i.next() == oldChild) - { - if(newChild != null) + // Remove child + if(this._lBrace_ == child) { - i.set(newChild); - oldChild.parent(null); - return; + this._lBrace_ = null; + return; } - i.remove(); - oldChild.parent(null); - return; - } - } + if(this._terms_.remove(child)) + { + return; + } - if(_rBrace_ == oldChild) - { - setRBrace((TRBrace) newChild); - return; - } + if(this._rBrace_ == child) + { + this._rBrace_ = null; + return; + } - } + throw new RuntimeException("Not a child."); + } - private class Terms_Cast implements Cast - { - public Object cast(Object o) + @Override + void replaceChild(Node oldChild, Node newChild) { - PTerm node = (PTerm) o; + // Replace child + if(this._lBrace_ == oldChild) + { + setLBrace((TLBrace) newChild); + return; + } - if((node.parent() != null) && - (node.parent() != AAltTransform.this)) - { - node.parent().removeChild(node); - } + for(ListIterator<PTerm> i = this._terms_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PTerm) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - if((node.parent() == null) || - (node.parent() != AAltTransform.this)) - { - node.parent(AAltTransform.this); - } + if(this._rBrace_ == oldChild) + { + setRBrace((TRBrace) newChild); + return; + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AAst.java b/src/main/java/org/sablecc/sablecc/node/AAst.java index a7b682bfbaa84aa6f8d6a0611a1045d4c5448b57..c5002df4a52bc895fa0934205fe8c34aec79cafc 100644 --- a/src/main/java/org/sablecc/sablecc/node/AAst.java +++ b/src/main/java/org/sablecc/sablecc/node/AAst.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AAst extends PAst { - private final LinkedList _prods_ = new TypedLinkedList(new Prods_Cast()); + private final LinkedList<PAstProd> _prods_ = new LinkedList<PAstProd>(); + + public AAst() + { + // Constructor + } + + public AAst( + List<PAstProd> _prods_) + { + // Constructor + setProds(_prods_); - public AAst() - {} + } + + public AAst(AAst node) + { + super(node); + setProds(cloneList(node._prods_)); + } - public AAst( - List _prods_) - { + @Override + public AAst clone() { - this._prods_.clear(); - this._prods_.addAll(_prods_); + return new AAst(this); } - } - public Object clone() - { - return new AAst( - cloneList(_prods_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAAst(this); - } - - public LinkedList getProds() - { - return _prods_; - } - - public void setProds(List list) - { - _prods_.clear(); - _prods_.addAll(list); - } - - public String toString() - { - return "" - + toString(_prods_); - } - - void removeChild(Node child) - { - if(_prods_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseAAst(this); } - } + public LinkedList<PAstProd> getProds() + { + return this._prods_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _prods_.listIterator(); i.hasNext();) + public void setProds(List<PAstProd> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PAstProd e : this._prods_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._prods_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PAstProd e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._prods_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._prods_); + } - private class Prods_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PAstProd node = (PAstProd) o; + // Remove child + if(this._prods_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != AAst.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != AAst.this)) - { - node.parent(AAst.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<PAstProd> i = this._prods_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PAstProd) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AAstAlt.java b/src/main/java/org/sablecc/sablecc/node/AAstAlt.java index d47495f01ffd41e1fde80c0b7c005e54afcbc1c4..ade7c7e1ed01917d3f843d4dedb37d88c0a8b277 100644 --- a/src/main/java/org/sablecc/sablecc/node/AAstAlt.java +++ b/src/main/java/org/sablecc/sablecc/node/AAstAlt.java @@ -5,142 +5,151 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AAstAlt extends PAstAlt { - private TId _altName_; - private final LinkedList _elems_ = new TypedLinkedList(new Elems_Cast()); - - public AAstAlt() - {} - - public AAstAlt( - TId _altName_, - List _elems_) - { - setAltName(_altName_); + private TId _altName_; + private final LinkedList<PElem> _elems_ = new LinkedList<PElem>(); + public AAstAlt() { - this._elems_.clear(); - this._elems_.addAll(_elems_); + // Constructor } - } - public Object clone() - { - return new AAstAlt( - (TId) cloneNode(_altName_), - cloneList(_elems_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAAstAlt(this); - } - - public TId getAltName() - { - return _altName_; - } - - public void setAltName(TId node) - { - if(_altName_ != null) + public AAstAlt( + TId _altName_, + List<PElem> _elems_) { - _altName_.parent(null); + // Constructor + setAltName(_altName_); + + setElems(_elems_); + } - if(node != null) + public AAstAlt(AAstAlt node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setAltName(cloneNode(node._altName_)); + setElems(cloneList(node._elems_)); + } - node.parent(this); + @Override + public AAstAlt clone() + { + return new AAstAlt(this); } - _altName_ = node; - } - - public LinkedList getElems() - { - return _elems_; - } - - public void setElems(List list) - { - _elems_.clear(); - _elems_.addAll(list); - } - - public String toString() - { - return "" - + toString(_altName_) - + toString(_elems_); - } - - void removeChild(Node child) - { - if(_altName_ == child) + @Override + public void apply(Switch sw) { - _altName_ = null; - return; + ((Analysis) sw).caseAAstAlt(this); } - if(_elems_.remove(child)) + public TId getAltName() { - return; + return this._altName_; } - } + public void setAltName(TId node) + { + if(this._altName_ != null) + { + this._altName_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._altName_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_altName_ == oldChild) + public LinkedList<PElem> getElems() { - setAltName((TId) newChild); - return; + return this._elems_; } - for(ListIterator i = _elems_.listIterator(); i.hasNext();) + public void setElems(List<PElem> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PElem e : this._elems_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._elems_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PElem e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._elems_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._altName_) + + toString(this._elems_); + } - private class Elems_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PElem node = (PElem) o; + // Remove child + if(this._altName_ == child) + { + this._altName_ = null; + return; + } + + if(this._elems_.remove(child)) + { + return; + } + + throw new RuntimeException("Not a child."); + } - if((node.parent() != null) && - (node.parent() != AAstAlt.this)) - { - node.parent().removeChild(node); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._altName_ == oldChild) + { + setAltName((TId) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != AAstAlt.this)) - { - node.parent(AAstAlt.this); - } + for(ListIterator<PElem> i = this._elems_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PElem) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AAstProd.java b/src/main/java/org/sablecc/sablecc/node/AAstProd.java index 85ee56f6757ea068df17aa367c2848be04ef90ef..bf451c69cc0c9650809b694778c96d181ee0d73d 100644 --- a/src/main/java/org/sablecc/sablecc/node/AAstProd.java +++ b/src/main/java/org/sablecc/sablecc/node/AAstProd.java @@ -5,142 +5,151 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AAstProd extends PAstProd { - private TId _id_; - private final LinkedList _alts_ = new TypedLinkedList(new Alts_Cast()); - - public AAstProd() - {} - - public AAstProd( - TId _id_, - List _alts_) - { - setId(_id_); + private TId _id_; + private final LinkedList<PAstAlt> _alts_ = new LinkedList<PAstAlt>(); + public AAstProd() { - this._alts_.clear(); - this._alts_.addAll(_alts_); + // Constructor } - } - public Object clone() - { - return new AAstProd( - (TId) cloneNode(_id_), - cloneList(_alts_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAAstProd(this); - } - - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) + public AAstProd( + TId _id_, + List<PAstAlt> _alts_) { - _id_.parent(null); + // Constructor + setId(_id_); + + setAlts(_alts_); + } - if(node != null) + public AAstProd(AAstProd node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setId(cloneNode(node._id_)); + setAlts(cloneList(node._alts_)); + } - node.parent(this); + @Override + public AAstProd clone() + { + return new AAstProd(this); } - _id_ = node; - } - - public LinkedList getAlts() - { - return _alts_; - } - - public void setAlts(List list) - { - _alts_.clear(); - _alts_.addAll(list); - } - - public String toString() - { - return "" - + toString(_id_) - + toString(_alts_); - } - - void removeChild(Node child) - { - if(_id_ == child) + @Override + public void apply(Switch sw) { - _id_ = null; - return; + ((Analysis) sw).caseAAstProd(this); } - if(_alts_.remove(child)) + public TId getId() { - return; + return this._id_; } - } + public void setId(TId node) + { + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) + public LinkedList<PAstAlt> getAlts() { - setId((TId) newChild); - return; + return this._alts_; } - for(ListIterator i = _alts_.listIterator(); i.hasNext();) + public void setAlts(List<PAstAlt> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PAstAlt e : this._alts_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._alts_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PAstAlt e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._alts_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._id_) + + toString(this._alts_); + } - private class Alts_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PAstAlt node = (PAstAlt) o; + // Remove child + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._alts_.remove(child)) + { + return; + } + + throw new RuntimeException("Not a child."); + } - if((node.parent() != null) && - (node.parent() != AAstProd.this)) - { - node.parent().removeChild(node); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != AAstProd.this)) - { - node.parent(AAstProd.this); - } + for(ListIterator<PAstAlt> i = this._alts_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PAstAlt) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/ACharBasic.java b/src/main/java/org/sablecc/sablecc/node/ACharBasic.java index e0c320a4c6a570caa843bb7f82aa552cb41e0627..e2c2c290835a2f9a2063c212bfd8ffc0fcf1e239 100644 --- a/src/main/java/org/sablecc/sablecc/node/ACharBasic.java +++ b/src/main/java/org/sablecc/sablecc/node/ACharBasic.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ACharBasic extends PBasic { - private PChar _char_; - - public ACharBasic() - {} - - public ACharBasic( - PChar _char_) - { - setChar(_char_); - - } - public Object clone() - { - return new ACharBasic( - (PChar) cloneNode(_char_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseACharBasic(this); - } - - public PChar getChar() - { - return _char_; - } - - public void setChar(PChar node) - { - if(_char_ != null) + private PChar _char_; + + public ACharBasic() + { + // Constructor + } + + public ACharBasic( + PChar _char_) { - _char_.parent(null); + // Constructor + setChar(_char_); + } - if(node != null) + public ACharBasic(ACharBasic node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setChar(cloneNode(node._char_)); + } - node.parent(this); + @Override + public ACharBasic clone() + { + return new ACharBasic(this); } - _char_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseACharBasic(this); + } - public String toString() - { - return "" - + toString(_char_); - } + public PChar getChar() + { + return this._char_; + } - void removeChild(Node child) - { - if(_char_ == child) + public void setChar(PChar node) { - _char_ = null; - return; + if(this._char_ != null) + { + this._char_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._char_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._char_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_char_ == oldChild) + @Override + void removeChild(Node child) { - setChar((PChar) newChild); - return; + // Remove child + if(this._char_ == child) + { + this._char_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._char_ == oldChild) + { + setChar((PChar) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ACharChar.java b/src/main/java/org/sablecc/sablecc/node/ACharChar.java index e7cd222435b6bd1f3cf3f63fa7e9371dad025b29..c843556274ff14ff8c5ed26eba4085bce641344a 100644 --- a/src/main/java/org/sablecc/sablecc/node/ACharChar.java +++ b/src/main/java/org/sablecc/sablecc/node/ACharChar.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ACharChar extends PChar { - private TChar _char_; - - public ACharChar() - {} - - public ACharChar( - TChar _char_) - { - setChar(_char_); - - } - public Object clone() - { - return new ACharChar( - (TChar) cloneNode(_char_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseACharChar(this); - } - - public TChar getChar() - { - return _char_; - } - - public void setChar(TChar node) - { - if(_char_ != null) + private TChar _char_; + + public ACharChar() + { + // Constructor + } + + public ACharChar( + TChar _char_) { - _char_.parent(null); + // Constructor + setChar(_char_); + } - if(node != null) + public ACharChar(ACharChar node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setChar(cloneNode(node._char_)); + } - node.parent(this); + @Override + public ACharChar clone() + { + return new ACharChar(this); } - _char_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseACharChar(this); + } - public String toString() - { - return "" - + toString(_char_); - } + public TChar getChar() + { + return this._char_; + } - void removeChild(Node child) - { - if(_char_ == child) + public void setChar(TChar node) { - _char_ = null; - return; + if(this._char_ != null) + { + this._char_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._char_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._char_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_char_ == oldChild) + @Override + void removeChild(Node child) { - setChar((TChar) newChild); - return; + // Remove child + if(this._char_ == child) + { + this._char_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._char_ == oldChild) + { + setChar((TChar) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AConcat.java b/src/main/java/org/sablecc/sablecc/node/AConcat.java index 41a8d0b871da0b6923eaa709b7c7ffd7d8ac501e..a3c666d899b9eba07d7f60c3d1dd7c14f86aefa7 100644 --- a/src/main/java/org/sablecc/sablecc/node/AConcat.java +++ b/src/main/java/org/sablecc/sablecc/node/AConcat.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AConcat extends PConcat { - private final LinkedList _unExps_ = new TypedLinkedList(new UnExps_Cast()); + private final LinkedList<PUnExp> _unExps_ = new LinkedList<PUnExp>(); + + public AConcat() + { + // Constructor + } + + public AConcat( + List<PUnExp> _unExps_) + { + // Constructor + setUnExps(_unExps_); - public AConcat() - {} + } + + public AConcat(AConcat node) + { + super(node); + setUnExps(cloneList(node._unExps_)); + } - public AConcat( - List _unExps_) - { + @Override + public AConcat clone() { - this._unExps_.clear(); - this._unExps_.addAll(_unExps_); + return new AConcat(this); } - } - public Object clone() - { - return new AConcat( - cloneList(_unExps_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAConcat(this); - } - - public LinkedList getUnExps() - { - return _unExps_; - } - - public void setUnExps(List list) - { - _unExps_.clear(); - _unExps_.addAll(list); - } - - public String toString() - { - return "" - + toString(_unExps_); - } - - void removeChild(Node child) - { - if(_unExps_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseAConcat(this); } - } + public LinkedList<PUnExp> getUnExps() + { + return this._unExps_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _unExps_.listIterator(); i.hasNext();) + public void setUnExps(List<PUnExp> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PUnExp e : this._unExps_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._unExps_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PUnExp e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._unExps_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._unExps_); + } - private class UnExps_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PUnExp node = (PUnExp) o; + // Remove child + if(this._unExps_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != AConcat.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != AConcat.this)) - { - node.parent(AConcat.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<PUnExp> i = this._unExps_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PUnExp) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/ADecChar.java b/src/main/java/org/sablecc/sablecc/node/ADecChar.java index 6807187fd1618b45fc2026557ac652209990422f..31c50336ad18ef60fe1ef63de05d70f27111b186 100644 --- a/src/main/java/org/sablecc/sablecc/node/ADecChar.java +++ b/src/main/java/org/sablecc/sablecc/node/ADecChar.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ADecChar extends PChar { - private TDecChar _decChar_; - - public ADecChar() - {} - - public ADecChar( - TDecChar _decChar_) - { - setDecChar(_decChar_); - - } - public Object clone() - { - return new ADecChar( - (TDecChar) cloneNode(_decChar_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseADecChar(this); - } - - public TDecChar getDecChar() - { - return _decChar_; - } - - public void setDecChar(TDecChar node) - { - if(_decChar_ != null) + private TDecChar _decChar_; + + public ADecChar() + { + // Constructor + } + + public ADecChar( + TDecChar _decChar_) { - _decChar_.parent(null); + // Constructor + setDecChar(_decChar_); + } - if(node != null) + public ADecChar(ADecChar node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setDecChar(cloneNode(node._decChar_)); + } - node.parent(this); + @Override + public ADecChar clone() + { + return new ADecChar(this); } - _decChar_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseADecChar(this); + } - public String toString() - { - return "" - + toString(_decChar_); - } + public TDecChar getDecChar() + { + return this._decChar_; + } - void removeChild(Node child) - { - if(_decChar_ == child) + public void setDecChar(TDecChar node) { - _decChar_ = null; - return; + if(this._decChar_ != null) + { + this._decChar_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._decChar_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._decChar_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_decChar_ == oldChild) + @Override + void removeChild(Node child) { - setDecChar((TDecChar) newChild); - return; + // Remove child + if(this._decChar_ == child) + { + this._decChar_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._decChar_ == oldChild) + { + setDecChar((TDecChar) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AElem.java b/src/main/java/org/sablecc/sablecc/node/AElem.java index 891d0b6d5b006384394a72f151fdcd9d6f92063c..70985fa2053b5bd3e69a3d48e2e7d94c07881e34 100644 --- a/src/main/java/org/sablecc/sablecc/node/AElem.java +++ b/src/main/java/org/sablecc/sablecc/node/AElem.java @@ -2,210 +2,228 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AElem extends PElem { - private TId _elemName_; - private PSpecifier _specifier_; - private TId _id_; - private PUnOp _unOp_; - - public AElem() - {} + private TId _elemName_; + private PSpecifier _specifier_; + private TId _id_; + private PUnOp _unOp_; - public AElem( - TId _elemName_, - PSpecifier _specifier_, - TId _id_, - PUnOp _unOp_) - { - setElemName(_elemName_); - - setSpecifier(_specifier_); + public AElem() + { + // Constructor + } - setId(_id_); + public AElem( + TId _elemName_, + PSpecifier _specifier_, + TId _id_, + PUnOp _unOp_) + { + // Constructor + setElemName(_elemName_); - setUnOp(_unOp_); + setSpecifier(_specifier_); - } - public Object clone() - { - return new AElem( - (TId) cloneNode(_elemName_), - (PSpecifier) cloneNode(_specifier_), - (TId) cloneNode(_id_), - (PUnOp) cloneNode(_unOp_)); - } + setId(_id_); - public void apply(Switch sw) - { - ((Analysis) sw).caseAElem(this); - } + setUnOp(_unOp_); - public TId getElemName() - { - return _elemName_; - } + } - public void setElemName(TId node) - { - if(_elemName_ != null) + public AElem(AElem node) { - _elemName_.parent(null); + super(node); + setElemName(cloneNode(node._elemName_)); + setSpecifier(cloneNode(node._specifier_)); + setId(cloneNode(node._id_)); + setUnOp(cloneNode(node._unOp_)); } - if(node != null) + @Override + public AElem clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AElem(this); } - _elemName_ = node; - } - - public PSpecifier getSpecifier() - { - return _specifier_; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAElem(this); + } - public void setSpecifier(PSpecifier node) - { - if(_specifier_ != null) + public TId getElemName() { - _specifier_.parent(null); + return this._elemName_; } - if(node != null) + public void setElemName(TId node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._elemName_ != null) + { + this._elemName_.parent(null); + } - node.parent(this); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - _specifier_ = node; - } + node.parent(this); + } - public TId getId() - { - return _id_; - } + this._elemName_ = node; + } - public void setId(TId node) - { - if(_id_ != null) + public PSpecifier getSpecifier() { - _id_.parent(null); + return this._specifier_; } - if(node != null) + public void setSpecifier(PSpecifier node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._specifier_ != null) + { + this._specifier_.parent(null); + } - node.parent(this); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - _id_ = node; - } + node.parent(this); + } - public PUnOp getUnOp() - { - return _unOp_; - } + this._specifier_ = node; + } - public void setUnOp(PUnOp node) - { - if(_unOp_ != null) + public TId getId() { - _unOp_.parent(null); + return this._id_; } - if(node != null) + public void setId(TId node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._id_ != null) + { + this._id_.parent(null); + } - node.parent(this); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - _unOp_ = node; - } + node.parent(this); + } - public String toString() - { - return "" - + toString(_elemName_) - + toString(_specifier_) - + toString(_id_) - + toString(_unOp_); - } - - void removeChild(Node child) - { - if(_elemName_ == child) - { - _elemName_ = null; - return; + this._id_ = node; } - if(_specifier_ == child) + public PUnOp getUnOp() { - _specifier_ = null; - return; + return this._unOp_; } - if(_id_ == child) + public void setUnOp(PUnOp node) { - _id_ = null; - return; - } + if(this._unOp_ != null) + { + this._unOp_.parent(null); + } - if(_unOp_ == child) - { - _unOp_ = null; - return; - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - } + node.parent(this); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_elemName_ == oldChild) - { - setElemName((TId) newChild); - return; + this._unOp_ = node; } - if(_specifier_ == oldChild) + @Override + public String toString() { - setSpecifier((PSpecifier) newChild); - return; + return "" + + toString(this._elemName_) + + toString(this._specifier_) + + toString(this._id_) + + toString(this._unOp_); } - if(_id_ == oldChild) + @Override + void removeChild(Node child) { - setId((TId) newChild); - return; + // Remove child + if(this._elemName_ == child) + { + this._elemName_ = null; + return; + } + + if(this._specifier_ == child) + { + this._specifier_ = null; + return; + } + + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._unOp_ == child) + { + this._unOp_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - if(_unOp_ == oldChild) + @Override + void replaceChild(Node oldChild, Node newChild) { - setUnOp((PUnOp) newChild); - return; - } + // Replace child + if(this._elemName_ == oldChild) + { + setElemName((TId) newChild); + return; + } + + if(this._specifier_ == oldChild) + { + setSpecifier((PSpecifier) newChild); + return; + } - } + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + if(this._unOp_ == oldChild) + { + setUnOp((PUnOp) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AGrammar.java b/src/main/java/org/sablecc/sablecc/node/AGrammar.java index c8b4fb302c10164703ac6c0ca6a3fa0a4573330a..1408be174f1495e9d50121985c3ab83e92401a2c 100644 --- a/src/main/java/org/sablecc/sablecc/node/AGrammar.java +++ b/src/main/java/org/sablecc/sablecc/node/AGrammar.java @@ -5,357 +5,366 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AGrammar extends PGrammar { - private final LinkedList _package_ = new TypedLinkedList(new Package_Cast()); - private PHelpers _helpers_; - private PStates _states_; - private PTokens _tokens_; - private PIgnTokens _ignTokens_; - private PProductions _productions_; - private PAst _ast_; - - public AGrammar() - {} - - public AGrammar( - List _package_, - PHelpers _helpers_, - PStates _states_, - PTokens _tokens_, - PIgnTokens _ignTokens_, - PProductions _productions_, - PAst _ast_) - { + private final LinkedList<TPkgId> _package_ = new LinkedList<TPkgId>(); + private PHelpers _helpers_; + private PStates _states_; + private PTokens _tokens_; + private PIgnTokens _ignTokens_; + private PProductions _productions_; + private PAst _ast_; + + public AGrammar() { - this._package_.clear(); - this._package_.addAll(_package_); + // Constructor } - setHelpers(_helpers_); - - setStates(_states_); - - setTokens(_tokens_); - - setIgnTokens(_ignTokens_); + public AGrammar( + List<TPkgId> _package_, + PHelpers _helpers_, + PStates _states_, + PTokens _tokens_, + PIgnTokens _ignTokens_, + PProductions _productions_, + PAst _ast_) + { + // Constructor + setPackage(_package_); - setProductions(_productions_); + setHelpers(_helpers_); - setAst(_ast_); + setStates(_states_); - } - public Object clone() - { - return new AGrammar( - cloneList(_package_), - (PHelpers) cloneNode(_helpers_), - (PStates) cloneNode(_states_), - (PTokens) cloneNode(_tokens_), - (PIgnTokens) cloneNode(_ignTokens_), - (PProductions) cloneNode(_productions_), - (PAst) cloneNode(_ast_)); - } + setTokens(_tokens_); - public void apply(Switch sw) - { - ((Analysis) sw).caseAGrammar(this); - } + setIgnTokens(_ignTokens_); - public LinkedList getPackage() - { - return _package_; - } + setProductions(_productions_); - public void setPackage(List list) - { - _package_.clear(); - _package_.addAll(list); - } + setAst(_ast_); - public PHelpers getHelpers() - { - return _helpers_; - } + } - public void setHelpers(PHelpers node) - { - if(_helpers_ != null) + public AGrammar(AGrammar node) { - _helpers_.parent(null); + super(node); + setPackage(cloneList(node._package_)); + setHelpers(cloneNode(node._helpers_)); + setStates(cloneNode(node._states_)); + setTokens(cloneNode(node._tokens_)); + setIgnTokens(cloneNode(node._ignTokens_)); + setProductions(cloneNode(node._productions_)); + setAst(cloneNode(node._ast_)); } - if(node != null) + @Override + public AGrammar clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AGrammar(this); } - _helpers_ = node; - } - - public PStates getStates() - { - return _states_; - } - - public void setStates(PStates node) - { - if(_states_ != null) + @Override + public void apply(Switch sw) { - _states_.parent(null); + ((Analysis) sw).caseAGrammar(this); } - if(node != null) + public LinkedList<TPkgId> getPackage() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._package_; } - _states_ = node; - } + public void setPackage(List<TPkgId> list) + { + for(TPkgId e : this._package_) + { + e.parent(null); + } + this._package_.clear(); - public PTokens getTokens() - { - return _tokens_; - } + for(TPkgId e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._package_.add(e); + } + } - public void setTokens(PTokens node) - { - if(_tokens_ != null) + public PHelpers getHelpers() { - _tokens_.parent(null); + return this._helpers_; } - if(node != null) + public void setHelpers(PHelpers node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._helpers_ != null) + { + this._helpers_.parent(null); + } - node.parent(this); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - _tokens_ = node; - } + node.parent(this); + } - public PIgnTokens getIgnTokens() - { - return _ignTokens_; - } + this._helpers_ = node; + } - public void setIgnTokens(PIgnTokens node) - { - if(_ignTokens_ != null) + public PStates getStates() { - _ignTokens_.parent(null); + return this._states_; } - if(node != null) + public void setStates(PStates node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._states_ != null) + { + this._states_.parent(null); + } - node.parent(this); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - _ignTokens_ = node; - } + node.parent(this); + } - public PProductions getProductions() - { - return _productions_; - } + this._states_ = node; + } - public void setProductions(PProductions node) - { - if(_productions_ != null) + public PTokens getTokens() { - _productions_.parent(null); + return this._tokens_; } - if(node != null) + public void setTokens(PTokens node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._tokens_ != null) + { + this._tokens_.parent(null); + } - node.parent(this); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - _productions_ = node; - } + node.parent(this); + } - public PAst getAst() - { - return _ast_; - } + this._tokens_ = node; + } - public void setAst(PAst node) - { - if(_ast_ != null) + public PIgnTokens getIgnTokens() { - _ast_.parent(null); + return this._ignTokens_; } - if(node != null) + public void setIgnTokens(PIgnTokens node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._ignTokens_ != null) + { + this._ignTokens_.parent(null); + } - node.parent(this); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - _ast_ = node; - } - - public String toString() - { - return "" - + toString(_package_) - + toString(_helpers_) - + toString(_states_) - + toString(_tokens_) - + toString(_ignTokens_) - + toString(_productions_) - + toString(_ast_); - } - - void removeChild(Node child) - { - if(_package_.remove(child)) - { - return; + node.parent(this); + } + + this._ignTokens_ = node; } - if(_helpers_ == child) + public PProductions getProductions() { - _helpers_ = null; - return; + return this._productions_; } - if(_states_ == child) + public void setProductions(PProductions node) { - _states_ = null; - return; + if(this._productions_ != null) + { + this._productions_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._productions_ = node; } - if(_tokens_ == child) + public PAst getAst() { - _tokens_ = null; - return; + return this._ast_; } - if(_ignTokens_ == child) + public void setAst(PAst node) { - _ignTokens_ = null; - return; + if(this._ast_ != null) + { + this._ast_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._ast_ = node; } - if(_productions_ == child) + @Override + public String toString() { - _productions_ = null; - return; + return "" + + toString(this._package_) + + toString(this._helpers_) + + toString(this._states_) + + toString(this._tokens_) + + toString(this._ignTokens_) + + toString(this._productions_) + + toString(this._ast_); } - if(_ast_ == child) + @Override + void removeChild(Node child) { - _ast_ = null; - return; - } + // Remove child + if(this._package_.remove(child)) + { + return; + } - } + if(this._helpers_ == child) + { + this._helpers_ = null; + return; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _package_.listIterator(); i.hasNext();) - { - if(i.next() == oldChild) - { - if(newChild != null) + if(this._states_ == child) { - i.set(newChild); - oldChild.parent(null); - return; + this._states_ = null; + return; } - i.remove(); - oldChild.parent(null); - return; - } - } + if(this._tokens_ == child) + { + this._tokens_ = null; + return; + } - if(_helpers_ == oldChild) - { - setHelpers((PHelpers) newChild); - return; - } + if(this._ignTokens_ == child) + { + this._ignTokens_ = null; + return; + } - if(_states_ == oldChild) - { - setStates((PStates) newChild); - return; - } + if(this._productions_ == child) + { + this._productions_ = null; + return; + } - if(_tokens_ == oldChild) - { - setTokens((PTokens) newChild); - return; - } + if(this._ast_ == child) + { + this._ast_ = null; + return; + } - if(_ignTokens_ == oldChild) - { - setIgnTokens((PIgnTokens) newChild); - return; + throw new RuntimeException("Not a child."); } - if(_productions_ == oldChild) + @Override + void replaceChild(Node oldChild, Node newChild) { - setProductions((PProductions) newChild); - return; - } + // Replace child + for(ListIterator<TPkgId> i = this._package_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((TPkgId) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - if(_ast_ == oldChild) - { - setAst((PAst) newChild); - return; - } + if(this._helpers_ == oldChild) + { + setHelpers((PHelpers) newChild); + return; + } - } + if(this._states_ == oldChild) + { + setStates((PStates) newChild); + return; + } - private class Package_Cast implements Cast - { - public Object cast(Object o) - { - TPkgId node = (TPkgId) o; + if(this._tokens_ == oldChild) + { + setTokens((PTokens) newChild); + return; + } + + if(this._ignTokens_ == oldChild) + { + setIgnTokens((PIgnTokens) newChild); + return; + } - if((node.parent() != null) && - (node.parent() != AGrammar.this)) - { - node.parent().removeChild(node); - } + if(this._productions_ == oldChild) + { + setProductions((PProductions) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != AGrammar.this)) - { - node.parent(AGrammar.this); - } + if(this._ast_ == oldChild) + { + setAst((PAst) newChild); + return; + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AHelperDef.java b/src/main/java/org/sablecc/sablecc/node/AHelperDef.java index d9cff12b336513171cfbf58c78989d60fb1cc799..872f966d1c3f06975db23d335cc41d9ea212b2fa 100644 --- a/src/main/java/org/sablecc/sablecc/node/AHelperDef.java +++ b/src/main/java/org/sablecc/sablecc/node/AHelperDef.java @@ -2,124 +2,142 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AHelperDef extends PHelperDef { - private TId _id_; - private PRegExp _regExp_; - - public AHelperDef() - {} - - public AHelperDef( - TId _id_, - PRegExp _regExp_) - { - setId(_id_); - - setRegExp(_regExp_); - - } - public Object clone() - { - return new AHelperDef( - (TId) cloneNode(_id_), - (PRegExp) cloneNode(_regExp_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAHelperDef(this); - } - - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) + private TId _id_; + private PRegExp _regExp_; + + public AHelperDef() { - _id_.parent(null); + // Constructor } - if(node != null) + public AHelperDef( + TId _id_, + PRegExp _regExp_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); - } + // Constructor + setId(_id_); - _id_ = node; - } + setRegExp(_regExp_); - public PRegExp getRegExp() - { - return _regExp_; - } + } - public void setRegExp(PRegExp node) - { - if(_regExp_ != null) + public AHelperDef(AHelperDef node) { - _regExp_.parent(null); + super(node); + setId(cloneNode(node._id_)); + setRegExp(cloneNode(node._regExp_)); } - if(node != null) + @Override + public AHelperDef clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AHelperDef(this); } - _regExp_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAHelperDef(this); + } - public String toString() - { - return "" - + toString(_id_) - + toString(_regExp_); - } + public TId getId() + { + return this._id_; + } - void removeChild(Node child) - { - if(_id_ == child) + public void setId(TId node) { - _id_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - if(_regExp_ == child) + public PRegExp getRegExp() { - _regExp_ = null; - return; + return this._regExp_; } - } + public void setRegExp(PRegExp node) + { + if(this._regExp_ != null) + { + this._regExp_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._regExp_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) + @Override + public String toString() { - setId((TId) newChild); - return; + return "" + + toString(this._id_) + + toString(this._regExp_); } - if(_regExp_ == oldChild) + @Override + void removeChild(Node child) { - setRegExp((PRegExp) newChild); - return; + // Remove child + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._regExp_ == child) + { + this._regExp_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + if(this._regExp_ == oldChild) + { + setRegExp((PRegExp) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AHelpers.java b/src/main/java/org/sablecc/sablecc/node/AHelpers.java index 0b9caec600e5c0c2ec2a0d4c407dbf6133eead05..5b5f96a2fc755b92da1c790d5ed37651689977a9 100644 --- a/src/main/java/org/sablecc/sablecc/node/AHelpers.java +++ b/src/main/java/org/sablecc/sablecc/node/AHelpers.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AHelpers extends PHelpers { - private final LinkedList _helperDefs_ = new TypedLinkedList(new HelperDefs_Cast()); + private final LinkedList<PHelperDef> _helperDefs_ = new LinkedList<PHelperDef>(); + + public AHelpers() + { + // Constructor + } + + public AHelpers( + List<PHelperDef> _helperDefs_) + { + // Constructor + setHelperDefs(_helperDefs_); - public AHelpers() - {} + } + + public AHelpers(AHelpers node) + { + super(node); + setHelperDefs(cloneList(node._helperDefs_)); + } - public AHelpers( - List _helperDefs_) - { + @Override + public AHelpers clone() { - this._helperDefs_.clear(); - this._helperDefs_.addAll(_helperDefs_); + return new AHelpers(this); } - } - public Object clone() - { - return new AHelpers( - cloneList(_helperDefs_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAHelpers(this); - } - - public LinkedList getHelperDefs() - { - return _helperDefs_; - } - - public void setHelperDefs(List list) - { - _helperDefs_.clear(); - _helperDefs_.addAll(list); - } - - public String toString() - { - return "" - + toString(_helperDefs_); - } - - void removeChild(Node child) - { - if(_helperDefs_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseAHelpers(this); } - } + public LinkedList<PHelperDef> getHelperDefs() + { + return this._helperDefs_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _helperDefs_.listIterator(); i.hasNext();) + public void setHelperDefs(List<PHelperDef> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PHelperDef e : this._helperDefs_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._helperDefs_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PHelperDef e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._helperDefs_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._helperDefs_); + } - private class HelperDefs_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PHelperDef node = (PHelperDef) o; + // Remove child + if(this._helperDefs_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != AHelpers.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != AHelpers.this)) - { - node.parent(AHelpers.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<PHelperDef> i = this._helperDefs_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PHelperDef) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AHexChar.java b/src/main/java/org/sablecc/sablecc/node/AHexChar.java index 8d047cff9bd7ba43fee2c85bc8c137280ead16cf..03913724395d8f7bee061d6a68c0bb2d8c8a0f8d 100644 --- a/src/main/java/org/sablecc/sablecc/node/AHexChar.java +++ b/src/main/java/org/sablecc/sablecc/node/AHexChar.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AHexChar extends PChar { - private THexChar _hexChar_; - - public AHexChar() - {} - - public AHexChar( - THexChar _hexChar_) - { - setHexChar(_hexChar_); - - } - public Object clone() - { - return new AHexChar( - (THexChar) cloneNode(_hexChar_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAHexChar(this); - } - - public THexChar getHexChar() - { - return _hexChar_; - } - - public void setHexChar(THexChar node) - { - if(_hexChar_ != null) + private THexChar _hexChar_; + + public AHexChar() + { + // Constructor + } + + public AHexChar( + THexChar _hexChar_) { - _hexChar_.parent(null); + // Constructor + setHexChar(_hexChar_); + } - if(node != null) + public AHexChar(AHexChar node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setHexChar(cloneNode(node._hexChar_)); + } - node.parent(this); + @Override + public AHexChar clone() + { + return new AHexChar(this); } - _hexChar_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAHexChar(this); + } - public String toString() - { - return "" - + toString(_hexChar_); - } + public THexChar getHexChar() + { + return this._hexChar_; + } - void removeChild(Node child) - { - if(_hexChar_ == child) + public void setHexChar(THexChar node) { - _hexChar_ = null; - return; + if(this._hexChar_ != null) + { + this._hexChar_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._hexChar_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._hexChar_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_hexChar_ == oldChild) + @Override + void removeChild(Node child) { - setHexChar((THexChar) newChild); - return; + // Remove child + if(this._hexChar_ == child) + { + this._hexChar_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._hexChar_ == oldChild) + { + setHexChar((THexChar) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AIdBasic.java b/src/main/java/org/sablecc/sablecc/node/AIdBasic.java index a3ea1f7ef53b047f3e1d22033875929acd9da4bd..8ce3a09337bf32bc4de18b083f419640490b6f4b 100644 --- a/src/main/java/org/sablecc/sablecc/node/AIdBasic.java +++ b/src/main/java/org/sablecc/sablecc/node/AIdBasic.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AIdBasic extends PBasic { - private TId _id_; - - public AIdBasic() - {} - - public AIdBasic( - TId _id_) - { - setId(_id_); - - } - public Object clone() - { - return new AIdBasic( - (TId) cloneNode(_id_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAIdBasic(this); - } - - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) + private TId _id_; + + public AIdBasic() + { + // Constructor + } + + public AIdBasic( + TId _id_) { - _id_.parent(null); + // Constructor + setId(_id_); + } - if(node != null) + public AIdBasic(AIdBasic node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setId(cloneNode(node._id_)); + } - node.parent(this); + @Override + public AIdBasic clone() + { + return new AIdBasic(this); } - _id_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAIdBasic(this); + } - public String toString() - { - return "" - + toString(_id_); - } + public TId getId() + { + return this._id_; + } - void removeChild(Node child) - { - if(_id_ == child) + public void setId(TId node) { - _id_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._id_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) + @Override + void removeChild(Node child) { - setId((TId) newChild); - return; + // Remove child + if(this._id_ == child) + { + this._id_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AIgnTokens.java b/src/main/java/org/sablecc/sablecc/node/AIgnTokens.java index 872eb2718c957c0b7df24a1e8f9c7e0e90b6e026..4e89102c1903fe8b3ccd83a88ae9a6d4ffdb3600 100644 --- a/src/main/java/org/sablecc/sablecc/node/AIgnTokens.java +++ b/src/main/java/org/sablecc/sablecc/node/AIgnTokens.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AIgnTokens extends PIgnTokens { - private final LinkedList _listId_ = new TypedLinkedList(new ListId_Cast()); + private final LinkedList<TId> _listId_ = new LinkedList<TId>(); + + public AIgnTokens() + { + // Constructor + } + + public AIgnTokens( + List<TId> _listId_) + { + // Constructor + setListId(_listId_); - public AIgnTokens() - {} + } + + public AIgnTokens(AIgnTokens node) + { + super(node); + setListId(cloneList(node._listId_)); + } - public AIgnTokens( - List _listId_) - { + @Override + public AIgnTokens clone() { - this._listId_.clear(); - this._listId_.addAll(_listId_); + return new AIgnTokens(this); } - } - public Object clone() - { - return new AIgnTokens( - cloneList(_listId_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAIgnTokens(this); - } - - public LinkedList getListId() - { - return _listId_; - } - - public void setListId(List list) - { - _listId_.clear(); - _listId_.addAll(list); - } - - public String toString() - { - return "" - + toString(_listId_); - } - - void removeChild(Node child) - { - if(_listId_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseAIgnTokens(this); } - } + public LinkedList<TId> getListId() + { + return this._listId_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _listId_.listIterator(); i.hasNext();) + public void setListId(List<TId> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(TId e : this._listId_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._listId_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(TId e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._listId_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._listId_); + } - private class ListId_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - TId node = (TId) o; + // Remove child + if(this._listId_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != AIgnTokens.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != AIgnTokens.this)) - { - node.parent(AIgnTokens.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<TId> i = this._listId_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((TId) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AIntervalSet.java b/src/main/java/org/sablecc/sablecc/node/AIntervalSet.java index d9c40f94616d0813196d1c3326f21b899021c8bf..dbd1b004938d96aba08682da410bcc1eb8e67293 100644 --- a/src/main/java/org/sablecc/sablecc/node/AIntervalSet.java +++ b/src/main/java/org/sablecc/sablecc/node/AIntervalSet.java @@ -2,124 +2,142 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AIntervalSet extends PSet { - private PChar _left_; - private PChar _right_; - - public AIntervalSet() - {} - - public AIntervalSet( - PChar _left_, - PChar _right_) - { - setLeft(_left_); - - setRight(_right_); - - } - public Object clone() - { - return new AIntervalSet( - (PChar) cloneNode(_left_), - (PChar) cloneNode(_right_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAIntervalSet(this); - } - - public PChar getLeft() - { - return _left_; - } - - public void setLeft(PChar node) - { - if(_left_ != null) + private PChar _left_; + private PChar _right_; + + public AIntervalSet() { - _left_.parent(null); + // Constructor } - if(node != null) + public AIntervalSet( + PChar _left_, + PChar _right_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); - } + // Constructor + setLeft(_left_); - _left_ = node; - } + setRight(_right_); - public PChar getRight() - { - return _right_; - } + } - public void setRight(PChar node) - { - if(_right_ != null) + public AIntervalSet(AIntervalSet node) { - _right_.parent(null); + super(node); + setLeft(cloneNode(node._left_)); + setRight(cloneNode(node._right_)); } - if(node != null) + @Override + public AIntervalSet clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AIntervalSet(this); } - _right_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAIntervalSet(this); + } - public String toString() - { - return "" - + toString(_left_) - + toString(_right_); - } + public PChar getLeft() + { + return this._left_; + } - void removeChild(Node child) - { - if(_left_ == child) + public void setLeft(PChar node) { - _left_ = null; - return; + if(this._left_ != null) + { + this._left_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._left_ = node; } - if(_right_ == child) + public PChar getRight() { - _right_ = null; - return; + return this._right_; } - } + public void setRight(PChar node) + { + if(this._right_ != null) + { + this._right_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._right_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_left_ == oldChild) + @Override + public String toString() { - setLeft((PChar) newChild); - return; + return "" + + toString(this._left_) + + toString(this._right_); } - if(_right_ == oldChild) + @Override + void removeChild(Node child) { - setRight((PChar) newChild); - return; + // Remove child + if(this._left_ == child) + { + this._left_ = null; + return; + } + + if(this._right_ == child) + { + this._right_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._left_ == oldChild) + { + setLeft((PChar) newChild); + return; + } + + if(this._right_ == oldChild) + { + setRight((PChar) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AListTerm.java b/src/main/java/org/sablecc/sablecc/node/AListTerm.java index 7a0a593e5dcd03044756dad400022edd44e179d2..33ef29cd0c671b9d752bbd7bb36b46c79a776b9d 100644 --- a/src/main/java/org/sablecc/sablecc/node/AListTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/AListTerm.java @@ -5,142 +5,151 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AListTerm extends PTerm { - private TLBkt _lBkt_; - private final LinkedList _listTerms_ = new TypedLinkedList(new ListTerms_Cast()); - - public AListTerm() - {} - - public AListTerm( - TLBkt _lBkt_, - List _listTerms_) - { - setLBkt(_lBkt_); + private TLBkt _lBkt_; + private final LinkedList<PListTerm> _listTerms_ = new LinkedList<PListTerm>(); + public AListTerm() { - this._listTerms_.clear(); - this._listTerms_.addAll(_listTerms_); + // Constructor } - } - public Object clone() - { - return new AListTerm( - (TLBkt) cloneNode(_lBkt_), - cloneList(_listTerms_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAListTerm(this); - } - - public TLBkt getLBkt() - { - return _lBkt_; - } - - public void setLBkt(TLBkt node) - { - if(_lBkt_ != null) + public AListTerm( + TLBkt _lBkt_, + List<PListTerm> _listTerms_) { - _lBkt_.parent(null); + // Constructor + setLBkt(_lBkt_); + + setListTerms(_listTerms_); + } - if(node != null) + public AListTerm(AListTerm node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setLBkt(cloneNode(node._lBkt_)); + setListTerms(cloneList(node._listTerms_)); + } - node.parent(this); + @Override + public AListTerm clone() + { + return new AListTerm(this); } - _lBkt_ = node; - } - - public LinkedList getListTerms() - { - return _listTerms_; - } - - public void setListTerms(List list) - { - _listTerms_.clear(); - _listTerms_.addAll(list); - } - - public String toString() - { - return "" - + toString(_lBkt_) - + toString(_listTerms_); - } - - void removeChild(Node child) - { - if(_lBkt_ == child) + @Override + public void apply(Switch sw) { - _lBkt_ = null; - return; + ((Analysis) sw).caseAListTerm(this); } - if(_listTerms_.remove(child)) + public TLBkt getLBkt() { - return; + return this._lBkt_; } - } + public void setLBkt(TLBkt node) + { + if(this._lBkt_ != null) + { + this._lBkt_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._lBkt_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_lBkt_ == oldChild) + public LinkedList<PListTerm> getListTerms() { - setLBkt((TLBkt) newChild); - return; + return this._listTerms_; } - for(ListIterator i = _listTerms_.listIterator(); i.hasNext();) + public void setListTerms(List<PListTerm> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PListTerm e : this._listTerms_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._listTerms_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PListTerm e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._listTerms_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._lBkt_) + + toString(this._listTerms_); + } - private class ListTerms_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PListTerm node = (PListTerm) o; + // Remove child + if(this._lBkt_ == child) + { + this._lBkt_ = null; + return; + } + + if(this._listTerms_.remove(child)) + { + return; + } + + throw new RuntimeException("Not a child."); + } - if((node.parent() != null) && - (node.parent() != AListTerm.this)) - { - node.parent().removeChild(node); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._lBkt_ == oldChild) + { + setLBkt((TLBkt) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != AListTerm.this)) - { - node.parent(AListTerm.this); - } + for(ListIterator<PListTerm> i = this._listTerms_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PListTerm) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AMinusBinOp.java b/src/main/java/org/sablecc/sablecc/node/AMinusBinOp.java index b79f00560f86241f2d5d9997793e39ece9ac0c03..f83b25fd65f5487f1ec3b746148bafe2b0f221e5 100644 --- a/src/main/java/org/sablecc/sablecc/node/AMinusBinOp.java +++ b/src/main/java/org/sablecc/sablecc/node/AMinusBinOp.java @@ -2,32 +2,51 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AMinusBinOp extends PBinOp { - public AMinusBinOp() - {} - public Object clone() - { - return new AMinusBinOp(); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAMinusBinOp(this); - } - - public String toString() - { - return ""; - } - - void removeChild(Node child) - {} - - void replaceChild(Node oldChild, Node newChild) - {} + public AMinusBinOp() + { + // Constructor + } + + public AMinusBinOp(AMinusBinOp node) + { + super(node); + } + + @Override + public AMinusBinOp clone() + { + return new AMinusBinOp(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAMinusBinOp(this); + } + + @Override + public String toString() + { + return ""; + } + + @Override + void removeChild(Node child) + { + // Remove child + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ANewListTerm.java b/src/main/java/org/sablecc/sablecc/node/ANewListTerm.java index 82e42e7646b707f99ef3b0780e500fbce6306af8..d90bcba479d7d8106b4f28e99c5968397378a3b1 100644 --- a/src/main/java/org/sablecc/sablecc/node/ANewListTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/ANewListTerm.java @@ -5,185 +5,194 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ANewListTerm extends PListTerm { - private PProdName _prodName_; - private TLPar _lPar_; - private final LinkedList _params_ = new TypedLinkedList(new Params_Cast()); + private PProdName _prodName_; + private TLPar _lPar_; + private final LinkedList<PTerm> _params_ = new LinkedList<PTerm>(); + + public ANewListTerm() + { + // Constructor + } - public ANewListTerm() - {} + public ANewListTerm( + PProdName _prodName_, + TLPar _lPar_, + List<PTerm> _params_) + { + // Constructor + setProdName(_prodName_); - public ANewListTerm( - PProdName _prodName_, - TLPar _lPar_, - List _params_) - { - setProdName(_prodName_); + setLPar(_lPar_); - setLPar(_lPar_); + setParams(_params_); - { - this._params_.clear(); - this._params_.addAll(_params_); } - } - public Object clone() - { - return new ANewListTerm( - (PProdName) cloneNode(_prodName_), - (TLPar) cloneNode(_lPar_), - cloneList(_params_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseANewListTerm(this); - } - - public PProdName getProdName() - { - return _prodName_; - } - - public void setProdName(PProdName node) - { - if(_prodName_ != null) + public ANewListTerm(ANewListTerm node) { - _prodName_.parent(null); + super(node); + setProdName(cloneNode(node._prodName_)); + setLPar(cloneNode(node._lPar_)); + setParams(cloneList(node._params_)); } - if(node != null) + @Override + public ANewListTerm clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new ANewListTerm(this); } - _prodName_ = node; - } - - public TLPar getLPar() - { - return _lPar_; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseANewListTerm(this); + } - public void setLPar(TLPar node) - { - if(_lPar_ != null) + public PProdName getProdName() { - _lPar_.parent(null); + return this._prodName_; } - if(node != null) + public void setProdName(PProdName node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._prodName_ != null) + { + this._prodName_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - node.parent(this); + node.parent(this); + } + + this._prodName_ = node; } - _lPar_ = node; - } - - public LinkedList getParams() - { - return _params_; - } - - public void setParams(List list) - { - _params_.clear(); - _params_.addAll(list); - } - - public String toString() - { - return "" - + toString(_prodName_) - + toString(_lPar_) - + toString(_params_); - } - - void removeChild(Node child) - { - if(_prodName_ == child) + public TLPar getLPar() { - _prodName_ = null; - return; + return this._lPar_; } - if(_lPar_ == child) + public void setLPar(TLPar node) { - _lPar_ = null; - return; + if(this._lPar_ != null) + { + this._lPar_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._lPar_ = node; } - if(_params_.remove(child)) + public LinkedList<PTerm> getParams() { - return; + return this._params_; } - } - - void replaceChild(Node oldChild, Node newChild) - { - if(_prodName_ == oldChild) + public void setParams(List<PTerm> list) { - setProdName((PProdName) newChild); - return; + for(PTerm e : this._params_) + { + e.parent(null); + } + this._params_.clear(); + + for(PTerm e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._params_.add(e); + } } - if(_lPar_ == oldChild) + @Override + public String toString() { - setLPar((TLPar) newChild); - return; + return "" + + toString(this._prodName_) + + toString(this._lPar_) + + toString(this._params_); } - for(ListIterator i = _params_.listIterator(); i.hasNext();) + @Override + void removeChild(Node child) { - if(i.next() == oldChild) - { - if(newChild != null) + // Remove child + if(this._prodName_ == child) { - i.set(newChild); - oldChild.parent(null); - return; + this._prodName_ = null; + return; } - i.remove(); - oldChild.parent(null); - return; - } - } + if(this._lPar_ == child) + { + this._lPar_ = null; + return; + } - } + if(this._params_.remove(child)) + { + return; + } - private class Params_Cast implements Cast - { - public Object cast(Object o) + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) { - PTerm node = (PTerm) o; + // Replace child + if(this._prodName_ == oldChild) + { + setProdName((PProdName) newChild); + return; + } - if((node.parent() != null) && - (node.parent() != ANewListTerm.this)) - { - node.parent().removeChild(node); - } + if(this._lPar_ == oldChild) + { + setLPar((TLPar) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != ANewListTerm.this)) - { - node.parent(ANewListTerm.this); - } + for(ListIterator<PTerm> i = this._params_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PTerm) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/ANewTerm.java b/src/main/java/org/sablecc/sablecc/node/ANewTerm.java index bf8afbba01a6a9aa8143941e8bcef2e014c84f24..5b15adbda881acec82476b5edbd11a88bbe8b15c 100644 --- a/src/main/java/org/sablecc/sablecc/node/ANewTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/ANewTerm.java @@ -5,185 +5,194 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ANewTerm extends PTerm { - private PProdName _prodName_; - private TLPar _lPar_; - private final LinkedList _params_ = new TypedLinkedList(new Params_Cast()); + private PProdName _prodName_; + private TLPar _lPar_; + private final LinkedList<PTerm> _params_ = new LinkedList<PTerm>(); + + public ANewTerm() + { + // Constructor + } - public ANewTerm() - {} + public ANewTerm( + PProdName _prodName_, + TLPar _lPar_, + List<PTerm> _params_) + { + // Constructor + setProdName(_prodName_); - public ANewTerm( - PProdName _prodName_, - TLPar _lPar_, - List _params_) - { - setProdName(_prodName_); + setLPar(_lPar_); - setLPar(_lPar_); + setParams(_params_); - { - this._params_.clear(); - this._params_.addAll(_params_); } - } - public Object clone() - { - return new ANewTerm( - (PProdName) cloneNode(_prodName_), - (TLPar) cloneNode(_lPar_), - cloneList(_params_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseANewTerm(this); - } - - public PProdName getProdName() - { - return _prodName_; - } - - public void setProdName(PProdName node) - { - if(_prodName_ != null) + public ANewTerm(ANewTerm node) { - _prodName_.parent(null); + super(node); + setProdName(cloneNode(node._prodName_)); + setLPar(cloneNode(node._lPar_)); + setParams(cloneList(node._params_)); } - if(node != null) + @Override + public ANewTerm clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new ANewTerm(this); } - _prodName_ = node; - } - - public TLPar getLPar() - { - return _lPar_; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseANewTerm(this); + } - public void setLPar(TLPar node) - { - if(_lPar_ != null) + public PProdName getProdName() { - _lPar_.parent(null); + return this._prodName_; } - if(node != null) + public void setProdName(PProdName node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._prodName_ != null) + { + this._prodName_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - node.parent(this); + node.parent(this); + } + + this._prodName_ = node; } - _lPar_ = node; - } - - public LinkedList getParams() - { - return _params_; - } - - public void setParams(List list) - { - _params_.clear(); - _params_.addAll(list); - } - - public String toString() - { - return "" - + toString(_prodName_) - + toString(_lPar_) - + toString(_params_); - } - - void removeChild(Node child) - { - if(_prodName_ == child) + public TLPar getLPar() { - _prodName_ = null; - return; + return this._lPar_; } - if(_lPar_ == child) + public void setLPar(TLPar node) { - _lPar_ = null; - return; + if(this._lPar_ != null) + { + this._lPar_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._lPar_ = node; } - if(_params_.remove(child)) + public LinkedList<PTerm> getParams() { - return; + return this._params_; } - } - - void replaceChild(Node oldChild, Node newChild) - { - if(_prodName_ == oldChild) + public void setParams(List<PTerm> list) { - setProdName((PProdName) newChild); - return; + for(PTerm e : this._params_) + { + e.parent(null); + } + this._params_.clear(); + + for(PTerm e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._params_.add(e); + } } - if(_lPar_ == oldChild) + @Override + public String toString() { - setLPar((TLPar) newChild); - return; + return "" + + toString(this._prodName_) + + toString(this._lPar_) + + toString(this._params_); } - for(ListIterator i = _params_.listIterator(); i.hasNext();) + @Override + void removeChild(Node child) { - if(i.next() == oldChild) - { - if(newChild != null) + // Remove child + if(this._prodName_ == child) { - i.set(newChild); - oldChild.parent(null); - return; + this._prodName_ = null; + return; } - i.remove(); - oldChild.parent(null); - return; - } - } + if(this._lPar_ == child) + { + this._lPar_ = null; + return; + } - } + if(this._params_.remove(child)) + { + return; + } - private class Params_Cast implements Cast - { - public Object cast(Object o) + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) { - PTerm node = (PTerm) o; + // Replace child + if(this._prodName_ == oldChild) + { + setProdName((PProdName) newChild); + return; + } - if((node.parent() != null) && - (node.parent() != ANewTerm.this)) - { - node.parent().removeChild(node); - } + if(this._lPar_ == oldChild) + { + setLPar((TLPar) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != ANewTerm.this)) - { - node.parent(ANewTerm.this); - } + for(ListIterator<PTerm> i = this._params_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PTerm) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/ANullTerm.java b/src/main/java/org/sablecc/sablecc/node/ANullTerm.java index cc08054808aad00e52ae84f82803989ad13df4fc..7054505a7a1ef9ae63394fc304f87c6f2ae981a6 100644 --- a/src/main/java/org/sablecc/sablecc/node/ANullTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/ANullTerm.java @@ -2,32 +2,51 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ANullTerm extends PTerm { - public ANullTerm() - {} - public Object clone() - { - return new ANullTerm(); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseANullTerm(this); - } - - public String toString() - { - return ""; - } - - void removeChild(Node child) - {} - - void replaceChild(Node oldChild, Node newChild) - {} + public ANullTerm() + { + // Constructor + } + + public ANullTerm(ANullTerm node) + { + super(node); + } + + @Override + public ANullTerm clone() + { + return new ANullTerm(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseANullTerm(this); + } + + @Override + public String toString() + { + return ""; + } + + @Override + void removeChild(Node child) + { + // Remove child + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AOperationSet.java b/src/main/java/org/sablecc/sablecc/node/AOperationSet.java index 722a3d11f4b1122ac27d3fbc3d1f9a3c0979eb41..d34ea9083b2320230c007b7ce205715ed0c1c8eb 100644 --- a/src/main/java/org/sablecc/sablecc/node/AOperationSet.java +++ b/src/main/java/org/sablecc/sablecc/node/AOperationSet.java @@ -2,167 +2,185 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AOperationSet extends PSet { - private PBasic _left_; - private PBinOp _binOp_; - private PBasic _right_; - - public AOperationSet() - {} - - public AOperationSet( - PBasic _left_, - PBinOp _binOp_, - PBasic _right_) - { - setLeft(_left_); - - setBinOp(_binOp_); - - setRight(_right_); - - } - public Object clone() - { - return new AOperationSet( - (PBasic) cloneNode(_left_), - (PBinOp) cloneNode(_binOp_), - (PBasic) cloneNode(_right_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAOperationSet(this); - } - - public PBasic getLeft() - { - return _left_; - } - - public void setLeft(PBasic node) - { - if(_left_ != null) + private PBasic _left_; + private PBinOp _binOp_; + private PBasic _right_; + + public AOperationSet() { - _left_.parent(null); + // Constructor } - if(node != null) + public AOperationSet( + PBasic _left_, + PBinOp _binOp_, + PBasic _right_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + // Constructor + setLeft(_left_); - node.parent(this); - } + setBinOp(_binOp_); - _left_ = node; - } + setRight(_right_); - public PBinOp getBinOp() - { - return _binOp_; - } + } - public void setBinOp(PBinOp node) - { - if(_binOp_ != null) + public AOperationSet(AOperationSet node) { - _binOp_.parent(null); + super(node); + setLeft(cloneNode(node._left_)); + setBinOp(cloneNode(node._binOp_)); + setRight(cloneNode(node._right_)); } - if(node != null) + @Override + public AOperationSet clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AOperationSet(this); } - _binOp_ = node; - } - - public PBasic getRight() - { - return _right_; - } - - public void setRight(PBasic node) - { - if(_right_ != null) + @Override + public void apply(Switch sw) { - _right_.parent(null); + ((Analysis) sw).caseAOperationSet(this); } - if(node != null) + public PBasic getLeft() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._left_; } - _right_ = node; - } - - public String toString() - { - return "" - + toString(_left_) - + toString(_binOp_) - + toString(_right_); - } - - void removeChild(Node child) - { - if(_left_ == child) + public void setLeft(PBasic node) { - _left_ = null; - return; + if(this._left_ != null) + { + this._left_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._left_ = node; } - if(_binOp_ == child) + public PBinOp getBinOp() { - _binOp_ = null; - return; + return this._binOp_; } - if(_right_ == child) + public void setBinOp(PBinOp node) { - _right_ = null; - return; + if(this._binOp_ != null) + { + this._binOp_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._binOp_ = node; } - } + public PBasic getRight() + { + return this._right_; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_left_ == oldChild) + public void setRight(PBasic node) { - setLeft((PBasic) newChild); - return; + if(this._right_ != null) + { + this._right_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._right_ = node; } - if(_binOp_ == oldChild) + @Override + public String toString() { - setBinOp((PBinOp) newChild); - return; + return "" + + toString(this._left_) + + toString(this._binOp_) + + toString(this._right_); } - if(_right_ == oldChild) + @Override + void removeChild(Node child) { - setRight((PBasic) newChild); - return; + // Remove child + if(this._left_ == child) + { + this._left_ = null; + return; + } + + if(this._binOp_ == child) + { + this._binOp_ = null; + return; + } + + if(this._right_ == child) + { + this._right_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._left_ == oldChild) + { + setLeft((PBasic) newChild); + return; + } + + if(this._binOp_ == oldChild) + { + setBinOp((PBinOp) newChild); + return; + } + + if(this._right_ == oldChild) + { + setRight((PBasic) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/APlusBinOp.java b/src/main/java/org/sablecc/sablecc/node/APlusBinOp.java index 047de4ff6177802d85bb8b2a1013bb69e555c3f9..37600cb7b4a975622dde5b3c3a7a6bc09daf3c9c 100644 --- a/src/main/java/org/sablecc/sablecc/node/APlusBinOp.java +++ b/src/main/java/org/sablecc/sablecc/node/APlusBinOp.java @@ -2,32 +2,51 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class APlusBinOp extends PBinOp { - public APlusBinOp() - {} - public Object clone() - { - return new APlusBinOp(); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAPlusBinOp(this); - } - - public String toString() - { - return ""; - } - - void removeChild(Node child) - {} - - void replaceChild(Node oldChild, Node newChild) - {} + public APlusBinOp() + { + // Constructor + } + + public APlusBinOp(APlusBinOp node) + { + super(node); + } + + @Override + public APlusBinOp clone() + { + return new APlusBinOp(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAPlusBinOp(this); + } + + @Override + public String toString() + { + return ""; + } + + @Override + void removeChild(Node child) + { + // Remove child + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/APlusUnOp.java b/src/main/java/org/sablecc/sablecc/node/APlusUnOp.java index 1daee86f761acc117e5a8c7288348cd1b19bcba1..d31ac09b57b26ae668c4f218bc75b23ef6061ec5 100644 --- a/src/main/java/org/sablecc/sablecc/node/APlusUnOp.java +++ b/src/main/java/org/sablecc/sablecc/node/APlusUnOp.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class APlusUnOp extends PUnOp { - private TPlus _plus_; - - public APlusUnOp() - {} - - public APlusUnOp( - TPlus _plus_) - { - setPlus(_plus_); - - } - public Object clone() - { - return new APlusUnOp( - (TPlus) cloneNode(_plus_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAPlusUnOp(this); - } - - public TPlus getPlus() - { - return _plus_; - } - - public void setPlus(TPlus node) - { - if(_plus_ != null) + private TPlus _plus_; + + public APlusUnOp() + { + // Constructor + } + + public APlusUnOp( + TPlus _plus_) { - _plus_.parent(null); + // Constructor + setPlus(_plus_); + } - if(node != null) + public APlusUnOp(APlusUnOp node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setPlus(cloneNode(node._plus_)); + } - node.parent(this); + @Override + public APlusUnOp clone() + { + return new APlusUnOp(this); } - _plus_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAPlusUnOp(this); + } - public String toString() - { - return "" - + toString(_plus_); - } + public TPlus getPlus() + { + return this._plus_; + } - void removeChild(Node child) - { - if(_plus_ == child) + public void setPlus(TPlus node) { - _plus_ = null; - return; + if(this._plus_ != null) + { + this._plus_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._plus_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._plus_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_plus_ == oldChild) + @Override + void removeChild(Node child) { - setPlus((TPlus) newChild); - return; + // Remove child + if(this._plus_ == child) + { + this._plus_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._plus_ == oldChild) + { + setPlus((TPlus) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AProd.java b/src/main/java/org/sablecc/sablecc/node/AProd.java index 53c37b689fefa9e184eca991bc9821a4a1a817a2..d058034bd0aebeceeaef06d86c224e16a49bb50f 100644 --- a/src/main/java/org/sablecc/sablecc/node/AProd.java +++ b/src/main/java/org/sablecc/sablecc/node/AProd.java @@ -5,249 +5,248 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AProd extends PProd { - private TId _id_; - private TArrow _arrow_; - private final LinkedList _prodTransform_ = new TypedLinkedList(new ProdTransform_Cast()); - private final LinkedList _alts_ = new TypedLinkedList(new Alts_Cast()); - - public AProd() - {} - - public AProd( - TId _id_, - TArrow _arrow_, - List _prodTransform_, - List _alts_) - { - setId(_id_); - - setArrow(_arrow_); + private TId _id_; + private TArrow _arrow_; + private final LinkedList<PElem> _prodTransform_ = new LinkedList<PElem>(); + private final LinkedList<PAlt> _alts_ = new LinkedList<PAlt>(); + public AProd() { - this._prodTransform_.clear(); - this._prodTransform_.addAll(_prodTransform_); + // Constructor } + public AProd( + TId _id_, + TArrow _arrow_, + List<PElem> _prodTransform_, + List<PAlt> _alts_) { - this._alts_.clear(); - this._alts_.addAll(_alts_); - } + // Constructor + setId(_id_); - } - public Object clone() - { - return new AProd( - (TId) cloneNode(_id_), - (TArrow) cloneNode(_arrow_), - cloneList(_prodTransform_), - cloneList(_alts_)); - } + setArrow(_arrow_); - public void apply(Switch sw) - { - ((Analysis) sw).caseAProd(this); - } + setProdTransform(_prodTransform_); - public TId getId() - { - return _id_; - } + setAlts(_alts_); - public void setId(TId node) - { - if(_id_ != null) - { - _id_.parent(null); } - if(node != null) + public AProd(AProd node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + super(node); + setId(cloneNode(node._id_)); + setArrow(cloneNode(node._arrow_)); + setProdTransform(cloneList(node._prodTransform_)); + setAlts(cloneList(node._alts_)); } - _id_ = node; - } - - public TArrow getArrow() - { - return _arrow_; - } - - public void setArrow(TArrow node) - { - if(_arrow_ != null) + @Override + public AProd clone() { - _arrow_.parent(null); + return new AProd(this); } - if(node != null) + @Override + public void apply(Switch sw) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + ((Analysis) sw).caseAProd(this); } - _arrow_ = node; - } - - public LinkedList getProdTransform() - { - return _prodTransform_; - } - - public void setProdTransform(List list) - { - _prodTransform_.clear(); - _prodTransform_.addAll(list); - } + public TId getId() + { + return this._id_; + } - public LinkedList getAlts() - { - return _alts_; - } + public void setId(TId node) + { + if(this._id_ != null) + { + this._id_.parent(null); + } - public void setAlts(List list) - { - _alts_.clear(); - _alts_.addAll(list); - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - public String toString() - { - return "" - + toString(_id_) - + toString(_arrow_) - + toString(_prodTransform_) - + toString(_alts_); - } + node.parent(this); + } - void removeChild(Node child) - { - if(_id_ == child) - { - _id_ = null; - return; + this._id_ = node; } - if(_arrow_ == child) + public TArrow getArrow() { - _arrow_ = null; - return; + return this._arrow_; } - if(_prodTransform_.remove(child)) + public void setArrow(TArrow node) { - return; - } + if(this._arrow_ != null) + { + this._arrow_.parent(null); + } - if(_alts_.remove(child)) - { - return; - } + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - } + node.parent(this); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) - { - setId((TId) newChild); - return; + this._arrow_ = node; } - if(_arrow_ == oldChild) + public LinkedList<PElem> getProdTransform() { - setArrow((TArrow) newChild); - return; + return this._prodTransform_; } - for(ListIterator i = _prodTransform_.listIterator(); i.hasNext();) + public void setProdTransform(List<PElem> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PElem e : this._prodTransform_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._prodTransform_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PElem e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._prodTransform_.add(e); + } } - for(ListIterator i = _alts_.listIterator(); i.hasNext();) + public LinkedList<PAlt> getAlts() { - if(i.next() == oldChild) - { - if(newChild != null) + return this._alts_; + } + + public void setAlts(List<PAlt> list) + { + for(PAlt e : this._alts_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._alts_.clear(); + + for(PAlt e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } - i.remove(); - oldChild.parent(null); - return; - } + e.parent(this); + this._alts_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._id_) + + toString(this._arrow_) + + toString(this._prodTransform_) + + toString(this._alts_); + } - private class ProdTransform_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PElem node = (PElem) o; + // Remove child + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._arrow_ == child) + { + this._arrow_ = null; + return; + } - if((node.parent() != null) && - (node.parent() != AProd.this)) - { - node.parent().removeChild(node); - } + if(this._prodTransform_.remove(child)) + { + return; + } - if((node.parent() == null) || - (node.parent() != AProd.this)) - { - node.parent(AProd.this); - } + if(this._alts_.remove(child)) + { + return; + } - return node; + throw new RuntimeException("Not a child."); } - } - private class Alts_Cast implements Cast - { - public Object cast(Object o) + @Override + void replaceChild(Node oldChild, Node newChild) { - PAlt node = (PAlt) o; + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } - if((node.parent() != null) && - (node.parent() != AProd.this)) - { - node.parent().removeChild(node); - } + if(this._arrow_ == oldChild) + { + setArrow((TArrow) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != AProd.this)) - { - node.parent(AProd.this); - } + for(ListIterator<PElem> i = this._prodTransform_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PElem) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } + + for(ListIterator<PAlt> i = this._alts_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PAlt) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AProdName.java b/src/main/java/org/sablecc/sablecc/node/AProdName.java index 03a3fa120827569400321c630be1c2ca3d016cd3..48d5ed27d687398584365e3eaec51a60f3897e83 100644 --- a/src/main/java/org/sablecc/sablecc/node/AProdName.java +++ b/src/main/java/org/sablecc/sablecc/node/AProdName.java @@ -2,124 +2,142 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AProdName extends PProdName { - private TId _id_; - private TId _prodNameTail_; - - public AProdName() - {} - - public AProdName( - TId _id_, - TId _prodNameTail_) - { - setId(_id_); - - setProdNameTail(_prodNameTail_); - - } - public Object clone() - { - return new AProdName( - (TId) cloneNode(_id_), - (TId) cloneNode(_prodNameTail_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAProdName(this); - } - - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) + private TId _id_; + private TId _prodNameTail_; + + public AProdName() { - _id_.parent(null); + // Constructor } - if(node != null) + public AProdName( + TId _id_, + TId _prodNameTail_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); - } + // Constructor + setId(_id_); - _id_ = node; - } + setProdNameTail(_prodNameTail_); - public TId getProdNameTail() - { - return _prodNameTail_; - } + } - public void setProdNameTail(TId node) - { - if(_prodNameTail_ != null) + public AProdName(AProdName node) { - _prodNameTail_.parent(null); + super(node); + setId(cloneNode(node._id_)); + setProdNameTail(cloneNode(node._prodNameTail_)); } - if(node != null) + @Override + public AProdName clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AProdName(this); } - _prodNameTail_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAProdName(this); + } - public String toString() - { - return "" - + toString(_id_) - + toString(_prodNameTail_); - } + public TId getId() + { + return this._id_; + } - void removeChild(Node child) - { - if(_id_ == child) + public void setId(TId node) { - _id_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - if(_prodNameTail_ == child) + public TId getProdNameTail() { - _prodNameTail_ = null; - return; + return this._prodNameTail_; } - } + public void setProdNameTail(TId node) + { + if(this._prodNameTail_ != null) + { + this._prodNameTail_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._prodNameTail_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) + @Override + public String toString() { - setId((TId) newChild); - return; + return "" + + toString(this._id_) + + toString(this._prodNameTail_); } - if(_prodNameTail_ == oldChild) + @Override + void removeChild(Node child) { - setProdNameTail((TId) newChild); - return; + // Remove child + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._prodNameTail_ == child) + { + this._prodNameTail_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + if(this._prodNameTail_ == oldChild) + { + setProdNameTail((TId) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AProductionSpecifier.java b/src/main/java/org/sablecc/sablecc/node/AProductionSpecifier.java index 75b2c2d535a11bafa0339c554b8b10b03e1615dc..df84feb26a50114481a2831c23ce5703db629ebf 100644 --- a/src/main/java/org/sablecc/sablecc/node/AProductionSpecifier.java +++ b/src/main/java/org/sablecc/sablecc/node/AProductionSpecifier.java @@ -2,32 +2,51 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AProductionSpecifier extends PSpecifier { - public AProductionSpecifier() - {} - public Object clone() - { - return new AProductionSpecifier(); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAProductionSpecifier(this); - } - - public String toString() - { - return ""; - } - - void removeChild(Node child) - {} - - void replaceChild(Node oldChild, Node newChild) - {} + public AProductionSpecifier() + { + // Constructor + } + + public AProductionSpecifier(AProductionSpecifier node) + { + super(node); + } + + @Override + public AProductionSpecifier clone() + { + return new AProductionSpecifier(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAProductionSpecifier(this); + } + + @Override + public String toString() + { + return ""; + } + + @Override + void removeChild(Node child) + { + // Remove child + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AProductions.java b/src/main/java/org/sablecc/sablecc/node/AProductions.java index f3d9fc8d25641e37a74d6bd5d6c5a340db6fb58d..d5078d560f1fbbed861ba7fcd3a378bd2cb9f7db 100644 --- a/src/main/java/org/sablecc/sablecc/node/AProductions.java +++ b/src/main/java/org/sablecc/sablecc/node/AProductions.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AProductions extends PProductions { - private final LinkedList _prods_ = new TypedLinkedList(new Prods_Cast()); + private final LinkedList<PProd> _prods_ = new LinkedList<PProd>(); + + public AProductions() + { + // Constructor + } + + public AProductions( + List<PProd> _prods_) + { + // Constructor + setProds(_prods_); - public AProductions() - {} + } + + public AProductions(AProductions node) + { + super(node); + setProds(cloneList(node._prods_)); + } - public AProductions( - List _prods_) - { + @Override + public AProductions clone() { - this._prods_.clear(); - this._prods_.addAll(_prods_); + return new AProductions(this); } - } - public Object clone() - { - return new AProductions( - cloneList(_prods_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAProductions(this); - } - - public LinkedList getProds() - { - return _prods_; - } - - public void setProds(List list) - { - _prods_.clear(); - _prods_.addAll(list); - } - - public String toString() - { - return "" - + toString(_prods_); - } - - void removeChild(Node child) - { - if(_prods_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseAProductions(this); } - } + public LinkedList<PProd> getProds() + { + return this._prods_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _prods_.listIterator(); i.hasNext();) + public void setProds(List<PProd> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PProd e : this._prods_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._prods_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PProd e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._prods_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._prods_); + } - private class Prods_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PProd node = (PProd) o; + // Remove child + if(this._prods_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != AProductions.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != AProductions.this)) - { - node.parent(AProductions.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<PProd> i = this._prods_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PProd) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AQMarkUnOp.java b/src/main/java/org/sablecc/sablecc/node/AQMarkUnOp.java index 497cdf476a7b0e07879e68d6b517ebd2d2ed5285..da78e8791a964e97e6b0ad7f2a4b67503a0d40ed 100644 --- a/src/main/java/org/sablecc/sablecc/node/AQMarkUnOp.java +++ b/src/main/java/org/sablecc/sablecc/node/AQMarkUnOp.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AQMarkUnOp extends PUnOp { - private TQMark _qMark_; - - public AQMarkUnOp() - {} - - public AQMarkUnOp( - TQMark _qMark_) - { - setQMark(_qMark_); - - } - public Object clone() - { - return new AQMarkUnOp( - (TQMark) cloneNode(_qMark_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAQMarkUnOp(this); - } - - public TQMark getQMark() - { - return _qMark_; - } - - public void setQMark(TQMark node) - { - if(_qMark_ != null) + private TQMark _qMark_; + + public AQMarkUnOp() + { + // Constructor + } + + public AQMarkUnOp( + TQMark _qMark_) { - _qMark_.parent(null); + // Constructor + setQMark(_qMark_); + } - if(node != null) + public AQMarkUnOp(AQMarkUnOp node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setQMark(cloneNode(node._qMark_)); + } - node.parent(this); + @Override + public AQMarkUnOp clone() + { + return new AQMarkUnOp(this); } - _qMark_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAQMarkUnOp(this); + } - public String toString() - { - return "" - + toString(_qMark_); - } + public TQMark getQMark() + { + return this._qMark_; + } - void removeChild(Node child) - { - if(_qMark_ == child) + public void setQMark(TQMark node) { - _qMark_ = null; - return; + if(this._qMark_ != null) + { + this._qMark_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._qMark_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._qMark_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_qMark_ == oldChild) + @Override + void removeChild(Node child) { - setQMark((TQMark) newChild); - return; + // Remove child + if(this._qMark_ == child) + { + this._qMark_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._qMark_ == oldChild) + { + setQMark((TQMark) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ARegExp.java b/src/main/java/org/sablecc/sablecc/node/ARegExp.java index d07a142deabc21f23923c9cbbf402eb18afacc26..e9a9eedb3c25e100bf69f23d6e5147f1be40a3d8 100644 --- a/src/main/java/org/sablecc/sablecc/node/ARegExp.java +++ b/src/main/java/org/sablecc/sablecc/node/ARegExp.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ARegExp extends PRegExp { - private final LinkedList _concats_ = new TypedLinkedList(new Concats_Cast()); + private final LinkedList<PConcat> _concats_ = new LinkedList<PConcat>(); + + public ARegExp() + { + // Constructor + } + + public ARegExp( + List<PConcat> _concats_) + { + // Constructor + setConcats(_concats_); - public ARegExp() - {} + } + + public ARegExp(ARegExp node) + { + super(node); + setConcats(cloneList(node._concats_)); + } - public ARegExp( - List _concats_) - { + @Override + public ARegExp clone() { - this._concats_.clear(); - this._concats_.addAll(_concats_); + return new ARegExp(this); } - } - public Object clone() - { - return new ARegExp( - cloneList(_concats_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseARegExp(this); - } - - public LinkedList getConcats() - { - return _concats_; - } - - public void setConcats(List list) - { - _concats_.clear(); - _concats_.addAll(list); - } - - public String toString() - { - return "" - + toString(_concats_); - } - - void removeChild(Node child) - { - if(_concats_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseARegExp(this); } - } + public LinkedList<PConcat> getConcats() + { + return this._concats_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _concats_.listIterator(); i.hasNext();) + public void setConcats(List<PConcat> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PConcat e : this._concats_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._concats_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PConcat e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._concats_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._concats_); + } - private class Concats_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PConcat node = (PConcat) o; + // Remove child + if(this._concats_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != ARegExp.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != ARegExp.this)) - { - node.parent(ARegExp.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<PConcat> i = this._concats_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PConcat) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/ARegExpBasic.java b/src/main/java/org/sablecc/sablecc/node/ARegExpBasic.java index 208d45a4e140f277ea3421872485ebd0c85bc821..1c29eec74ef24927e70082fbd0062f8fff48b504 100644 --- a/src/main/java/org/sablecc/sablecc/node/ARegExpBasic.java +++ b/src/main/java/org/sablecc/sablecc/node/ARegExpBasic.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ARegExpBasic extends PBasic { - private PRegExp _regExp_; - - public ARegExpBasic() - {} - - public ARegExpBasic( - PRegExp _regExp_) - { - setRegExp(_regExp_); - - } - public Object clone() - { - return new ARegExpBasic( - (PRegExp) cloneNode(_regExp_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseARegExpBasic(this); - } - - public PRegExp getRegExp() - { - return _regExp_; - } - - public void setRegExp(PRegExp node) - { - if(_regExp_ != null) + private PRegExp _regExp_; + + public ARegExpBasic() + { + // Constructor + } + + public ARegExpBasic( + PRegExp _regExp_) { - _regExp_.parent(null); + // Constructor + setRegExp(_regExp_); + } - if(node != null) + public ARegExpBasic(ARegExpBasic node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setRegExp(cloneNode(node._regExp_)); + } - node.parent(this); + @Override + public ARegExpBasic clone() + { + return new ARegExpBasic(this); } - _regExp_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseARegExpBasic(this); + } - public String toString() - { - return "" - + toString(_regExp_); - } + public PRegExp getRegExp() + { + return this._regExp_; + } - void removeChild(Node child) - { - if(_regExp_ == child) + public void setRegExp(PRegExp node) { - _regExp_ = null; - return; + if(this._regExp_ != null) + { + this._regExp_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._regExp_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._regExp_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_regExp_ == oldChild) + @Override + void removeChild(Node child) { - setRegExp((PRegExp) newChild); - return; + // Remove child + if(this._regExp_ == child) + { + this._regExp_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._regExp_ == oldChild) + { + setRegExp((PRegExp) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ASetBasic.java b/src/main/java/org/sablecc/sablecc/node/ASetBasic.java index eb4ad7f243a11d40399562499fa91c63325194f7..9c26ab094894d9991f42894ccab765ae515d4d50 100644 --- a/src/main/java/org/sablecc/sablecc/node/ASetBasic.java +++ b/src/main/java/org/sablecc/sablecc/node/ASetBasic.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ASetBasic extends PBasic { - private PSet _set_; - - public ASetBasic() - {} - - public ASetBasic( - PSet _set_) - { - setSet(_set_); - - } - public Object clone() - { - return new ASetBasic( - (PSet) cloneNode(_set_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseASetBasic(this); - } - - public PSet getSet() - { - return _set_; - } - - public void setSet(PSet node) - { - if(_set_ != null) + private PSet _set_; + + public ASetBasic() + { + // Constructor + } + + public ASetBasic( + PSet _set_) { - _set_.parent(null); + // Constructor + setSet(_set_); + } - if(node != null) + public ASetBasic(ASetBasic node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setSet(cloneNode(node._set_)); + } - node.parent(this); + @Override + public ASetBasic clone() + { + return new ASetBasic(this); } - _set_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseASetBasic(this); + } - public String toString() - { - return "" - + toString(_set_); - } + public PSet getSet() + { + return this._set_; + } - void removeChild(Node child) - { - if(_set_ == child) + public void setSet(PSet node) { - _set_ = null; - return; + if(this._set_ != null) + { + this._set_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._set_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._set_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_set_ == oldChild) + @Override + void removeChild(Node child) { - setSet((PSet) newChild); - return; + // Remove child + if(this._set_ == child) + { + this._set_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._set_ == oldChild) + { + setSet((PSet) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ASimpleListTerm.java b/src/main/java/org/sablecc/sablecc/node/ASimpleListTerm.java index c97addb7f61910c0d0f81be98ed350d27443ee14..7821735cd82e0ac2cfd98073959ea2448ded3e47 100644 --- a/src/main/java/org/sablecc/sablecc/node/ASimpleListTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/ASimpleListTerm.java @@ -2,167 +2,185 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ASimpleListTerm extends PListTerm { - private PSpecifier _specifier_; - private TId _id_; - private TId _simpleTermTail_; - - public ASimpleListTerm() - {} - - public ASimpleListTerm( - PSpecifier _specifier_, - TId _id_, - TId _simpleTermTail_) - { - setSpecifier(_specifier_); - - setId(_id_); - - setSimpleTermTail(_simpleTermTail_); - - } - public Object clone() - { - return new ASimpleListTerm( - (PSpecifier) cloneNode(_specifier_), - (TId) cloneNode(_id_), - (TId) cloneNode(_simpleTermTail_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseASimpleListTerm(this); - } - - public PSpecifier getSpecifier() - { - return _specifier_; - } - - public void setSpecifier(PSpecifier node) - { - if(_specifier_ != null) + private PSpecifier _specifier_; + private TId _id_; + private TId _simpleTermTail_; + + public ASimpleListTerm() { - _specifier_.parent(null); + // Constructor } - if(node != null) + public ASimpleListTerm( + PSpecifier _specifier_, + TId _id_, + TId _simpleTermTail_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + // Constructor + setSpecifier(_specifier_); - node.parent(this); - } + setId(_id_); - _specifier_ = node; - } + setSimpleTermTail(_simpleTermTail_); - public TId getId() - { - return _id_; - } + } - public void setId(TId node) - { - if(_id_ != null) + public ASimpleListTerm(ASimpleListTerm node) { - _id_.parent(null); + super(node); + setSpecifier(cloneNode(node._specifier_)); + setId(cloneNode(node._id_)); + setSimpleTermTail(cloneNode(node._simpleTermTail_)); } - if(node != null) + @Override + public ASimpleListTerm clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new ASimpleListTerm(this); } - _id_ = node; - } - - public TId getSimpleTermTail() - { - return _simpleTermTail_; - } - - public void setSimpleTermTail(TId node) - { - if(_simpleTermTail_ != null) + @Override + public void apply(Switch sw) { - _simpleTermTail_.parent(null); + ((Analysis) sw).caseASimpleListTerm(this); } - if(node != null) + public PSpecifier getSpecifier() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._specifier_; } - _simpleTermTail_ = node; - } - - public String toString() - { - return "" - + toString(_specifier_) - + toString(_id_) - + toString(_simpleTermTail_); - } - - void removeChild(Node child) - { - if(_specifier_ == child) + public void setSpecifier(PSpecifier node) { - _specifier_ = null; - return; + if(this._specifier_ != null) + { + this._specifier_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._specifier_ = node; } - if(_id_ == child) + public TId getId() { - _id_ = null; - return; + return this._id_; } - if(_simpleTermTail_ == child) + public void setId(TId node) { - _simpleTermTail_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - } + public TId getSimpleTermTail() + { + return this._simpleTermTail_; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_specifier_ == oldChild) + public void setSimpleTermTail(TId node) { - setSpecifier((PSpecifier) newChild); - return; + if(this._simpleTermTail_ != null) + { + this._simpleTermTail_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._simpleTermTail_ = node; } - if(_id_ == oldChild) + @Override + public String toString() { - setId((TId) newChild); - return; + return "" + + toString(this._specifier_) + + toString(this._id_) + + toString(this._simpleTermTail_); } - if(_simpleTermTail_ == oldChild) + @Override + void removeChild(Node child) { - setSimpleTermTail((TId) newChild); - return; + // Remove child + if(this._specifier_ == child) + { + this._specifier_ = null; + return; + } + + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._simpleTermTail_ == child) + { + this._simpleTermTail_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._specifier_ == oldChild) + { + setSpecifier((PSpecifier) newChild); + return; + } + + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + if(this._simpleTermTail_ == oldChild) + { + setSimpleTermTail((TId) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ASimpleTerm.java b/src/main/java/org/sablecc/sablecc/node/ASimpleTerm.java index 2b03fb31e681b66b39d5fa47c0165baf12e2c337..693bea1fb73a5b757e3d08436fc9d46d14b8d8d3 100644 --- a/src/main/java/org/sablecc/sablecc/node/ASimpleTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/ASimpleTerm.java @@ -2,167 +2,185 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ASimpleTerm extends PTerm { - private PSpecifier _specifier_; - private TId _id_; - private TId _simpleTermTail_; - - public ASimpleTerm() - {} - - public ASimpleTerm( - PSpecifier _specifier_, - TId _id_, - TId _simpleTermTail_) - { - setSpecifier(_specifier_); - - setId(_id_); - - setSimpleTermTail(_simpleTermTail_); - - } - public Object clone() - { - return new ASimpleTerm( - (PSpecifier) cloneNode(_specifier_), - (TId) cloneNode(_id_), - (TId) cloneNode(_simpleTermTail_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseASimpleTerm(this); - } - - public PSpecifier getSpecifier() - { - return _specifier_; - } - - public void setSpecifier(PSpecifier node) - { - if(_specifier_ != null) + private PSpecifier _specifier_; + private TId _id_; + private TId _simpleTermTail_; + + public ASimpleTerm() { - _specifier_.parent(null); + // Constructor } - if(node != null) + public ASimpleTerm( + PSpecifier _specifier_, + TId _id_, + TId _simpleTermTail_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + // Constructor + setSpecifier(_specifier_); - node.parent(this); - } + setId(_id_); - _specifier_ = node; - } + setSimpleTermTail(_simpleTermTail_); - public TId getId() - { - return _id_; - } + } - public void setId(TId node) - { - if(_id_ != null) + public ASimpleTerm(ASimpleTerm node) { - _id_.parent(null); + super(node); + setSpecifier(cloneNode(node._specifier_)); + setId(cloneNode(node._id_)); + setSimpleTermTail(cloneNode(node._simpleTermTail_)); } - if(node != null) + @Override + public ASimpleTerm clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new ASimpleTerm(this); } - _id_ = node; - } - - public TId getSimpleTermTail() - { - return _simpleTermTail_; - } - - public void setSimpleTermTail(TId node) - { - if(_simpleTermTail_ != null) + @Override + public void apply(Switch sw) { - _simpleTermTail_.parent(null); + ((Analysis) sw).caseASimpleTerm(this); } - if(node != null) + public PSpecifier getSpecifier() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._specifier_; } - _simpleTermTail_ = node; - } - - public String toString() - { - return "" - + toString(_specifier_) - + toString(_id_) - + toString(_simpleTermTail_); - } - - void removeChild(Node child) - { - if(_specifier_ == child) + public void setSpecifier(PSpecifier node) { - _specifier_ = null; - return; + if(this._specifier_ != null) + { + this._specifier_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._specifier_ = node; } - if(_id_ == child) + public TId getId() { - _id_ = null; - return; + return this._id_; } - if(_simpleTermTail_ == child) + public void setId(TId node) { - _simpleTermTail_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - } + public TId getSimpleTermTail() + { + return this._simpleTermTail_; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_specifier_ == oldChild) + public void setSimpleTermTail(TId node) { - setSpecifier((PSpecifier) newChild); - return; + if(this._simpleTermTail_ != null) + { + this._simpleTermTail_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._simpleTermTail_ = node; } - if(_id_ == oldChild) + @Override + public String toString() { - setId((TId) newChild); - return; + return "" + + toString(this._specifier_) + + toString(this._id_) + + toString(this._simpleTermTail_); } - if(_simpleTermTail_ == oldChild) + @Override + void removeChild(Node child) { - setSimpleTermTail((TId) newChild); - return; + // Remove child + if(this._specifier_ == child) + { + this._specifier_ = null; + return; + } + + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._simpleTermTail_ == child) + { + this._simpleTermTail_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._specifier_ == oldChild) + { + setSpecifier((PSpecifier) newChild); + return; + } + + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + if(this._simpleTermTail_ == oldChild) + { + setSimpleTermTail((TId) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AStarUnOp.java b/src/main/java/org/sablecc/sablecc/node/AStarUnOp.java index 2488d7680f6173d1120c5e486216d92f26062e5d..65146a48504d8ed4393b1648d5b9e97ca9006b22 100644 --- a/src/main/java/org/sablecc/sablecc/node/AStarUnOp.java +++ b/src/main/java/org/sablecc/sablecc/node/AStarUnOp.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AStarUnOp extends PUnOp { - private TStar _star_; - - public AStarUnOp() - {} - - public AStarUnOp( - TStar _star_) - { - setStar(_star_); - - } - public Object clone() - { - return new AStarUnOp( - (TStar) cloneNode(_star_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAStarUnOp(this); - } - - public TStar getStar() - { - return _star_; - } - - public void setStar(TStar node) - { - if(_star_ != null) + private TStar _star_; + + public AStarUnOp() + { + // Constructor + } + + public AStarUnOp( + TStar _star_) { - _star_.parent(null); + // Constructor + setStar(_star_); + } - if(node != null) + public AStarUnOp(AStarUnOp node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setStar(cloneNode(node._star_)); + } - node.parent(this); + @Override + public AStarUnOp clone() + { + return new AStarUnOp(this); } - _star_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAStarUnOp(this); + } - public String toString() - { - return "" - + toString(_star_); - } + public TStar getStar() + { + return this._star_; + } - void removeChild(Node child) - { - if(_star_ == child) + public void setStar(TStar node) { - _star_ = null; - return; + if(this._star_ != null) + { + this._star_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._star_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._star_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_star_ == oldChild) + @Override + void removeChild(Node child) { - setStar((TStar) newChild); - return; + // Remove child + if(this._star_ == child) + { + this._star_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._star_ == oldChild) + { + setStar((TStar) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AStateList.java b/src/main/java/org/sablecc/sablecc/node/AStateList.java index 1e87a236a645d511715c9bbf581c7b4d197bbf0e..f24a890d5701946bb38c36329b6e38697b9b8e95 100644 --- a/src/main/java/org/sablecc/sablecc/node/AStateList.java +++ b/src/main/java/org/sablecc/sablecc/node/AStateList.java @@ -5,185 +5,194 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AStateList extends PStateList { - private TId _id_; - private PTransition _transition_; - private final LinkedList _stateLists_ = new TypedLinkedList(new StateLists_Cast()); + private TId _id_; + private PTransition _transition_; + private final LinkedList<PStateListTail> _stateLists_ = new LinkedList<PStateListTail>(); + + public AStateList() + { + // Constructor + } - public AStateList() - {} + public AStateList( + TId _id_, + PTransition _transition_, + List<PStateListTail> _stateLists_) + { + // Constructor + setId(_id_); - public AStateList( - TId _id_, - PTransition _transition_, - List _stateLists_) - { - setId(_id_); + setTransition(_transition_); - setTransition(_transition_); + setStateLists(_stateLists_); - { - this._stateLists_.clear(); - this._stateLists_.addAll(_stateLists_); } - } - public Object clone() - { - return new AStateList( - (TId) cloneNode(_id_), - (PTransition) cloneNode(_transition_), - cloneList(_stateLists_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAStateList(this); - } - - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) + public AStateList(AStateList node) { - _id_.parent(null); + super(node); + setId(cloneNode(node._id_)); + setTransition(cloneNode(node._transition_)); + setStateLists(cloneList(node._stateLists_)); } - if(node != null) + @Override + public AStateList clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AStateList(this); } - _id_ = node; - } - - public PTransition getTransition() - { - return _transition_; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAStateList(this); + } - public void setTransition(PTransition node) - { - if(_transition_ != null) + public TId getId() { - _transition_.parent(null); + return this._id_; } - if(node != null) + public void setId(TId node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } - node.parent(this); + node.parent(this); + } + + this._id_ = node; } - _transition_ = node; - } - - public LinkedList getStateLists() - { - return _stateLists_; - } - - public void setStateLists(List list) - { - _stateLists_.clear(); - _stateLists_.addAll(list); - } - - public String toString() - { - return "" - + toString(_id_) - + toString(_transition_) - + toString(_stateLists_); - } - - void removeChild(Node child) - { - if(_id_ == child) + public PTransition getTransition() { - _id_ = null; - return; + return this._transition_; } - if(_transition_ == child) + public void setTransition(PTransition node) { - _transition_ = null; - return; + if(this._transition_ != null) + { + this._transition_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._transition_ = node; } - if(_stateLists_.remove(child)) + public LinkedList<PStateListTail> getStateLists() { - return; + return this._stateLists_; } - } - - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) + public void setStateLists(List<PStateListTail> list) { - setId((TId) newChild); - return; + for(PStateListTail e : this._stateLists_) + { + e.parent(null); + } + this._stateLists_.clear(); + + for(PStateListTail e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._stateLists_.add(e); + } } - if(_transition_ == oldChild) + @Override + public String toString() { - setTransition((PTransition) newChild); - return; + return "" + + toString(this._id_) + + toString(this._transition_) + + toString(this._stateLists_); } - for(ListIterator i = _stateLists_.listIterator(); i.hasNext();) + @Override + void removeChild(Node child) { - if(i.next() == oldChild) - { - if(newChild != null) + // Remove child + if(this._id_ == child) { - i.set(newChild); - oldChild.parent(null); - return; + this._id_ = null; + return; } - i.remove(); - oldChild.parent(null); - return; - } - } + if(this._transition_ == child) + { + this._transition_ = null; + return; + } - } + if(this._stateLists_.remove(child)) + { + return; + } - private class StateLists_Cast implements Cast - { - public Object cast(Object o) + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) { - PStateListTail node = (PStateListTail) o; + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } - if((node.parent() != null) && - (node.parent() != AStateList.this)) - { - node.parent().removeChild(node); - } + if(this._transition_ == oldChild) + { + setTransition((PTransition) newChild); + return; + } - if((node.parent() == null) || - (node.parent() != AStateList.this)) - { - node.parent(AStateList.this); - } + for(ListIterator<PStateListTail> i = this._stateLists_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PStateListTail) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AStateListTail.java b/src/main/java/org/sablecc/sablecc/node/AStateListTail.java index c46e0bd6f07e2fe872f402bf880e50570a058e84..b07fbfcc87000a2dd5447b1fa408324ac0189454 100644 --- a/src/main/java/org/sablecc/sablecc/node/AStateListTail.java +++ b/src/main/java/org/sablecc/sablecc/node/AStateListTail.java @@ -2,124 +2,142 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AStateListTail extends PStateListTail { - private TId _id_; - private PTransition _transition_; - - public AStateListTail() - {} - - public AStateListTail( - TId _id_, - PTransition _transition_) - { - setId(_id_); - - setTransition(_transition_); - - } - public Object clone() - { - return new AStateListTail( - (TId) cloneNode(_id_), - (PTransition) cloneNode(_transition_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAStateListTail(this); - } - - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) + private TId _id_; + private PTransition _transition_; + + public AStateListTail() { - _id_.parent(null); + // Constructor } - if(node != null) + public AStateListTail( + TId _id_, + PTransition _transition_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); - } + // Constructor + setId(_id_); - _id_ = node; - } + setTransition(_transition_); - public PTransition getTransition() - { - return _transition_; - } + } - public void setTransition(PTransition node) - { - if(_transition_ != null) + public AStateListTail(AStateListTail node) { - _transition_.parent(null); + super(node); + setId(cloneNode(node._id_)); + setTransition(cloneNode(node._transition_)); } - if(node != null) + @Override + public AStateListTail clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AStateListTail(this); } - _transition_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAStateListTail(this); + } - public String toString() - { - return "" - + toString(_id_) - + toString(_transition_); - } + public TId getId() + { + return this._id_; + } - void removeChild(Node child) - { - if(_id_ == child) + public void setId(TId node) { - _id_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - if(_transition_ == child) + public PTransition getTransition() { - _transition_ = null; - return; + return this._transition_; } - } + public void setTransition(PTransition node) + { + if(this._transition_ != null) + { + this._transition_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._transition_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) + @Override + public String toString() { - setId((TId) newChild); - return; + return "" + + toString(this._id_) + + toString(this._transition_); } - if(_transition_ == oldChild) + @Override + void removeChild(Node child) { - setTransition((PTransition) newChild); - return; + // Remove child + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._transition_ == child) + { + this._transition_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + if(this._transition_ == oldChild) + { + setTransition((PTransition) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AStates.java b/src/main/java/org/sablecc/sablecc/node/AStates.java index ecbadc82f24f2c50a3c0ef361c059bd58e544b8a..1c8e4eec6b5720a5b3ed770eda397c1f1a9e91ab 100644 --- a/src/main/java/org/sablecc/sablecc/node/AStates.java +++ b/src/main/java/org/sablecc/sablecc/node/AStates.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AStates extends PStates { - private final LinkedList _listId_ = new TypedLinkedList(new ListId_Cast()); + private final LinkedList<TId> _listId_ = new LinkedList<TId>(); + + public AStates() + { + // Constructor + } + + public AStates( + List<TId> _listId_) + { + // Constructor + setListId(_listId_); - public AStates() - {} + } + + public AStates(AStates node) + { + super(node); + setListId(cloneList(node._listId_)); + } - public AStates( - List _listId_) - { + @Override + public AStates clone() { - this._listId_.clear(); - this._listId_.addAll(_listId_); + return new AStates(this); } - } - public Object clone() - { - return new AStates( - cloneList(_listId_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAStates(this); - } - - public LinkedList getListId() - { - return _listId_; - } - - public void setListId(List list) - { - _listId_.clear(); - _listId_.addAll(list); - } - - public String toString() - { - return "" - + toString(_listId_); - } - - void removeChild(Node child) - { - if(_listId_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseAStates(this); } - } + public LinkedList<TId> getListId() + { + return this._listId_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _listId_.listIterator(); i.hasNext();) + public void setListId(List<TId> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(TId e : this._listId_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._listId_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(TId e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._listId_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._listId_); + } - private class ListId_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - TId node = (TId) o; + // Remove child + if(this._listId_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != AStates.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != AStates.this)) - { - node.parent(AStates.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<TId> i = this._listId_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((TId) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/AStringBasic.java b/src/main/java/org/sablecc/sablecc/node/AStringBasic.java index 2d8f9889db0605c27939e570bea3c62f542988b6..79963c2303490abda7f75c28d4befd4afe39b524 100644 --- a/src/main/java/org/sablecc/sablecc/node/AStringBasic.java +++ b/src/main/java/org/sablecc/sablecc/node/AStringBasic.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AStringBasic extends PBasic { - private TString _string_; - - public AStringBasic() - {} - - public AStringBasic( - TString _string_) - { - setString(_string_); - - } - public Object clone() - { - return new AStringBasic( - (TString) cloneNode(_string_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAStringBasic(this); - } - - public TString getString() - { - return _string_; - } - - public void setString(TString node) - { - if(_string_ != null) + private TString _string_; + + public AStringBasic() + { + // Constructor + } + + public AStringBasic( + TString _string_) { - _string_.parent(null); + // Constructor + setString(_string_); + } - if(node != null) + public AStringBasic(AStringBasic node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setString(cloneNode(node._string_)); + } - node.parent(this); + @Override + public AStringBasic clone() + { + return new AStringBasic(this); } - _string_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAStringBasic(this); + } - public String toString() - { - return "" - + toString(_string_); - } + public TString getString() + { + return this._string_; + } - void removeChild(Node child) - { - if(_string_ == child) + public void setString(TString node) { - _string_ = null; - return; + if(this._string_ != null) + { + this._string_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._string_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._string_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_string_ == oldChild) + @Override + void removeChild(Node child) { - setString((TString) newChild); - return; + // Remove child + if(this._string_ == child) + { + this._string_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._string_ == oldChild) + { + setString((TString) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ATokenDef.java b/src/main/java/org/sablecc/sablecc/node/ATokenDef.java index c52f52fd2aa0d3af5f5f9c7794fce6af5071f234..b2e423d3a805e98c22fa34324f1f0d8f73de1d21 100644 --- a/src/main/java/org/sablecc/sablecc/node/ATokenDef.java +++ b/src/main/java/org/sablecc/sablecc/node/ATokenDef.java @@ -2,253 +2,271 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ATokenDef extends PTokenDef { - private PStateList _stateList_; - private TId _id_; - private PRegExp _regExp_; - private TSlash _slash_; - private PRegExp _lookAhead_; - - public ATokenDef() - {} - - public ATokenDef( - PStateList _stateList_, - TId _id_, - PRegExp _regExp_, - TSlash _slash_, - PRegExp _lookAhead_) - { - setStateList(_stateList_); - - setId(_id_); - - setRegExp(_regExp_); - - setSlash(_slash_); - - setLookAhead(_lookAhead_); + private PStateList _stateList_; + private TId _id_; + private PRegExp _regExp_; + private TSlash _slash_; + private PRegExp _lookAhead_; - } - public Object clone() - { - return new ATokenDef( - (PStateList) cloneNode(_stateList_), - (TId) cloneNode(_id_), - (PRegExp) cloneNode(_regExp_), - (TSlash) cloneNode(_slash_), - (PRegExp) cloneNode(_lookAhead_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseATokenDef(this); - } - - public PStateList getStateList() - { - return _stateList_; - } - - public void setStateList(PStateList node) - { - if(_stateList_ != null) + public ATokenDef() { - _stateList_.parent(null); + // Constructor } - if(node != null) + public ATokenDef( + PStateList _stateList_, + TId _id_, + PRegExp _regExp_, + TSlash _slash_, + PRegExp _lookAhead_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + // Constructor + setStateList(_stateList_); - node.parent(this); - } + setId(_id_); - _stateList_ = node; - } + setRegExp(_regExp_); - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) - { - _id_.parent(null); - } + setSlash(_slash_); - if(node != null) - { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + setLookAhead(_lookAhead_); - node.parent(this); } - _id_ = node; - } - - public PRegExp getRegExp() - { - return _regExp_; - } - - public void setRegExp(PRegExp node) - { - if(_regExp_ != null) + public ATokenDef(ATokenDef node) { - _regExp_.parent(null); + super(node); + setStateList(cloneNode(node._stateList_)); + setId(cloneNode(node._id_)); + setRegExp(cloneNode(node._regExp_)); + setSlash(cloneNode(node._slash_)); + setLookAhead(cloneNode(node._lookAhead_)); } - if(node != null) + @Override + public ATokenDef clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new ATokenDef(this); } - _regExp_ = node; - } - - public TSlash getSlash() - { - return _slash_; - } - - public void setSlash(TSlash node) - { - if(_slash_ != null) + @Override + public void apply(Switch sw) { - _slash_.parent(null); + ((Analysis) sw).caseATokenDef(this); } - if(node != null) + public PStateList getStateList() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._stateList_; } - _slash_ = node; - } - - public PRegExp getLookAhead() - { - return _lookAhead_; - } - - public void setLookAhead(PRegExp node) - { - if(_lookAhead_ != null) + public void setStateList(PStateList node) { - _lookAhead_.parent(null); + if(this._stateList_ != null) + { + this._stateList_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._stateList_ = node; } - if(node != null) + public TId getId() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return this._id_; } - _lookAhead_ = node; - } - - public String toString() - { - return "" - + toString(_stateList_) - + toString(_id_) - + toString(_regExp_) - + toString(_slash_) - + toString(_lookAhead_); - } - - void removeChild(Node child) - { - if(_stateList_ == child) + public void setId(TId node) { - _stateList_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - if(_id_ == child) + public PRegExp getRegExp() { - _id_ = null; - return; + return this._regExp_; } - if(_regExp_ == child) + public void setRegExp(PRegExp node) { - _regExp_ = null; - return; + if(this._regExp_ != null) + { + this._regExp_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._regExp_ = node; } - if(_slash_ == child) + public TSlash getSlash() { - _slash_ = null; - return; + return this._slash_; } - if(_lookAhead_ == child) + public void setSlash(TSlash node) { - _lookAhead_ = null; - return; + if(this._slash_ != null) + { + this._slash_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._slash_ = node; } - } - - void replaceChild(Node oldChild, Node newChild) - { - if(_stateList_ == oldChild) + public PRegExp getLookAhead() { - setStateList((PStateList) newChild); - return; + return this._lookAhead_; } - if(_id_ == oldChild) + public void setLookAhead(PRegExp node) { - setId((TId) newChild); - return; + if(this._lookAhead_ != null) + { + this._lookAhead_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._lookAhead_ = node; } - if(_regExp_ == oldChild) + @Override + public String toString() { - setRegExp((PRegExp) newChild); - return; + return "" + + toString(this._stateList_) + + toString(this._id_) + + toString(this._regExp_) + + toString(this._slash_) + + toString(this._lookAhead_); } - if(_slash_ == oldChild) + @Override + void removeChild(Node child) { - setSlash((TSlash) newChild); - return; + // Remove child + if(this._stateList_ == child) + { + this._stateList_ = null; + return; + } + + if(this._id_ == child) + { + this._id_ = null; + return; + } + + if(this._regExp_ == child) + { + this._regExp_ = null; + return; + } + + if(this._slash_ == child) + { + this._slash_ = null; + return; + } + + if(this._lookAhead_ == child) + { + this._lookAhead_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - if(_lookAhead_ == oldChild) + @Override + void replaceChild(Node oldChild, Node newChild) { - setLookAhead((PRegExp) newChild); - return; + // Replace child + if(this._stateList_ == oldChild) + { + setStateList((PStateList) newChild); + return; + } + + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + if(this._regExp_ == oldChild) + { + setRegExp((PRegExp) newChild); + return; + } + + if(this._slash_ == oldChild) + { + setSlash((TSlash) newChild); + return; + } + + if(this._lookAhead_ == oldChild) + { + setLookAhead((PRegExp) newChild); + return; + } + + throw new RuntimeException("Not a child."); } - - } } diff --git a/src/main/java/org/sablecc/sablecc/node/ATokenSpecifier.java b/src/main/java/org/sablecc/sablecc/node/ATokenSpecifier.java index 0828026590ebdb52f33438204db2bceb87098811..596e939289aa23f3a6dda76391f0258452049e66 100644 --- a/src/main/java/org/sablecc/sablecc/node/ATokenSpecifier.java +++ b/src/main/java/org/sablecc/sablecc/node/ATokenSpecifier.java @@ -2,32 +2,51 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ATokenSpecifier extends PSpecifier { - public ATokenSpecifier() - {} - public Object clone() - { - return new ATokenSpecifier(); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseATokenSpecifier(this); - } - - public String toString() - { - return ""; - } - - void removeChild(Node child) - {} - - void replaceChild(Node oldChild, Node newChild) - {} + public ATokenSpecifier() + { + // Constructor + } + + public ATokenSpecifier(ATokenSpecifier node) + { + super(node); + } + + @Override + public ATokenSpecifier clone() + { + return new ATokenSpecifier(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseATokenSpecifier(this); + } + + @Override + public String toString() + { + return ""; + } + + @Override + void removeChild(Node child) + { + // Remove child + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/ATokens.java b/src/main/java/org/sablecc/sablecc/node/ATokens.java index 918c9c8535b0d6b79777a6f42be67c17aab25792..2ad3db72495dcb10f541587b3d10da2ea21f342b 100644 --- a/src/main/java/org/sablecc/sablecc/node/ATokens.java +++ b/src/main/java/org/sablecc/sablecc/node/ATokens.java @@ -5,99 +5,108 @@ package org.sablecc.sablecc.node; import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ATokens extends PTokens { - private final LinkedList _tokenDefs_ = new TypedLinkedList(new TokenDefs_Cast()); + private final LinkedList<PTokenDef> _tokenDefs_ = new LinkedList<PTokenDef>(); + + public ATokens() + { + // Constructor + } + + public ATokens( + List<PTokenDef> _tokenDefs_) + { + // Constructor + setTokenDefs(_tokenDefs_); - public ATokens() - {} + } + + public ATokens(ATokens node) + { + super(node); + setTokenDefs(cloneList(node._tokenDefs_)); + } - public ATokens( - List _tokenDefs_) - { + @Override + public ATokens clone() { - this._tokenDefs_.clear(); - this._tokenDefs_.addAll(_tokenDefs_); + return new ATokens(this); } - } - public Object clone() - { - return new ATokens( - cloneList(_tokenDefs_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseATokens(this); - } - - public LinkedList getTokenDefs() - { - return _tokenDefs_; - } - - public void setTokenDefs(List list) - { - _tokenDefs_.clear(); - _tokenDefs_.addAll(list); - } - - public String toString() - { - return "" - + toString(_tokenDefs_); - } - - void removeChild(Node child) - { - if(_tokenDefs_.remove(child)) + @Override + public void apply(Switch sw) { - return; + ((Analysis) sw).caseATokens(this); } - } + public LinkedList<PTokenDef> getTokenDefs() + { + return this._tokenDefs_; + } - void replaceChild(Node oldChild, Node newChild) - { - for(ListIterator i = _tokenDefs_.listIterator(); i.hasNext();) + public void setTokenDefs(List<PTokenDef> list) { - if(i.next() == oldChild) - { - if(newChild != null) + for(PTokenDef e : this._tokenDefs_) { - i.set(newChild); - oldChild.parent(null); - return; + e.parent(null); } + this._tokenDefs_.clear(); - i.remove(); - oldChild.parent(null); - return; - } + for(PTokenDef e : list) + { + if(e.parent() != null) + { + e.parent().removeChild(e); + } + + e.parent(this); + this._tokenDefs_.add(e); + } } - } + @Override + public String toString() + { + return "" + + toString(this._tokenDefs_); + } - private class TokenDefs_Cast implements Cast - { - public Object cast(Object o) + @Override + void removeChild(Node child) { - PTokenDef node = (PTokenDef) o; + // Remove child + if(this._tokenDefs_.remove(child)) + { + return; + } - if((node.parent() != null) && - (node.parent() != ATokens.this)) - { - node.parent().removeChild(node); - } + throw new RuntimeException("Not a child."); + } - if((node.parent() == null) || - (node.parent() != ATokens.this)) - { - node.parent(ATokens.this); - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + for(ListIterator<PTokenDef> i = this._tokenDefs_.listIterator(); i.hasNext();) + { + if(i.next() == oldChild) + { + if(newChild != null) + { + i.set((PTokenDef) newChild); + newChild.parent(this); + oldChild.parent(null); + return; + } + + i.remove(); + oldChild.parent(null); + return; + } + } - return node; + throw new RuntimeException("Not a child."); } - } } diff --git a/src/main/java/org/sablecc/sablecc/node/ATransition.java b/src/main/java/org/sablecc/sablecc/node/ATransition.java index ac6157febc68fbe4cd05bc0b497c77b724b51ea8..e0c63282c9b02a058fac2f6e4cb6d636133d5e8c 100644 --- a/src/main/java/org/sablecc/sablecc/node/ATransition.java +++ b/src/main/java/org/sablecc/sablecc/node/ATransition.java @@ -2,81 +2,99 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class ATransition extends PTransition { - private TId _id_; - - public ATransition() - {} - - public ATransition( - TId _id_) - { - setId(_id_); - - } - public Object clone() - { - return new ATransition( - (TId) cloneNode(_id_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseATransition(this); - } - - public TId getId() - { - return _id_; - } - - public void setId(TId node) - { - if(_id_ != null) + private TId _id_; + + public ATransition() + { + // Constructor + } + + public ATransition( + TId _id_) { - _id_.parent(null); + // Constructor + setId(_id_); + } - if(node != null) + public ATransition(ATransition node) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + super(node); + setId(cloneNode(node._id_)); + } - node.parent(this); + @Override + public ATransition clone() + { + return new ATransition(this); } - _id_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseATransition(this); + } - public String toString() - { - return "" - + toString(_id_); - } + public TId getId() + { + return this._id_; + } - void removeChild(Node child) - { - if(_id_ == child) + public void setId(TId node) { - _id_ = null; - return; + if(this._id_ != null) + { + this._id_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._id_ = node; } - } + @Override + public String toString() + { + return "" + + toString(this._id_); + } - void replaceChild(Node oldChild, Node newChild) - { - if(_id_ == oldChild) + @Override + void removeChild(Node child) { - setId((TId) newChild); - return; + // Remove child + if(this._id_ == child) + { + this._id_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._id_ == oldChild) + { + setId((TId) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/AUnExp.java b/src/main/java/org/sablecc/sablecc/node/AUnExp.java index b3ad503dae55ab761f187f6868f19b07985bb328..ea2d1e39625a98a4d8b7c12bac7784127e3caf6e 100644 --- a/src/main/java/org/sablecc/sablecc/node/AUnExp.java +++ b/src/main/java/org/sablecc/sablecc/node/AUnExp.java @@ -2,124 +2,142 @@ package org.sablecc.sablecc.node; -import java.util.*; import org.sablecc.sablecc.analysis.*; + public final class AUnExp extends PUnExp { - private PBasic _basic_; - private PUnOp _unOp_; - - public AUnExp() - {} - - public AUnExp( - PBasic _basic_, - PUnOp _unOp_) - { - setBasic(_basic_); - - setUnOp(_unOp_); - - } - public Object clone() - { - return new AUnExp( - (PBasic) cloneNode(_basic_), - (PUnOp) cloneNode(_unOp_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseAUnExp(this); - } - - public PBasic getBasic() - { - return _basic_; - } - - public void setBasic(PBasic node) - { - if(_basic_ != null) + private PBasic _basic_; + private PUnOp _unOp_; + + public AUnExp() { - _basic_.parent(null); + // Constructor } - if(node != null) + public AUnExp( + PBasic _basic_, + PUnOp _unOp_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); - } + // Constructor + setBasic(_basic_); - _basic_ = node; - } + setUnOp(_unOp_); - public PUnOp getUnOp() - { - return _unOp_; - } + } - public void setUnOp(PUnOp node) - { - if(_unOp_ != null) + public AUnExp(AUnExp node) { - _unOp_.parent(null); + super(node); + setBasic(cloneNode(node._basic_)); + setUnOp(cloneNode(node._unOp_)); } - if(node != null) + @Override + public AUnExp clone() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + return new AUnExp(this); } - _unOp_ = node; - } + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseAUnExp(this); + } - public String toString() - { - return "" - + toString(_basic_) - + toString(_unOp_); - } + public PBasic getBasic() + { + return this._basic_; + } - void removeChild(Node child) - { - if(_basic_ == child) + public void setBasic(PBasic node) { - _basic_ = null; - return; + if(this._basic_ != null) + { + this._basic_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._basic_ = node; } - if(_unOp_ == child) + public PUnOp getUnOp() { - _unOp_ = null; - return; + return this._unOp_; } - } + public void setUnOp(PUnOp node) + { + if(this._unOp_ != null) + { + this._unOp_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._unOp_ = node; + } - void replaceChild(Node oldChild, Node newChild) - { - if(_basic_ == oldChild) + @Override + public String toString() { - setBasic((PBasic) newChild); - return; + return "" + + toString(this._basic_) + + toString(this._unOp_); } - if(_unOp_ == oldChild) + @Override + void removeChild(Node child) { - setUnOp((PUnOp) newChild); - return; + // Remove child + if(this._basic_ == child) + { + this._basic_ = null; + return; + } + + if(this._unOp_ == child) + { + this._unOp_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } + @Override + void replaceChild(Node oldChild, Node newChild) + { + // Replace child + if(this._basic_ == oldChild) + { + setBasic((PBasic) newChild); + return; + } + + if(this._unOp_ == oldChild) + { + setUnOp((PUnOp) newChild); + return; + } + + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/Cast.java b/src/main/java/org/sablecc/sablecc/node/Cast.java deleted file mode 100644 index 920b94b709695d3e2e96e4922bb0d667f2bb75c0..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/node/Cast.java +++ /dev/null @@ -1,8 +0,0 @@ -/* This file was generated by SableCC (http://www.sablecc.org/). */ - -package org.sablecc.sablecc.node; - -public interface Cast -{ - Object cast(Object o); -} diff --git a/src/main/java/org/sablecc/sablecc/node/EOF.java b/src/main/java/org/sablecc/sablecc/node/EOF.java index 0133752e3dff61fae1c75e55b9af8632a7c5dfc1..5097f39cd8213c78aa0567870c15183e3ece638d 100644 --- a/src/main/java/org/sablecc/sablecc/node/EOF.java +++ b/src/main/java/org/sablecc/sablecc/node/EOF.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class EOF extends Token { - public EOF() - { - setText(""); - } - - public EOF(int line, int pos) - { - setText(""); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new EOF(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseEOF(this); - } + public EOF() + { + super(""); + } + + public EOF(int line, int pos) + { + super("", line, pos); + } + + public EOF(EOF token) + { + super(token); + } + + @Override + public EOF clone() + { + return new EOF(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseEOF(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/NoCast.java b/src/main/java/org/sablecc/sablecc/node/NoCast.java deleted file mode 100644 index 1678661a159f18165e85a738148ad7b9c2219473..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/node/NoCast.java +++ /dev/null @@ -1,16 +0,0 @@ -/* This file was generated by SableCC (http://www.sablecc.org/). */ - -package org.sablecc.sablecc.node; - -public class NoCast implements Cast -{ - public final static NoCast instance = new NoCast(); - - private NoCast() - {} - - public Object cast(Object o) - { - return o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/node/Node.java b/src/main/java/org/sablecc/sablecc/node/Node.java index dc73c6c9d1c572da09239cce414e2349384bb14e..f37caa17aa10369ec626ddc9a28edc095347f5e2 100644 --- a/src/main/java/org/sablecc/sablecc/node/Node.java +++ b/src/main/java/org/sablecc/sablecc/node/Node.java @@ -2,78 +2,90 @@ package org.sablecc.sablecc.node; -import java.util.*; -import org.sablecc.sablecc.analysis.*; +import java.util.LinkedList; +import java.util.List; -@SuppressWarnings({"rawtypes","unchecked"}) -public abstract class Node implements Switchable, Cloneable -{ - private Node parent; +import de.hhu.stups.sablecc.patch.PositionedNode; - public abstract Object clone(); +public abstract class Node extends PositionedNode implements Switchable, Cloneable +{ + private Node parent; - public Node parent() - { - return parent; - } + protected Node() + {} - void parent(Node parent) - { - this.parent = parent; - } + protected Node(Node node) + { + super(node); + // Copy constructor intentionally does not keep parent! + // The new copied node is not a child of the original parent anymore. + this.parent = null; + } - abstract void removeChild(Node child); - abstract void replaceChild(Node oldChild, Node newChild); + @Override + public abstract Node clone(); - public void replaceBy(Node node) - { - if(parent != null) + public Node parent() { - parent.replaceChild(this, node); + return this.parent; } - } - protected String toString(Node node) - { - if(node != null) + void parent(Node parent) { - return node.toString(); + this.parent = parent; } - return ""; - } + abstract void removeChild(Node child); + abstract void replaceChild(Node oldChild, Node newChild); - protected String toString(List list) - { - StringBuffer s = new StringBuffer(); - - for(Iterator i = list.iterator(); i.hasNext();) + public void replaceBy(Node node) { - s.append(i.next()); + this.parent.replaceChild(this, node); } - return s.toString(); - } - - protected Node cloneNode(Node node) - { - if(node != null) + protected static String toString(Node node) { - return (Node) node.clone(); + if(node != null) + { + return node.toString(); + } + + return ""; } - return null; - } + protected static String toString(List<?> list) + { + StringBuilder s = new StringBuilder(); - protected List cloneList(List list) - { - List clone = new LinkedList(); + for(Object o : list) + { + s.append(o); + } - for(Iterator i = list.iterator(); i.hasNext();) + return s.toString(); + } + + @SuppressWarnings("unchecked") + protected static <T extends Node> T cloneNode(T node) { - clone.add(((Node) i.next()).clone()); + if(node != null) + { + return (T) node.clone(); + } + + return null; } - return clone; - } + @SuppressWarnings("unchecked") + protected static <T extends Node> List<T> cloneList(List<T> list) + { + List<T> clone = new LinkedList<T>(); + + for(T n : list) + { + clone.add((T) n.clone()); + } + + return clone; + } } diff --git a/src/main/java/org/sablecc/sablecc/node/NodeCast.java b/src/main/java/org/sablecc/sablecc/node/NodeCast.java deleted file mode 100644 index 9ee7fc37754a488e7cdceb5b761c875da3ba3e45..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/node/NodeCast.java +++ /dev/null @@ -1,16 +0,0 @@ -/* This file was generated by SableCC (http://www.sablecc.org/). */ - -package org.sablecc.sablecc.node; - -public class NodeCast implements Cast -{ - public final static NodeCast instance = new NodeCast(); - - private NodeCast() - {} - - public Object cast(Object o) - { - return (Node) o; - } -} diff --git a/src/main/java/org/sablecc/sablecc/node/PAlt.java b/src/main/java/org/sablecc/sablecc/node/PAlt.java index 765b8b08b22acf5e5d86572d5b8b46dce78bb420..805ab230e329fd4693a7994ac3b49cd7e3f32695 100644 --- a/src/main/java/org/sablecc/sablecc/node/PAlt.java +++ b/src/main/java/org/sablecc/sablecc/node/PAlt.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PAlt extends Node - {} +{ + public PAlt() + {} + + public PAlt(PAlt node) + { + super(node); + } + + @Override + public abstract PAlt clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PAltTransform.java b/src/main/java/org/sablecc/sablecc/node/PAltTransform.java index 58b590e1bd7c490dead68419cbfb40488bd43b16..f0eafa2ea20ba7bc6895e3f410c8c79566b18ac5 100644 --- a/src/main/java/org/sablecc/sablecc/node/PAltTransform.java +++ b/src/main/java/org/sablecc/sablecc/node/PAltTransform.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PAltTransform extends Node - {} +{ + public PAltTransform() + {} + + public PAltTransform(PAltTransform node) + { + super(node); + } + + @Override + public abstract PAltTransform clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PAst.java b/src/main/java/org/sablecc/sablecc/node/PAst.java index aa65dd77ce60d019b5196e161ceb9b81b21e57b5..04d7430515d9fa82ccfb32cb04b3783329803d63 100644 --- a/src/main/java/org/sablecc/sablecc/node/PAst.java +++ b/src/main/java/org/sablecc/sablecc/node/PAst.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PAst extends Node - {} +{ + public PAst() + {} + + public PAst(PAst node) + { + super(node); + } + + @Override + public abstract PAst clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PAstAlt.java b/src/main/java/org/sablecc/sablecc/node/PAstAlt.java index edabab56a0f1ee7b29e328eae7621c3a8a315287..7fa3763890d2b5441d693633db0c2d3526a8b452 100644 --- a/src/main/java/org/sablecc/sablecc/node/PAstAlt.java +++ b/src/main/java/org/sablecc/sablecc/node/PAstAlt.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PAstAlt extends Node - {} +{ + public PAstAlt() + {} + + public PAstAlt(PAstAlt node) + { + super(node); + } + + @Override + public abstract PAstAlt clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PAstProd.java b/src/main/java/org/sablecc/sablecc/node/PAstProd.java index 7ca1e78f644f5420b48a00fbd11db1557d6ccf24..de12a50aa730b3d35c761e96a8a20b47a192de19 100644 --- a/src/main/java/org/sablecc/sablecc/node/PAstProd.java +++ b/src/main/java/org/sablecc/sablecc/node/PAstProd.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PAstProd extends Node - {} +{ + public PAstProd() + {} + + public PAstProd(PAstProd node) + { + super(node); + } + + @Override + public abstract PAstProd clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PBasic.java b/src/main/java/org/sablecc/sablecc/node/PBasic.java index cbd72e51ff86487a14986c22a31b54080298e477..2a3b4b9c02c9a6371c9a782958d8f2bd31fabd80 100644 --- a/src/main/java/org/sablecc/sablecc/node/PBasic.java +++ b/src/main/java/org/sablecc/sablecc/node/PBasic.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PBasic extends Node - {} +{ + public PBasic() + {} + + public PBasic(PBasic node) + { + super(node); + } + + @Override + public abstract PBasic clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PBinOp.java b/src/main/java/org/sablecc/sablecc/node/PBinOp.java index a2286b4d3d76bd6a92022d8495ab1332b29f1632..1d35acb71ff9a10a68dfa8bf74677218ba20bd86 100644 --- a/src/main/java/org/sablecc/sablecc/node/PBinOp.java +++ b/src/main/java/org/sablecc/sablecc/node/PBinOp.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PBinOp extends Node - {} +{ + public PBinOp() + {} + + public PBinOp(PBinOp node) + { + super(node); + } + + @Override + public abstract PBinOp clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PChar.java b/src/main/java/org/sablecc/sablecc/node/PChar.java index 70fdd12088f1b21119bdb594fd1ca449aaea29f4..1e1975cc9edebdde7462b3d85320c5e4b857a8f1 100644 --- a/src/main/java/org/sablecc/sablecc/node/PChar.java +++ b/src/main/java/org/sablecc/sablecc/node/PChar.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PChar extends Node - {} +{ + public PChar() + {} + + public PChar(PChar node) + { + super(node); + } + + @Override + public abstract PChar clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PConcat.java b/src/main/java/org/sablecc/sablecc/node/PConcat.java index c97f5d9f9c02cff0b95fff1cbbbf47fa4727aa9f..7c9ef83e1a5faa05761ed20a792560264a01ea72 100644 --- a/src/main/java/org/sablecc/sablecc/node/PConcat.java +++ b/src/main/java/org/sablecc/sablecc/node/PConcat.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PConcat extends Node - {} +{ + public PConcat() + {} + + public PConcat(PConcat node) + { + super(node); + } + + @Override + public abstract PConcat clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PElem.java b/src/main/java/org/sablecc/sablecc/node/PElem.java index 66dbb70708efa425a93a0e1975a65caa8d520058..748f1bc5ec9b069d99b54db2d2a361af026991c5 100644 --- a/src/main/java/org/sablecc/sablecc/node/PElem.java +++ b/src/main/java/org/sablecc/sablecc/node/PElem.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PElem extends Node - {} +{ + public PElem() + {} + + public PElem(PElem node) + { + super(node); + } + + @Override + public abstract PElem clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PGrammar.java b/src/main/java/org/sablecc/sablecc/node/PGrammar.java index 2e4f19ffbfb3c9230dd0a48a3ff71c7ef69828ca..8501e4c0b95d2135664b18fb021ad9742313759e 100644 --- a/src/main/java/org/sablecc/sablecc/node/PGrammar.java +++ b/src/main/java/org/sablecc/sablecc/node/PGrammar.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PGrammar extends Node - {} +{ + public PGrammar() + {} + + public PGrammar(PGrammar node) + { + super(node); + } + + @Override + public abstract PGrammar clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PHelperDef.java b/src/main/java/org/sablecc/sablecc/node/PHelperDef.java index 8a2b10974701d2a679e30141e5b44a6de9712cff..b9e501dc3ebc011a5faf44dd0934345c69fa6740 100644 --- a/src/main/java/org/sablecc/sablecc/node/PHelperDef.java +++ b/src/main/java/org/sablecc/sablecc/node/PHelperDef.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PHelperDef extends Node - {} +{ + public PHelperDef() + {} + + public PHelperDef(PHelperDef node) + { + super(node); + } + + @Override + public abstract PHelperDef clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PHelpers.java b/src/main/java/org/sablecc/sablecc/node/PHelpers.java index 1553c87bfeb3027ad4d6888f583841ca1a47a287..a1ddbf2b92fa1914726da310f944720600c43a22 100644 --- a/src/main/java/org/sablecc/sablecc/node/PHelpers.java +++ b/src/main/java/org/sablecc/sablecc/node/PHelpers.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PHelpers extends Node - {} +{ + public PHelpers() + {} + + public PHelpers(PHelpers node) + { + super(node); + } + + @Override + public abstract PHelpers clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PIgnTokens.java b/src/main/java/org/sablecc/sablecc/node/PIgnTokens.java index 253de6edde5b51e9aecba5e7e1cc1bec4d467536..fb53108b47c422f028ac881a09990a31f790c53c 100644 --- a/src/main/java/org/sablecc/sablecc/node/PIgnTokens.java +++ b/src/main/java/org/sablecc/sablecc/node/PIgnTokens.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PIgnTokens extends Node - {} +{ + public PIgnTokens() + {} + + public PIgnTokens(PIgnTokens node) + { + super(node); + } + + @Override + public abstract PIgnTokens clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PListTerm.java b/src/main/java/org/sablecc/sablecc/node/PListTerm.java index 35837af3962f50cc91a968c601b00d5f2b04fa95..d8e7a48fc7537f0a1ca95dfc1a9eec33df44497b 100644 --- a/src/main/java/org/sablecc/sablecc/node/PListTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/PListTerm.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PListTerm extends Node - {} +{ + public PListTerm() + {} + + public PListTerm(PListTerm node) + { + super(node); + } + + @Override + public abstract PListTerm clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PProd.java b/src/main/java/org/sablecc/sablecc/node/PProd.java index 2c728027296d3294ea7391beea7d5d8df6a350d4..2d9db40db2087d7b65bc2e48ba491854392625a8 100644 --- a/src/main/java/org/sablecc/sablecc/node/PProd.java +++ b/src/main/java/org/sablecc/sablecc/node/PProd.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PProd extends Node - {} +{ + public PProd() + {} + + public PProd(PProd node) + { + super(node); + } + + @Override + public abstract PProd clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PProdName.java b/src/main/java/org/sablecc/sablecc/node/PProdName.java index 7da2e3d8e70269ed7d6c7824e9268651b8bb321a..380e8da86d939305a4353354040908258a3175e7 100644 --- a/src/main/java/org/sablecc/sablecc/node/PProdName.java +++ b/src/main/java/org/sablecc/sablecc/node/PProdName.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PProdName extends Node - {} +{ + public PProdName() + {} + + public PProdName(PProdName node) + { + super(node); + } + + @Override + public abstract PProdName clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PProductions.java b/src/main/java/org/sablecc/sablecc/node/PProductions.java index f5f954b03ed88ee76ff0a2374c1caeb9e451d023..98da82638503ce58f7d0a5dcab776c74d0f75a45 100644 --- a/src/main/java/org/sablecc/sablecc/node/PProductions.java +++ b/src/main/java/org/sablecc/sablecc/node/PProductions.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PProductions extends Node - {} +{ + public PProductions() + {} + + public PProductions(PProductions node) + { + super(node); + } + + @Override + public abstract PProductions clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PRegExp.java b/src/main/java/org/sablecc/sablecc/node/PRegExp.java index 6d1e4368d654288d77e23c202963b0911b798c9f..3ebc5a202aafbe5c3b3c9eeb7876811385bff89e 100644 --- a/src/main/java/org/sablecc/sablecc/node/PRegExp.java +++ b/src/main/java/org/sablecc/sablecc/node/PRegExp.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PRegExp extends Node - {} +{ + public PRegExp() + {} + + public PRegExp(PRegExp node) + { + super(node); + } + + @Override + public abstract PRegExp clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PSet.java b/src/main/java/org/sablecc/sablecc/node/PSet.java index cbddf9a67ba05e53dcf9c552f5d1b6df99893246..e9d659382aa480c0e48ba2bc7cecb37981d8a5f4 100644 --- a/src/main/java/org/sablecc/sablecc/node/PSet.java +++ b/src/main/java/org/sablecc/sablecc/node/PSet.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PSet extends Node - {} +{ + public PSet() + {} + + public PSet(PSet node) + { + super(node); + } + + @Override + public abstract PSet clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PSpecifier.java b/src/main/java/org/sablecc/sablecc/node/PSpecifier.java index 99cb14ed530f7c39e9bb365ccfc356f90520fdd2..39fc6267212ab15aa372725b0867cca14da46a45 100644 --- a/src/main/java/org/sablecc/sablecc/node/PSpecifier.java +++ b/src/main/java/org/sablecc/sablecc/node/PSpecifier.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PSpecifier extends Node - {} +{ + public PSpecifier() + {} + + public PSpecifier(PSpecifier node) + { + super(node); + } + + @Override + public abstract PSpecifier clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PStateList.java b/src/main/java/org/sablecc/sablecc/node/PStateList.java index 6bc113239fcadd68c857216b072819e6fc058738..b8509d11053b69d32c20260b72b11cb4af5e9d2d 100644 --- a/src/main/java/org/sablecc/sablecc/node/PStateList.java +++ b/src/main/java/org/sablecc/sablecc/node/PStateList.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PStateList extends Node - {} +{ + public PStateList() + {} + + public PStateList(PStateList node) + { + super(node); + } + + @Override + public abstract PStateList clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PStateListTail.java b/src/main/java/org/sablecc/sablecc/node/PStateListTail.java index d34ca707152bd9d68a094591d32d1e4c99c28c35..3968b1082c1f172e094d050aea9c395ceea9be7a 100644 --- a/src/main/java/org/sablecc/sablecc/node/PStateListTail.java +++ b/src/main/java/org/sablecc/sablecc/node/PStateListTail.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PStateListTail extends Node - {} +{ + public PStateListTail() + {} + + public PStateListTail(PStateListTail node) + { + super(node); + } + + @Override + public abstract PStateListTail clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PStates.java b/src/main/java/org/sablecc/sablecc/node/PStates.java index c01e8726b3c14a6810021326fdeb370f7db637ac..c0f22d478a1f94a32d4197f128defd220ab886fe 100644 --- a/src/main/java/org/sablecc/sablecc/node/PStates.java +++ b/src/main/java/org/sablecc/sablecc/node/PStates.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PStates extends Node - {} +{ + public PStates() + {} + + public PStates(PStates node) + { + super(node); + } + + @Override + public abstract PStates clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PTerm.java b/src/main/java/org/sablecc/sablecc/node/PTerm.java index 49feaaf853c99d85da826b859a067b7abd6ead71..e3e93730dcc61b39ac3fa36b010370dca07f8e4f 100644 --- a/src/main/java/org/sablecc/sablecc/node/PTerm.java +++ b/src/main/java/org/sablecc/sablecc/node/PTerm.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PTerm extends Node - {} +{ + public PTerm() + {} + + public PTerm(PTerm node) + { + super(node); + } + + @Override + public abstract PTerm clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PTokenDef.java b/src/main/java/org/sablecc/sablecc/node/PTokenDef.java index c9e7f2d849fc93a4cb596247b4b06f010fe1c4b1..783f7429f527e3eedcf317914e7b161f270ee6a2 100644 --- a/src/main/java/org/sablecc/sablecc/node/PTokenDef.java +++ b/src/main/java/org/sablecc/sablecc/node/PTokenDef.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PTokenDef extends Node - {} +{ + public PTokenDef() + {} + + public PTokenDef(PTokenDef node) + { + super(node); + } + + @Override + public abstract PTokenDef clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PTokens.java b/src/main/java/org/sablecc/sablecc/node/PTokens.java index 0539578de1d0f1e69e31e392d55d1e48e968c45f..d0b4af8c15e5b50afc3796e6d741b82361346bb3 100644 --- a/src/main/java/org/sablecc/sablecc/node/PTokens.java +++ b/src/main/java/org/sablecc/sablecc/node/PTokens.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PTokens extends Node - {} +{ + public PTokens() + {} + + public PTokens(PTokens node) + { + super(node); + } + + @Override + public abstract PTokens clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PTransition.java b/src/main/java/org/sablecc/sablecc/node/PTransition.java index e651f5e6b44902d7d527e94dd2215efedda07ff7..d8b166d4d497dbacadd8f8227dfb0788a3d1b68d 100644 --- a/src/main/java/org/sablecc/sablecc/node/PTransition.java +++ b/src/main/java/org/sablecc/sablecc/node/PTransition.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PTransition extends Node - {} +{ + public PTransition() + {} + + public PTransition(PTransition node) + { + super(node); + } + + @Override + public abstract PTransition clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PUnExp.java b/src/main/java/org/sablecc/sablecc/node/PUnExp.java index e16b6e9a894000d0ba78f54c3a4fe5455da1af25..28f0cbadbcaa0433cdd6501c21abaeab6d660806 100644 --- a/src/main/java/org/sablecc/sablecc/node/PUnExp.java +++ b/src/main/java/org/sablecc/sablecc/node/PUnExp.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PUnExp extends Node - {} +{ + public PUnExp() + {} + + public PUnExp(PUnExp node) + { + super(node); + } + + @Override + public abstract PUnExp clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/PUnOp.java b/src/main/java/org/sablecc/sablecc/node/PUnOp.java index 48e258210c73b550e8506ebed8840418914ecc8a..fc09a3313178fcab10351741575164f30ca6bfe3 100644 --- a/src/main/java/org/sablecc/sablecc/node/PUnOp.java +++ b/src/main/java/org/sablecc/sablecc/node/PUnOp.java @@ -3,4 +3,15 @@ package org.sablecc.sablecc.node; public abstract class PUnOp extends Node - {} +{ + public PUnOp() + {} + + public PUnOp(PUnOp node) + { + super(node); + } + + @Override + public abstract PUnOp clone(); +} diff --git a/src/main/java/org/sablecc/sablecc/node/Start.java b/src/main/java/org/sablecc/sablecc/node/Start.java index 0806caa644b9991a0065ce61b9913307bce6212c..0988c84f035f06138fea1ccbdf1097b123aa2a56 100644 --- a/src/main/java/org/sablecc/sablecc/node/Start.java +++ b/src/main/java/org/sablecc/sablecc/node/Start.java @@ -6,116 +6,132 @@ import org.sablecc.sablecc.analysis.*; public final class Start extends Node { - private PGrammar _pGrammar_; - private EOF _eof_; - - public Start() - {} - - public Start( - PGrammar _pGrammar_, - EOF _eof_) - { - setPGrammar(_pGrammar_); - setEOF(_eof_); - } - - public Object clone() - { - return new Start( - (PGrammar) cloneNode(_pGrammar_), - (EOF) cloneNode(_eof_)); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseStart(this); - } - - public PGrammar getPGrammar() - { - return _pGrammar_; - } - - public void setPGrammar(PGrammar node) - { - if(_pGrammar_ != null) + private PGrammar _pGrammar_; + private EOF _eof_; + + public Start() { - _pGrammar_.parent(null); + // Empty body } - if(node != null) + public Start( + PGrammar _pGrammar_, + EOF _eof_) { - if(node.parent() != null) - { - node.parent().removeChild(node); - } - - node.parent(this); + setPGrammar(_pGrammar_); + setEOF(_eof_); } - _pGrammar_ = node; - } + public Start(Start node) + { + super(node); + setPGrammar(cloneNode(node._pGrammar_)); + setEOF(cloneNode(node._eof_)); + } - public EOF getEOF() - { - return _eof_; - } + @Override + public Start clone() + { + return new Start(this); + } - public void setEOF(EOF node) - { - if(_eof_ != null) + @Override + public void apply(Switch sw) { - _eof_.parent(null); + ((Analysis) sw).caseStart(this); } - if(node != null) + public PGrammar getPGrammar() { - if(node.parent() != null) - { - node.parent().removeChild(node); - } + return this._pGrammar_; + } - node.parent(this); + public void setPGrammar(PGrammar node) + { + if(this._pGrammar_ != null) + { + this._pGrammar_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._pGrammar_ = node; } - _eof_ = node; - } + public EOF getEOF() + { + return this._eof_; + } - void removeChild(Node child) - { - if(_pGrammar_ == child) + public void setEOF(EOF node) { - _pGrammar_ = null; - return; + if(this._eof_ != null) + { + this._eof_.parent(null); + } + + if(node != null) + { + if(node.parent() != null) + { + node.parent().removeChild(node); + } + + node.parent(this); + } + + this._eof_ = node; } - if(_eof_ == child) + @Override + void removeChild(Node child) { - _eof_ = null; - return; + if(this._pGrammar_ == child) + { + this._pGrammar_ = null; + return; + } + + if(this._eof_ == child) + { + this._eof_ = null; + return; + } + + throw new RuntimeException("Not a child."); } - } - void replaceChild(Node oldChild, Node newChild) - { - if(_pGrammar_ == oldChild) + @Override + void replaceChild(Node oldChild, Node newChild) { - setPGrammar((PGrammar) newChild); - return; + if(this._pGrammar_ == oldChild) + { + setPGrammar((PGrammar) newChild); + return; + } + + if(this._eof_ == oldChild) + { + setEOF((EOF) newChild); + return; + } + + throw new RuntimeException("Not a child."); } - if(_eof_ == oldChild) + @Override + public String toString() { - setEOF((EOF) newChild); - return; + return "" + + toString(this._pGrammar_) + + toString(this._eof_); } - } - - public String toString() - { - return "" + - toString(_pGrammar_) + - toString(_eof_); - } } diff --git a/src/main/java/org/sablecc/sablecc/node/Switch.java b/src/main/java/org/sablecc/sablecc/node/Switch.java index 8cadd36c842707c27c55b365c2343cc918f65579..ca792e67ce93d850d977db6e8a7e3023818b68d6 100644 --- a/src/main/java/org/sablecc/sablecc/node/Switch.java +++ b/src/main/java/org/sablecc/sablecc/node/Switch.java @@ -3,4 +3,6 @@ package org.sablecc.sablecc.node; public interface Switch - {} +{ + // Empty body +} diff --git a/src/main/java/org/sablecc/sablecc/node/Switchable.java b/src/main/java/org/sablecc/sablecc/node/Switchable.java index 6e0ef866b76779306465141a413b9c0a269dcdd4..cee4d38c620fa6ce732484654f1b80926fbb223d 100644 --- a/src/main/java/org/sablecc/sablecc/node/Switchable.java +++ b/src/main/java/org/sablecc/sablecc/node/Switchable.java @@ -4,5 +4,5 @@ package org.sablecc.sablecc.node; public interface Switchable { - void apply(Switch sw); + void apply(Switch sw); } diff --git a/src/main/java/org/sablecc/sablecc/node/TAbstract.java b/src/main/java/org/sablecc/sablecc/node/TAbstract.java index 754a507ad702f8d768f6c31e957b073d295b1eda..8fc5a72b365fe61494c9fdfaab219458755ee22a 100644 --- a/src/main/java/org/sablecc/sablecc/node/TAbstract.java +++ b/src/main/java/org/sablecc/sablecc/node/TAbstract.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TAbstract extends Token { - public TAbstract() - { - super.setText("Abstract"); - } - - public TAbstract(int line, int pos) - { - super.setText("Abstract"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TAbstract(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTAbstract(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TAbstract text."); - } + public TAbstract() + { + super("Abstract"); + } + + public TAbstract(int line, int pos) + { + super("Abstract", line, pos); + } + + public TAbstract(TAbstract token) + { + super(token); + } + + @Override + public TAbstract clone() + { + return new TAbstract(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTAbstract(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TAbstract text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TArrow.java b/src/main/java/org/sablecc/sablecc/node/TArrow.java index dcfedeeca09b000f901cc8d7d34cf31a9657fc7a..ac885099e845cb6a413aa715be5fddeb0d197760 100644 --- a/src/main/java/org/sablecc/sablecc/node/TArrow.java +++ b/src/main/java/org/sablecc/sablecc/node/TArrow.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TArrow extends Token { - public TArrow() - { - super.setText("->"); - } - - public TArrow(int line, int pos) - { - super.setText("->"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TArrow(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTArrow(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TArrow text."); - } + public TArrow() + { + super("->"); + } + + public TArrow(int line, int pos) + { + super("->", line, pos); + } + + public TArrow(TArrow token) + { + super(token); + } + + @Override + public TArrow clone() + { + return new TArrow(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTArrow(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TArrow text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TBar.java b/src/main/java/org/sablecc/sablecc/node/TBar.java index 507ae38e02e0040b54e717b75d29e9b949de7b5b..1fd5831e2d3da63e9bf44dcd4ba952d3689c2a72 100644 --- a/src/main/java/org/sablecc/sablecc/node/TBar.java +++ b/src/main/java/org/sablecc/sablecc/node/TBar.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TBar extends Token { - public TBar() - { - super.setText("|"); - } - - public TBar(int line, int pos) - { - super.setText("|"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TBar(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTBar(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TBar text."); - } + public TBar() + { + super("|"); + } + + public TBar(int line, int pos) + { + super("|", line, pos); + } + + public TBar(TBar token) + { + super(token); + } + + @Override + public TBar clone() + { + return new TBar(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTBar(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TBar text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TBlank.java b/src/main/java/org/sablecc/sablecc/node/TBlank.java index 585bca25a0fdfc3f2b707f35433812c4618d2c90..70b8ecf905be3f22432f256b9af5730ca4ccaa68 100644 --- a/src/main/java/org/sablecc/sablecc/node/TBlank.java +++ b/src/main/java/org/sablecc/sablecc/node/TBlank.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TBlank extends Token { - public TBlank(String text) - { - setText(text); - } - - public TBlank(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TBlank(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTBlank(this); - } + public TBlank(String text) + { + super(text); + } + + public TBlank(String text, int line, int pos) + { + super(text, line, pos); + } + + public TBlank(TBlank token) + { + super(token); + } + + @Override + public TBlank clone() + { + return new TBlank(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTBlank(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TChar.java b/src/main/java/org/sablecc/sablecc/node/TChar.java index c5b6bd536fd3ac181265cd9f785482ff477839a6..6f70e04472fec0daf5c881dfa00395cd23804314 100644 --- a/src/main/java/org/sablecc/sablecc/node/TChar.java +++ b/src/main/java/org/sablecc/sablecc/node/TChar.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TChar extends Token { - public TChar(String text) - { - setText(text); - } - - public TChar(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TChar(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTChar(this); - } + public TChar(String text) + { + super(text); + } + + public TChar(String text, int line, int pos) + { + super(text, line, pos); + } + + public TChar(TChar token) + { + super(token); + } + + @Override + public TChar clone() + { + return new TChar(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTChar(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TColon.java b/src/main/java/org/sablecc/sablecc/node/TColon.java index 678a3b5b3491b44435c06fa7ccb574c162b9907a..ac8d6aca2f401d5c5e0a42c9a6a6da557c3ef032 100644 --- a/src/main/java/org/sablecc/sablecc/node/TColon.java +++ b/src/main/java/org/sablecc/sablecc/node/TColon.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TColon extends Token { - public TColon() - { - super.setText(":"); - } - - public TColon(int line, int pos) - { - super.setText(":"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TColon(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTColon(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TColon text."); - } + public TColon() + { + super(":"); + } + + public TColon(int line, int pos) + { + super(":", line, pos); + } + + public TColon(TColon token) + { + super(token); + } + + @Override + public TColon clone() + { + return new TColon(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTColon(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TColon text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TComma.java b/src/main/java/org/sablecc/sablecc/node/TComma.java index b0364e7dbf4a4c41e7a8e4d32d498c3790e0cba1..0905a298f6958cdbdc0543475ec90515512bd714 100644 --- a/src/main/java/org/sablecc/sablecc/node/TComma.java +++ b/src/main/java/org/sablecc/sablecc/node/TComma.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TComma extends Token { - public TComma() - { - super.setText(","); - } - - public TComma(int line, int pos) - { - super.setText(","); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TComma(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTComma(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TComma text."); - } + public TComma() + { + super(","); + } + + public TComma(int line, int pos) + { + super(",", line, pos); + } + + public TComma(TComma token) + { + super(token); + } + + @Override + public TComma clone() + { + return new TComma(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTComma(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TComma text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TComment.java b/src/main/java/org/sablecc/sablecc/node/TComment.java index 4056f524507badad62fe131403d5a60cc4c550a3..67275750b6300598089f24bbe9c1909553c9ea5e 100644 --- a/src/main/java/org/sablecc/sablecc/node/TComment.java +++ b/src/main/java/org/sablecc/sablecc/node/TComment.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TComment extends Token { - public TComment(String text) - { - setText(text); - } - - public TComment(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TComment(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTComment(this); - } + public TComment(String text) + { + super(text); + } + + public TComment(String text, int line, int pos) + { + super(text, line, pos); + } + + public TComment(TComment token) + { + super(token); + } + + @Override + public TComment clone() + { + return new TComment(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTComment(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TDDot.java b/src/main/java/org/sablecc/sablecc/node/TDDot.java index 0243d227e9c9ee821149c0f56247337cdac8dbac..d650fed9dc243d1ea193c31edf1365beac8a9b07 100644 --- a/src/main/java/org/sablecc/sablecc/node/TDDot.java +++ b/src/main/java/org/sablecc/sablecc/node/TDDot.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TDDot extends Token { - public TDDot() - { - super.setText(".."); - } - - public TDDot(int line, int pos) - { - super.setText(".."); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TDDot(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTDDot(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TDDot text."); - } + public TDDot() + { + super(".."); + } + + public TDDot(int line, int pos) + { + super("..", line, pos); + } + + public TDDot(TDDot token) + { + super(token); + } + + @Override + public TDDot clone() + { + return new TDDot(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTDDot(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TDDot text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TDecChar.java b/src/main/java/org/sablecc/sablecc/node/TDecChar.java index f9c46881b06ad4345a166b6ca6581e7da0a99905..11fef1ec15e9712027b9143d86223cd97607c04e 100644 --- a/src/main/java/org/sablecc/sablecc/node/TDecChar.java +++ b/src/main/java/org/sablecc/sablecc/node/TDecChar.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TDecChar extends Token { - public TDecChar(String text) - { - setText(text); - } - - public TDecChar(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TDecChar(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTDecChar(this); - } + public TDecChar(String text) + { + super(text); + } + + public TDecChar(String text, int line, int pos) + { + super(text, line, pos); + } + + public TDecChar(TDecChar token) + { + super(token); + } + + @Override + public TDecChar clone() + { + return new TDecChar(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTDecChar(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TDot.java b/src/main/java/org/sablecc/sablecc/node/TDot.java index 84df19e5d5bcc1a4571fad0937f77d8515080b20..8606648faa48a431d52e2e793d5631387c4c1598 100644 --- a/src/main/java/org/sablecc/sablecc/node/TDot.java +++ b/src/main/java/org/sablecc/sablecc/node/TDot.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TDot extends Token { - public TDot() - { - super.setText("."); - } - - public TDot(int line, int pos) - { - super.setText("."); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TDot(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTDot(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TDot text."); - } + public TDot() + { + super("."); + } + + public TDot(int line, int pos) + { + super(".", line, pos); + } + + public TDot(TDot token) + { + super(token); + } + + @Override + public TDot clone() + { + return new TDot(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTDot(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TDot text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TEqual.java b/src/main/java/org/sablecc/sablecc/node/TEqual.java index 1ff8e6d9628d3680da8c6c981101b89c6bdbc253..fc57280efbb718e118e6691530e99a55ffc2b7ec 100644 --- a/src/main/java/org/sablecc/sablecc/node/TEqual.java +++ b/src/main/java/org/sablecc/sablecc/node/TEqual.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TEqual extends Token { - public TEqual() - { - super.setText("="); - } - - public TEqual(int line, int pos) - { - super.setText("="); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TEqual(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTEqual(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TEqual text."); - } + public TEqual() + { + super("="); + } + + public TEqual(int line, int pos) + { + super("=", line, pos); + } + + public TEqual(TEqual token) + { + super(token); + } + + @Override + public TEqual clone() + { + return new TEqual(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTEqual(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TEqual text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/THelpers.java b/src/main/java/org/sablecc/sablecc/node/THelpers.java index 8ed8c1e92375c4f16480b6df4ecba27509679cbb..01bf376ef0f2930fe8b085705f1ce94d35727616 100644 --- a/src/main/java/org/sablecc/sablecc/node/THelpers.java +++ b/src/main/java/org/sablecc/sablecc/node/THelpers.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class THelpers extends Token { - public THelpers() - { - super.setText("Helpers"); - } - - public THelpers(int line, int pos) - { - super.setText("Helpers"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new THelpers(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTHelpers(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change THelpers text."); - } + public THelpers() + { + super("Helpers"); + } + + public THelpers(int line, int pos) + { + super("Helpers", line, pos); + } + + public THelpers(THelpers token) + { + super(token); + } + + @Override + public THelpers clone() + { + return new THelpers(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTHelpers(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change THelpers text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/THexChar.java b/src/main/java/org/sablecc/sablecc/node/THexChar.java index b3d7d91001ed4073141b212c0459ff2cf2de09ae..be72cbca158910c92060f95f0de855c5e90b3acd 100644 --- a/src/main/java/org/sablecc/sablecc/node/THexChar.java +++ b/src/main/java/org/sablecc/sablecc/node/THexChar.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class THexChar extends Token { - public THexChar(String text) - { - setText(text); - } - - public THexChar(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new THexChar(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTHexChar(this); - } + public THexChar(String text) + { + super(text); + } + + public THexChar(String text, int line, int pos) + { + super(text, line, pos); + } + + public THexChar(THexChar token) + { + super(token); + } + + @Override + public THexChar clone() + { + return new THexChar(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTHexChar(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TId.java b/src/main/java/org/sablecc/sablecc/node/TId.java index 7ba0ed913f4ee5b06b40d071227aff1dcf0e1c5b..6ecb2e6e46e54fc9c703cfcbb94a1c7964ba833f 100644 --- a/src/main/java/org/sablecc/sablecc/node/TId.java +++ b/src/main/java/org/sablecc/sablecc/node/TId.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TId extends Token { - public TId(String text) - { - setText(text); - } - - public TId(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TId(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTId(this); - } + public TId(String text) + { + super(text); + } + + public TId(String text, int line, int pos) + { + super(text, line, pos); + } + + public TId(TId token) + { + super(token); + } + + @Override + public TId clone() + { + return new TId(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTId(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TIgnored.java b/src/main/java/org/sablecc/sablecc/node/TIgnored.java index 230eef84ccc4e6108858f314f31e3692534a52b8..872e211f8f7b3c84889f2e1d6ded01dc450ac17c 100644 --- a/src/main/java/org/sablecc/sablecc/node/TIgnored.java +++ b/src/main/java/org/sablecc/sablecc/node/TIgnored.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TIgnored extends Token { - public TIgnored() - { - super.setText("Ignored"); - } - - public TIgnored(int line, int pos) - { - super.setText("Ignored"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TIgnored(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTIgnored(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TIgnored text."); - } + public TIgnored() + { + super("Ignored"); + } + + public TIgnored(int line, int pos) + { + super("Ignored", line, pos); + } + + public TIgnored(TIgnored token) + { + super(token); + } + + @Override + public TIgnored clone() + { + return new TIgnored(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTIgnored(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TIgnored text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TLBkt.java b/src/main/java/org/sablecc/sablecc/node/TLBkt.java index 64c601580f8125b088a98eba94e166c3429ae1b1..18e858af26c5285283cc3358a11b549c22382061 100644 --- a/src/main/java/org/sablecc/sablecc/node/TLBkt.java +++ b/src/main/java/org/sablecc/sablecc/node/TLBkt.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TLBkt extends Token { - public TLBkt() - { - super.setText("["); - } - - public TLBkt(int line, int pos) - { - super.setText("["); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TLBkt(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTLBkt(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TLBkt text."); - } + public TLBkt() + { + super("["); + } + + public TLBkt(int line, int pos) + { + super("[", line, pos); + } + + public TLBkt(TLBkt token) + { + super(token); + } + + @Override + public TLBkt clone() + { + return new TLBkt(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTLBkt(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TLBkt text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TLBrace.java b/src/main/java/org/sablecc/sablecc/node/TLBrace.java index 062bc75b97b522aa4f958f51933c1902611c7a23..ce2f4d2fdfc4b4cae4a6e5fcb21b8962a9405f1a 100644 --- a/src/main/java/org/sablecc/sablecc/node/TLBrace.java +++ b/src/main/java/org/sablecc/sablecc/node/TLBrace.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TLBrace extends Token { - public TLBrace() - { - super.setText("{"); - } - - public TLBrace(int line, int pos) - { - super.setText("{"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TLBrace(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTLBrace(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TLBrace text."); - } + public TLBrace() + { + super("{"); + } + + public TLBrace(int line, int pos) + { + super("{", line, pos); + } + + public TLBrace(TLBrace token) + { + super(token); + } + + @Override + public TLBrace clone() + { + return new TLBrace(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTLBrace(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TLBrace text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TLPar.java b/src/main/java/org/sablecc/sablecc/node/TLPar.java index eb69710090b90c789b2ecb9e80d9ce446802b477..411908f7500df45e288ca932660e9babc73570fe 100644 --- a/src/main/java/org/sablecc/sablecc/node/TLPar.java +++ b/src/main/java/org/sablecc/sablecc/node/TLPar.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TLPar extends Token { - public TLPar() - { - super.setText("("); - } - - public TLPar(int line, int pos) - { - super.setText("("); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TLPar(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTLPar(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TLPar text."); - } + public TLPar() + { + super("("); + } + + public TLPar(int line, int pos) + { + super("(", line, pos); + } + + public TLPar(TLPar token) + { + super(token); + } + + @Override + public TLPar clone() + { + return new TLPar(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTLPar(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TLPar text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TMinus.java b/src/main/java/org/sablecc/sablecc/node/TMinus.java index 6e655a990dfa5dd26aa220a61eadd28a3029ba5c..1894edab789708133f693902cf61ad598781a33b 100644 --- a/src/main/java/org/sablecc/sablecc/node/TMinus.java +++ b/src/main/java/org/sablecc/sablecc/node/TMinus.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TMinus extends Token { - public TMinus() - { - super.setText("-"); - } - - public TMinus(int line, int pos) - { - super.setText("-"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TMinus(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTMinus(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TMinus text."); - } + public TMinus() + { + super("-"); + } + + public TMinus(int line, int pos) + { + super("-", line, pos); + } + + public TMinus(TMinus token) + { + super(token); + } + + @Override + public TMinus clone() + { + return new TMinus(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTMinus(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TMinus text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TNew.java b/src/main/java/org/sablecc/sablecc/node/TNew.java index 4d3b87ecbba5fdf4f4db2739ef3e82e0b31df02c..445cc6fc691ccee972228200d71c517e6dcf6bfa 100644 --- a/src/main/java/org/sablecc/sablecc/node/TNew.java +++ b/src/main/java/org/sablecc/sablecc/node/TNew.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TNew extends Token { - public TNew() - { - super.setText("New"); - } - - public TNew(int line, int pos) - { - super.setText("New"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TNew(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTNew(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TNew text."); - } + public TNew() + { + super("New"); + } + + public TNew(int line, int pos) + { + super("New", line, pos); + } + + public TNew(TNew token) + { + super(token); + } + + @Override + public TNew clone() + { + return new TNew(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTNew(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TNew text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TNull.java b/src/main/java/org/sablecc/sablecc/node/TNull.java index 4b523c7bfae2abd16458b665f51da499eb73dfe8..c41eea7f545d26d90ae0c3dd56f0123d6a6ab649 100644 --- a/src/main/java/org/sablecc/sablecc/node/TNull.java +++ b/src/main/java/org/sablecc/sablecc/node/TNull.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TNull extends Token { - public TNull() - { - super.setText("Null"); - } - - public TNull(int line, int pos) - { - super.setText("Null"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TNull(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTNull(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TNull text."); - } + public TNull() + { + super("Null"); + } + + public TNull(int line, int pos) + { + super("Null", line, pos); + } + + public TNull(TNull token) + { + super(token); + } + + @Override + public TNull clone() + { + return new TNull(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTNull(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TNull text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TPackage.java b/src/main/java/org/sablecc/sablecc/node/TPackage.java index 10003fa8792ee3fea9434cc66c16e0e167ad3868..9d0dce2619f3974934ab072eaa0009352343fe14 100644 --- a/src/main/java/org/sablecc/sablecc/node/TPackage.java +++ b/src/main/java/org/sablecc/sablecc/node/TPackage.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TPackage extends Token { - public TPackage() - { - super.setText("Package"); - } - - public TPackage(int line, int pos) - { - super.setText("Package"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TPackage(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTPackage(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TPackage text."); - } + public TPackage() + { + super("Package"); + } + + public TPackage(int line, int pos) + { + super("Package", line, pos); + } + + public TPackage(TPackage token) + { + super(token); + } + + @Override + public TPackage clone() + { + return new TPackage(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTPackage(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TPackage text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TPkgId.java b/src/main/java/org/sablecc/sablecc/node/TPkgId.java index 0390d216a5806ebdca52ddb622fb31d9157b4bd4..4a35d8f5f549c3c4a32bfae3cfc7d07d7a68ec75 100644 --- a/src/main/java/org/sablecc/sablecc/node/TPkgId.java +++ b/src/main/java/org/sablecc/sablecc/node/TPkgId.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TPkgId extends Token { - public TPkgId(String text) - { - setText(text); - } - - public TPkgId(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TPkgId(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTPkgId(this); - } + public TPkgId(String text) + { + super(text); + } + + public TPkgId(String text, int line, int pos) + { + super(text, line, pos); + } + + public TPkgId(TPkgId token) + { + super(token); + } + + @Override + public TPkgId clone() + { + return new TPkgId(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTPkgId(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TPlus.java b/src/main/java/org/sablecc/sablecc/node/TPlus.java index d7e48a78ac3451ff92997f269af713fc11cb422c..72b8346a4e57954405b13894183e46b6e3d165d0 100644 --- a/src/main/java/org/sablecc/sablecc/node/TPlus.java +++ b/src/main/java/org/sablecc/sablecc/node/TPlus.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TPlus extends Token { - public TPlus() - { - super.setText("+"); - } - - public TPlus(int line, int pos) - { - super.setText("+"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TPlus(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTPlus(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TPlus text."); - } + public TPlus() + { + super("+"); + } + + public TPlus(int line, int pos) + { + super("+", line, pos); + } + + public TPlus(TPlus token) + { + super(token); + } + + @Override + public TPlus clone() + { + return new TPlus(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTPlus(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TPlus text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TProductionSpecifier.java b/src/main/java/org/sablecc/sablecc/node/TProductionSpecifier.java index 8cb21c2818edfba005e6318296eb431deafb69c4..f392e9651087b846862ce8c2971a39af374a1f54 100644 --- a/src/main/java/org/sablecc/sablecc/node/TProductionSpecifier.java +++ b/src/main/java/org/sablecc/sablecc/node/TProductionSpecifier.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TProductionSpecifier extends Token { - public TProductionSpecifier() - { - super.setText("P"); - } - - public TProductionSpecifier(int line, int pos) - { - super.setText("P"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TProductionSpecifier(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTProductionSpecifier(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TProductionSpecifier text."); - } + public TProductionSpecifier() + { + super("P"); + } + + public TProductionSpecifier(int line, int pos) + { + super("P", line, pos); + } + + public TProductionSpecifier(TProductionSpecifier token) + { + super(token); + } + + @Override + public TProductionSpecifier clone() + { + return new TProductionSpecifier(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTProductionSpecifier(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TProductionSpecifier text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TProductions.java b/src/main/java/org/sablecc/sablecc/node/TProductions.java index 6d201b5396eb58b593a30d6c2602082bad53c064..0420f850b56cab9cf6fbe7c60b7213805ac971d2 100644 --- a/src/main/java/org/sablecc/sablecc/node/TProductions.java +++ b/src/main/java/org/sablecc/sablecc/node/TProductions.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TProductions extends Token { - public TProductions() - { - super.setText("Productions"); - } - - public TProductions(int line, int pos) - { - super.setText("Productions"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TProductions(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTProductions(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TProductions text."); - } + public TProductions() + { + super("Productions"); + } + + public TProductions(int line, int pos) + { + super("Productions", line, pos); + } + + public TProductions(TProductions token) + { + super(token); + } + + @Override + public TProductions clone() + { + return new TProductions(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTProductions(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TProductions text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TQMark.java b/src/main/java/org/sablecc/sablecc/node/TQMark.java index b07059fc1a218a5e18239a07165e2db4f5cbca14..c7db1cc7f75e7a8ec826622387d745d7b9e7f913 100644 --- a/src/main/java/org/sablecc/sablecc/node/TQMark.java +++ b/src/main/java/org/sablecc/sablecc/node/TQMark.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TQMark extends Token { - public TQMark() - { - super.setText("?"); - } - - public TQMark(int line, int pos) - { - super.setText("?"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TQMark(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTQMark(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TQMark text."); - } + public TQMark() + { + super("?"); + } + + public TQMark(int line, int pos) + { + super("?", line, pos); + } + + public TQMark(TQMark token) + { + super(token); + } + + @Override + public TQMark clone() + { + return new TQMark(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTQMark(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TQMark text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TRBkt.java b/src/main/java/org/sablecc/sablecc/node/TRBkt.java index a32f0e78be0ecc83f4c3298580c6f095fad1f349..63f0c0e361bab2e54db2dbcdabff0bfa0902d6dc 100644 --- a/src/main/java/org/sablecc/sablecc/node/TRBkt.java +++ b/src/main/java/org/sablecc/sablecc/node/TRBkt.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TRBkt extends Token { - public TRBkt() - { - super.setText("]"); - } - - public TRBkt(int line, int pos) - { - super.setText("]"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TRBkt(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTRBkt(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TRBkt text."); - } + public TRBkt() + { + super("]"); + } + + public TRBkt(int line, int pos) + { + super("]", line, pos); + } + + public TRBkt(TRBkt token) + { + super(token); + } + + @Override + public TRBkt clone() + { + return new TRBkt(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTRBkt(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TRBkt text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TRBrace.java b/src/main/java/org/sablecc/sablecc/node/TRBrace.java index 26e4a85e2bdb5d82abc021052cef3a06702bde40..e90c27d6dee70dd075ca7844d602431aee26263d 100644 --- a/src/main/java/org/sablecc/sablecc/node/TRBrace.java +++ b/src/main/java/org/sablecc/sablecc/node/TRBrace.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TRBrace extends Token { - public TRBrace() - { - super.setText("}"); - } - - public TRBrace(int line, int pos) - { - super.setText("}"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TRBrace(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTRBrace(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TRBrace text."); - } + public TRBrace() + { + super("}"); + } + + public TRBrace(int line, int pos) + { + super("}", line, pos); + } + + public TRBrace(TRBrace token) + { + super(token); + } + + @Override + public TRBrace clone() + { + return new TRBrace(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTRBrace(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TRBrace text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TRPar.java b/src/main/java/org/sablecc/sablecc/node/TRPar.java index 856a3753f8b4fafcf61cfe2ab9492d388c01e19a..0e29764edb7c57a09311e3f852f04f61f90baac9 100644 --- a/src/main/java/org/sablecc/sablecc/node/TRPar.java +++ b/src/main/java/org/sablecc/sablecc/node/TRPar.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TRPar extends Token { - public TRPar() - { - super.setText(")"); - } - - public TRPar(int line, int pos) - { - super.setText(")"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TRPar(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTRPar(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TRPar text."); - } + public TRPar() + { + super(")"); + } + + public TRPar(int line, int pos) + { + super(")", line, pos); + } + + public TRPar(TRPar token) + { + super(token); + } + + @Override + public TRPar clone() + { + return new TRPar(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTRPar(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TRPar text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TSemicolon.java b/src/main/java/org/sablecc/sablecc/node/TSemicolon.java index c7686576d7bc7c24ef3b9b5a370c27ec68029293..f8cfe4bad16641eb598b9d4752a7785aa8dcdfcf 100644 --- a/src/main/java/org/sablecc/sablecc/node/TSemicolon.java +++ b/src/main/java/org/sablecc/sablecc/node/TSemicolon.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TSemicolon extends Token { - public TSemicolon() - { - super.setText(";"); - } - - public TSemicolon(int line, int pos) - { - super.setText(";"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TSemicolon(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTSemicolon(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TSemicolon text."); - } + public TSemicolon() + { + super(";"); + } + + public TSemicolon(int line, int pos) + { + super(";", line, pos); + } + + public TSemicolon(TSemicolon token) + { + super(token); + } + + @Override + public TSemicolon clone() + { + return new TSemicolon(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTSemicolon(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TSemicolon text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TSlash.java b/src/main/java/org/sablecc/sablecc/node/TSlash.java index c37106279c67d30b599dc5af92f8a1ee495f8d62..a4ff8b0149081b01b05dd237c388b815714cb473 100644 --- a/src/main/java/org/sablecc/sablecc/node/TSlash.java +++ b/src/main/java/org/sablecc/sablecc/node/TSlash.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TSlash extends Token { - public TSlash() - { - super.setText("/"); - } - - public TSlash(int line, int pos) - { - super.setText("/"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TSlash(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTSlash(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TSlash text."); - } + public TSlash() + { + super("/"); + } + + public TSlash(int line, int pos) + { + super("/", line, pos); + } + + public TSlash(TSlash token) + { + super(token); + } + + @Override + public TSlash clone() + { + return new TSlash(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTSlash(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TSlash text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TStar.java b/src/main/java/org/sablecc/sablecc/node/TStar.java index e96232713386d03ef96ba93e2325dc402c96560a..fc3d36be16a1aef6c4945072d9e2ebebdcc31832 100644 --- a/src/main/java/org/sablecc/sablecc/node/TStar.java +++ b/src/main/java/org/sablecc/sablecc/node/TStar.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TStar extends Token { - public TStar() - { - super.setText("*"); - } - - public TStar(int line, int pos) - { - super.setText("*"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TStar(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTStar(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TStar text."); - } + public TStar() + { + super("*"); + } + + public TStar(int line, int pos) + { + super("*", line, pos); + } + + public TStar(TStar token) + { + super(token); + } + + @Override + public TStar clone() + { + return new TStar(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTStar(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TStar text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TStates.java b/src/main/java/org/sablecc/sablecc/node/TStates.java index 6933885e12d52feaa2d609b2d3335fbdbdd572cb..4ae149afc9bf39a254172a291a6e875d03f06c16 100644 --- a/src/main/java/org/sablecc/sablecc/node/TStates.java +++ b/src/main/java/org/sablecc/sablecc/node/TStates.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TStates extends Token { - public TStates() - { - super.setText("States"); - } - - public TStates(int line, int pos) - { - super.setText("States"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TStates(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTStates(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TStates text."); - } + public TStates() + { + super("States"); + } + + public TStates(int line, int pos) + { + super("States", line, pos); + } + + public TStates(TStates token) + { + super(token); + } + + @Override + public TStates clone() + { + return new TStates(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTStates(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TStates text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TString.java b/src/main/java/org/sablecc/sablecc/node/TString.java index daf490873f71e75c8ba44e8fb59b81dae8e7c468..74779c4e44efefd91718cf0712817f334f138fa0 100644 --- a/src/main/java/org/sablecc/sablecc/node/TString.java +++ b/src/main/java/org/sablecc/sablecc/node/TString.java @@ -4,27 +4,33 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TString extends Token { - public TString(String text) - { - setText(text); - } - - public TString(String text, int line, int pos) - { - setText(text); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TString(getText(), getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTString(this); - } + public TString(String text) + { + super(text); + } + + public TString(String text, int line, int pos) + { + super(text, line, pos); + } + + public TString(TString token) + { + super(token); + } + + @Override + public TString clone() + { + return new TString(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTString(this); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TSyntax.java b/src/main/java/org/sablecc/sablecc/node/TSyntax.java index 3b24e0e447d8ca0a6643c9f1d5d2554ec6b8d941..64e466c6da6b7cc22606f8df895a75d61e729e0e 100644 --- a/src/main/java/org/sablecc/sablecc/node/TSyntax.java +++ b/src/main/java/org/sablecc/sablecc/node/TSyntax.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TSyntax extends Token { - public TSyntax() - { - super.setText("Syntax"); - } - - public TSyntax(int line, int pos) - { - super.setText("Syntax"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TSyntax(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTSyntax(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TSyntax text."); - } + public TSyntax() + { + super("Syntax"); + } + + public TSyntax(int line, int pos) + { + super("Syntax", line, pos); + } + + public TSyntax(TSyntax token) + { + super(token); + } + + @Override + public TSyntax clone() + { + return new TSyntax(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTSyntax(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TSyntax text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TTokenSpecifier.java b/src/main/java/org/sablecc/sablecc/node/TTokenSpecifier.java index ec0360ff26ac4cf94d4c0aa39af4530577ee7cbf..96a1eaa692c628fbc545cb4a377a7554ee2d1850 100644 --- a/src/main/java/org/sablecc/sablecc/node/TTokenSpecifier.java +++ b/src/main/java/org/sablecc/sablecc/node/TTokenSpecifier.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TTokenSpecifier extends Token { - public TTokenSpecifier() - { - super.setText("T"); - } - - public TTokenSpecifier(int line, int pos) - { - super.setText("T"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TTokenSpecifier(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTTokenSpecifier(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TTokenSpecifier text."); - } + public TTokenSpecifier() + { + super("T"); + } + + public TTokenSpecifier(int line, int pos) + { + super("T", line, pos); + } + + public TTokenSpecifier(TTokenSpecifier token) + { + super(token); + } + + @Override + public TTokenSpecifier clone() + { + return new TTokenSpecifier(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTTokenSpecifier(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TTokenSpecifier text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TTokens.java b/src/main/java/org/sablecc/sablecc/node/TTokens.java index f815231c00c1f02569cd6ac7b7a781199d47e77d..977178fd29dbccfdc151d6b09f6c0f07378e2660 100644 --- a/src/main/java/org/sablecc/sablecc/node/TTokens.java +++ b/src/main/java/org/sablecc/sablecc/node/TTokens.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TTokens extends Token { - public TTokens() - { - super.setText("Tokens"); - } - - public TTokens(int line, int pos) - { - super.setText("Tokens"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TTokens(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTTokens(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TTokens text."); - } + public TTokens() + { + super("Tokens"); + } + + public TTokens(int line, int pos) + { + super("Tokens", line, pos); + } + + public TTokens(TTokens token) + { + super(token); + } + + @Override + public TTokens clone() + { + return new TTokens(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTTokens(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TTokens text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TTree.java b/src/main/java/org/sablecc/sablecc/node/TTree.java index 46ae3872837a229e036614a864a947791ed97175..f90670bac79ab701591ca9deb239ed1fee8415e2 100644 --- a/src/main/java/org/sablecc/sablecc/node/TTree.java +++ b/src/main/java/org/sablecc/sablecc/node/TTree.java @@ -4,32 +4,39 @@ package org.sablecc.sablecc.node; import org.sablecc.sablecc.analysis.*; + public final class TTree extends Token { - public TTree() - { - super.setText("Tree"); - } - - public TTree(int line, int pos) - { - super.setText("Tree"); - setLine(line); - setPos(pos); - } - - public Object clone() - { - return new TTree(getLine(), getPos()); - } - - public void apply(Switch sw) - { - ((Analysis) sw).caseTTree(this); - } - - public void setText(String text) - { - throw new RuntimeException("Cannot change TTree text."); - } + public TTree() + { + super("Tree"); + } + + public TTree(int line, int pos) + { + super("Tree", line, pos); + } + + public TTree(TTree token) + { + super(token); + } + + @Override + public TTree clone() + { + return new TTree(this); + } + + @Override + public void apply(Switch sw) + { + ((Analysis) sw).caseTTree(this); + } + + @Override + public void setText(String text) + { + throw new RuntimeException("Cannot change TTree text."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/Token.java b/src/main/java/org/sablecc/sablecc/node/Token.java index ec21ec9417014fd1ae259e07a08964efd78370ce..bc0376a9cfbf59aabfc228576aa2befa4d6f9914 100644 --- a/src/main/java/org/sablecc/sablecc/node/Token.java +++ b/src/main/java/org/sablecc/sablecc/node/Token.java @@ -2,50 +2,130 @@ package org.sablecc.sablecc.node; -public abstract class Token extends Node +import de.hhu.stups.sablecc.patch.IToken; +import de.hhu.stups.sablecc.patch.SourcePosition; + + +public abstract class Token extends Node implements IToken { - private String text; - private int line; - private int pos; - - public String getText() - { - return text; - } - - public void setText(String text) - { - this.text = text; - } - - public int getLine() - { - return line; - } - - public void setLine(int line) - { - this.line = line; - } - - public int getPos() - { - return pos; - } - - public void setPos(int pos) - { - this.pos = pos; - } - - public String toString() - { - return text + " "; - } - - void removeChild(Node child) - {} - - void replaceChild(Node oldChild, Node newChild) - {} + private String text; + private int line; + private int pos; + + protected Token(String text, int line, int pos) + { + this.text = text; + this.line = line; + this.pos = pos; + } + + protected Token(String text) + { + this(text, 0, 0); + } + + protected Token() + { + this((String)null); + } + + protected Token(Token token) + { + super(token); + this.text = token.text; + this.line = token.line; + this.pos = token.pos; + } + + @Override + public abstract Token clone(); + + @Override + public String getText() + { + return this.text; + } + + @Override + public void setText(String text) + { + this.text = text; + // Invalidate any already calculated SourcePositions + setStartPos(null); + setEndPos(null); + } + + @Override + public int getLine() + { + return this.line; + } + + @Override + public void setLine(int line) + { + this.line = line; + // Invalidate any already calculated SourcePositions + setStartPos(null); + setEndPos(null); + } + + @Override + public int getPos() + { + return this.pos; + } + + @Override + public void setPos(int pos) + { + this.pos = pos; + // Invalidate any already calculated SourcePositions + setStartPos(null); + setEndPos(null); + } + + // startPos and endPos are calculated lazily to avoid creating two SourcePosition objects for every token. + + @Override + public SourcePosition getStartPos() + { + SourcePosition startPos = super.getStartPos(); + if(startPos == null) + { + startPos = new SourcePosition(this.line, this.pos); + setStartPos(startPos); + } + return startPos; + } + + @Override + public SourcePosition getEndPos() + { + SourcePosition endPos = super.getEndPos(); + if(endPos == null) + { + endPos = new SourcePosition(this.line, this.pos + (this.text == null ? 0 : this.text.length())); + setEndPos(endPos); + } + return endPos; + } + + @Override + public String toString() + { + return this.text + " "; + } + + @Override + void removeChild(Node child) + { + throw new RuntimeException("Not a child."); + } + + @Override + void replaceChild(Node oldChild, Node newChild) + { + throw new RuntimeException("Not a child."); + } } diff --git a/src/main/java/org/sablecc/sablecc/node/TypedLinkedList.java b/src/main/java/org/sablecc/sablecc/node/TypedLinkedList.java deleted file mode 100644 index 7c9ebd6fd1a5c03f7eafdcb228bd578286b44477..0000000000000000000000000000000000000000 --- a/src/main/java/org/sablecc/sablecc/node/TypedLinkedList.java +++ /dev/null @@ -1,149 +0,0 @@ -/* This file was generated by SableCC (http://www.sablecc.org/). */ - -package org.sablecc.sablecc.node; - -import java.util.*; - -public class TypedLinkedList extends LinkedList -{ - Cast cast; - - public TypedLinkedList() - { - super(); - - cast = NoCast.instance; - } - - public TypedLinkedList(Collection c) - { - super(c); - - cast = NoCast.instance; - } - - public TypedLinkedList(Cast cast) - { - super(); - - this.cast = cast; - } - - public TypedLinkedList(Collection c, Cast cast) - { - super(c); - - this.cast = cast; - } - - public Cast getCast() - { - return cast; - } - - public void add - (int index, Object element) - { - super.add(index, cast.cast(element)); - } - - public boolean add - (Object o) - { - return super.add(cast.cast(o)); - } - - public boolean addAll(Collection c) - { - Object[] elements = c.toArray(); - for(int i=0; i<elements.length; i++) - { - super.add(cast.cast(elements[i])); - } - return true; - } - - public boolean addAll(int index, Collection c) - { - int pos = index; - Object[] elements = c.toArray(); - for(int i=0; i<elements.length; i++) - { - super.add(pos++, cast.cast(elements[i])); - } - return true; - } - - public void addFirst(Object o) - { - super.addFirst(cast.cast(o)); - } - - public void addLast(Object o) - { - super.addLast(cast.cast(o)); - } - - public ListIterator listIterator(int index) - { - return new TypedLinkedListIterator(super.listIterator(index)); - } - - private class TypedLinkedListIterator implements ListIterator - { - ListIterator iterator; - - TypedLinkedListIterator(ListIterator iterator) - { - this.iterator = iterator; - } - - public boolean hasNext() - { - return iterator.hasNext(); - } - - public Object next() - { - return iterator.next(); - } - - public boolean hasPrevious() - { - return iterator.hasPrevious(); - } - - public Object previous() - { - return iterator.previous(); - } - - public int nextIndex() - { - return iterator.nextIndex(); - } - - public int previousIndex() - { - return iterator.previousIndex(); - } - - public void remove - () - { - iterator.remove(); - } - - public void set - (Object o) - { - iterator.set(cast.cast(o)); - } - - public void add - (Object o) - { - iterator.add(cast.cast(o)); - } - } -} diff --git a/src/main/java/org/sablecc/sablecc/parser/Parser.java b/src/main/java/org/sablecc/sablecc/parser/Parser.java index 69bc5db7dd85ec5de52470e39e52a77e4a7f0bdd..aadf7435f6aceccef7955e225392839b594c6d00 100644 --- a/src/main/java/org/sablecc/sablecc/parser/Parser.java +++ b/src/main/java/org/sablecc/sablecc/parser/Parser.java @@ -6,9272 +6,10710 @@ import org.sablecc.sablecc.lexer.*; import org.sablecc.sablecc.node.*; import org.sablecc.sablecc.analysis.*; import java.util.*; +import de.hhu.stups.sablecc.patch.*; + import java.io.DataInputStream; import java.io.BufferedInputStream; +import java.io.InputStream; import java.io.IOException; -public class Parser +@SuppressWarnings({"rawtypes","unchecked","unused"}) +public class Parser implements IParser { - public final Analysis ignoredTokens = new AnalysisAdapter(); - - protected ArrayList nodeList; - - private final Lexer lexer; - private final ListIterator stack = new LinkedList().listIterator(); - private int last_shift; - private int last_pos; - private int last_line; - private Token last_token; - private final TokenIndex converter = new TokenIndex(); - private final int[] action = new int[2]; - - private final static int SHIFT = 0; - private final static int REDUCE = 1; - private final static int ACCEPT = 2; - private final static int ERROR = 3; - - public Parser(Lexer lexer) - { - this.lexer = lexer; - } - - private void push(int numstate, ArrayList listNode) throws ParserException, LexerException, IOException - { - this.nodeList = listNode; + protected List<Object> nodeList; + + private final Lexer lexer; + private final ListIterator<State> stack = new LinkedList<State>().listIterator(); + private int last_pos; + private int last_line; + private Token last_token; + private final TokenIndex converter = new TokenIndex(); + private final int[] action = new int[2]; + + private final static int SHIFT = 0; + private final static int REDUCE = 1; + private final static int ACCEPT = 2; + private final static int ERROR = 3; + + public Parser(Lexer lexer) + { + this.lexer = lexer; + } + + + private Map<PositionedNode, SourcecodeRange> mapping = new HashMap<PositionedNode, SourcecodeRange>(); + @Override + public Map<PositionedNode, SourcecodeRange> getMapping() { return this.mapping; } + + private void checkResult(Object elementToCheck, List<Object> beginNodeList, List<Object> endNodeList) { + if (elementToCheck instanceof List<?>) { + /* + * special case: this is a list of nodes, for example an identifier + * list, so we don't want to check the list but the last element + * added to it + */ + final List<?> nodeList = (List<?>) elementToCheck; + + if (nodeList.size() > 0) { + elementToCheck = nodeList.get(nodeList.size() - 1); + } else { + // no positions for empty lists... + return; + } + } + + final PositionedNode node = (PositionedNode) elementToCheck; + + if (!this.getMapping().containsKey(node)) { + PositionedNode beginNode = findBeginNode(beginNodeList); + final int begin; + if (beginNode == null) { + /* + * Sometimes (haven't found out why) we get empty list here. In + * the only observed cases we were looking for the source range + * of the whole parse unit. Then the index is 0. + */ + beginNode = (PositionedNode)this.lexer.getTokenList().get(0); + begin = 0; + } else { + begin = findBeginPos(beginNode); + } + + PositionedNode endNode = findEndNode(endNodeList); + int end = findEndPos(endNode); + if (end == -1) end = begin; + final SourcecodeRange range = new SourcecodeRange(begin, end); + + this.getMapping().put(node, range); + + node.setStartPos(beginNode.getStartPos()); + node.setEndPos(endNode.getEndPos()); + } + } + + private PositionedNode findBeginNode(final List<Object> list) { + Object first = list.get(0); + if (first instanceof List<?>) { + List<?> list2 = (List<?>) first; + + if (list2.size() > 0) { + return (PositionedNode)list2.get(0); + } else { + return null; + } + } + + return (PositionedNode)first; + } + + private int findBeginPos(final PositionedNode node) { + if (node instanceof IToken) { + return findIndex((IToken) node); + } + + return this.getMapping().get(node).getBeginIndex(); + } + + private PositionedNode findEndNode(final List<Object> list) { + Object last = list.get(list.size() - 1); + if (last instanceof List<?>) { + final List<?> list2 = (List<?>) last; + return (PositionedNode)list2.get(list2.size() - 1); + } + + return (PositionedNode)last; + } + + private int findEndPos(final PositionedNode node) { + if (node instanceof IToken) { + return findIndex((IToken) node); + } + + final SourcecodeRange item = this.getMapping().get(node); + if (item == null) { + return -1; + } + return item.getEndIndex(); + } + + private int findIndex(final IToken token) { + final List<IToken> list = this.lexer.getTokenList(); + + for (int i = list.size() - 1; i >= 0; i--) { + if (list.get(i) == token) { + return i; + } + } + + return -1; + } + + /** + * @deprecated Overriding this method no longer has any effect. This optimization is now applied automatically iff it is safe. + */ + @Deprecated + protected boolean addElementsFromListToNewList(String productionRuleAsString) { + return true; + } + + private void push(int numstate, List<Object> listNode) throws ParserException, LexerException, IOException + { + this.nodeList = listNode; - if(!stack.hasNext()) + if(!this.stack.hasNext()) + { + this.stack.add(new State(numstate, this.nodeList)); + return; + } + + State s = this.stack.next(); + s.state = numstate; + s.nodes = this.nodeList; + } + + private int goTo(int index) { - stack.add(new State(numstate, this.nodeList)); - return; + int state = state(); + int low = 1; + int high = gotoTable[index].length - 1; + int value = gotoTable[index][0][1]; + + while(low <= high) + { + int middle = (low + high) >>> 1; + + if(state < gotoTable[index][middle][0]) + { + high = middle - 1; + } + else if(state > gotoTable[index][middle][0]) + { + low = middle + 1; + } + else + { + value = gotoTable[index][middle][1]; + break; + } + } + + return value; } - State s = (State) stack.next(); - s.state = numstate; - s.nodes = this.nodeList; - } + private int state() + { + State s = this.stack.previous(); + this.stack.next(); + return s.state; + } - private int goTo(int index) - { - int state = state(); - int low = 1; - int high = gotoTable[index].length - 1; - int value = gotoTable[index][0][1]; + private List<Object> pop() + { + return this.stack.previous().nodes; + } - while(low <= high) + private int index(Switchable token) { - int middle = (low + high) / 2; + this.converter.index = -1; + token.apply(this.converter); + return this.converter.index; + } - if(state < gotoTable[index][middle][0]) - { - high = middle - 1; - } - else if(state > gotoTable[index][middle][0]) - { - low = middle + 1; - } - else - { - value = gotoTable[index][middle][1]; - break; - } - } - - return value; - } - - private int state() - { - State s = (State) stack.previous(); - stack.next(); - return s.state; - } - - private ArrayList pop() - { - return (ArrayList) ((State) stack.previous()).nodes; - } - - private int index(Switchable token) - { - converter.index = -1; - token.apply(converter); - return converter.index; - } - - public Start parse() throws ParserException, LexerException, IOException - { - push(0, null); - List ign = null; - while(true) - { - while(index(lexer.peek()) == -1) - { - if(ign == null) - { - ign = new TypedLinkedList(NodeCast.instance); - } - - ign.add(lexer.next()); - } - - if(ign != null) - { - ignoredTokens.setIn(lexer.peek(), ign); - ign = null; - } - - last_pos = lexer.peek().getPos(); - last_line = lexer.peek().getLine(); - last_token = lexer.peek(); - - int index = index(lexer.peek()); - action[0] = actionTable[state()][0][1]; - action[1] = actionTable[state()][0][2]; - - int low = 1; - int high = actionTable[state()].length - 1; - - while(low <= high) - { - int middle = (low + high) / 2; - - if(index < actionTable[state()][middle][0]) - { - high = middle - 1; - } - else if(index > actionTable[state()][middle][0]) - { - low = middle + 1; - } - else - { - action[0] = actionTable[state()][middle][1]; - action[1] = actionTable[state()][middle][2]; - break; - } - } - - switch(action[0]) - { - case SHIFT: - { - ArrayList list = new ArrayList(); - list.add(lexer.next()); - push(action[1], list); - last_shift = action[1]; - } - break; - case REDUCE: - switch(action[1]) - { - case 0: /* reduce AAgrammar1Grammar */ - { - ArrayList list = new0(); - push(goTo(0), list); - } - break; - case 1: /* reduce AAgrammar2Grammar */ - { - ArrayList list = new1(); - push(goTo(0), list); - } - break; - case 2: /* reduce AAgrammar3Grammar */ - { - ArrayList list = new2(); - push(goTo(0), list); - } - break; - case 3: /* reduce AAgrammar4Grammar */ - { - ArrayList list = new3(); - push(goTo(0), list); - } - break; - case 4: /* reduce AAgrammar5Grammar */ - { - ArrayList list = new4(); - push(goTo(0), list); - } - break; - case 5: /* reduce AAgrammar6Grammar */ - { - ArrayList list = new5(); - push(goTo(0), list); - } - break; - case 6: /* reduce AAgrammar7Grammar */ - { - ArrayList list = new6(); - push(goTo(0), list); - } - break; - case 7: /* reduce AAgrammar8Grammar */ - { - ArrayList list = new7(); - push(goTo(0), list); - } - break; - case 8: /* reduce AAgrammar9Grammar */ - { - ArrayList list = new8(); - push(goTo(0), list); - } - break; - case 9: /* reduce AAgrammar10Grammar */ - { - ArrayList list = new9(); - push(goTo(0), list); - } - break; - case 10: /* reduce AAgrammar11Grammar */ - { - ArrayList list = new10(); - push(goTo(0), list); - } - break; - case 11: /* reduce AAgrammar12Grammar */ - { - ArrayList list = new11(); - push(goTo(0), list); - } - break; - case 12: /* reduce AAgrammar13Grammar */ - { - ArrayList list = new12(); - push(goTo(0), list); - } - break; - case 13: /* reduce AAgrammar14Grammar */ - { - ArrayList list = new13(); - push(goTo(0), list); - } - break; - case 14: /* reduce AAgrammar15Grammar */ - { - ArrayList list = new14(); - push(goTo(0), list); - } - break; - case 15: /* reduce AAgrammar16Grammar */ - { - ArrayList list = new15(); - push(goTo(0), list); - } - break; - case 16: /* reduce AAgrammar17Grammar */ - { - ArrayList list = new16(); - push(goTo(0), list); - } - break; - case 17: /* reduce AAgrammar18Grammar */ - { - ArrayList list = new17(); - push(goTo(0), list); - } - break; - case 18: /* reduce AAgrammar19Grammar */ - { - ArrayList list = new18(); - push(goTo(0), list); - } - break; - case 19: /* reduce AAgrammar20Grammar */ - { - ArrayList list = new19(); - push(goTo(0), list); - } - break; - case 20: /* reduce AAgrammar21Grammar */ - { - ArrayList list = new20(); - push(goTo(0), list); - } - break; - case 21: /* reduce AAgrammar22Grammar */ - { - ArrayList list = new21(); - push(goTo(0), list); - } - break; - case 22: /* reduce AAgrammar23Grammar */ - { - ArrayList list = new22(); - push(goTo(0), list); - } - break; - case 23: /* reduce AAgrammar24Grammar */ - { - ArrayList list = new23(); - push(goTo(0), list); - } - break; - case 24: /* reduce AAgrammar25Grammar */ - { - ArrayList list = new24(); - push(goTo(0), list); - } - break; - case 25: /* reduce AAgrammar26Grammar */ - { - ArrayList list = new25(); - push(goTo(0), list); - } - break; - case 26: /* reduce AAgrammar27Grammar */ - { - ArrayList list = new26(); - push(goTo(0), list); - } - break; - case 27: /* reduce AAgrammar28Grammar */ - { - ArrayList list = new27(); - push(goTo(0), list); - } - break; - case 28: /* reduce AAgrammar29Grammar */ - { - ArrayList list = new28(); - push(goTo(0), list); - } - break; - case 29: /* reduce AAgrammar30Grammar */ - { - ArrayList list = new29(); - push(goTo(0), list); - } - break; - case 30: /* reduce AAgrammar31Grammar */ - { - ArrayList list = new30(); - push(goTo(0), list); - } - break; - case 31: /* reduce AAgrammar32Grammar */ - { - ArrayList list = new31(); - push(goTo(0), list); - } - break; - case 32: /* reduce AAgrammar33Grammar */ - { - ArrayList list = new32(); - push(goTo(0), list); - } - break; - case 33: /* reduce AAgrammar34Grammar */ - { - ArrayList list = new33(); - push(goTo(0), list); - } - break; - case 34: /* reduce AAgrammar35Grammar */ - { - ArrayList list = new34(); - push(goTo(0), list); - } - break; - case 35: /* reduce AAgrammar36Grammar */ - { - ArrayList list = new35(); - push(goTo(0), list); - } - break; - case 36: /* reduce AAgrammar37Grammar */ - { - ArrayList list = new36(); - push(goTo(0), list); - } - break; - case 37: /* reduce AAgrammar38Grammar */ - { - ArrayList list = new37(); - push(goTo(0), list); - } - break; - case 38: /* reduce AAgrammar39Grammar */ - { - ArrayList list = new38(); - push(goTo(0), list); - } - break; - case 39: /* reduce AAgrammar40Grammar */ - { - ArrayList list = new39(); - push(goTo(0), list); - } - break; - case 40: /* reduce AAgrammar41Grammar */ - { - ArrayList list = new40(); - push(goTo(0), list); - } - break; - case 41: /* reduce AAgrammar42Grammar */ - { - ArrayList list = new41(); - push(goTo(0), list); - } - break; - case 42: /* reduce AAgrammar43Grammar */ - { - ArrayList list = new42(); - push(goTo(0), list); - } - break; - case 43: /* reduce AAgrammar44Grammar */ - { - ArrayList list = new43(); - push(goTo(0), list); - } - break; - case 44: /* reduce AAgrammar45Grammar */ - { - ArrayList list = new44(); - push(goTo(0), list); - } - break; - case 45: /* reduce AAgrammar46Grammar */ - { - ArrayList list = new45(); - push(goTo(0), list); - } - break; - case 46: /* reduce AAgrammar47Grammar */ - { - ArrayList list = new46(); - push(goTo(0), list); - } - break; - case 47: /* reduce AAgrammar48Grammar */ - { - ArrayList list = new47(); - push(goTo(0), list); - } - break; - case 48: /* reduce AAgrammar49Grammar */ - { - ArrayList list = new48(); - push(goTo(0), list); - } - break; - case 49: /* reduce AAgrammar50Grammar */ - { - ArrayList list = new49(); - push(goTo(0), list); - } - break; - case 50: /* reduce AAgrammar51Grammar */ - { - ArrayList list = new50(); - push(goTo(0), list); - } - break; - case 51: /* reduce AAgrammar52Grammar */ - { - ArrayList list = new51(); - push(goTo(0), list); - } - break; - case 52: /* reduce AAgrammar53Grammar */ - { - ArrayList list = new52(); - push(goTo(0), list); - } - break; - case 53: /* reduce AAgrammar54Grammar */ - { - ArrayList list = new53(); - push(goTo(0), list); - } - break; - case 54: /* reduce AAgrammar55Grammar */ - { - ArrayList list = new54(); - push(goTo(0), list); - } - break; - case 55: /* reduce AAgrammar56Grammar */ - { - ArrayList list = new55(); - push(goTo(0), list); - } - break; - case 56: /* reduce AAgrammar57Grammar */ - { - ArrayList list = new56(); - push(goTo(0), list); - } - break; - case 57: /* reduce AAgrammar58Grammar */ - { - ArrayList list = new57(); - push(goTo(0), list); - } - break; - case 58: /* reduce AAgrammar59Grammar */ - { - ArrayList list = new58(); - push(goTo(0), list); - } - break; - case 59: /* reduce AAgrammar60Grammar */ - { - ArrayList list = new59(); - push(goTo(0), list); - } - break; - case 60: /* reduce AAgrammar61Grammar */ - { - ArrayList list = new60(); - push(goTo(0), list); - } - break; - case 61: /* reduce AAgrammar62Grammar */ - { - ArrayList list = new61(); - push(goTo(0), list); - } - break; - case 62: /* reduce AAgrammar63Grammar */ - { - ArrayList list = new62(); - push(goTo(0), list); - } - break; - case 63: /* reduce AAgrammar64Grammar */ - { - ArrayList list = new63(); - push(goTo(0), list); - } - break; - case 64: /* reduce AAgrammar65Grammar */ - { - ArrayList list = new64(); - push(goTo(0), list); - } - break; - case 65: /* reduce AAgrammar66Grammar */ - { - ArrayList list = new65(); - push(goTo(0), list); - } - break; - case 66: /* reduce AAgrammar67Grammar */ - { - ArrayList list = new66(); - push(goTo(0), list); - } - break; - case 67: /* reduce AAgrammar68Grammar */ - { - ArrayList list = new67(); - push(goTo(0), list); - } - break; - case 68: /* reduce AAgrammar69Grammar */ - { - ArrayList list = new68(); - push(goTo(0), list); - } - break; - case 69: /* reduce AAgrammar70Grammar */ - { - ArrayList list = new69(); - push(goTo(0), list); - } - break; - case 70: /* reduce AAgrammar71Grammar */ - { - ArrayList list = new70(); - push(goTo(0), list); - } - break; - case 71: /* reduce AAgrammar72Grammar */ - { - ArrayList list = new71(); - push(goTo(0), list); - } - break; - case 72: /* reduce AAgrammar73Grammar */ - { - ArrayList list = new72(); - push(goTo(0), list); - } - break; - case 73: /* reduce AAgrammar74Grammar */ - { - ArrayList list = new73(); - push(goTo(0), list); - } - break; - case 74: /* reduce AAgrammar75Grammar */ - { - ArrayList list = new74(); - push(goTo(0), list); - } - break; - case 75: /* reduce AAgrammar76Grammar */ - { - ArrayList list = new75(); - push(goTo(0), list); - } - break; - case 76: /* reduce AAgrammar77Grammar */ - { - ArrayList list = new76(); - push(goTo(0), list); - } - break; - case 77: /* reduce AAgrammar78Grammar */ - { - ArrayList list = new77(); - push(goTo(0), list); - } - break; - case 78: /* reduce AAgrammar79Grammar */ - { - ArrayList list = new78(); - push(goTo(0), list); - } - break; - case 79: /* reduce AAgrammar80Grammar */ - { - ArrayList list = new79(); - push(goTo(0), list); - } - break; - case 80: /* reduce AAgrammar81Grammar */ - { - ArrayList list = new80(); - push(goTo(0), list); - } - break; - case 81: /* reduce AAgrammar82Grammar */ - { - ArrayList list = new81(); - push(goTo(0), list); - } - break; - case 82: /* reduce AAgrammar83Grammar */ - { - ArrayList list = new82(); - push(goTo(0), list); - } - break; - case 83: /* reduce AAgrammar84Grammar */ - { - ArrayList list = new83(); - push(goTo(0), list); - } - break; - case 84: /* reduce AAgrammar85Grammar */ - { - ArrayList list = new84(); - push(goTo(0), list); - } - break; - case 85: /* reduce AAgrammar86Grammar */ - { - ArrayList list = new85(); - push(goTo(0), list); - } - break; - case 86: /* reduce AAgrammar87Grammar */ - { - ArrayList list = new86(); - push(goTo(0), list); - } - break; - case 87: /* reduce AAgrammar88Grammar */ - { - ArrayList list = new87(); - push(goTo(0), list); - } - break; - case 88: /* reduce AAgrammar89Grammar */ - { - ArrayList list = new88(); - push(goTo(0), list); - } - break; - case 89: /* reduce AAgrammar90Grammar */ - { - ArrayList list = new89(); - push(goTo(0), list); - } - break; - case 90: /* reduce AAgrammar91Grammar */ - { - ArrayList list = new90(); - push(goTo(0), list); - } - break; - case 91: /* reduce AAgrammar92Grammar */ - { - ArrayList list = new91(); - push(goTo(0), list); - } - break; - case 92: /* reduce AAgrammar93Grammar */ - { - ArrayList list = new92(); - push(goTo(0), list); - } - break; - case 93: /* reduce AAgrammar94Grammar */ - { - ArrayList list = new93(); - push(goTo(0), list); - } - break; - case 94: /* reduce AAgrammar95Grammar */ - { - ArrayList list = new94(); - push(goTo(0), list); - } - break; - case 95: /* reduce AAgrammar96Grammar */ - { - ArrayList list = new95(); - push(goTo(0), list); - } - break; - case 96: /* reduce AAgrammar97Grammar */ - { - ArrayList list = new96(); - push(goTo(0), list); - } - break; - case 97: /* reduce AAgrammar98Grammar */ - { - ArrayList list = new97(); - push(goTo(0), list); - } - break; - case 98: /* reduce AAgrammar99Grammar */ - { - ArrayList list = new98(); - push(goTo(0), list); - } - break; - case 99: /* reduce AAgrammar100Grammar */ - { - ArrayList list = new99(); - push(goTo(0), list); - } - break; - case 100: /* reduce AAgrammar101Grammar */ - { - ArrayList list = new100(); - push(goTo(0), list); - } - break; - case 101: /* reduce AAgrammar102Grammar */ - { - ArrayList list = new101(); - push(goTo(0), list); - } - break; - case 102: /* reduce AAgrammar103Grammar */ - { - ArrayList list = new102(); - push(goTo(0), list); - } - break; - case 103: /* reduce AAgrammar104Grammar */ - { - ArrayList list = new103(); - push(goTo(0), list); - } - break; - case 104: /* reduce AAgrammar105Grammar */ - { - ArrayList list = new104(); - push(goTo(0), list); - } - break; - case 105: /* reduce AAgrammar106Grammar */ - { - ArrayList list = new105(); - push(goTo(0), list); - } - break; - case 106: /* reduce AAgrammar107Grammar */ - { - ArrayList list = new106(); - push(goTo(0), list); - } - break; - case 107: /* reduce AAgrammar108Grammar */ - { - ArrayList list = new107(); - push(goTo(0), list); - } - break; - case 108: /* reduce AAgrammar109Grammar */ - { - ArrayList list = new108(); - push(goTo(0), list); - } - break; - case 109: /* reduce AAgrammar110Grammar */ - { - ArrayList list = new109(); - push(goTo(0), list); - } - break; - case 110: /* reduce AAgrammar111Grammar */ - { - ArrayList list = new110(); - push(goTo(0), list); - } - break; - case 111: /* reduce AAgrammar112Grammar */ - { - ArrayList list = new111(); - push(goTo(0), list); - } - break; - case 112: /* reduce AAgrammar113Grammar */ - { - ArrayList list = new112(); - push(goTo(0), list); - } - break; - case 113: /* reduce AAgrammar114Grammar */ - { - ArrayList list = new113(); - push(goTo(0), list); - } - break; - case 114: /* reduce AAgrammar115Grammar */ - { - ArrayList list = new114(); - push(goTo(0), list); - } - break; - case 115: /* reduce AAgrammar116Grammar */ - { - ArrayList list = new115(); - push(goTo(0), list); - } - break; - case 116: /* reduce AAgrammar117Grammar */ - { - ArrayList list = new116(); - push(goTo(0), list); - } - break; - case 117: /* reduce AAgrammar118Grammar */ - { - ArrayList list = new117(); - push(goTo(0), list); - } - break; - case 118: /* reduce AAgrammar119Grammar */ - { - ArrayList list = new118(); - push(goTo(0), list); - } - break; - case 119: /* reduce AAgrammar120Grammar */ - { - ArrayList list = new119(); - push(goTo(0), list); - } - break; - case 120: /* reduce AAgrammar121Grammar */ - { - ArrayList list = new120(); - push(goTo(0), list); - } - break; - case 121: /* reduce AAgrammar122Grammar */ - { - ArrayList list = new121(); - push(goTo(0), list); - } - break; - case 122: /* reduce AAgrammar123Grammar */ - { - ArrayList list = new122(); - push(goTo(0), list); - } - break; - case 123: /* reduce AAgrammar124Grammar */ - { - ArrayList list = new123(); - push(goTo(0), list); - } - break; - case 124: /* reduce AAgrammar125Grammar */ - { - ArrayList list = new124(); - push(goTo(0), list); - } - break; - case 125: /* reduce AAgrammar126Grammar */ - { - ArrayList list = new125(); - push(goTo(0), list); - } - break; - case 126: /* reduce AAgrammar127Grammar */ - { - ArrayList list = new126(); - push(goTo(0), list); - } - break; - case 127: /* reduce AAgrammar128Grammar */ - { - ArrayList list = new127(); - push(goTo(0), list); - } - break; - case 128: /* reduce APackage */ - { - ArrayList list = new128(); - push(goTo(1), list); - } - break; - case 129: /* reduce AApkgname1PkgName */ - { - ArrayList list = new129(); - push(goTo(2), list); - } - break; - case 130: /* reduce AApkgname2PkgName */ - { - ArrayList list = new130(); - push(goTo(2), list); - } - break; - case 131: /* reduce APkgNameTail */ - { - ArrayList list = new131(); - push(goTo(3), list); - } - break; - case 132: /* reduce AHelpers */ - { - ArrayList list = new132(); - push(goTo(4), list); - } - break; - case 133: /* reduce AHelperDef */ - { - ArrayList list = new133(); - push(goTo(5), list); - } - break; - case 134: /* reduce AStates */ - { - ArrayList list = new134(); - push(goTo(6), list); - } - break; - case 135: /* reduce AAidlist1IdList */ - { - ArrayList list = new135(); - push(goTo(7), list); - } - break; - case 136: /* reduce AAidlist2IdList */ - { - ArrayList list = new136(); - push(goTo(7), list); - } - break; - case 137: /* reduce AIdListTail */ - { - ArrayList list = new137(); - push(goTo(8), list); - } - break; - case 138: /* reduce ATokens */ - { - ArrayList list = new138(); - push(goTo(9), list); - } - break; - case 139: /* reduce AAtokendef1TokenDef */ - { - ArrayList list = new139(); - push(goTo(10), list); - } - break; - case 140: /* reduce AAtokendef2TokenDef */ - { - ArrayList list = new140(); - push(goTo(10), list); - } - break; - case 141: /* reduce AAtokendef3TokenDef */ - { - ArrayList list = new141(); - push(goTo(10), list); - } - break; - case 142: /* reduce AAtokendef4TokenDef */ - { - ArrayList list = new142(); - push(goTo(10), list); - } - break; - case 143: /* reduce AAstatelist1StateList */ - { - ArrayList list = new143(); - push(goTo(11), list); - } - break; - case 144: /* reduce AAstatelist2StateList */ - { - ArrayList list = new144(); - push(goTo(11), list); - } - break; - case 145: /* reduce AAstatelist3StateList */ - { - ArrayList list = new145(); - push(goTo(11), list); - } - break; - case 146: /* reduce AAstatelist4StateList */ - { - ArrayList list = new146(); - push(goTo(11), list); - } - break; - case 147: /* reduce AAstatelisttail1StateListTail */ - { - ArrayList list = new147(); - push(goTo(12), list); - } - break; - case 148: /* reduce AAstatelisttail2StateListTail */ - { - ArrayList list = new148(); - push(goTo(12), list); - } - break; - case 149: /* reduce ATransition */ - { - ArrayList list = new149(); - push(goTo(13), list); - } - break; - case 150: /* reduce AAigntokens1IgnTokens */ - { - ArrayList list = new150(); - push(goTo(14), list); - } - break; - case 151: /* reduce AAigntokens2IgnTokens */ - { - ArrayList list = new151(); - push(goTo(14), list); - } - break; - case 152: /* reduce ALookAhead */ - { - ArrayList list = new152(); - push(goTo(15), list); - } - break; - case 153: /* reduce AAregexp1RegExp */ - { - ArrayList list = new153(); - push(goTo(16), list); - } - break; - case 154: /* reduce AAregexp2RegExp */ - { - ArrayList list = new154(); - push(goTo(16), list); - } - break; - case 155: /* reduce ARegExpTail */ - { - ArrayList list = new155(); - push(goTo(17), list); - } - break; - case 156: /* reduce AAconcat1Concat */ - { - ArrayList list = new156(); - push(goTo(18), list); - } - break; - case 157: /* reduce AAconcat2Concat */ - { - ArrayList list = new157(); - push(goTo(18), list); - } - break; - case 158: /* reduce AAunexp1UnExp */ - { - ArrayList list = new158(); - push(goTo(19), list); - } - break; - case 159: /* reduce AAunexp2UnExp */ - { - ArrayList list = new159(); - push(goTo(19), list); - } - break; - case 160: /* reduce ACharBasic */ - { - ArrayList list = new160(); - push(goTo(20), list); - } - break; - case 161: /* reduce ASetBasic */ - { - ArrayList list = new161(); - push(goTo(20), list); - } - break; - case 162: /* reduce AStringBasic */ - { - ArrayList list = new162(); - push(goTo(20), list); - } - break; - case 163: /* reduce AIdBasic */ - { - ArrayList list = new163(); - push(goTo(20), list); - } - break; - case 164: /* reduce ARegExpBasic */ - { - ArrayList list = new164(); - push(goTo(20), list); - } - break; - case 165: /* reduce ACharChar */ - { - ArrayList list = new165(); - push(goTo(21), list); - } - break; - case 166: /* reduce ADecChar */ - { - ArrayList list = new166(); - push(goTo(21), list); - } - break; - case 167: /* reduce AHexChar */ - { - ArrayList list = new167(); - push(goTo(21), list); - } - break; - case 168: /* reduce AOperationSet */ - { - ArrayList list = new168(); - push(goTo(22), list); - } - break; - case 169: /* reduce AIntervalSet */ - { - ArrayList list = new169(); - push(goTo(22), list); - } - break; - case 170: /* reduce AStarUnOp */ - { - ArrayList list = new170(); - push(goTo(23), list); - } - break; - case 171: /* reduce AQMarkUnOp */ - { - ArrayList list = new171(); - push(goTo(23), list); - } - break; - case 172: /* reduce APlusUnOp */ - { - ArrayList list = new172(); - push(goTo(23), list); - } - break; - case 173: /* reduce APlusBinOp */ - { - ArrayList list = new173(); - push(goTo(24), list); - } - break; - case 174: /* reduce AMinusBinOp */ - { - ArrayList list = new174(); - push(goTo(24), list); - } - break; - case 175: /* reduce AProductions */ - { - ArrayList list = new175(); - push(goTo(25), list); - } - break; - case 176: /* reduce AAprod1Prod */ - { - ArrayList list = new176(); - push(goTo(26), list); - } - break; - case 177: /* reduce AAprod2Prod */ - { - ArrayList list = new177(); - push(goTo(26), list); - } - break; - case 178: /* reduce AAprodtransform1ProdTransform */ - { - ArrayList list = new178(); - push(goTo(27), list); - } - break; - case 179: /* reduce AAprodtransform2ProdTransform */ - { - ArrayList list = new179(); - push(goTo(27), list); - } - break; - case 180: /* reduce AAalts1Alts */ - { - ArrayList list = new180(); - push(goTo(28), list); - } - break; - case 181: /* reduce AAalts2Alts */ - { - ArrayList list = new181(); - push(goTo(28), list); - } - break; - case 182: /* reduce AAltsTail */ - { - ArrayList list = new182(); - push(goTo(29), list); - } - break; - case 183: /* reduce AAalt1Alt */ - { - ArrayList list = new183(); - push(goTo(30), list); - } - break; - case 184: /* reduce AAalt2Alt */ - { - ArrayList list = new184(); - push(goTo(30), list); - } - break; - case 185: /* reduce AAalt3Alt */ - { - ArrayList list = new185(); - push(goTo(30), list); - } - break; - case 186: /* reduce AAalt4Alt */ - { - ArrayList list = new186(); - push(goTo(30), list); - } - break; - case 187: /* reduce AAalt5Alt */ - { - ArrayList list = new187(); - push(goTo(30), list); - } - break; - case 188: /* reduce AAalt6Alt */ - { - ArrayList list = new188(); - push(goTo(30), list); - } - break; - case 189: /* reduce AAalt7Alt */ - { - ArrayList list = new189(); - push(goTo(30), list); - } - break; - case 190: /* reduce AAalt8Alt */ - { - ArrayList list = new190(); - push(goTo(30), list); - } - break; - case 191: /* reduce AAalttransform1AltTransform */ - { - ArrayList list = new191(); - push(goTo(31), list); - } - break; - case 192: /* reduce AAalttransform2AltTransform */ - { - ArrayList list = new192(); - push(goTo(31), list); - } - break; - case 193: /* reduce AAnewterm1Term */ - { - ArrayList list = new193(); - push(goTo(32), list); - } - break; - case 194: /* reduce AAnewterm2Term */ - { - ArrayList list = new194(); - push(goTo(32), list); - } - break; - case 195: /* reduce AAlistterm1Term */ - { - ArrayList list = new195(); - push(goTo(32), list); - } - break; - case 196: /* reduce AAlistterm2Term */ - { - ArrayList list = new196(); - push(goTo(32), list); - } - break; - case 197: /* reduce AAsimpleterm1Term */ - { - ArrayList list = new197(); - push(goTo(32), list); - } - break; - case 198: /* reduce AAsimpleterm2Term */ - { - ArrayList list = new198(); - push(goTo(32), list); - } - break; - case 199: /* reduce AAsimpleterm3Term */ - { - ArrayList list = new199(); - push(goTo(32), list); - } - break; - case 200: /* reduce AAsimpleterm4Term */ - { - ArrayList list = new200(); - push(goTo(32), list); - } - break; - case 201: /* reduce ANullTerm */ - { - ArrayList list = new201(); - push(goTo(32), list); - } - break; - case 202: /* reduce AAlistoflistterm1ListOfListTerm */ - { - ArrayList list = new202(); - push(goTo(33), list); - } - break; - case 203: /* reduce AAlistoflistterm2ListOfListTerm */ - { - ArrayList list = new203(); - push(goTo(33), list); - } - break; - case 204: /* reduce AAnewlistterm1ListTerm */ - { - ArrayList list = new204(); - push(goTo(34), list); - } - break; - case 205: /* reduce AAnewlistterm2ListTerm */ - { - ArrayList list = new205(); - push(goTo(34), list); - } - break; - case 206: /* reduce AAsimplelistterm1ListTerm */ - { - ArrayList list = new206(); - push(goTo(34), list); - } - break; - case 207: /* reduce AAsimplelistterm2ListTerm */ - { - ArrayList list = new207(); - push(goTo(34), list); - } - break; - case 208: /* reduce AAsimplelistterm3ListTerm */ - { - ArrayList list = new208(); - push(goTo(34), list); - } - break; - case 209: /* reduce AAsimplelistterm4ListTerm */ - { - ArrayList list = new209(); - push(goTo(34), list); - } - break; - case 210: /* reduce AListTermTail */ - { - ArrayList list = new210(); - push(goTo(35), list); - } - break; - case 211: /* reduce ASimpleTermTail */ - { - ArrayList list = new211(); - push(goTo(36), list); - } - break; - case 212: /* reduce AAprodname1ProdName */ - { - ArrayList list = new212(); - push(goTo(37), list); - } - break; - case 213: /* reduce AAprodname2ProdName */ - { - ArrayList list = new213(); - push(goTo(37), list); - } - break; - case 214: /* reduce AProdNameTail */ - { - ArrayList list = new214(); - push(goTo(38), list); - } - break; - case 215: /* reduce AAparams1Params */ - { - ArrayList list = new215(); - push(goTo(39), list); - } - break; - case 216: /* reduce AAparams2Params */ - { - ArrayList list = new216(); - push(goTo(39), list); - } - break; - case 217: /* reduce AParamsTail */ - { - ArrayList list = new217(); - push(goTo(40), list); - } - break; - case 218: /* reduce AAltName */ - { - ArrayList list = new218(); - push(goTo(41), list); - } - break; - case 219: /* reduce AAelem1Elem */ - { - ArrayList list = new219(); - push(goTo(42), list); - } - break; - case 220: /* reduce AAelem2Elem */ - { - ArrayList list = new220(); - push(goTo(42), list); - } - break; - case 221: /* reduce AAelem3Elem */ - { - ArrayList list = new221(); - push(goTo(42), list); - } - break; - case 222: /* reduce AAelem4Elem */ - { - ArrayList list = new222(); - push(goTo(42), list); - } - break; - case 223: /* reduce AAelem5Elem */ - { - ArrayList list = new223(); - push(goTo(42), list); - } - break; - case 224: /* reduce AAelem6Elem */ - { - ArrayList list = new224(); - push(goTo(42), list); - } - break; - case 225: /* reduce AAelem7Elem */ - { - ArrayList list = new225(); - push(goTo(42), list); - } - break; - case 226: /* reduce AAelem8Elem */ - { - ArrayList list = new226(); - push(goTo(42), list); - } - break; - case 227: /* reduce AElemName */ - { - ArrayList list = new227(); - push(goTo(43), list); - } - break; - case 228: /* reduce ATokenSpecifier */ - { - ArrayList list = new228(); - push(goTo(44), list); - } - break; - case 229: /* reduce AProductionSpecifier */ - { - ArrayList list = new229(); - push(goTo(44), list); - } - break; - case 230: /* reduce AAst */ - { - ArrayList list = new230(); - push(goTo(45), list); - } - break; - case 231: /* reduce AAstProd */ - { - ArrayList list = new231(); - push(goTo(46), list); - } - break; - case 232: /* reduce AAastalts1AstAlts */ - { - ArrayList list = new232(); - push(goTo(47), list); - } - break; - case 233: /* reduce AAastalts2AstAlts */ - { - ArrayList list = new233(); - push(goTo(47), list); - } - break; - case 234: /* reduce AAstAltsTail */ - { - ArrayList list = new234(); - push(goTo(48), list); - } - break; - case 235: /* reduce AAastalt1AstAlt */ - { - ArrayList list = new235(); - push(goTo(49), list); - } - break; - case 236: /* reduce AAastalt2AstAlt */ - { - ArrayList list = new236(); - push(goTo(49), list); - } - break; - case 237: /* reduce AAastalt3AstAlt */ - { - ArrayList list = new237(); - push(goTo(49), list); - } - break; - case 238: /* reduce AAastalt4AstAlt */ - { - ArrayList list = new238(); - push(goTo(49), list); - } - break; - case 239: /* reduce ATerminal$PkgNameTail */ - { - ArrayList list = new239(); - push(goTo(50), list); - } - break; - case 240: /* reduce ANonTerminal$PkgNameTail */ - { - ArrayList list = new240(); - push(goTo(50), list); - } - break; - case 241: /* reduce ATerminal$HelperDef */ - { - ArrayList list = new241(); - push(goTo(51), list); - } - break; - case 242: /* reduce ANonTerminal$HelperDef */ - { - ArrayList list = new242(); - push(goTo(51), list); - } - break; - case 243: /* reduce ATerminal$IdListTail */ - { - ArrayList list = new243(); - push(goTo(52), list); - } - break; - case 244: /* reduce ANonTerminal$IdListTail */ - { - ArrayList list = new244(); - push(goTo(52), list); - } - break; - case 245: /* reduce ATerminal$TokenDef */ - { - ArrayList list = new245(); - push(goTo(53), list); - } - break; - case 246: /* reduce ANonTerminal$TokenDef */ - { - ArrayList list = new246(); - push(goTo(53), list); - } - break; - case 247: /* reduce ATerminal$StateListTail */ - { - ArrayList list = new247(); - push(goTo(54), list); - } - break; - case 248: /* reduce ANonTerminal$StateListTail */ - { - ArrayList list = new248(); - push(goTo(54), list); - } - break; - case 249: /* reduce ATerminal$RegExpTail */ - { - ArrayList list = new249(); - push(goTo(55), list); - } - break; - case 250: /* reduce ANonTerminal$RegExpTail */ - { - ArrayList list = new250(); - push(goTo(55), list); - } - break; - case 251: /* reduce ATerminal$UnExp */ - { - ArrayList list = new251(); - push(goTo(56), list); - } - break; - case 252: /* reduce ANonTerminal$UnExp */ - { - ArrayList list = new252(); - push(goTo(56), list); - } - break; - case 253: /* reduce ATerminal$Prod */ - { - ArrayList list = new253(); - push(goTo(57), list); - } - break; - case 254: /* reduce ANonTerminal$Prod */ - { - ArrayList list = new254(); - push(goTo(57), list); - } - break; - case 255: /* reduce ATerminal$Elem */ - { - ArrayList list = new255(); - push(goTo(58), list); - } - break; - case 256: /* reduce ANonTerminal$Elem */ - { - ArrayList list = new256(); - push(goTo(58), list); - } - break; - case 257: /* reduce ATerminal$AltsTail */ - { - ArrayList list = new257(); - push(goTo(59), list); - } - break; - case 258: /* reduce ANonTerminal$AltsTail */ - { - ArrayList list = new258(); - push(goTo(59), list); - } - break; - case 259: /* reduce ATerminal$Term */ - { - ArrayList list = new259(); - push(goTo(60), list); - } - break; - case 260: /* reduce ANonTerminal$Term */ - { - ArrayList list = new260(); - push(goTo(60), list); - } - break; - case 261: /* reduce ATerminal$ListTermTail */ - { - ArrayList list = new261(); - push(goTo(61), list); - } - break; - case 262: /* reduce ANonTerminal$ListTermTail */ - { - ArrayList list = new262(); - push(goTo(61), list); - } - break; - case 263: /* reduce ATerminal$ParamsTail */ - { - ArrayList list = new263(); - push(goTo(62), list); - } - break; - case 264: /* reduce ANonTerminal$ParamsTail */ - { - ArrayList list = new264(); - push(goTo(62), list); - } - break; - case 265: /* reduce ATerminal$AstProd */ - { - ArrayList list = new265(); - push(goTo(63), list); - } - break; - case 266: /* reduce ANonTerminal$AstProd */ - { - ArrayList list = new266(); - push(goTo(63), list); - } - break; - case 267: /* reduce ATerminal$AstAltsTail */ - { - ArrayList list = new267(); - push(goTo(64), list); - } - break; - case 268: /* reduce ANonTerminal$AstAltsTail */ - { - ArrayList list = new268(); - push(goTo(64), list); - } - break; - } - break; - case ACCEPT: - { - EOF node2 = (EOF) lexer.next(); - PGrammar node1 = (PGrammar) ((ArrayList)pop()).get(0); - Start node = new Start(node1, node2); - return node; - } - case ERROR: - throw new ParserException(last_token, - "[" + last_line + "," + last_pos + "] " + - errorMessages[errors[action[1]]]); - } - } - } - - ArrayList new0() /* reduce AAgrammar1Grammar */ - { - ArrayList nodeList = new ArrayList(); - - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new1() /* reduce AAgrammar2Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + + public Start parse() throws ParserException, LexerException, IOException + { + this.getMapping().clear(); + + push(0, null); + while(true) { - listNode3.addAll(listNode2); - } - } - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new2() /* reduce AAgrammar3Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new3() /* reduce AAgrammar4Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + while(index(this.lexer.peek()) == -1) + { + // this is an ignored token + this.lexer.next(); + } + + this.last_pos = this.lexer.peek().getPos(); + this.last_line = this.lexer.peek().getLine(); + this.last_token = this.lexer.peek(); + + int index = index(this.lexer.peek()); + this.action[0] = Parser.actionTable[state()][0][1]; + this.action[1] = Parser.actionTable[state()][0][2]; + + int low = 1; + int high = Parser.actionTable[state()].length - 1; + + while(low <= high) + { + int middle = (low + high) >>> 1; + + if(index < Parser.actionTable[state()][middle][0]) + { + high = middle - 1; + } + else if(index > Parser.actionTable[state()][middle][0]) + { + low = middle + 1; + } + else + { + this.action[0] = Parser.actionTable[state()][middle][1]; + this.action[1] = Parser.actionTable[state()][middle][2]; + break; + } + } + + switch(this.action[0]) + { + case SHIFT: + { + List<Object> list = new ArrayList<Object>(); + list.add(this.lexer.next()); + push(this.action[1], list); + } + break; + case REDUCE: + switch(this.action[1]) + { + case 0: /* reduce AAgrammar1Grammar */ + { + List<Object> list = new0(); + push(goTo(0), list); + } + break; + case 1: /* reduce AAgrammar2Grammar */ + { + List<Object> list = new1(); + push(goTo(0), list); + } + break; + case 2: /* reduce AAgrammar3Grammar */ + { + List<Object> list = new2(); + push(goTo(0), list); + } + break; + case 3: /* reduce AAgrammar4Grammar */ + { + List<Object> list = new3(); + push(goTo(0), list); + } + break; + case 4: /* reduce AAgrammar5Grammar */ + { + List<Object> list = new4(); + push(goTo(0), list); + } + break; + case 5: /* reduce AAgrammar6Grammar */ + { + List<Object> list = new5(); + push(goTo(0), list); + } + break; + case 6: /* reduce AAgrammar7Grammar */ + { + List<Object> list = new6(); + push(goTo(0), list); + } + break; + case 7: /* reduce AAgrammar8Grammar */ + { + List<Object> list = new7(); + push(goTo(0), list); + } + break; + case 8: /* reduce AAgrammar9Grammar */ + { + List<Object> list = new8(); + push(goTo(0), list); + } + break; + case 9: /* reduce AAgrammar10Grammar */ + { + List<Object> list = new9(); + push(goTo(0), list); + } + break; + case 10: /* reduce AAgrammar11Grammar */ + { + List<Object> list = new10(); + push(goTo(0), list); + } + break; + case 11: /* reduce AAgrammar12Grammar */ + { + List<Object> list = new11(); + push(goTo(0), list); + } + break; + case 12: /* reduce AAgrammar13Grammar */ + { + List<Object> list = new12(); + push(goTo(0), list); + } + break; + case 13: /* reduce AAgrammar14Grammar */ + { + List<Object> list = new13(); + push(goTo(0), list); + } + break; + case 14: /* reduce AAgrammar15Grammar */ + { + List<Object> list = new14(); + push(goTo(0), list); + } + break; + case 15: /* reduce AAgrammar16Grammar */ + { + List<Object> list = new15(); + push(goTo(0), list); + } + break; + case 16: /* reduce AAgrammar17Grammar */ + { + List<Object> list = new16(); + push(goTo(0), list); + } + break; + case 17: /* reduce AAgrammar18Grammar */ + { + List<Object> list = new17(); + push(goTo(0), list); + } + break; + case 18: /* reduce AAgrammar19Grammar */ + { + List<Object> list = new18(); + push(goTo(0), list); + } + break; + case 19: /* reduce AAgrammar20Grammar */ + { + List<Object> list = new19(); + push(goTo(0), list); + } + break; + case 20: /* reduce AAgrammar21Grammar */ + { + List<Object> list = new20(); + push(goTo(0), list); + } + break; + case 21: /* reduce AAgrammar22Grammar */ + { + List<Object> list = new21(); + push(goTo(0), list); + } + break; + case 22: /* reduce AAgrammar23Grammar */ + { + List<Object> list = new22(); + push(goTo(0), list); + } + break; + case 23: /* reduce AAgrammar24Grammar */ + { + List<Object> list = new23(); + push(goTo(0), list); + } + break; + case 24: /* reduce AAgrammar25Grammar */ + { + List<Object> list = new24(); + push(goTo(0), list); + } + break; + case 25: /* reduce AAgrammar26Grammar */ + { + List<Object> list = new25(); + push(goTo(0), list); + } + break; + case 26: /* reduce AAgrammar27Grammar */ + { + List<Object> list = new26(); + push(goTo(0), list); + } + break; + case 27: /* reduce AAgrammar28Grammar */ + { + List<Object> list = new27(); + push(goTo(0), list); + } + break; + case 28: /* reduce AAgrammar29Grammar */ + { + List<Object> list = new28(); + push(goTo(0), list); + } + break; + case 29: /* reduce AAgrammar30Grammar */ + { + List<Object> list = new29(); + push(goTo(0), list); + } + break; + case 30: /* reduce AAgrammar31Grammar */ + { + List<Object> list = new30(); + push(goTo(0), list); + } + break; + case 31: /* reduce AAgrammar32Grammar */ + { + List<Object> list = new31(); + push(goTo(0), list); + } + break; + case 32: /* reduce AAgrammar33Grammar */ + { + List<Object> list = new32(); + push(goTo(0), list); + } + break; + case 33: /* reduce AAgrammar34Grammar */ + { + List<Object> list = new33(); + push(goTo(0), list); + } + break; + case 34: /* reduce AAgrammar35Grammar */ + { + List<Object> list = new34(); + push(goTo(0), list); + } + break; + case 35: /* reduce AAgrammar36Grammar */ + { + List<Object> list = new35(); + push(goTo(0), list); + } + break; + case 36: /* reduce AAgrammar37Grammar */ + { + List<Object> list = new36(); + push(goTo(0), list); + } + break; + case 37: /* reduce AAgrammar38Grammar */ + { + List<Object> list = new37(); + push(goTo(0), list); + } + break; + case 38: /* reduce AAgrammar39Grammar */ + { + List<Object> list = new38(); + push(goTo(0), list); + } + break; + case 39: /* reduce AAgrammar40Grammar */ + { + List<Object> list = new39(); + push(goTo(0), list); + } + break; + case 40: /* reduce AAgrammar41Grammar */ + { + List<Object> list = new40(); + push(goTo(0), list); + } + break; + case 41: /* reduce AAgrammar42Grammar */ + { + List<Object> list = new41(); + push(goTo(0), list); + } + break; + case 42: /* reduce AAgrammar43Grammar */ + { + List<Object> list = new42(); + push(goTo(0), list); + } + break; + case 43: /* reduce AAgrammar44Grammar */ + { + List<Object> list = new43(); + push(goTo(0), list); + } + break; + case 44: /* reduce AAgrammar45Grammar */ + { + List<Object> list = new44(); + push(goTo(0), list); + } + break; + case 45: /* reduce AAgrammar46Grammar */ + { + List<Object> list = new45(); + push(goTo(0), list); + } + break; + case 46: /* reduce AAgrammar47Grammar */ + { + List<Object> list = new46(); + push(goTo(0), list); + } + break; + case 47: /* reduce AAgrammar48Grammar */ + { + List<Object> list = new47(); + push(goTo(0), list); + } + break; + case 48: /* reduce AAgrammar49Grammar */ + { + List<Object> list = new48(); + push(goTo(0), list); + } + break; + case 49: /* reduce AAgrammar50Grammar */ + { + List<Object> list = new49(); + push(goTo(0), list); + } + break; + case 50: /* reduce AAgrammar51Grammar */ + { + List<Object> list = new50(); + push(goTo(0), list); + } + break; + case 51: /* reduce AAgrammar52Grammar */ + { + List<Object> list = new51(); + push(goTo(0), list); + } + break; + case 52: /* reduce AAgrammar53Grammar */ + { + List<Object> list = new52(); + push(goTo(0), list); + } + break; + case 53: /* reduce AAgrammar54Grammar */ + { + List<Object> list = new53(); + push(goTo(0), list); + } + break; + case 54: /* reduce AAgrammar55Grammar */ + { + List<Object> list = new54(); + push(goTo(0), list); + } + break; + case 55: /* reduce AAgrammar56Grammar */ + { + List<Object> list = new55(); + push(goTo(0), list); + } + break; + case 56: /* reduce AAgrammar57Grammar */ + { + List<Object> list = new56(); + push(goTo(0), list); + } + break; + case 57: /* reduce AAgrammar58Grammar */ + { + List<Object> list = new57(); + push(goTo(0), list); + } + break; + case 58: /* reduce AAgrammar59Grammar */ + { + List<Object> list = new58(); + push(goTo(0), list); + } + break; + case 59: /* reduce AAgrammar60Grammar */ + { + List<Object> list = new59(); + push(goTo(0), list); + } + break; + case 60: /* reduce AAgrammar61Grammar */ + { + List<Object> list = new60(); + push(goTo(0), list); + } + break; + case 61: /* reduce AAgrammar62Grammar */ + { + List<Object> list = new61(); + push(goTo(0), list); + } + break; + case 62: /* reduce AAgrammar63Grammar */ + { + List<Object> list = new62(); + push(goTo(0), list); + } + break; + case 63: /* reduce AAgrammar64Grammar */ + { + List<Object> list = new63(); + push(goTo(0), list); + } + break; + case 64: /* reduce AAgrammar65Grammar */ + { + List<Object> list = new64(); + push(goTo(0), list); + } + break; + case 65: /* reduce AAgrammar66Grammar */ + { + List<Object> list = new65(); + push(goTo(0), list); + } + break; + case 66: /* reduce AAgrammar67Grammar */ + { + List<Object> list = new66(); + push(goTo(0), list); + } + break; + case 67: /* reduce AAgrammar68Grammar */ + { + List<Object> list = new67(); + push(goTo(0), list); + } + break; + case 68: /* reduce AAgrammar69Grammar */ + { + List<Object> list = new68(); + push(goTo(0), list); + } + break; + case 69: /* reduce AAgrammar70Grammar */ + { + List<Object> list = new69(); + push(goTo(0), list); + } + break; + case 70: /* reduce AAgrammar71Grammar */ + { + List<Object> list = new70(); + push(goTo(0), list); + } + break; + case 71: /* reduce AAgrammar72Grammar */ + { + List<Object> list = new71(); + push(goTo(0), list); + } + break; + case 72: /* reduce AAgrammar73Grammar */ + { + List<Object> list = new72(); + push(goTo(0), list); + } + break; + case 73: /* reduce AAgrammar74Grammar */ + { + List<Object> list = new73(); + push(goTo(0), list); + } + break; + case 74: /* reduce AAgrammar75Grammar */ + { + List<Object> list = new74(); + push(goTo(0), list); + } + break; + case 75: /* reduce AAgrammar76Grammar */ + { + List<Object> list = new75(); + push(goTo(0), list); + } + break; + case 76: /* reduce AAgrammar77Grammar */ + { + List<Object> list = new76(); + push(goTo(0), list); + } + break; + case 77: /* reduce AAgrammar78Grammar */ + { + List<Object> list = new77(); + push(goTo(0), list); + } + break; + case 78: /* reduce AAgrammar79Grammar */ + { + List<Object> list = new78(); + push(goTo(0), list); + } + break; + case 79: /* reduce AAgrammar80Grammar */ + { + List<Object> list = new79(); + push(goTo(0), list); + } + break; + case 80: /* reduce AAgrammar81Grammar */ + { + List<Object> list = new80(); + push(goTo(0), list); + } + break; + case 81: /* reduce AAgrammar82Grammar */ + { + List<Object> list = new81(); + push(goTo(0), list); + } + break; + case 82: /* reduce AAgrammar83Grammar */ + { + List<Object> list = new82(); + push(goTo(0), list); + } + break; + case 83: /* reduce AAgrammar84Grammar */ + { + List<Object> list = new83(); + push(goTo(0), list); + } + break; + case 84: /* reduce AAgrammar85Grammar */ + { + List<Object> list = new84(); + push(goTo(0), list); + } + break; + case 85: /* reduce AAgrammar86Grammar */ + { + List<Object> list = new85(); + push(goTo(0), list); + } + break; + case 86: /* reduce AAgrammar87Grammar */ + { + List<Object> list = new86(); + push(goTo(0), list); + } + break; + case 87: /* reduce AAgrammar88Grammar */ + { + List<Object> list = new87(); + push(goTo(0), list); + } + break; + case 88: /* reduce AAgrammar89Grammar */ + { + List<Object> list = new88(); + push(goTo(0), list); + } + break; + case 89: /* reduce AAgrammar90Grammar */ + { + List<Object> list = new89(); + push(goTo(0), list); + } + break; + case 90: /* reduce AAgrammar91Grammar */ + { + List<Object> list = new90(); + push(goTo(0), list); + } + break; + case 91: /* reduce AAgrammar92Grammar */ + { + List<Object> list = new91(); + push(goTo(0), list); + } + break; + case 92: /* reduce AAgrammar93Grammar */ + { + List<Object> list = new92(); + push(goTo(0), list); + } + break; + case 93: /* reduce AAgrammar94Grammar */ + { + List<Object> list = new93(); + push(goTo(0), list); + } + break; + case 94: /* reduce AAgrammar95Grammar */ + { + List<Object> list = new94(); + push(goTo(0), list); + } + break; + case 95: /* reduce AAgrammar96Grammar */ + { + List<Object> list = new95(); + push(goTo(0), list); + } + break; + case 96: /* reduce AAgrammar97Grammar */ + { + List<Object> list = new96(); + push(goTo(0), list); + } + break; + case 97: /* reduce AAgrammar98Grammar */ + { + List<Object> list = new97(); + push(goTo(0), list); + } + break; + case 98: /* reduce AAgrammar99Grammar */ + { + List<Object> list = new98(); + push(goTo(0), list); + } + break; + case 99: /* reduce AAgrammar100Grammar */ + { + List<Object> list = new99(); + push(goTo(0), list); + } + break; + case 100: /* reduce AAgrammar101Grammar */ + { + List<Object> list = new100(); + push(goTo(0), list); + } + break; + case 101: /* reduce AAgrammar102Grammar */ + { + List<Object> list = new101(); + push(goTo(0), list); + } + break; + case 102: /* reduce AAgrammar103Grammar */ + { + List<Object> list = new102(); + push(goTo(0), list); + } + break; + case 103: /* reduce AAgrammar104Grammar */ + { + List<Object> list = new103(); + push(goTo(0), list); + } + break; + case 104: /* reduce AAgrammar105Grammar */ + { + List<Object> list = new104(); + push(goTo(0), list); + } + break; + case 105: /* reduce AAgrammar106Grammar */ + { + List<Object> list = new105(); + push(goTo(0), list); + } + break; + case 106: /* reduce AAgrammar107Grammar */ + { + List<Object> list = new106(); + push(goTo(0), list); + } + break; + case 107: /* reduce AAgrammar108Grammar */ + { + List<Object> list = new107(); + push(goTo(0), list); + } + break; + case 108: /* reduce AAgrammar109Grammar */ + { + List<Object> list = new108(); + push(goTo(0), list); + } + break; + case 109: /* reduce AAgrammar110Grammar */ + { + List<Object> list = new109(); + push(goTo(0), list); + } + break; + case 110: /* reduce AAgrammar111Grammar */ + { + List<Object> list = new110(); + push(goTo(0), list); + } + break; + case 111: /* reduce AAgrammar112Grammar */ + { + List<Object> list = new111(); + push(goTo(0), list); + } + break; + case 112: /* reduce AAgrammar113Grammar */ + { + List<Object> list = new112(); + push(goTo(0), list); + } + break; + case 113: /* reduce AAgrammar114Grammar */ + { + List<Object> list = new113(); + push(goTo(0), list); + } + break; + case 114: /* reduce AAgrammar115Grammar */ + { + List<Object> list = new114(); + push(goTo(0), list); + } + break; + case 115: /* reduce AAgrammar116Grammar */ + { + List<Object> list = new115(); + push(goTo(0), list); + } + break; + case 116: /* reduce AAgrammar117Grammar */ + { + List<Object> list = new116(); + push(goTo(0), list); + } + break; + case 117: /* reduce AAgrammar118Grammar */ + { + List<Object> list = new117(); + push(goTo(0), list); + } + break; + case 118: /* reduce AAgrammar119Grammar */ + { + List<Object> list = new118(); + push(goTo(0), list); + } + break; + case 119: /* reduce AAgrammar120Grammar */ + { + List<Object> list = new119(); + push(goTo(0), list); + } + break; + case 120: /* reduce AAgrammar121Grammar */ + { + List<Object> list = new120(); + push(goTo(0), list); + } + break; + case 121: /* reduce AAgrammar122Grammar */ + { + List<Object> list = new121(); + push(goTo(0), list); + } + break; + case 122: /* reduce AAgrammar123Grammar */ + { + List<Object> list = new122(); + push(goTo(0), list); + } + break; + case 123: /* reduce AAgrammar124Grammar */ + { + List<Object> list = new123(); + push(goTo(0), list); + } + break; + case 124: /* reduce AAgrammar125Grammar */ + { + List<Object> list = new124(); + push(goTo(0), list); + } + break; + case 125: /* reduce AAgrammar126Grammar */ + { + List<Object> list = new125(); + push(goTo(0), list); + } + break; + case 126: /* reduce AAgrammar127Grammar */ + { + List<Object> list = new126(); + push(goTo(0), list); + } + break; + case 127: /* reduce AAgrammar128Grammar */ + { + List<Object> list = new127(); + push(goTo(0), list); + } + break; + case 128: /* reduce APackage */ + { + List<Object> list = new128(); + push(goTo(1), list); + } + break; + case 129: /* reduce AApkgname1PkgName */ + { + List<Object> list = new129(); + push(goTo(2), list); + } + break; + case 130: /* reduce AApkgname2PkgName */ + { + List<Object> list = new130(); + push(goTo(2), list); + } + break; + case 131: /* reduce APkgNameTail */ + { + List<Object> list = new131(); + push(goTo(3), list); + } + break; + case 132: /* reduce AHelpers */ + { + List<Object> list = new132(); + push(goTo(4), list); + } + break; + case 133: /* reduce AHelperDef */ + { + List<Object> list = new133(); + push(goTo(5), list); + } + break; + case 134: /* reduce AStates */ + { + List<Object> list = new134(); + push(goTo(6), list); + } + break; + case 135: /* reduce AAidlist1IdList */ + { + List<Object> list = new135(); + push(goTo(7), list); + } + break; + case 136: /* reduce AAidlist2IdList */ + { + List<Object> list = new136(); + push(goTo(7), list); + } + break; + case 137: /* reduce AIdListTail */ + { + List<Object> list = new137(); + push(goTo(8), list); + } + break; + case 138: /* reduce ATokens */ + { + List<Object> list = new138(); + push(goTo(9), list); + } + break; + case 139: /* reduce AAtokendef1TokenDef */ + { + List<Object> list = new139(); + push(goTo(10), list); + } + break; + case 140: /* reduce AAtokendef2TokenDef */ + { + List<Object> list = new140(); + push(goTo(10), list); + } + break; + case 141: /* reduce AAtokendef3TokenDef */ + { + List<Object> list = new141(); + push(goTo(10), list); + } + break; + case 142: /* reduce AAtokendef4TokenDef */ + { + List<Object> list = new142(); + push(goTo(10), list); + } + break; + case 143: /* reduce AAstatelist1StateList */ + { + List<Object> list = new143(); + push(goTo(11), list); + } + break; + case 144: /* reduce AAstatelist2StateList */ + { + List<Object> list = new144(); + push(goTo(11), list); + } + break; + case 145: /* reduce AAstatelist3StateList */ + { + List<Object> list = new145(); + push(goTo(11), list); + } + break; + case 146: /* reduce AAstatelist4StateList */ + { + List<Object> list = new146(); + push(goTo(11), list); + } + break; + case 147: /* reduce AAstatelisttail1StateListTail */ + { + List<Object> list = new147(); + push(goTo(12), list); + } + break; + case 148: /* reduce AAstatelisttail2StateListTail */ + { + List<Object> list = new148(); + push(goTo(12), list); + } + break; + case 149: /* reduce ATransition */ + { + List<Object> list = new149(); + push(goTo(13), list); + } + break; + case 150: /* reduce AAigntokens1IgnTokens */ + { + List<Object> list = new150(); + push(goTo(14), list); + } + break; + case 151: /* reduce AAigntokens2IgnTokens */ + { + List<Object> list = new151(); + push(goTo(14), list); + } + break; + case 152: /* reduce ALookAhead */ + { + List<Object> list = new152(); + push(goTo(15), list); + } + break; + case 153: /* reduce AAregexp1RegExp */ + { + List<Object> list = new153(); + push(goTo(16), list); + } + break; + case 154: /* reduce AAregexp2RegExp */ + { + List<Object> list = new154(); + push(goTo(16), list); + } + break; + case 155: /* reduce ARegExpTail */ + { + List<Object> list = new155(); + push(goTo(17), list); + } + break; + case 156: /* reduce AAconcat1Concat */ + { + List<Object> list = new156(); + push(goTo(18), list); + } + break; + case 157: /* reduce AAconcat2Concat */ + { + List<Object> list = new157(); + push(goTo(18), list); + } + break; + case 158: /* reduce AAunexp1UnExp */ + { + List<Object> list = new158(); + push(goTo(19), list); + } + break; + case 159: /* reduce AAunexp2UnExp */ + { + List<Object> list = new159(); + push(goTo(19), list); + } + break; + case 160: /* reduce ACharBasic */ + { + List<Object> list = new160(); + push(goTo(20), list); + } + break; + case 161: /* reduce ASetBasic */ + { + List<Object> list = new161(); + push(goTo(20), list); + } + break; + case 162: /* reduce AStringBasic */ + { + List<Object> list = new162(); + push(goTo(20), list); + } + break; + case 163: /* reduce AIdBasic */ + { + List<Object> list = new163(); + push(goTo(20), list); + } + break; + case 164: /* reduce ARegExpBasic */ + { + List<Object> list = new164(); + push(goTo(20), list); + } + break; + case 165: /* reduce ACharChar */ + { + List<Object> list = new165(); + push(goTo(21), list); + } + break; + case 166: /* reduce ADecChar */ + { + List<Object> list = new166(); + push(goTo(21), list); + } + break; + case 167: /* reduce AHexChar */ + { + List<Object> list = new167(); + push(goTo(21), list); + } + break; + case 168: /* reduce AOperationSet */ + { + List<Object> list = new168(); + push(goTo(22), list); + } + break; + case 169: /* reduce AIntervalSet */ + { + List<Object> list = new169(); + push(goTo(22), list); + } + break; + case 170: /* reduce AStarUnOp */ + { + List<Object> list = new170(); + push(goTo(23), list); + } + break; + case 171: /* reduce AQMarkUnOp */ + { + List<Object> list = new171(); + push(goTo(23), list); + } + break; + case 172: /* reduce APlusUnOp */ + { + List<Object> list = new172(); + push(goTo(23), list); + } + break; + case 173: /* reduce APlusBinOp */ + { + List<Object> list = new173(); + push(goTo(24), list); + } + break; + case 174: /* reduce AMinusBinOp */ + { + List<Object> list = new174(); + push(goTo(24), list); + } + break; + case 175: /* reduce AProductions */ + { + List<Object> list = new175(); + push(goTo(25), list); + } + break; + case 176: /* reduce AAprod1Prod */ + { + List<Object> list = new176(); + push(goTo(26), list); + } + break; + case 177: /* reduce AAprod2Prod */ + { + List<Object> list = new177(); + push(goTo(26), list); + } + break; + case 178: /* reduce AAprodtransform1ProdTransform */ + { + List<Object> list = new178(); + push(goTo(27), list); + } + break; + case 179: /* reduce AAprodtransform2ProdTransform */ + { + List<Object> list = new179(); + push(goTo(27), list); + } + break; + case 180: /* reduce AAalts1Alts */ + { + List<Object> list = new180(); + push(goTo(28), list); + } + break; + case 181: /* reduce AAalts2Alts */ + { + List<Object> list = new181(); + push(goTo(28), list); + } + break; + case 182: /* reduce AAltsTail */ + { + List<Object> list = new182(); + push(goTo(29), list); + } + break; + case 183: /* reduce AAalt1Alt */ + { + List<Object> list = new183(); + push(goTo(30), list); + } + break; + case 184: /* reduce AAalt2Alt */ + { + List<Object> list = new184(); + push(goTo(30), list); + } + break; + case 185: /* reduce AAalt3Alt */ + { + List<Object> list = new185(); + push(goTo(30), list); + } + break; + case 186: /* reduce AAalt4Alt */ + { + List<Object> list = new186(); + push(goTo(30), list); + } + break; + case 187: /* reduce AAalt5Alt */ + { + List<Object> list = new187(); + push(goTo(30), list); + } + break; + case 188: /* reduce AAalt6Alt */ + { + List<Object> list = new188(); + push(goTo(30), list); + } + break; + case 189: /* reduce AAalt7Alt */ + { + List<Object> list = new189(); + push(goTo(30), list); + } + break; + case 190: /* reduce AAalt8Alt */ + { + List<Object> list = new190(); + push(goTo(30), list); + } + break; + case 191: /* reduce AAalttransform1AltTransform */ + { + List<Object> list = new191(); + push(goTo(31), list); + } + break; + case 192: /* reduce AAalttransform2AltTransform */ + { + List<Object> list = new192(); + push(goTo(31), list); + } + break; + case 193: /* reduce AAnewterm1Term */ + { + List<Object> list = new193(); + push(goTo(32), list); + } + break; + case 194: /* reduce AAnewterm2Term */ + { + List<Object> list = new194(); + push(goTo(32), list); + } + break; + case 195: /* reduce AAlistterm1Term */ + { + List<Object> list = new195(); + push(goTo(32), list); + } + break; + case 196: /* reduce AAlistterm2Term */ + { + List<Object> list = new196(); + push(goTo(32), list); + } + break; + case 197: /* reduce AAsimpleterm1Term */ + { + List<Object> list = new197(); + push(goTo(32), list); + } + break; + case 198: /* reduce AAsimpleterm2Term */ + { + List<Object> list = new198(); + push(goTo(32), list); + } + break; + case 199: /* reduce AAsimpleterm3Term */ + { + List<Object> list = new199(); + push(goTo(32), list); + } + break; + case 200: /* reduce AAsimpleterm4Term */ + { + List<Object> list = new200(); + push(goTo(32), list); + } + break; + case 201: /* reduce ANullTerm */ + { + List<Object> list = new201(); + push(goTo(32), list); + } + break; + case 202: /* reduce AAlistoflistterm1ListOfListTerm */ + { + List<Object> list = new202(); + push(goTo(33), list); + } + break; + case 203: /* reduce AAlistoflistterm2ListOfListTerm */ + { + List<Object> list = new203(); + push(goTo(33), list); + } + break; + case 204: /* reduce AAnewlistterm1ListTerm */ + { + List<Object> list = new204(); + push(goTo(34), list); + } + break; + case 205: /* reduce AAnewlistterm2ListTerm */ + { + List<Object> list = new205(); + push(goTo(34), list); + } + break; + case 206: /* reduce AAsimplelistterm1ListTerm */ + { + List<Object> list = new206(); + push(goTo(34), list); + } + break; + case 207: /* reduce AAsimplelistterm2ListTerm */ + { + List<Object> list = new207(); + push(goTo(34), list); + } + break; + case 208: /* reduce AAsimplelistterm3ListTerm */ + { + List<Object> list = new208(); + push(goTo(34), list); + } + break; + case 209: /* reduce AAsimplelistterm4ListTerm */ + { + List<Object> list = new209(); + push(goTo(34), list); + } + break; + case 210: /* reduce AListTermTail */ + { + List<Object> list = new210(); + push(goTo(35), list); + } + break; + case 211: /* reduce ASimpleTermTail */ + { + List<Object> list = new211(); + push(goTo(36), list); + } + break; + case 212: /* reduce AAprodname1ProdName */ + { + List<Object> list = new212(); + push(goTo(37), list); + } + break; + case 213: /* reduce AAprodname2ProdName */ + { + List<Object> list = new213(); + push(goTo(37), list); + } + break; + case 214: /* reduce AProdNameTail */ + { + List<Object> list = new214(); + push(goTo(38), list); + } + break; + case 215: /* reduce AAparams1Params */ + { + List<Object> list = new215(); + push(goTo(39), list); + } + break; + case 216: /* reduce AAparams2Params */ + { + List<Object> list = new216(); + push(goTo(39), list); + } + break; + case 217: /* reduce AParamsTail */ + { + List<Object> list = new217(); + push(goTo(40), list); + } + break; + case 218: /* reduce AAltName */ + { + List<Object> list = new218(); + push(goTo(41), list); + } + break; + case 219: /* reduce AAelem1Elem */ + { + List<Object> list = new219(); + push(goTo(42), list); + } + break; + case 220: /* reduce AAelem2Elem */ + { + List<Object> list = new220(); + push(goTo(42), list); + } + break; + case 221: /* reduce AAelem3Elem */ + { + List<Object> list = new221(); + push(goTo(42), list); + } + break; + case 222: /* reduce AAelem4Elem */ + { + List<Object> list = new222(); + push(goTo(42), list); + } + break; + case 223: /* reduce AAelem5Elem */ + { + List<Object> list = new223(); + push(goTo(42), list); + } + break; + case 224: /* reduce AAelem6Elem */ + { + List<Object> list = new224(); + push(goTo(42), list); + } + break; + case 225: /* reduce AAelem7Elem */ + { + List<Object> list = new225(); + push(goTo(42), list); + } + break; + case 226: /* reduce AAelem8Elem */ + { + List<Object> list = new226(); + push(goTo(42), list); + } + break; + case 227: /* reduce AElemName */ + { + List<Object> list = new227(); + push(goTo(43), list); + } + break; + case 228: /* reduce ATokenSpecifier */ + { + List<Object> list = new228(); + push(goTo(44), list); + } + break; + case 229: /* reduce AProductionSpecifier */ + { + List<Object> list = new229(); + push(goTo(44), list); + } + break; + case 230: /* reduce AAst */ + { + List<Object> list = new230(); + push(goTo(45), list); + } + break; + case 231: /* reduce AAstProd */ + { + List<Object> list = new231(); + push(goTo(46), list); + } + break; + case 232: /* reduce AAastalts1AstAlts */ + { + List<Object> list = new232(); + push(goTo(47), list); + } + break; + case 233: /* reduce AAastalts2AstAlts */ + { + List<Object> list = new233(); + push(goTo(47), list); + } + break; + case 234: /* reduce AAstAltsTail */ + { + List<Object> list = new234(); + push(goTo(48), list); + } + break; + case 235: /* reduce AAastalt1AstAlt */ + { + List<Object> list = new235(); + push(goTo(49), list); + } + break; + case 236: /* reduce AAastalt2AstAlt */ + { + List<Object> list = new236(); + push(goTo(49), list); + } + break; + case 237: /* reduce AAastalt3AstAlt */ + { + List<Object> list = new237(); + push(goTo(49), list); + } + break; + case 238: /* reduce AAastalt4AstAlt */ + { + List<Object> list = new238(); + push(goTo(49), list); + } + break; + case 239: /* reduce ATerminal$PkgNameTail */ + { + List<Object> list = new239(); + push(goTo(50), list); + } + break; + case 240: /* reduce ANonTerminal$PkgNameTail */ + { + List<Object> list = new240(); + push(goTo(50), list); + } + break; + case 241: /* reduce ATerminal$HelperDef */ + { + List<Object> list = new241(); + push(goTo(51), list); + } + break; + case 242: /* reduce ANonTerminal$HelperDef */ + { + List<Object> list = new242(); + push(goTo(51), list); + } + break; + case 243: /* reduce ATerminal$IdListTail */ + { + List<Object> list = new243(); + push(goTo(52), list); + } + break; + case 244: /* reduce ANonTerminal$IdListTail */ + { + List<Object> list = new244(); + push(goTo(52), list); + } + break; + case 245: /* reduce ATerminal$TokenDef */ + { + List<Object> list = new245(); + push(goTo(53), list); + } + break; + case 246: /* reduce ANonTerminal$TokenDef */ + { + List<Object> list = new246(); + push(goTo(53), list); + } + break; + case 247: /* reduce ATerminal$StateListTail */ + { + List<Object> list = new247(); + push(goTo(54), list); + } + break; + case 248: /* reduce ANonTerminal$StateListTail */ + { + List<Object> list = new248(); + push(goTo(54), list); + } + break; + case 249: /* reduce ATerminal$RegExpTail */ + { + List<Object> list = new249(); + push(goTo(55), list); + } + break; + case 250: /* reduce ANonTerminal$RegExpTail */ + { + List<Object> list = new250(); + push(goTo(55), list); + } + break; + case 251: /* reduce ATerminal$UnExp */ + { + List<Object> list = new251(); + push(goTo(56), list); + } + break; + case 252: /* reduce ANonTerminal$UnExp */ + { + List<Object> list = new252(); + push(goTo(56), list); + } + break; + case 253: /* reduce ATerminal$Prod */ + { + List<Object> list = new253(); + push(goTo(57), list); + } + break; + case 254: /* reduce ANonTerminal$Prod */ + { + List<Object> list = new254(); + push(goTo(57), list); + } + break; + case 255: /* reduce ATerminal$Elem */ + { + List<Object> list = new255(); + push(goTo(58), list); + } + break; + case 256: /* reduce ANonTerminal$Elem */ + { + List<Object> list = new256(); + push(goTo(58), list); + } + break; + case 257: /* reduce ATerminal$AltsTail */ + { + List<Object> list = new257(); + push(goTo(59), list); + } + break; + case 258: /* reduce ANonTerminal$AltsTail */ + { + List<Object> list = new258(); + push(goTo(59), list); + } + break; + case 259: /* reduce ATerminal$Term */ + { + List<Object> list = new259(); + push(goTo(60), list); + } + break; + case 260: /* reduce ANonTerminal$Term */ + { + List<Object> list = new260(); + push(goTo(60), list); + } + break; + case 261: /* reduce ATerminal$ListTermTail */ + { + List<Object> list = new261(); + push(goTo(61), list); + } + break; + case 262: /* reduce ANonTerminal$ListTermTail */ + { + List<Object> list = new262(); + push(goTo(61), list); + } + break; + case 263: /* reduce ATerminal$ParamsTail */ + { + List<Object> list = new263(); + push(goTo(62), list); + } + break; + case 264: /* reduce ANonTerminal$ParamsTail */ + { + List<Object> list = new264(); + push(goTo(62), list); + } + break; + case 265: /* reduce ATerminal$AstProd */ + { + List<Object> list = new265(); + push(goTo(63), list); + } + break; + case 266: /* reduce ANonTerminal$AstProd */ + { + List<Object> list = new266(); + push(goTo(63), list); + } + break; + case 267: /* reduce ATerminal$AstAltsTail */ + { + List<Object> list = new267(); + push(goTo(64), list); + } + break; + case 268: /* reduce ANonTerminal$AstAltsTail */ + { + List<Object> list = new268(); + push(goTo(64), list); + } + break; + } + break; + case ACCEPT: + { + EOF node2 = (EOF) this.lexer.next(); + PGrammar node1 = (PGrammar) pop().get(0); + Start node = new Start(node1, node2); + return node; + } + case ERROR: + throw new ParserException(this.last_token, + "[" + this.last_line + "," + this.last_pos + "] " , + Parser.errorMessages[Parser.errors[this.action[1]]]); + } + } + } + + + + + private List<Object> new0() /* reduce AAgrammar1Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new4() /* reduce AAgrammar5Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new5() /* reduce AAgrammar6Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new6() /* reduce AAgrammar7Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new7() /* reduce AAgrammar8Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, null, null); + } + nodeList.add(pgrammarNode1); + return nodeList; + } + + + + private List<Object> new1() /* reduce AAgrammar2Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new8() /* reduce AAgrammar9Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new9() /* reduce AAgrammar10Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode3 = new LinkedList(); { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new10() /* reduce AAgrammar11Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new11() /* reduce AAgrammar12Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new12() /* reduce AAgrammar13Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new13() /* reduce AAgrammar14Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new2() /* reduce AAgrammar3Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new14() /* reduce AAgrammar15Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new15() /* reduce AAgrammar16Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new16() /* reduce AAgrammar17Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new17() /* reduce AAgrammar18Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new3() /* reduce AAgrammar4Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new18() /* reduce AAgrammar19Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new19() /* reduce AAgrammar20Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new20() /* reduce AAgrammar21Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new21() /* reduce AAgrammar22Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new22() /* reduce AAgrammar23Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new23() /* reduce AAgrammar24Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new4() /* reduce AAgrammar5Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new24() /* reduce AAgrammar25Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new25() /* reduce AAgrammar26Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new26() /* reduce AAgrammar27Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new27() /* reduce AAgrammar28Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new5() /* reduce AAgrammar6Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new28() /* reduce AAgrammar29Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new29() /* reduce AAgrammar30Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new30() /* reduce AAgrammar31Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new31() /* reduce AAgrammar32Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, null, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new32() /* reduce AAgrammar33Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - pproductionsNode7 = (PProductions)nodeArrayList1.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new33() /* reduce AAgrammar34Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new6() /* reduce AAgrammar7Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - pproductionsNode8 = (PProductions)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new34() /* reduce AAgrammar35Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new35() /* reduce AAgrammar36Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new36() /* reduce AAgrammar37Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new37() /* reduce AAgrammar38Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new7() /* reduce AAgrammar8Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new38() /* reduce AAgrammar39Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new39() /* reduce AAgrammar40Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new40() /* reduce AAgrammar41Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new41() /* reduce AAgrammar42Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new42() /* reduce AAgrammar43Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new43() /* reduce AAgrammar44Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new8() /* reduce AAgrammar9Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new44() /* reduce AAgrammar45Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new45() /* reduce AAgrammar46Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new46() /* reduce AAgrammar47Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new47() /* reduce AAgrammar48Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new9() /* reduce AAgrammar10Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new48() /* reduce AAgrammar49Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new49() /* reduce AAgrammar50Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; { - listNode3.addAll(listNode2); - } - } - pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new50() /* reduce AAgrammar51Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new51() /* reduce AAgrammar52Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new52() /* reduce AAgrammar53Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new53() /* reduce AAgrammar54Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new10() /* reduce AAgrammar11Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new54() /* reduce AAgrammar55Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new55() /* reduce AAgrammar56Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new56() /* reduce AAgrammar57Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new57() /* reduce AAgrammar58Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new11() /* reduce AAgrammar12Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new58() /* reduce AAgrammar59Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new59() /* reduce AAgrammar60Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new60() /* reduce AAgrammar61Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new61() /* reduce AAgrammar62Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new62() /* reduce AAgrammar63Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - Object nullNode8 = null; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode7 = (PProductions)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new63() /* reduce AAgrammar64Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - Object nullNode9 = null; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new12() /* reduce AAgrammar13Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); - pproductionsNode8 = (PProductions)nodeArrayList6.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, null); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new64() /* reduce AAgrammar65Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - pastNode8 = (PAst)nodeArrayList1.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new65() /* reduce AAgrammar66Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; { - listNode3.addAll(listNode2); - } - } - pastNode9 = (PAst)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new66() /* reduce AAgrammar67Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pastNode8 = (PAst)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new67() /* reduce AAgrammar68Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new13() /* reduce AAgrammar14Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pastNode9 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new68() /* reduce AAgrammar69Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - pastNode8 = (PAst)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new69() /* reduce AAgrammar70Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - pastNode9 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new70() /* reduce AAgrammar71Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new71() /* reduce AAgrammar72Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new72() /* reduce AAgrammar73Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - pastNode8 = (PAst)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new73() /* reduce AAgrammar74Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new14() /* reduce AAgrammar15Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - pastNode9 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new74() /* reduce AAgrammar75Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new75() /* reduce AAgrammar76Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new15() /* reduce AAgrammar16Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new76() /* reduce AAgrammar77Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new77() /* reduce AAgrammar78Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new78() /* reduce AAgrammar79Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new79() /* reduce AAgrammar80Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new16() /* reduce AAgrammar17Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PIgnTokens pigntokensNode6; + { + // Block + } + pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new17() /* reduce AAgrammar18Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new80() /* reduce AAgrammar81Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); - pastNode8 = (PAst)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new81() /* reduce AAgrammar82Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new18() /* reduce AAgrammar19Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PIgnTokens pigntokensNode6; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new19() /* reduce AAgrammar20Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new20() /* reduce AAgrammar21Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new21() /* reduce AAgrammar22Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new22() /* reduce AAgrammar23Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new23() /* reduce AAgrammar24Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new24() /* reduce AAgrammar25Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + { + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new25() /* reduce AAgrammar26Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new26() /* reduce AAgrammar27Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new27() /* reduce AAgrammar28Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new28() /* reduce AAgrammar29Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new29() /* reduce AAgrammar30Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new30() /* reduce AAgrammar31Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new31() /* reduce AAgrammar32Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, null, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new32() /* reduce AAgrammar33Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PProductions pproductionsNode7; + { + // Block + } + pproductionsNode7 = (PProductions)nodeArrayList1.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new33() /* reduce AAgrammar34Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pproductionsNode8 = (PProductions)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new34() /* reduce AAgrammar35Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new35() /* reduce AAgrammar36Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new36() /* reduce AAgrammar37Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PProductions pproductionsNode7; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new37() /* reduce AAgrammar38Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new38() /* reduce AAgrammar39Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new39() /* reduce AAgrammar40Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new40() /* reduce AAgrammar41Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; + PProductions pproductionsNode7; + { + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new41() /* reduce AAgrammar42Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new42() /* reduce AAgrammar43Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new43() /* reduce AAgrammar44Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new44() /* reduce AAgrammar45Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; + PProductions pproductionsNode7; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new45() /* reduce AAgrammar46Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new46() /* reduce AAgrammar47Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new47() /* reduce AAgrammar48Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new48() /* reduce AAgrammar49Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new49() /* reduce AAgrammar50Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new50() /* reduce AAgrammar51Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new51() /* reduce AAgrammar52Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new52() /* reduce AAgrammar53Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new53() /* reduce AAgrammar54Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new54() /* reduce AAgrammar55Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new55() /* reduce AAgrammar56Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new56() /* reduce AAgrammar57Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new57() /* reduce AAgrammar58Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new58() /* reduce AAgrammar59Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new59() /* reduce AAgrammar60Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new60() /* reduce AAgrammar61Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new61() /* reduce AAgrammar62Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new62() /* reduce AAgrammar63Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode7 = (PProductions)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new63() /* reduce AAgrammar64Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); + pproductionsNode8 = (PProductions)nodeArrayList6.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, null); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new64() /* reduce AAgrammar65Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PAst pastNode8; + { + // Block + } + pastNode8 = (PAst)nodeArrayList1.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new65() /* reduce AAgrammar66Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pastNode9 = (PAst)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new66() /* reduce AAgrammar67Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pastNode8 = (PAst)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new67() /* reduce AAgrammar68Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pastNode9 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new68() /* reduce AAgrammar69Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + pastNode8 = (PAst)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new69() /* reduce AAgrammar70Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + pastNode9 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new70() /* reduce AAgrammar71Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new71() /* reduce AAgrammar72Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new72() /* reduce AAgrammar73Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; + PAst pastNode8; + { + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + pastNode8 = (PAst)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new73() /* reduce AAgrammar74Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + pastNode9 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new74() /* reduce AAgrammar75Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new75() /* reduce AAgrammar76Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new76() /* reduce AAgrammar77Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new77() /* reduce AAgrammar78Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new78() /* reduce AAgrammar79Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new79() /* reduce AAgrammar80Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new80() /* reduce AAgrammar81Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); + pastNode8 = (PAst)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new81() /* reduce AAgrammar82Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); + pastNode9 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new82() /* reduce AAgrammar83Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new83() /* reduce AAgrammar84Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new84() /* reduce AAgrammar85Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new85() /* reduce AAgrammar86Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new86() /* reduce AAgrammar87Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new87() /* reduce AAgrammar88Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new88() /* reduce AAgrammar89Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new89() /* reduce AAgrammar90Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new90() /* reduce AAgrammar91Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new91() /* reduce AAgrammar92Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new92() /* reduce AAgrammar93Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new93() /* reduce AAgrammar94Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new94() /* reduce AAgrammar95Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); + pastNode8 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new95() /* reduce AAgrammar96Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); + pastNode9 = (PAst)nodeArrayList6.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, null, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new96() /* reduce AAgrammar97Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + pproductionsNode7 = (PProductions)nodeArrayList1.get(0); + pastNode8 = (PAst)nodeArrayList2.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new97() /* reduce AAgrammar98Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pproductionsNode8 = (PProductions)nodeArrayList2.get(0); + pastNode9 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new98() /* reduce AAgrammar99Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new99() /* reduce AAgrammar100Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new100() /* reduce AAgrammar101Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new101() /* reduce AAgrammar102Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new102() /* reduce AAgrammar103Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new103() /* reduce AAgrammar104Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new104() /* reduce AAgrammar105Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new105() /* reduce AAgrammar106Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new106() /* reduce AAgrammar107Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new107() /* reduce AAgrammar108Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new108() /* reduce AAgrammar109Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new109() /* reduce AAgrammar110Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new110() /* reduce AAgrammar111Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + pastNode8 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new111() /* reduce AAgrammar112Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + pastNode9 = (PAst)nodeArrayList6.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new112() /* reduce AAgrammar113Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); + pproductionsNode7 = (PProductions)nodeArrayList2.get(0); + pastNode8 = (PAst)nodeArrayList3.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new113() /* reduce AAgrammar114Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode8 = (PProductions)nodeArrayList3.get(0); + pastNode9 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new114() /* reduce AAgrammar115Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new115() /* reduce AAgrammar116Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new116() /* reduce AAgrammar117Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new117() /* reduce AAgrammar118Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new118() /* reduce AAgrammar119Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + pastNode8 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new119() /* reduce AAgrammar120Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + pastNode9 = (PAst)nodeArrayList6.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new120() /* reduce AAgrammar121Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + ptokensNode5 = (PTokens)nodeArrayList1.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); + pproductionsNode7 = (PProductions)nodeArrayList3.get(0); + pastNode8 = (PAst)nodeArrayList4.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new121() /* reduce AAgrammar122Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + ptokensNode6 = (PTokens)nodeArrayList2.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode8 = (PProductions)nodeArrayList4.get(0); + pastNode9 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new122() /* reduce AAgrammar123Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + pastNode8 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new123() /* reduce AAgrammar124Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + pastNode9 = (PAst)nodeArrayList6.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new124() /* reduce AAgrammar125Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + pstatesNode4 = (PStates)nodeArrayList1.get(0); + ptokensNode5 = (PTokens)nodeArrayList2.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); + pproductionsNode7 = (PProductions)nodeArrayList4.get(0); + pastNode8 = (PAst)nodeArrayList5.get(0); + + pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new125() /* reduce AAgrammar126Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + pstatesNode5 = (PStates)nodeArrayList2.get(0); + ptokensNode6 = (PTokens)nodeArrayList3.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode8 = (PProductions)nodeArrayList5.get(0); + pastNode9 = (PAst)nodeArrayList6.get(0); + + pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new126() /* reduce AAgrammar127Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + PHelpers phelpersNode3; + PStates pstatesNode4; + PTokens ptokensNode5; + PIgnTokens pigntokensNode6; + PProductions pproductionsNode7; + PAst pastNode8; + { + // Block + } + phelpersNode3 = (PHelpers)nodeArrayList1.get(0); + pstatesNode4 = (PStates)nodeArrayList2.get(0); + ptokensNode5 = (PTokens)nodeArrayList3.get(0); + pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); + pproductionsNode7 = (PProductions)nodeArrayList5.get(0); + pastNode8 = (PAst)nodeArrayList6.get(0); + + pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new127() /* reduce AAgrammar128Grammar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList7 = pop(); + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PGrammar pgrammarNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PHelpers phelpersNode4; + PStates pstatesNode5; + PTokens ptokensNode6; + PIgnTokens pigntokensNode7; + PProductions pproductionsNode8; + PAst pastNode9; + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + phelpersNode4 = (PHelpers)nodeArrayList2.get(0); + pstatesNode5 = (PStates)nodeArrayList3.get(0); + ptokensNode6 = (PTokens)nodeArrayList4.get(0); + pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); + pproductionsNode8 = (PProductions)nodeArrayList6.get(0); + pastNode9 = (PAst)nodeArrayList7.get(0); + + pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); + } + nodeList.add(pgrammarNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList7); + return nodeList; + } + + + + private List<Object> new128() /* reduce APackage */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + listNode1 = (LinkedList)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode2.isEmpty()){ + listNode2.addAll(listNode1); + }else{ + listNode2 = listNode1; + } + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new129() /* reduce AApkgname1PkgName */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + TPkgId tpkgidNode1; + tpkgidNode1 = (TPkgId)nodeArrayList1.get(0); + if(tpkgidNode1 != null) + { + listNode2.add(tpkgidNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new130() /* reduce AApkgname2PkgName */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + TPkgId tpkgidNode1; + LinkedList listNode2 = new LinkedList(); + tpkgidNode1 = (TPkgId)nodeArrayList1.get(0); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(tpkgidNode1 != null) + { + listNode3.add(tpkgidNode1); + } + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new131() /* reduce APkgNameTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TPkgId tpkgidNode1; + tpkgidNode1 = (TPkgId)nodeArrayList2.get(0); + nodeList.add(tpkgidNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new132() /* reduce AHelpers */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PHelpers phelpersNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + + phelpersNode1 = new AHelpers(listNode3); + } + nodeList.add(phelpersNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new133() /* reduce AHelperDef */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PHelperDef phelperdefNode1; + { + // Block + TId tidNode2; + PRegExp pregexpNode3; + tidNode2 = (TId)nodeArrayList1.get(0); + pregexpNode3 = (PRegExp)nodeArrayList3.get(0); + + phelperdefNode1 = new AHelperDef(tidNode2, pregexpNode3); + } + nodeList.add(phelperdefNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new134() /* reduce AStates */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PStates pstatesNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + + pstatesNode1 = new AStates(listNode3); + } + nodeList.add(pstatesNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new135() /* reduce AAidlist1IdList */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + TId tidNode1; + tidNode1 = (TId)nodeArrayList1.get(0); + if(tidNode1 != null) + { + listNode2.add(tidNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new136() /* reduce AAidlist2IdList */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + TId tidNode1; + LinkedList listNode2 = new LinkedList(); + tidNode1 = (TId)nodeArrayList1.get(0); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(tidNode1 != null) + { + listNode3.add(tidNode1); + } + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new137() /* reduce AIdListTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TId tidNode1; + tidNode1 = (TId)nodeArrayList2.get(0); + nodeList.add(tidNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new138() /* reduce ATokens */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTokens ptokensNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + + ptokensNode1 = new ATokens(listNode3); + } + nodeList.add(ptokensNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new139() /* reduce AAtokendef1TokenDef */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTokenDef ptokendefNode1; + { + // Block + TId tidNode3; + PRegExp pregexpNode4; + tidNode3 = (TId)nodeArrayList1.get(0); + pregexpNode4 = (PRegExp)nodeArrayList3.get(0); + + ptokendefNode1 = new ATokenDef(null, tidNode3, pregexpNode4, null, null); + } + nodeList.add(ptokendefNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new140() /* reduce AAtokendef2TokenDef */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTokenDef ptokendefNode1; + { + // Block + PStateList pstatelistNode2; + TId tidNode3; + PRegExp pregexpNode4; + pstatelistNode2 = (PStateList)nodeArrayList1.get(0); + tidNode3 = (TId)nodeArrayList2.get(0); + pregexpNode4 = (PRegExp)nodeArrayList4.get(0); + + ptokendefNode1 = new ATokenDef(pstatelistNode2, tidNode3, pregexpNode4, null, null); + } + nodeList.add(ptokendefNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new141() /* reduce AAtokendef3TokenDef */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTokenDef ptokendefNode1; + { + // Block + TId tidNode3; + PRegExp pregexpNode4; + TSlash tslashNode5; + PRegExp pregexpNode6; + tidNode3 = (TId)nodeArrayList1.get(0); + pregexpNode4 = (PRegExp)nodeArrayList3.get(0); + tslashNode5 = (TSlash)nodeArrayList4.get(0); + pregexpNode6 = (PRegExp)nodeArrayList4.get(1); + + ptokendefNode1 = new ATokenDef(null, tidNode3, pregexpNode4, tslashNode5, pregexpNode6); + } + nodeList.add(ptokendefNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new142() /* reduce AAtokendef4TokenDef */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList6 = pop(); + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTokenDef ptokendefNode1; + { + // Block + PStateList pstatelistNode2; + TId tidNode3; + PRegExp pregexpNode4; + TSlash tslashNode5; + PRegExp pregexpNode6; + pstatelistNode2 = (PStateList)nodeArrayList1.get(0); + tidNode3 = (TId)nodeArrayList2.get(0); + pregexpNode4 = (PRegExp)nodeArrayList4.get(0); + tslashNode5 = (TSlash)nodeArrayList5.get(0); + pregexpNode6 = (PRegExp)nodeArrayList5.get(1); + + ptokendefNode1 = new ATokenDef(pstatelistNode2, tidNode3, pregexpNode4, tslashNode5, pregexpNode6); + } + nodeList.add(ptokendefNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList6); + return nodeList; + } + + + + private List<Object> new143() /* reduce AAstatelist1StateList */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PStateList pstatelistNode1; + { + // Block + TId tidNode2; + LinkedList listNode4 = new LinkedList(); + tidNode2 = (TId)nodeArrayList2.get(0); + { + // Block + } + + pstatelistNode1 = new AStateList(tidNode2, null, listNode4); + } + nodeList.add(pstatelistNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new144() /* reduce AAstatelist2StateList */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PStateList pstatelistNode1; + { + // Block + TId tidNode2; + PTransition ptransitionNode3; + LinkedList listNode4 = new LinkedList(); + tidNode2 = (TId)nodeArrayList2.get(0); + ptransitionNode3 = (PTransition)nodeArrayList3.get(0); + { + // Block + } + + pstatelistNode1 = new AStateList(tidNode2, ptransitionNode3, listNode4); + } + nodeList.add(pstatelistNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new145() /* reduce AAstatelist3StateList */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PStateList pstatelistNode1; + { + // Block + TId tidNode2; + LinkedList listNode5 = new LinkedList(); + tidNode2 = (TId)nodeArrayList2.get(0); + { + // Block + LinkedList listNode4 = new LinkedList(); + listNode4 = (LinkedList)nodeArrayList3.get(0); + if(listNode4 != null) + { + if(!listNode5.isEmpty()){ + listNode5.addAll(listNode4); + }else{ + listNode5 = listNode4; + } + } + } + + pstatelistNode1 = new AStateList(tidNode2, null, listNode5); + } + nodeList.add(pstatelistNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new146() /* reduce AAstatelist4StateList */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PStateList pstatelistNode1; + { + // Block + TId tidNode2; + PTransition ptransitionNode3; + LinkedList listNode5 = new LinkedList(); + tidNode2 = (TId)nodeArrayList2.get(0); + ptransitionNode3 = (PTransition)nodeArrayList3.get(0); + { + // Block + LinkedList listNode4 = new LinkedList(); + listNode4 = (LinkedList)nodeArrayList4.get(0); + if(listNode4 != null) + { + if(!listNode5.isEmpty()){ + listNode5.addAll(listNode4); + }else{ + listNode5 = listNode4; + } + } + } + + pstatelistNode1 = new AStateList(tidNode2, ptransitionNode3, listNode5); + } + nodeList.add(pstatelistNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new147() /* reduce AAstatelisttail1StateListTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PStateListTail pstatelisttailNode1; + { + // Block + TId tidNode2; + tidNode2 = (TId)nodeArrayList2.get(0); + + pstatelisttailNode1 = new AStateListTail(tidNode2, null); + } + nodeList.add(pstatelisttailNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new148() /* reduce AAstatelisttail2StateListTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PStateListTail pstatelisttailNode1; + { + // Block + TId tidNode2; + PTransition ptransitionNode3; + tidNode2 = (TId)nodeArrayList2.get(0); + ptransitionNode3 = (PTransition)nodeArrayList3.get(0); + + pstatelisttailNode1 = new AStateListTail(tidNode2, ptransitionNode3); + } + nodeList.add(pstatelisttailNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new149() /* reduce ATransition */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTransition ptransitionNode1; + { + // Block + TId tidNode2; + tidNode2 = (TId)nodeArrayList2.get(0); + + ptransitionNode1 = new ATransition(tidNode2); + } + nodeList.add(ptransitionNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new150() /* reduce AAigntokens1IgnTokens */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PIgnTokens pigntokensNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + { + // Block + } + + pigntokensNode1 = new AIgnTokens(listNode2); + } + nodeList.add(pigntokensNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new151() /* reduce AAigntokens2IgnTokens */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PIgnTokens pigntokensNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList3.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + + pigntokensNode1 = new AIgnTokens(listNode3); + } + nodeList.add(pigntokensNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new152() /* reduce ALookAhead */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TSlash tslashNode1; + PRegExp pregexpNode2; + tslashNode1 = (TSlash)nodeArrayList1.get(0); + pregexpNode2 = (PRegExp)nodeArrayList2.get(0); + nodeList.add(tslashNode1); + nodeList.add(pregexpNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new153() /* reduce AAregexp1RegExp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PRegExp pregexpNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + PConcat pconcatNode2; + pconcatNode2 = (PConcat)nodeArrayList1.get(0); + if(pconcatNode2 != null) + { + listNode3.add(pconcatNode2); + } + } + + pregexpNode1 = new ARegExp(listNode3); + } + nodeList.add(pregexpNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new154() /* reduce AAregexp2RegExp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PRegExp pregexpNode1; + { + // Block + LinkedList listNode4 = new LinkedList(); + { + // Block + PConcat pconcatNode2; + LinkedList listNode3 = new LinkedList(); + pconcatNode2 = (PConcat)nodeArrayList1.get(0); + listNode3 = (LinkedList)nodeArrayList2.get(0); + if(pconcatNode2 != null) + { + listNode4.add(pconcatNode2); + } + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } + + pregexpNode1 = new ARegExp(listNode4); + } + nodeList.add(pregexpNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new155() /* reduce ARegExpTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PConcat pconcatNode1; + pconcatNode1 = (PConcat)nodeArrayList2.get(0); + nodeList.add(pconcatNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new156() /* reduce AAconcat1Concat */ + { + List<Object> nodeList = new ArrayList<>(); + + PConcat pconcatNode1; + { + // Block + LinkedList listNode2 = new LinkedList(); + { + // Block + } + + pconcatNode1 = new AConcat(listNode2); + } + nodeList.add(pconcatNode1); + return nodeList; + } + + + + private List<Object> new157() /* reduce AAconcat2Concat */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PConcat pconcatNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList1.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + + pconcatNode1 = new AConcat(listNode3); + } + nodeList.add(pconcatNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new158() /* reduce AAunexp1UnExp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PUnExp punexpNode1; + { + // Block + PBasic pbasicNode2; + pbasicNode2 = (PBasic)nodeArrayList1.get(0); + + punexpNode1 = new AUnExp(pbasicNode2, null); + } + nodeList.add(punexpNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new159() /* reduce AAunexp2UnExp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PUnExp punexpNode1; + { + // Block + PBasic pbasicNode2; + PUnOp punopNode3; + pbasicNode2 = (PBasic)nodeArrayList1.get(0); + punopNode3 = (PUnOp)nodeArrayList2.get(0); + + punexpNode1 = new AUnExp(pbasicNode2, punopNode3); + } + nodeList.add(punexpNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new160() /* reduce ACharBasic */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PBasic pbasicNode1; + { + // Block + PChar pcharNode2; + pcharNode2 = (PChar)nodeArrayList1.get(0); + + pbasicNode1 = new ACharBasic(pcharNode2); + } + nodeList.add(pbasicNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new161() /* reduce ASetBasic */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PBasic pbasicNode1; + { + // Block + PSet psetNode2; + psetNode2 = (PSet)nodeArrayList1.get(0); + + pbasicNode1 = new ASetBasic(psetNode2); + } + nodeList.add(pbasicNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new162() /* reduce AStringBasic */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PBasic pbasicNode1; + { + // Block + TString tstringNode2; + tstringNode2 = (TString)nodeArrayList1.get(0); + + pbasicNode1 = new AStringBasic(tstringNode2); + } + nodeList.add(pbasicNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new163() /* reduce AIdBasic */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PBasic pbasicNode1; + { + // Block + TId tidNode2; + tidNode2 = (TId)nodeArrayList1.get(0); + + pbasicNode1 = new AIdBasic(tidNode2); + } + nodeList.add(pbasicNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new164() /* reduce ARegExpBasic */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PBasic pbasicNode1; + { + // Block + PRegExp pregexpNode2; + pregexpNode2 = (PRegExp)nodeArrayList2.get(0); + + pbasicNode1 = new ARegExpBasic(pregexpNode2); + } + nodeList.add(pbasicNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new165() /* reduce ACharChar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PChar pcharNode1; + { + // Block + TChar tcharNode2; + tcharNode2 = (TChar)nodeArrayList1.get(0); + + pcharNode1 = new ACharChar(tcharNode2); + } + nodeList.add(pcharNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new166() /* reduce ADecChar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PChar pcharNode1; + { + // Block + TDecChar tdeccharNode2; + tdeccharNode2 = (TDecChar)nodeArrayList1.get(0); + + pcharNode1 = new ADecChar(tdeccharNode2); + } + nodeList.add(pcharNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new167() /* reduce AHexChar */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PChar pcharNode1; + { + // Block + THexChar thexcharNode2; + thexcharNode2 = (THexChar)nodeArrayList1.get(0); + + pcharNode1 = new AHexChar(thexcharNode2); + } + nodeList.add(pcharNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new168() /* reduce AOperationSet */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PSet psetNode1; + { + // Block + PBasic pbasicNode2; + PBinOp pbinopNode3; + PBasic pbasicNode4; + pbasicNode2 = (PBasic)nodeArrayList2.get(0); + pbinopNode3 = (PBinOp)nodeArrayList3.get(0); + pbasicNode4 = (PBasic)nodeArrayList4.get(0); + + psetNode1 = new AOperationSet(pbasicNode2, pbinopNode3, pbasicNode4); + } + nodeList.add(psetNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new169() /* reduce AIntervalSet */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PSet psetNode1; + { + // Block + PChar pcharNode2; + PChar pcharNode3; + pcharNode2 = (PChar)nodeArrayList2.get(0); + pcharNode3 = (PChar)nodeArrayList4.get(0); + + psetNode1 = new AIntervalSet(pcharNode2, pcharNode3); + } + nodeList.add(psetNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new170() /* reduce AStarUnOp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PUnOp punopNode1; + { + // Block + TStar tstarNode2; + tstarNode2 = (TStar)nodeArrayList1.get(0); + + punopNode1 = new AStarUnOp(tstarNode2); + } + nodeList.add(punopNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new171() /* reduce AQMarkUnOp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PUnOp punopNode1; + { + // Block + TQMark tqmarkNode2; + tqmarkNode2 = (TQMark)nodeArrayList1.get(0); + + punopNode1 = new AQMarkUnOp(tqmarkNode2); + } + nodeList.add(punopNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new172() /* reduce APlusUnOp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PUnOp punopNode1; + { + // Block + TPlus tplusNode2; + tplusNode2 = (TPlus)nodeArrayList1.get(0); + + punopNode1 = new APlusUnOp(tplusNode2); + } + nodeList.add(punopNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new173() /* reduce APlusBinOp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PBinOp pbinopNode1; + { + // Block + + pbinopNode1 = new APlusBinOp(); + } + nodeList.add(pbinopNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new174() /* reduce AMinusBinOp */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PBinOp pbinopNode1; + { + // Block + + pbinopNode1 = new AMinusBinOp(); + } + nodeList.add(pbinopNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new175() /* reduce AProductions */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PProductions pproductionsNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + + pproductionsNode1 = new AProductions(listNode3); + } + nodeList.add(pproductionsNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new176() /* reduce AAprod1Prod */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PProd pprodNode1; + { + // Block + TId tidNode2; + LinkedList listNode4 = new LinkedList(); + LinkedList listNode6 = new LinkedList(); + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + } + { + // Block + LinkedList listNode5 = new LinkedList(); + listNode5 = (LinkedList)nodeArrayList3.get(0); + if(listNode5 != null) + { + if(!listNode6.isEmpty()){ + listNode6.addAll(listNode5); + }else{ + listNode6 = listNode5; + } + } + } + + pprodNode1 = new AProd(tidNode2, null, listNode4, listNode6); + } + nodeList.add(pprodNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new177() /* reduce AAprod2Prod */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PProd pprodNode1; + { + // Block + TId tidNode2; + TArrow tarrowNode3; + LinkedList listNode5 = new LinkedList(); + LinkedList listNode7 = new LinkedList(); + tidNode2 = (TId)nodeArrayList1.get(0); + tarrowNode3 = (TArrow)nodeArrayList2.get(0); + { + // Block + LinkedList listNode4 = new LinkedList(); + listNode4 = (LinkedList)nodeArrayList2.get(1); + if(listNode4 != null) + { + if(!listNode5.isEmpty()){ + listNode5.addAll(listNode4); + }else{ + listNode5 = listNode4; + } + } + } + { + // Block + LinkedList listNode6 = new LinkedList(); + listNode6 = (LinkedList)nodeArrayList4.get(0); + if(listNode6 != null) + { + if(!listNode7.isEmpty()){ + listNode7.addAll(listNode6); + }else{ + listNode7 = listNode6; + } + } + } + + pprodNode1 = new AProd(tidNode2, tarrowNode3, listNode5, listNode7); + } + nodeList.add(pprodNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new178() /* reduce AAprodtransform1ProdTransform */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TArrow tarrowNode1; + LinkedList listNode2 = new LinkedList(); + tarrowNode1 = (TArrow)nodeArrayList2.get(0); + { + // Block + } + nodeList.add(tarrowNode1); + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new179() /* reduce AAprodtransform2ProdTransform */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TArrow tarrowNode1; + LinkedList listNode3 = new LinkedList(); + tarrowNode1 = (TArrow)nodeArrayList2.get(0); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList3.get(0); + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + nodeList.add(tarrowNode1); + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new180() /* reduce AAalts1Alts */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PAlt paltNode1; + paltNode1 = (PAlt)nodeArrayList1.get(0); + if(paltNode1 != null) + { + listNode2.add(paltNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new181() /* reduce AAalts2Alts */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + PAlt paltNode1; + LinkedList listNode2 = new LinkedList(); + paltNode1 = (PAlt)nodeArrayList1.get(0); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(paltNode1 != null) + { + listNode3.add(paltNode1); + } + if(listNode2 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new182() /* reduce AAltsTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + paltNode1 = (PAlt)nodeArrayList2.get(0); + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new183() /* reduce AAalt1Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + PAlt paltNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + } + + paltNode1 = new AAlt(null, listNode3, null); + } + nodeList.add(paltNode1); + return nodeList; + } + + + + private List<Object> new184() /* reduce AAalt2Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + { + // Block + TId tidNode2; + LinkedList listNode3 = new LinkedList(); + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + } + + paltNode1 = new AAlt(tidNode2, listNode3, null); + } + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new185() /* reduce AAalt3Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + { + // Block + LinkedList listNode4 = new LinkedList(); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList1.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } + + paltNode1 = new AAlt(null, listNode4, null); + } + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new186() /* reduce AAalt4Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + { + // Block + TId tidNode2; + LinkedList listNode4 = new LinkedList(); + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList2.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } + + paltNode1 = new AAlt(tidNode2, listNode4, null); + } + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new187() /* reduce AAalt5Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + PAltTransform palttransformNode4; + { + // Block + } + palttransformNode4 = (PAltTransform)nodeArrayList1.get(0); + + paltNode1 = new AAlt(null, listNode3, palttransformNode4); + } + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new188() /* reduce AAalt6Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + { + // Block + TId tidNode2; + LinkedList listNode3 = new LinkedList(); + PAltTransform palttransformNode4; + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + } + palttransformNode4 = (PAltTransform)nodeArrayList2.get(0); + + paltNode1 = new AAlt(tidNode2, listNode3, palttransformNode4); + } + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new189() /* reduce AAalt7Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + { + // Block + LinkedList listNode4 = new LinkedList(); + PAltTransform palttransformNode5; + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList1.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } + palttransformNode5 = (PAltTransform)nodeArrayList2.get(0); + + paltNode1 = new AAlt(null, listNode4, palttransformNode5); + } + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new190() /* reduce AAalt8Alt */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAlt paltNode1; + { + // Block + TId tidNode2; + LinkedList listNode4 = new LinkedList(); + PAltTransform palttransformNode5; + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList2.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } + palttransformNode5 = (PAltTransform)nodeArrayList3.get(0); + + paltNode1 = new AAlt(tidNode2, listNode4, palttransformNode5); + } + nodeList.add(paltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new191() /* reduce AAalttransform1AltTransform */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAltTransform palttransformNode1; + { + // Block + TLBrace tlbraceNode2; + LinkedList listNode3 = new LinkedList(); + TRBrace trbraceNode4; + tlbraceNode2 = (TLBrace)nodeArrayList1.get(0); + { + // Block + } + trbraceNode4 = (TRBrace)nodeArrayList3.get(0); + + palttransformNode1 = new AAltTransform(tlbraceNode2, listNode3, trbraceNode4); + } + nodeList.add(palttransformNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new192() /* reduce AAalttransform2AltTransform */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAltTransform palttransformNode1; + { + // Block + TLBrace tlbraceNode2; + LinkedList listNode4 = new LinkedList(); + TRBrace trbraceNode5; + tlbraceNode2 = (TLBrace)nodeArrayList1.get(0); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList3.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } + trbraceNode5 = (TRBrace)nodeArrayList4.get(0); + + palttransformNode1 = new AAltTransform(tlbraceNode2, listNode4, trbraceNode5); + } + nodeList.add(palttransformNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new193() /* reduce AAnewterm1Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; + { + // Block + PProdName pprodnameNode2; + TLPar tlparNode3; + LinkedList listNode4 = new LinkedList(); + pprodnameNode2 = (PProdName)nodeArrayList2.get(0); + tlparNode3 = (TLPar)nodeArrayList3.get(0); + { + // Block + } + + ptermNode1 = new ANewTerm(pprodnameNode2, tlparNode3, listNode4); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new194() /* reduce AAnewterm2Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; + { + // Block + PProdName pprodnameNode2; + TLPar tlparNode3; + LinkedList listNode5 = new LinkedList(); + pprodnameNode2 = (PProdName)nodeArrayList2.get(0); + tlparNode3 = (TLPar)nodeArrayList3.get(0); + { + // Block + LinkedList listNode4 = new LinkedList(); + listNode4 = (LinkedList)nodeArrayList4.get(0); + if(listNode4 != null) + { + if(!listNode5.isEmpty()){ + listNode5.addAll(listNode4); + }else{ + listNode5 = listNode4; + } + } + } + + ptermNode1 = new ANewTerm(pprodnameNode2, tlparNode3, listNode5); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new195() /* reduce AAlistterm1Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; + { + // Block + TLBkt tlbktNode2; + LinkedList listNode3 = new LinkedList(); + tlbktNode2 = (TLBkt)nodeArrayList1.get(0); + { + // Block + } + + ptermNode1 = new AListTerm(tlbktNode2, listNode3); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new196() /* reduce AAlistterm2Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; + { + // Block + TLBkt tlbktNode2; + LinkedList listNode4 = new LinkedList(); + tlbktNode2 = (TLBkt)nodeArrayList1.get(0); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList2.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } + + ptermNode1 = new AListTerm(tlbktNode2, listNode4); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new197() /* reduce AAsimpleterm1Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; + { + // Block + TId tidNode3; + tidNode3 = (TId)nodeArrayList1.get(0); + + ptermNode1 = new ASimpleTerm(null, tidNode3, null); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new198() /* reduce AAsimpleterm2Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; { - listNode3.addAll(listNode2); - } - } - pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); - pastNode9 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new82() /* reduce AAgrammar83Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new83() /* reduce AAgrammar84Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PSpecifier pspecifierNode2; + TId tidNode3; + pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); + tidNode3 = (TId)nodeArrayList2.get(0); + + ptermNode1 = new ASimpleTerm(pspecifierNode2, tidNode3, null); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new199() /* reduce AAsimpleterm3Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new84() /* reduce AAgrammar85Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new85() /* reduce AAgrammar86Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + TId tidNode3; + TId tidNode4; + tidNode3 = (TId)nodeArrayList1.get(0); + tidNode4 = (TId)nodeArrayList2.get(0); + + ptermNode1 = new ASimpleTerm(null, tidNode3, tidNode4); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new200() /* reduce AAsimpleterm4Term */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new86() /* reduce AAgrammar87Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new87() /* reduce AAgrammar88Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PSpecifier pspecifierNode2; + TId tidNode3; + TId tidNode4; + pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); + tidNode3 = (TId)nodeArrayList2.get(0); + tidNode4 = (TId)nodeArrayList3.get(0); + + ptermNode1 = new ASimpleTerm(pspecifierNode2, tidNode3, tidNode4); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new201() /* reduce ANullTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new88() /* reduce AAgrammar89Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new89() /* reduce AAgrammar90Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + + ptermNode1 = new ANullTerm(); + } + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new202() /* reduce AAlistoflistterm1ListOfListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new90() /* reduce AAgrammar91Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new91() /* reduce AAgrammar92Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PListTerm plisttermNode1; + plisttermNode1 = (PListTerm)nodeArrayList1.get(0); + if(plisttermNode1 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new92() /* reduce AAgrammar93Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new93() /* reduce AAgrammar94Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + listNode2.add(plisttermNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new203() /* reduce AAlistoflistterm2ListOfListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new94() /* reduce AAgrammar95Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - Object nullNode7 = null; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); - pastNode8 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, null, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new95() /* reduce AAgrammar96Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - Object nullNode8 = null; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PListTerm plisttermNode1; + LinkedList listNode2 = new LinkedList(); + plisttermNode1 = (PListTerm)nodeArrayList1.get(0); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(plisttermNode1 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); - pastNode9 = (PAst)nodeArrayList6.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, null, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new96() /* reduce AAgrammar97Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - pproductionsNode7 = (PProductions)nodeArrayList1.get(0); - pastNode8 = (PAst)nodeArrayList2.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new97() /* reduce AAgrammar98Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + listNode3.add(plisttermNode1); + } if(listNode2 != null) { - listNode3.addAll(listNode2); - } - } - pproductionsNode8 = (PProductions)nodeArrayList2.get(0); - pastNode9 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new98() /* reduce AAgrammar99Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new99() /* reduce AAgrammar100Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new204() /* reduce AAnewlistterm1ListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PListTerm plisttermNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new100() /* reduce AAgrammar101Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new101() /* reduce AAgrammar102Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PProdName pprodnameNode2; + TLPar tlparNode3; + LinkedList listNode4 = new LinkedList(); + pprodnameNode2 = (PProdName)nodeArrayList2.get(0); + tlparNode3 = (TLPar)nodeArrayList3.get(0); { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new102() /* reduce AAgrammar103Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new103() /* reduce AAgrammar104Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + } + + plisttermNode1 = new ANewListTerm(pprodnameNode2, tlparNode3, listNode4); + } + nodeList.add(plisttermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; + } + + + + private List<Object> new205() /* reduce AAnewlistterm2ListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList5 = pop(); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PListTerm plisttermNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new104() /* reduce AAgrammar105Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new105() /* reduce AAgrammar106Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PProdName pprodnameNode2; + TLPar tlparNode3; + LinkedList listNode5 = new LinkedList(); + pprodnameNode2 = (PProdName)nodeArrayList2.get(0); + tlparNode3 = (TLPar)nodeArrayList3.get(0); { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new106() /* reduce AAgrammar107Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new107() /* reduce AAgrammar108Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + LinkedList listNode4 = new LinkedList(); + listNode4 = (LinkedList)nodeArrayList4.get(0); + if(listNode4 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new108() /* reduce AAgrammar109Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new109() /* reduce AAgrammar110Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + if(!listNode5.isEmpty()){ + listNode5.addAll(listNode4); + }else{ + listNode5 = listNode4; + } + } + } + + plisttermNode1 = new ANewListTerm(pprodnameNode2, tlparNode3, listNode5); + } + nodeList.add(plisttermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList5); + return nodeList; + } + + + + private List<Object> new206() /* reduce AAsimplelistterm1ListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PListTerm plisttermNode1; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new110() /* reduce AAgrammar111Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - Object nullNode6 = null; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - pastNode8 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, null, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new111() /* reduce AAgrammar112Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - Object nullNode7 = null; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + TId tidNode3; + tidNode3 = (TId)nodeArrayList1.get(0); + + plisttermNode1 = new ASimpleListTerm(null, tidNode3, null); + } + nodeList.add(plisttermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new207() /* reduce AAsimplelistterm2ListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PListTerm plisttermNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - pastNode9 = (PAst)nodeArrayList6.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, null, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new112() /* reduce AAgrammar113Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - pigntokensNode6 = (PIgnTokens)nodeArrayList1.get(0); - pproductionsNode7 = (PProductions)nodeArrayList2.get(0); - pastNode8 = (PAst)nodeArrayList3.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, null, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new113() /* reduce AAgrammar114Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PSpecifier pspecifierNode2; + TId tidNode3; + pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); + tidNode3 = (TId)nodeArrayList2.get(0); + + plisttermNode1 = new ASimpleListTerm(pspecifierNode2, tidNode3, null); + } + nodeList.add(plisttermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new208() /* reduce AAsimplelistterm3ListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PListTerm plisttermNode1; { - listNode3.addAll(listNode2); - } - } - pigntokensNode7 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode8 = (PProductions)nodeArrayList3.get(0); - pastNode9 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, null, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new114() /* reduce AAgrammar115Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, null, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new115() /* reduce AAgrammar116Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + TId tidNode3; + TId tidNode4; + tidNode3 = (TId)nodeArrayList1.get(0); + tidNode4 = (TId)nodeArrayList2.get(0); + + plisttermNode1 = new ASimpleListTerm(null, tidNode3, tidNode4); + } + nodeList.add(plisttermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new209() /* reduce AAsimplelistterm4ListTerm */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PListTerm plisttermNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, null, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new116() /* reduce AAgrammar117Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new117() /* reduce AAgrammar118Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PSpecifier pspecifierNode2; + TId tidNode3; + TId tidNode4; + pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); + tidNode3 = (TId)nodeArrayList2.get(0); + tidNode4 = (TId)nodeArrayList3.get(0); + + plisttermNode1 = new ASimpleListTerm(pspecifierNode2, tidNode3, tidNode4); + } + nodeList.add(plisttermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + + + + private List<Object> new210() /* reduce AListTermTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PListTerm plisttermNode1; + plisttermNode1 = (PListTerm)nodeArrayList2.get(0); + nodeList.add(plisttermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new211() /* reduce ASimpleTermTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TId tidNode1; + tidNode1 = (TId)nodeArrayList2.get(0); + nodeList.add(tidNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new212() /* reduce AAprodname1ProdName */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PProdName pprodnameNode1; { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, null, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new118() /* reduce AAgrammar119Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - Object nullNode5 = null; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - pastNode8 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, null, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new119() /* reduce AAgrammar120Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - Object nullNode6 = null; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + TId tidNode2; + tidNode2 = (TId)nodeArrayList1.get(0); + + pprodnameNode1 = new AProdName(tidNode2, null); + } + nodeList.add(pprodnameNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new213() /* reduce AAprodname2ProdName */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PProdName pprodnameNode1; { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - pastNode9 = (PAst)nodeArrayList6.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, null, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new120() /* reduce AAgrammar121Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - ptokensNode5 = (PTokens)nodeArrayList1.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList2.get(0); - pproductionsNode7 = (PProductions)nodeArrayList3.get(0); - pastNode8 = (PAst)nodeArrayList4.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new121() /* reduce AAgrammar122Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + TId tidNode2; + TId tidNode3; + tidNode2 = (TId)nodeArrayList1.get(0); + tidNode3 = (TId)nodeArrayList2.get(0); + + pprodnameNode1 = new AProdName(tidNode2, tidNode3); + } + nodeList.add(pprodnameNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new214() /* reduce AProdNameTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TId tidNode1; + tidNode1 = (TId)nodeArrayList2.get(0); + nodeList.add(tidNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new215() /* reduce AAparams1Params */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); { - listNode3.addAll(listNode2); - } - } - ptokensNode6 = (PTokens)nodeArrayList2.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode8 = (PProductions)nodeArrayList4.get(0); - pastNode9 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, null, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new122() /* reduce AAgrammar123Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - Object nullNode4 = null; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - pastNode8 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, null, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new123() /* reduce AAgrammar124Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - Object nullNode5 = null; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PTerm ptermNode1; + ptermNode1 = (PTerm)nodeArrayList1.get(0); + if(ptermNode1 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - pastNode9 = (PAst)nodeArrayList6.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, null, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new124() /* reduce AAgrammar125Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - Object nullNode3 = null; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - pstatesNode4 = (PStates)nodeArrayList1.get(0); - ptokensNode5 = (PTokens)nodeArrayList2.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList3.get(0); - pproductionsNode7 = (PProductions)nodeArrayList4.get(0); - pastNode8 = (PAst)nodeArrayList5.get(0); - - pgrammarNode1 = new AGrammar(listNode2, null, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new125() /* reduce AAgrammar126Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + listNode2.add(ptermNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new216() /* reduce AAparams2Params */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); { - listNode3.addAll(listNode2); - } - } - pstatesNode5 = (PStates)nodeArrayList2.get(0); - ptokensNode6 = (PTokens)nodeArrayList3.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode8 = (PProductions)nodeArrayList5.get(0); - pastNode9 = (PAst)nodeArrayList6.get(0); - - pgrammarNode1 = new AGrammar(listNode3, null, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new126() /* reduce AAgrammar127Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - PHelpers phelpersNode3; - PStates pstatesNode4; - PTokens ptokensNode5; - PIgnTokens pigntokensNode6; - PProductions pproductionsNode7; - PAst pastNode8; - {} - phelpersNode3 = (PHelpers)nodeArrayList1.get(0); - pstatesNode4 = (PStates)nodeArrayList2.get(0); - ptokensNode5 = (PTokens)nodeArrayList3.get(0); - pigntokensNode6 = (PIgnTokens)nodeArrayList4.get(0); - pproductionsNode7 = (PProductions)nodeArrayList5.get(0); - pastNode8 = (PAst)nodeArrayList6.get(0); - - pgrammarNode1 = new AGrammar(listNode2, phelpersNode3, pstatesNode4, ptokensNode5, pigntokensNode6, pproductionsNode7, pastNode8); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new127() /* reduce AAgrammar128Grammar */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList7 = (ArrayList) pop(); - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PGrammar pgrammarNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - PHelpers phelpersNode4; - PStates pstatesNode5; - PTokens ptokensNode6; - PIgnTokens pigntokensNode7; - PProductions pproductionsNode8; - PAst pastNode9; - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode2 != null) + // Block + PTerm ptermNode1; + LinkedList listNode2 = new LinkedList(); + ptermNode1 = (PTerm)nodeArrayList1.get(0); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(ptermNode1 != null) { - listNode3.addAll(listNode2); - } - } - phelpersNode4 = (PHelpers)nodeArrayList2.get(0); - pstatesNode5 = (PStates)nodeArrayList3.get(0); - ptokensNode6 = (PTokens)nodeArrayList4.get(0); - pigntokensNode7 = (PIgnTokens)nodeArrayList5.get(0); - pproductionsNode8 = (PProductions)nodeArrayList6.get(0); - pastNode9 = (PAst)nodeArrayList7.get(0); - - pgrammarNode1 = new AGrammar(listNode3, phelpersNode4, pstatesNode5, ptokensNode6, pigntokensNode7, pproductionsNode8, pastNode9); - } - nodeList.add(pgrammarNode1); - return nodeList; - } - - ArrayList new128() /* reduce APackage */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - listNode1 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode2.addAll(listNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new129() /* reduce AApkgname1PkgName */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - TPkgId tpkgidNode1; - tpkgidNode1 = (TPkgId)nodeArrayList1.get(0); - if(tpkgidNode1 != null) - { - listNode2.add(tpkgidNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new130() /* reduce AApkgname2PkgName */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TPkgId tpkgidNode1; - TypedLinkedList listNode2 = new TypedLinkedList(); - tpkgidNode1 = (TPkgId)nodeArrayList1.get(0); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(tpkgidNode1 != null) - { - listNode3.add(tpkgidNode1); - } - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new131() /* reduce APkgNameTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TPkgId tpkgidNode1; - tpkgidNode1 = (TPkgId)nodeArrayList2.get(0); - nodeList.add(tpkgidNode1); - return nodeList; - } - - ArrayList new132() /* reduce AHelpers */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PHelpers phelpersNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); + listNode3.add(ptermNode1); + } if(listNode2 != null) { - listNode3.addAll(listNode2); + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } } - } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + - phelpersNode1 = new AHelpers(listNode3); + + private List<Object> new217() /* reduce AParamsTail */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PTerm ptermNode1; + ptermNode1 = (PTerm)nodeArrayList2.get(0); + nodeList.add(ptermNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(phelpersNode1); - return nodeList; - } - ArrayList new133() /* reduce AHelperDef */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PHelperDef phelperdefNode1; + + private List<Object> new218() /* reduce AAltName */ { - TId tidNode2; - PRegExp pregexpNode3; - tidNode2 = (TId)nodeArrayList1.get(0); - pregexpNode3 = (PRegExp)nodeArrayList3.get(0); + List<Object> nodeList = new ArrayList<>(); - phelperdefNode1 = new AHelperDef(tidNode2, pregexpNode3); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TId tidNode1; + tidNode1 = (TId)nodeArrayList2.get(0); + nodeList.add(tidNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; } - nodeList.add(phelperdefNode1); - return nodeList; - } - ArrayList new134() /* reduce AStates */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PStates pstatesNode1; + + private List<Object> new219() /* reduce AAelem1Elem */ { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - - pstatesNode1 = new AStates(listNode3); - } - nodeList.add(pstatesNode1); - return nodeList; - } - - ArrayList new135() /* reduce AAidlist1IdList */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - TId tidNode1; - tidNode1 = (TId)nodeArrayList1.get(0); - if(tidNode1 != null) - { - listNode2.add(tidNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new136() /* reduce AAidlist2IdList */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TId tidNode1; - TypedLinkedList listNode2 = new TypedLinkedList(); - tidNode1 = (TId)nodeArrayList1.get(0); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(tidNode1 != null) - { - listNode3.add(tidNode1); - } - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new137() /* reduce AIdListTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TId tidNode1; - tidNode1 = (TId)nodeArrayList2.get(0); - nodeList.add(tidNode1); - return nodeList; - } - - ArrayList new138() /* reduce ATokens */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTokens ptokensNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode2 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; { - listNode3.addAll(listNode2); - } - } - - ptokensNode1 = new ATokens(listNode3); - } - nodeList.add(ptokensNode1); - return nodeList; - } - - ArrayList new139() /* reduce AAtokendef1TokenDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTokenDef ptokendefNode1; - { - Object nullNode2 = null; - TId tidNode3; - PRegExp pregexpNode4; - Object nullNode5 = null; - Object nullNode6 = null; - tidNode3 = (TId)nodeArrayList1.get(0); - pregexpNode4 = (PRegExp)nodeArrayList3.get(0); - - ptokendefNode1 = new ATokenDef(null, tidNode3, pregexpNode4, null, null); - } - nodeList.add(ptokendefNode1); - return nodeList; - } - - ArrayList new140() /* reduce AAtokendef2TokenDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTokenDef ptokendefNode1; - { - PStateList pstatelistNode2; - TId tidNode3; - PRegExp pregexpNode4; - Object nullNode5 = null; - Object nullNode6 = null; - pstatelistNode2 = (PStateList)nodeArrayList1.get(0); - tidNode3 = (TId)nodeArrayList2.get(0); - pregexpNode4 = (PRegExp)nodeArrayList4.get(0); - - ptokendefNode1 = new ATokenDef(pstatelistNode2, tidNode3, pregexpNode4, null, null); - } - nodeList.add(ptokendefNode1); - return nodeList; - } - - ArrayList new141() /* reduce AAtokendef3TokenDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTokenDef ptokendefNode1; - { - Object nullNode2 = null; - TId tidNode3; - PRegExp pregexpNode4; - TSlash tslashNode5; - PRegExp pregexpNode6; - tidNode3 = (TId)nodeArrayList1.get(0); - pregexpNode4 = (PRegExp)nodeArrayList3.get(0); - tslashNode5 = (TSlash)nodeArrayList4.get(0); - pregexpNode6 = (PRegExp)nodeArrayList4.get(1); - - ptokendefNode1 = new ATokenDef(null, tidNode3, pregexpNode4, tslashNode5, pregexpNode6); - } - nodeList.add(ptokendefNode1); - return nodeList; - } - - ArrayList new142() /* reduce AAtokendef4TokenDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList6 = (ArrayList) pop(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTokenDef ptokendefNode1; - { - PStateList pstatelistNode2; - TId tidNode3; - PRegExp pregexpNode4; - TSlash tslashNode5; - PRegExp pregexpNode6; - pstatelistNode2 = (PStateList)nodeArrayList1.get(0); - tidNode3 = (TId)nodeArrayList2.get(0); - pregexpNode4 = (PRegExp)nodeArrayList4.get(0); - tslashNode5 = (TSlash)nodeArrayList5.get(0); - pregexpNode6 = (PRegExp)nodeArrayList5.get(1); - - ptokendefNode1 = new ATokenDef(pstatelistNode2, tidNode3, pregexpNode4, tslashNode5, pregexpNode6); - } - nodeList.add(ptokendefNode1); - return nodeList; - } - - ArrayList new143() /* reduce AAstatelist1StateList */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PStateList pstatelistNode1; - { - TId tidNode2; - Object nullNode3 = null; - TypedLinkedList listNode4 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList2.get(0); - {} - - pstatelistNode1 = new AStateList(tidNode2, null, listNode4); - } - nodeList.add(pstatelistNode1); - return nodeList; - } - - ArrayList new144() /* reduce AAstatelist2StateList */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PStateList pstatelistNode1; - { - TId tidNode2; - PTransition ptransitionNode3; - TypedLinkedList listNode4 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList2.get(0); - ptransitionNode3 = (PTransition)nodeArrayList3.get(0); - {} - - pstatelistNode1 = new AStateList(tidNode2, ptransitionNode3, listNode4); - } - nodeList.add(pstatelistNode1); - return nodeList; - } - - ArrayList new145() /* reduce AAstatelist3StateList */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PStateList pstatelistNode1; - { - TId tidNode2; - Object nullNode3 = null; - TypedLinkedList listNode5 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList2.get(0); - { - TypedLinkedList listNode4 = new TypedLinkedList(); - listNode4 = (TypedLinkedList)nodeArrayList3.get(0); - if(listNode4 != null) + // Block + TId tidNode4; + tidNode4 = (TId)nodeArrayList1.get(0); + + pelemNode1 = new AElem(null, null, tidNode4, null); + } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; + } + + + + private List<Object> new220() /* reduce AAelem2Elem */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; { - listNode5.addAll(listNode4); + // Block + TId tidNode2; + TId tidNode4; + tidNode2 = (TId)nodeArrayList1.get(0); + tidNode4 = (TId)nodeArrayList2.get(0); + + pelemNode1 = new AElem(tidNode2, null, tidNode4, null); } - } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + + private List<Object> new221() /* reduce AAelem3Elem */ + { + List<Object> nodeList = new ArrayList<>(); - pstatelistNode1 = new AStateList(tidNode2, null, listNode5); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; + { + // Block + PSpecifier pspecifierNode3; + TId tidNode4; + pspecifierNode3 = (PSpecifier)nodeArrayList1.get(0); + tidNode4 = (TId)nodeArrayList2.get(0); + + pelemNode1 = new AElem(null, pspecifierNode3, tidNode4, null); + } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pstatelistNode1); - return nodeList; - } - ArrayList new146() /* reduce AAstatelist4StateList */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PStateList pstatelistNode1; + + private List<Object> new222() /* reduce AAelem4Elem */ { - TId tidNode2; - PTransition ptransitionNode3; - TypedLinkedList listNode5 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList2.get(0); - ptransitionNode3 = (PTransition)nodeArrayList3.get(0); - { - TypedLinkedList listNode4 = new TypedLinkedList(); - listNode4 = (TypedLinkedList)nodeArrayList4.get(0); - if(listNode4 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; { - listNode5.addAll(listNode4); + // Block + TId tidNode2; + PSpecifier pspecifierNode3; + TId tidNode4; + tidNode2 = (TId)nodeArrayList1.get(0); + pspecifierNode3 = (PSpecifier)nodeArrayList2.get(0); + tidNode4 = (TId)nodeArrayList3.get(0); + + pelemNode1 = new AElem(tidNode2, pspecifierNode3, tidNode4, null); } - } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; + } + - pstatelistNode1 = new AStateList(tidNode2, ptransitionNode3, listNode5); + + private List<Object> new223() /* reduce AAelem5Elem */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; + { + // Block + TId tidNode4; + PUnOp punopNode5; + tidNode4 = (TId)nodeArrayList1.get(0); + punopNode5 = (PUnOp)nodeArrayList2.get(0); + + pelemNode1 = new AElem(null, null, tidNode4, punopNode5); + } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pstatelistNode1); - return nodeList; - } - ArrayList new147() /* reduce AAstatelisttail1StateListTail */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PStateListTail pstatelisttailNode1; + + private List<Object> new224() /* reduce AAelem6Elem */ { - TId tidNode2; - Object nullNode3 = null; - tidNode2 = (TId)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - pstatelisttailNode1 = new AStateListTail(tidNode2, null); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; + { + // Block + TId tidNode2; + TId tidNode4; + PUnOp punopNode5; + tidNode2 = (TId)nodeArrayList1.get(0); + tidNode4 = (TId)nodeArrayList2.get(0); + punopNode5 = (PUnOp)nodeArrayList3.get(0); + + pelemNode1 = new AElem(tidNode2, null, tidNode4, punopNode5); + } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; } - nodeList.add(pstatelisttailNode1); - return nodeList; - } - ArrayList new148() /* reduce AAstatelisttail2StateListTail */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PStateListTail pstatelisttailNode1; + + private List<Object> new225() /* reduce AAelem7Elem */ { - TId tidNode2; - PTransition ptransitionNode3; - tidNode2 = (TId)nodeArrayList2.get(0); - ptransitionNode3 = (PTransition)nodeArrayList3.get(0); + List<Object> nodeList = new ArrayList<>(); - pstatelisttailNode1 = new AStateListTail(tidNode2, ptransitionNode3); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; + { + // Block + PSpecifier pspecifierNode3; + TId tidNode4; + PUnOp punopNode5; + pspecifierNode3 = (PSpecifier)nodeArrayList1.get(0); + tidNode4 = (TId)nodeArrayList2.get(0); + punopNode5 = (PUnOp)nodeArrayList3.get(0); + + pelemNode1 = new AElem(null, pspecifierNode3, tidNode4, punopNode5); + } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList3); + return nodeList; } - nodeList.add(pstatelisttailNode1); - return nodeList; - } - ArrayList new149() /* reduce ATransition */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTransition ptransitionNode1; + + private List<Object> new226() /* reduce AAelem8Elem */ { - TId tidNode2; - tidNode2 = (TId)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - ptransitionNode1 = new ATransition(tidNode2); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PElem pelemNode1; + { + // Block + TId tidNode2; + PSpecifier pspecifierNode3; + TId tidNode4; + PUnOp punopNode5; + tidNode2 = (TId)nodeArrayList1.get(0); + pspecifierNode3 = (PSpecifier)nodeArrayList2.get(0); + tidNode4 = (TId)nodeArrayList3.get(0); + punopNode5 = (PUnOp)nodeArrayList4.get(0); + + pelemNode1 = new AElem(tidNode2, pspecifierNode3, tidNode4, punopNode5); + } + nodeList.add(pelemNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; } - nodeList.add(ptransitionNode1); - return nodeList; - } - ArrayList new150() /* reduce AAigntokens1IgnTokens */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PIgnTokens pigntokensNode1; + + private List<Object> new227() /* reduce AElemName */ { - TypedLinkedList listNode2 = new TypedLinkedList(); - {} + List<Object> nodeList = new ArrayList<>(); - pigntokensNode1 = new AIgnTokens(listNode2); + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + TId tidNode1; + tidNode1 = (TId)nodeArrayList2.get(0); + nodeList.add(tidNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; } - nodeList.add(pigntokensNode1); - return nodeList; - } - ArrayList new151() /* reduce AAigntokens2IgnTokens */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PIgnTokens pigntokensNode1; + + private List<Object> new228() /* reduce ATokenSpecifier */ { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList3.get(0); - if(listNode2 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PSpecifier pspecifierNode1; { - listNode3.addAll(listNode2); - } - } + // Block - pigntokensNode1 = new AIgnTokens(listNode3); + pspecifierNode1 = new ATokenSpecifier(); + } + nodeList.add(pspecifierNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pigntokensNode1); - return nodeList; - } - ArrayList new152() /* reduce ALookAhead */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TSlash tslashNode1; - PRegExp pregexpNode2; - tslashNode1 = (TSlash)nodeArrayList1.get(0); - pregexpNode2 = (PRegExp)nodeArrayList2.get(0); - nodeList.add(tslashNode1); - nodeList.add(pregexpNode2); - return nodeList; - } - ArrayList new153() /* reduce AAregexp1RegExp */ - { - ArrayList nodeList = new ArrayList(); + private List<Object> new229() /* reduce AProductionSpecifier */ + { + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PSpecifier pspecifierNode1; + { + // Block + + pspecifierNode1 = new AProductionSpecifier(); + } + nodeList.add(pspecifierNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + - ArrayList nodeArrayList1 = (ArrayList) pop(); - PRegExp pregexpNode1; + private List<Object> new230() /* reduce AAst */ { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - PConcat pconcatNode2; - pconcatNode2 = (PConcat)nodeArrayList1.get(0); - if(pconcatNode2 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAst pastNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode2 = new LinkedList(); + listNode2 = (LinkedList)nodeArrayList4.get(0); + if(listNode2 != null) { - listNode3.add(pconcatNode2); + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } + } } - } - pregexpNode1 = new ARegExp(listNode3); + pastNode1 = new AAst(listNode3); + } + nodeList.add(pastNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; } - nodeList.add(pregexpNode1); - return nodeList; - } - ArrayList new154() /* reduce AAregexp2RegExp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PRegExp pregexpNode1; + + private List<Object> new231() /* reduce AAstProd */ { - TypedLinkedList listNode4 = new TypedLinkedList(); - { - PConcat pconcatNode2; - TypedLinkedList listNode3 = new TypedLinkedList(); - pconcatNode2 = (PConcat)nodeArrayList1.get(0); - listNode3 = (TypedLinkedList)nodeArrayList2.get(0); - if(pconcatNode2 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList4 = pop(); + List<Object> nodeArrayList3 = pop(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAstProd pastprodNode1; { - listNode4.add(pconcatNode2); - } + // Block + TId tidNode2; + LinkedList listNode4 = new LinkedList(); + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList3.get(0); if(listNode3 != null) { - listNode4.addAll(listNode3); + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } } - } - pregexpNode1 = new ARegExp(listNode4); + pastprodNode1 = new AAstProd(tidNode2, listNode4); + } + nodeList.add(pastprodNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList4); + return nodeList; } - nodeList.add(pregexpNode1); - return nodeList; - } - - ArrayList new155() /* reduce ARegExpTail */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PConcat pconcatNode1; - pconcatNode1 = (PConcat)nodeArrayList2.get(0); - nodeList.add(pconcatNode1); - return nodeList; - } - ArrayList new156() /* reduce AAconcat1Concat */ - { - ArrayList nodeList = new ArrayList(); - PConcat pconcatNode1; + private List<Object> new232() /* reduce AAastalts1AstAlts */ { - TypedLinkedList listNode2 = new TypedLinkedList(); - {} + List<Object> nodeList = new ArrayList<>(); - pconcatNode1 = new AConcat(listNode2); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PAstAlt pastaltNode1; + pastaltNode1 = (PAstAlt)nodeArrayList1.get(0); + if(pastaltNode1 != null) + { + listNode2.add(pastaltNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(pconcatNode1); - return nodeList; - } - ArrayList new157() /* reduce AAconcat2Concat */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PConcat pconcatNode1; + + private List<Object> new233() /* reduce AAastalts2AstAlts */ { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + PAstAlt pastaltNode1; + LinkedList listNode2 = new LinkedList(); + pastaltNode1 = (PAstAlt)nodeArrayList1.get(0); + listNode2 = (LinkedList)nodeArrayList2.get(0); + if(pastaltNode1 != null) + { + listNode3.add(pastaltNode1); + } if(listNode2 != null) { - listNode3.addAll(listNode2); + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode2); + }else{ + listNode3 = listNode2; + } } - } - - pconcatNode1 = new AConcat(listNode3); + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pconcatNode1); - return nodeList; - } - - ArrayList new158() /* reduce AAunexp1UnExp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PUnExp punexpNode1; - { - PBasic pbasicNode2; - Object nullNode3 = null; - pbasicNode2 = (PBasic)nodeArrayList1.get(0); - - punexpNode1 = new AUnExp(pbasicNode2, null); - } - nodeList.add(punexpNode1); - return nodeList; - } - ArrayList new159() /* reduce AAunexp2UnExp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PUnExp punexpNode1; + private List<Object> new234() /* reduce AAstAltsTail */ { - PBasic pbasicNode2; - PUnOp punopNode3; - pbasicNode2 = (PBasic)nodeArrayList1.get(0); - punopNode3 = (PUnOp)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - punexpNode1 = new AUnExp(pbasicNode2, punopNode3); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAstAlt pastaltNode1; + pastaltNode1 = (PAstAlt)nodeArrayList2.get(0); + nodeList.add(pastaltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(punexpNode1); - return nodeList; - } - - ArrayList new160() /* reduce ACharBasic */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PBasic pbasicNode1; - { - PChar pcharNode2; - pcharNode2 = (PChar)nodeArrayList1.get(0); - - pbasicNode1 = new ACharBasic(pcharNode2); - } - nodeList.add(pbasicNode1); - return nodeList; - } - ArrayList new161() /* reduce ASetBasic */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PBasic pbasicNode1; + private List<Object> new235() /* reduce AAastalt1AstAlt */ { - PSet psetNode2; - psetNode2 = (PSet)nodeArrayList1.get(0); - - pbasicNode1 = new ASetBasic(psetNode2); - } - nodeList.add(pbasicNode1); - return nodeList; - } - - ArrayList new162() /* reduce AStringBasic */ - { - ArrayList nodeList = new ArrayList(); + List<Object> nodeList = new ArrayList<>(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PBasic pbasicNode1; - { - TString tstringNode2; - tstringNode2 = (TString)nodeArrayList1.get(0); + PAstAlt pastaltNode1; + { + // Block + LinkedList listNode3 = new LinkedList(); + { + // Block + } - pbasicNode1 = new AStringBasic(tstringNode2); + pastaltNode1 = new AAstAlt(null, listNode3); + } + nodeList.add(pastaltNode1); + return nodeList; } - nodeList.add(pbasicNode1); - return nodeList; - } - ArrayList new163() /* reduce AIdBasic */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PBasic pbasicNode1; + + private List<Object> new236() /* reduce AAastalt2AstAlt */ { - TId tidNode2; - tidNode2 = (TId)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PAstAlt pastaltNode1; + { + // Block + TId tidNode2; + LinkedList listNode3 = new LinkedList(); + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + } - pbasicNode1 = new AIdBasic(tidNode2); + pastaltNode1 = new AAstAlt(tidNode2, listNode3); + } + nodeList.add(pastaltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(pbasicNode1); - return nodeList; - } - ArrayList new164() /* reduce ARegExpBasic */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PBasic pbasicNode1; + + private List<Object> new237() /* reduce AAastalt3AstAlt */ { - PRegExp pregexpNode2; - pregexpNode2 = (PRegExp)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + PAstAlt pastaltNode1; + { + // Block + LinkedList listNode4 = new LinkedList(); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList1.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } - pbasicNode1 = new ARegExpBasic(pregexpNode2); + pastaltNode1 = new AAstAlt(null, listNode4); + } + nodeList.add(pastaltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(pbasicNode1); - return nodeList; - } - ArrayList new165() /* reduce ACharChar */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PChar pcharNode1; + + private List<Object> new238() /* reduce AAastalt4AstAlt */ { - TChar tcharNode2; - tcharNode2 = (TChar)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + PAstAlt pastaltNode1; + { + // Block + TId tidNode2; + LinkedList listNode4 = new LinkedList(); + tidNode2 = (TId)nodeArrayList1.get(0); + { + // Block + LinkedList listNode3 = new LinkedList(); + listNode3 = (LinkedList)nodeArrayList2.get(0); + if(listNode3 != null) + { + if(!listNode4.isEmpty()){ + listNode4.addAll(listNode3); + }else{ + listNode4 = listNode3; + } + } + } - pcharNode1 = new ACharChar(tcharNode2); + pastaltNode1 = new AAstAlt(tidNode2, listNode4); + } + nodeList.add(pastaltNode1); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pcharNode1); - return nodeList; - } - ArrayList new166() /* reduce ADecChar */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PChar pcharNode1; + + private List<Object> new239() /* reduce ATerminal$PkgNameTail */ { - TDecChar tdeccharNode2; - tdeccharNode2 = (TDecChar)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - pcharNode1 = new ADecChar(tdeccharNode2); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + TPkgId tpkgidNode1; + tpkgidNode1 = (TPkgId)nodeArrayList1.get(0); + if(tpkgidNode1 != null) + { + listNode2.add(tpkgidNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(pcharNode1); - return nodeList; - } - ArrayList new167() /* reduce AHexChar */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PChar pcharNode1; + + private List<Object> new240() /* reduce ANonTerminal$PkgNameTail */ { - THexChar thexcharNode2; - thexcharNode2 = (THexChar)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - pcharNode1 = new AHexChar(thexcharNode2); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + TPkgId tpkgidNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + tpkgidNode2 = (TPkgId)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(tpkgidNode2 != null) + { + listNode3.add(tpkgidNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pcharNode1); - return nodeList; - } - ArrayList new168() /* reduce AOperationSet */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PSet psetNode1; + + private List<Object> new241() /* reduce ATerminal$HelperDef */ { - PBasic pbasicNode2; - PBinOp pbinopNode3; - PBasic pbasicNode4; - pbasicNode2 = (PBasic)nodeArrayList2.get(0); - pbinopNode3 = (PBinOp)nodeArrayList3.get(0); - pbasicNode4 = (PBasic)nodeArrayList4.get(0); + List<Object> nodeList = new ArrayList<>(); - psetNode1 = new AOperationSet(pbasicNode2, pbinopNode3, pbasicNode4); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PHelperDef phelperdefNode1; + phelperdefNode1 = (PHelperDef)nodeArrayList1.get(0); + if(phelperdefNode1 != null) + { + listNode2.add(phelperdefNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(psetNode1); - return nodeList; - } - ArrayList new169() /* reduce AIntervalSet */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PSet psetNode1; + + private List<Object> new242() /* reduce ANonTerminal$HelperDef */ { - PChar pcharNode2; - PChar pcharNode3; - pcharNode2 = (PChar)nodeArrayList2.get(0); - pcharNode3 = (PChar)nodeArrayList4.get(0); + List<Object> nodeList = new ArrayList<>(); - psetNode1 = new AIntervalSet(pcharNode2, pcharNode3); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PHelperDef phelperdefNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + phelperdefNode2 = (PHelperDef)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(phelperdefNode2 != null) + { + listNode3.add(phelperdefNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(psetNode1); - return nodeList; - } - ArrayList new170() /* reduce AStarUnOp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PUnOp punopNode1; + + private List<Object> new243() /* reduce ATerminal$IdListTail */ { - TStar tstarNode2; - tstarNode2 = (TStar)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - punopNode1 = new AStarUnOp(tstarNode2); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + TId tidNode1; + tidNode1 = (TId)nodeArrayList1.get(0); + if(tidNode1 != null) + { + listNode2.add(tidNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(punopNode1); - return nodeList; - } - ArrayList new171() /* reduce AQMarkUnOp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PUnOp punopNode1; + + private List<Object> new244() /* reduce ANonTerminal$IdListTail */ { - TQMark tqmarkNode2; - tqmarkNode2 = (TQMark)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - punopNode1 = new AQMarkUnOp(tqmarkNode2); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + TId tidNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + tidNode2 = (TId)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(tidNode2 != null) + { + listNode3.add(tidNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(punopNode1); - return nodeList; - } - ArrayList new172() /* reduce APlusUnOp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PUnOp punopNode1; + + private List<Object> new245() /* reduce ATerminal$TokenDef */ { - TPlus tplusNode2; - tplusNode2 = (TPlus)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - punopNode1 = new APlusUnOp(tplusNode2); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PTokenDef ptokendefNode1; + ptokendefNode1 = (PTokenDef)nodeArrayList1.get(0); + if(ptokendefNode1 != null) + { + listNode2.add(ptokendefNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(punopNode1); - return nodeList; - } - ArrayList new173() /* reduce APlusBinOp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PBinOp pbinopNode1; + + private List<Object> new246() /* reduce ANonTerminal$TokenDef */ { + List<Object> nodeList = new ArrayList<>(); - pbinopNode1 = new APlusBinOp(); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PTokenDef ptokendefNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + ptokendefNode2 = (PTokenDef)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(ptokendefNode2 != null) + { + listNode3.add(ptokendefNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pbinopNode1); - return nodeList; - } - ArrayList new174() /* reduce AMinusBinOp */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PBinOp pbinopNode1; + + private List<Object> new247() /* reduce ATerminal$StateListTail */ { + List<Object> nodeList = new ArrayList<>(); - pbinopNode1 = new AMinusBinOp(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PStateListTail pstatelisttailNode1; + pstatelisttailNode1 = (PStateListTail)nodeArrayList1.get(0); + if(pstatelisttailNode1 != null) + { + listNode2.add(pstatelisttailNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(pbinopNode1); - return nodeList; - } - ArrayList new175() /* reduce AProductions */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PProductions pproductionsNode1; + + private List<Object> new248() /* reduce ANonTerminal$StateListTail */ { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode2 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PStateListTail pstatelisttailNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + pstatelisttailNode2 = (PStateListTail)nodeArrayList2.get(0); + if(listNode1 != null) { - listNode3.addAll(listNode2); + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } } - } - - pproductionsNode1 = new AProductions(listNode3); + if(pstatelisttailNode2 != null) + { + listNode3.add(pstatelisttailNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(pproductionsNode1); - return nodeList; - } - ArrayList new176() /* reduce AAprod1Prod */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PProd pprodNode1; + + private List<Object> new249() /* reduce ATerminal$RegExpTail */ { - TId tidNode2; - Object nullNode3 = null; - TypedLinkedList listNode4 = new TypedLinkedList(); - TypedLinkedList listNode6 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList1.get(0); - {} + List<Object> nodeList = new ArrayList<>(); - { - TypedLinkedList listNode5 = new TypedLinkedList(); - listNode5 = (TypedLinkedList)nodeArrayList3.get(0); - if(listNode5 != null) + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); { - listNode6.addAll(listNode5); + // Block + PConcat pconcatNode1; + pconcatNode1 = (PConcat)nodeArrayList1.get(0); + if(pconcatNode1 != null) + { + listNode2.add(pconcatNode1); } - } - - pprodNode1 = new AProd(tidNode2, null, listNode4, listNode6); + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(pprodNode1); - return nodeList; - } - ArrayList new177() /* reduce AAprod2Prod */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PProd pprodNode1; + + private List<Object> new250() /* reduce ANonTerminal$RegExpTail */ { - TId tidNode2; - TArrow tarrowNode3; - TypedLinkedList listNode5 = new TypedLinkedList(); - TypedLinkedList listNode7 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList1.get(0); - tarrowNode3 = (TArrow)nodeArrayList2.get(0); - { - TypedLinkedList listNode4 = new TypedLinkedList(); - listNode4 = (TypedLinkedList)nodeArrayList2.get(1); - if(listNode4 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); { - listNode5.addAll(listNode4); - } - } - { - TypedLinkedList listNode6 = new TypedLinkedList(); - listNode6 = (TypedLinkedList)nodeArrayList4.get(0); - if(listNode6 != null) + // Block + LinkedList listNode1 = new LinkedList(); + PConcat pconcatNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + pconcatNode2 = (PConcat)nodeArrayList2.get(0); + if(listNode1 != null) { - listNode7.addAll(listNode6); - } - } - - pprodNode1 = new AProd(tidNode2, tarrowNode3, listNode5, listNode7); - } - nodeList.add(pprodNode1); - return nodeList; - } - - ArrayList new178() /* reduce AAprodtransform1ProdTransform */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TArrow tarrowNode1; - TypedLinkedList listNode2 = new TypedLinkedList(); - tarrowNode1 = (TArrow)nodeArrayList2.get(0); - {} - nodeList.add(tarrowNode1); - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new179() /* reduce AAprodtransform2ProdTransform */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TArrow tarrowNode1; - TypedLinkedList listNode3 = new TypedLinkedList(); - tarrowNode1 = (TArrow)nodeArrayList2.get(0); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList3.get(0); - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - nodeList.add(tarrowNode1); - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new180() /* reduce AAalts1Alts */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PAlt paltNode1; - paltNode1 = (PAlt)nodeArrayList1.get(0); - if(paltNode1 != null) - { - listNode2.add(paltNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new181() /* reduce AAalts2Alts */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - PAlt paltNode1; - TypedLinkedList listNode2 = new TypedLinkedList(); - paltNode1 = (PAlt)nodeArrayList1.get(0); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(paltNode1 != null) - { - listNode3.add(paltNode1); - } - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new182() /* reduce AAltsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; - paltNode1 = (PAlt)nodeArrayList2.get(0); - nodeList.add(paltNode1); - return nodeList; - } - - ArrayList new183() /* reduce AAalt1Alt */ - { - ArrayList nodeList = new ArrayList(); - - PAlt paltNode1; - { - Object nullNode2 = null; - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - {} - - paltNode1 = new AAlt(null, listNode3, null); - } - nodeList.add(paltNode1); - return nodeList; - } - - ArrayList new184() /* reduce AAalt2Alt */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; - { - TId tidNode2; - TypedLinkedList listNode3 = new TypedLinkedList(); - Object nullNode4 = null; - tidNode2 = (TId)nodeArrayList1.get(0); - {} - - paltNode1 = new AAlt(tidNode2, listNode3, null); - } - nodeList.add(paltNode1); - return nodeList; - } - - ArrayList new185() /* reduce AAalt3Alt */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; - { - Object nullNode2 = null; - TypedLinkedList listNode4 = new TypedLinkedList(); - Object nullNode5 = null; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode3 != null) + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(pconcatNode2 != null) { - listNode4.addAll(listNode3); + listNode3.add(pconcatNode2); } - } - - paltNode1 = new AAlt(null, listNode4, null); + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(paltNode1); - return nodeList; - } - ArrayList new186() /* reduce AAalt4Alt */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; + + private List<Object> new251() /* reduce ATerminal$UnExp */ { - TId tidNode2; - TypedLinkedList listNode4 = new TypedLinkedList(); - Object nullNode5 = null; - tidNode2 = (TId)nodeArrayList1.get(0); - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode3 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PUnExp punexpNode1; + punexpNode1 = (PUnExp)nodeArrayList1.get(0); + if(punexpNode1 != null) { - listNode4.addAll(listNode3); + listNode2.add(punexpNode1); } - } - - paltNode1 = new AAlt(tidNode2, listNode4, null); + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(paltNode1); - return nodeList; - } - ArrayList new187() /* reduce AAalt5Alt */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; + + private List<Object> new252() /* reduce ANonTerminal$UnExp */ { - Object nullNode2 = null; - TypedLinkedList listNode3 = new TypedLinkedList(); - PAltTransform palttransformNode4; - {} - palttransformNode4 = (PAltTransform)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - paltNode1 = new AAlt(null, listNode3, palttransformNode4); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PUnExp punexpNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + punexpNode2 = (PUnExp)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(punexpNode2 != null) + { + listNode3.add(punexpNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(paltNode1); - return nodeList; - } - ArrayList new188() /* reduce AAalt6Alt */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; + + private List<Object> new253() /* reduce ATerminal$Prod */ { - TId tidNode2; - TypedLinkedList listNode3 = new TypedLinkedList(); - PAltTransform palttransformNode4; - tidNode2 = (TId)nodeArrayList1.get(0); - {} - palttransformNode4 = (PAltTransform)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - paltNode1 = new AAlt(tidNode2, listNode3, palttransformNode4); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PProd pprodNode1; + pprodNode1 = (PProd)nodeArrayList1.get(0); + if(pprodNode1 != null) + { + listNode2.add(pprodNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(paltNode1); - return nodeList; - } - ArrayList new189() /* reduce AAalt7Alt */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; + + private List<Object> new254() /* reduce ANonTerminal$Prod */ { - Object nullNode2 = null; - TypedLinkedList listNode4 = new TypedLinkedList(); - PAltTransform palttransformNode5; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode3 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PProd pprodNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + pprodNode2 = (PProd)nodeArrayList2.get(0); + if(listNode1 != null) { - listNode4.addAll(listNode3); + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } } - } - palttransformNode5 = (PAltTransform)nodeArrayList2.get(0); - - paltNode1 = new AAlt(null, listNode4, palttransformNode5); + if(pprodNode2 != null) + { + listNode3.add(pprodNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(paltNode1); - return nodeList; - } - ArrayList new190() /* reduce AAalt8Alt */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAlt paltNode1; + + private List<Object> new255() /* reduce ATerminal$Elem */ { - TId tidNode2; - TypedLinkedList listNode4 = new TypedLinkedList(); - PAltTransform palttransformNode5; - tidNode2 = (TId)nodeArrayList1.get(0); - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode3 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PElem pelemNode1; + pelemNode1 = (PElem)nodeArrayList1.get(0); + if(pelemNode1 != null) { - listNode4.addAll(listNode3); + listNode2.add(pelemNode1); } - } - palttransformNode5 = (PAltTransform)nodeArrayList3.get(0); - - paltNode1 = new AAlt(tidNode2, listNode4, palttransformNode5); + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(paltNode1); - return nodeList; - } - ArrayList new191() /* reduce AAalttransform1AltTransform */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAltTransform palttransformNode1; + + private List<Object> new256() /* reduce ANonTerminal$Elem */ { - TLBrace tlbraceNode2; - TypedLinkedList listNode3 = new TypedLinkedList(); - TRBrace trbraceNode4; - tlbraceNode2 = (TLBrace)nodeArrayList1.get(0); - {} - trbraceNode4 = (TRBrace)nodeArrayList3.get(0); + List<Object> nodeList = new ArrayList<>(); - palttransformNode1 = new AAltTransform(tlbraceNode2, listNode3, trbraceNode4); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PElem pelemNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + pelemNode2 = (PElem)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(pelemNode2 != null) + { + listNode3.add(pelemNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(palttransformNode1); - return nodeList; - } - ArrayList new192() /* reduce AAalttransform2AltTransform */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAltTransform palttransformNode1; + + private List<Object> new257() /* reduce ATerminal$AltsTail */ { - TLBrace tlbraceNode2; - TypedLinkedList listNode4 = new TypedLinkedList(); - TRBrace trbraceNode5; - tlbraceNode2 = (TLBrace)nodeArrayList1.get(0); - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList3.get(0); - if(listNode3 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); { - listNode4.addAll(listNode3); - } - } - trbraceNode5 = (TRBrace)nodeArrayList4.get(0); - - palttransformNode1 = new AAltTransform(tlbraceNode2, listNode4, trbraceNode5); - } - nodeList.add(palttransformNode1); - return nodeList; - } - - ArrayList new193() /* reduce AAnewterm1Term */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; - { - PProdName pprodnameNode2; - TLPar tlparNode3; - TypedLinkedList listNode4 = new TypedLinkedList(); - pprodnameNode2 = (PProdName)nodeArrayList2.get(0); - tlparNode3 = (TLPar)nodeArrayList3.get(0); - {} - - ptermNode1 = new ANewTerm(pprodnameNode2, tlparNode3, listNode4); - } - nodeList.add(ptermNode1); - return nodeList; - } - - ArrayList new194() /* reduce AAnewterm2Term */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; - { - PProdName pprodnameNode2; - TLPar tlparNode3; - TypedLinkedList listNode5 = new TypedLinkedList(); - pprodnameNode2 = (PProdName)nodeArrayList2.get(0); - tlparNode3 = (TLPar)nodeArrayList3.get(0); - { - TypedLinkedList listNode4 = new TypedLinkedList(); - listNode4 = (TypedLinkedList)nodeArrayList4.get(0); - if(listNode4 != null) + // Block + PAlt paltNode1; + paltNode1 = (PAlt)nodeArrayList1.get(0); + if(paltNode1 != null) { - listNode5.addAll(listNode4); + listNode2.add(paltNode1); } - } - - ptermNode1 = new ANewTerm(pprodnameNode2, tlparNode3, listNode5); + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(ptermNode1); - return nodeList; - } - ArrayList new195() /* reduce AAlistterm1Term */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; + + private List<Object> new258() /* reduce ANonTerminal$AltsTail */ { - TLBkt tlbktNode2; - TypedLinkedList listNode3 = new TypedLinkedList(); - tlbktNode2 = (TLBkt)nodeArrayList1.get(0); - {} + List<Object> nodeList = new ArrayList<>(); - ptermNode1 = new AListTerm(tlbktNode2, listNode3); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PAlt paltNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + paltNode2 = (PAlt)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(paltNode2 != null) + { + listNode3.add(paltNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(ptermNode1); - return nodeList; - } - ArrayList new196() /* reduce AAlistterm2Term */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; + + private List<Object> new259() /* reduce ATerminal$Term */ { - TLBkt tlbktNode2; - TypedLinkedList listNode4 = new TypedLinkedList(); - tlbktNode2 = (TLBkt)nodeArrayList1.get(0); - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode3 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PTerm ptermNode1; + ptermNode1 = (PTerm)nodeArrayList1.get(0); + if(ptermNode1 != null) { - listNode4.addAll(listNode3); + listNode2.add(ptermNode1); } - } - - ptermNode1 = new AListTerm(tlbktNode2, listNode4); + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(ptermNode1); - return nodeList; - } - ArrayList new197() /* reduce AAsimpleterm1Term */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; + + private List<Object> new260() /* reduce ANonTerminal$Term */ { - Object nullNode2 = null; - TId tidNode3; - Object nullNode4 = null; - tidNode3 = (TId)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - ptermNode1 = new ASimpleTerm(null, tidNode3, null); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PTerm ptermNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + ptermNode2 = (PTerm)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(ptermNode2 != null) + { + listNode3.add(ptermNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(ptermNode1); - return nodeList; - } - ArrayList new198() /* reduce AAsimpleterm2Term */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; + + private List<Object> new261() /* reduce ATerminal$ListTermTail */ { - PSpecifier pspecifierNode2; - TId tidNode3; - Object nullNode4 = null; - pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); - tidNode3 = (TId)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - ptermNode1 = new ASimpleTerm(pspecifierNode2, tidNode3, null); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PListTerm plisttermNode1; + plisttermNode1 = (PListTerm)nodeArrayList1.get(0); + if(plisttermNode1 != null) + { + listNode2.add(plisttermNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(ptermNode1); - return nodeList; - } - ArrayList new199() /* reduce AAsimpleterm3Term */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; + + private List<Object> new262() /* reduce ANonTerminal$ListTermTail */ { - Object nullNode2 = null; - TId tidNode3; - TId tidNode4; - tidNode3 = (TId)nodeArrayList1.get(0); - tidNode4 = (TId)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - ptermNode1 = new ASimpleTerm(null, tidNode3, tidNode4); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PListTerm plisttermNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + plisttermNode2 = (PListTerm)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(plisttermNode2 != null) + { + listNode3.add(plisttermNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(ptermNode1); - return nodeList; - } - ArrayList new200() /* reduce AAsimpleterm4Term */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; + + private List<Object> new263() /* reduce ATerminal$ParamsTail */ { - PSpecifier pspecifierNode2; - TId tidNode3; - TId tidNode4; - pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); - tidNode3 = (TId)nodeArrayList2.get(0); - tidNode4 = (TId)nodeArrayList3.get(0); - - ptermNode1 = new ASimpleTerm(pspecifierNode2, tidNode3, tidNode4); - } - nodeList.add(ptermNode1); - return nodeList; - } - - ArrayList new201() /* reduce ANullTerm */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; - { - - ptermNode1 = new ANullTerm(); - } - nodeList.add(ptermNode1); - return nodeList; - } - - ArrayList new202() /* reduce AAlistoflistterm1ListOfListTerm */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PListTerm plisttermNode1; - plisttermNode1 = (PListTerm)nodeArrayList1.get(0); - if(plisttermNode1 != null) - { - listNode2.add(plisttermNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new203() /* reduce AAlistoflistterm2ListOfListTerm */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - PListTerm plisttermNode1; - TypedLinkedList listNode2 = new TypedLinkedList(); - plisttermNode1 = (PListTerm)nodeArrayList1.get(0); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(plisttermNode1 != null) - { - listNode3.add(plisttermNode1); - } - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new204() /* reduce AAnewlistterm1ListTerm */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PListTerm plisttermNode1; - { - PProdName pprodnameNode2; - TLPar tlparNode3; - TypedLinkedList listNode4 = new TypedLinkedList(); - pprodnameNode2 = (PProdName)nodeArrayList2.get(0); - tlparNode3 = (TLPar)nodeArrayList3.get(0); - {} - - plisttermNode1 = new ANewListTerm(pprodnameNode2, tlparNode3, listNode4); - } - nodeList.add(plisttermNode1); - return nodeList; - } - - ArrayList new205() /* reduce AAnewlistterm2ListTerm */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList5 = (ArrayList) pop(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PListTerm plisttermNode1; - { - PProdName pprodnameNode2; - TLPar tlparNode3; - TypedLinkedList listNode5 = new TypedLinkedList(); - pprodnameNode2 = (PProdName)nodeArrayList2.get(0); - tlparNode3 = (TLPar)nodeArrayList3.get(0); - { - TypedLinkedList listNode4 = new TypedLinkedList(); - listNode4 = (TypedLinkedList)nodeArrayList4.get(0); - if(listNode4 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); { - listNode5.addAll(listNode4); + // Block + PTerm ptermNode1; + ptermNode1 = (PTerm)nodeArrayList1.get(0); + if(ptermNode1 != null) + { + listNode2.add(ptermNode1); } - } - - plisttermNode1 = new ANewListTerm(pprodnameNode2, tlparNode3, listNode5); + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(plisttermNode1); - return nodeList; - } - ArrayList new206() /* reduce AAsimplelistterm1ListTerm */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PListTerm plisttermNode1; + + private List<Object> new264() /* reduce ANonTerminal$ParamsTail */ { - Object nullNode2 = null; - TId tidNode3; - Object nullNode4 = null; - tidNode3 = (TId)nodeArrayList1.get(0); + List<Object> nodeList = new ArrayList<>(); - plisttermNode1 = new ASimpleListTerm(null, tidNode3, null); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PTerm ptermNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + ptermNode2 = (PTerm)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(ptermNode2 != null) + { + listNode3.add(ptermNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(plisttermNode1); - return nodeList; - } - ArrayList new207() /* reduce AAsimplelistterm2ListTerm */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PListTerm plisttermNode1; + + private List<Object> new265() /* reduce ATerminal$AstProd */ { - PSpecifier pspecifierNode2; - TId tidNode3; - Object nullNode4 = null; - pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); - tidNode3 = (TId)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - plisttermNode1 = new ASimpleListTerm(pspecifierNode2, tidNode3, null); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); + { + // Block + PAstProd pastprodNode1; + pastprodNode1 = (PAstProd)nodeArrayList1.get(0); + if(pastprodNode1 != null) + { + listNode2.add(pastprodNode1); + } + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(plisttermNode1); - return nodeList; - } - ArrayList new208() /* reduce AAsimplelistterm3ListTerm */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PListTerm plisttermNode1; + + private List<Object> new266() /* reduce ANonTerminal$AstProd */ { - Object nullNode2 = null; - TId tidNode3; - TId tidNode4; - tidNode3 = (TId)nodeArrayList1.get(0); - tidNode4 = (TId)nodeArrayList2.get(0); + List<Object> nodeList = new ArrayList<>(); - plisttermNode1 = new ASimpleListTerm(null, tidNode3, tidNode4); + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); + { + // Block + LinkedList listNode1 = new LinkedList(); + PAstProd pastprodNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + pastprodNode2 = (PAstProd)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } + } + if(pastprodNode2 != null) + { + listNode3.add(pastprodNode2); + } + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; } - nodeList.add(plisttermNode1); - return nodeList; - } - ArrayList new209() /* reduce AAsimplelistterm4ListTerm */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PListTerm plisttermNode1; - { - PSpecifier pspecifierNode2; - TId tidNode3; - TId tidNode4; - pspecifierNode2 = (PSpecifier)nodeArrayList1.get(0); - tidNode3 = (TId)nodeArrayList2.get(0); - tidNode4 = (TId)nodeArrayList3.get(0); - plisttermNode1 = new ASimpleListTerm(pspecifierNode2, tidNode3, tidNode4); - } - nodeList.add(plisttermNode1); - return nodeList; - } + private List<Object> new267() /* reduce ATerminal$AstAltsTail */ + { + List<Object> nodeList = new ArrayList<>(); - ArrayList new210() /* reduce AListTermTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PListTerm plisttermNode1; - plisttermNode1 = (PListTerm)nodeArrayList2.get(0); - nodeList.add(plisttermNode1); - return nodeList; - } - - ArrayList new211() /* reduce ASimpleTermTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TId tidNode1; - tidNode1 = (TId)nodeArrayList2.get(0); - nodeList.add(tidNode1); - return nodeList; - } - - ArrayList new212() /* reduce AAprodname1ProdName */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PProdName pprodnameNode1; - { - TId tidNode2; - Object nullNode3 = null; - tidNode2 = (TId)nodeArrayList1.get(0); - - pprodnameNode1 = new AProdName(tidNode2, null); - } - nodeList.add(pprodnameNode1); - return nodeList; - } - - ArrayList new213() /* reduce AAprodname2ProdName */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PProdName pprodnameNode1; - { - TId tidNode2; - TId tidNode3; - tidNode2 = (TId)nodeArrayList1.get(0); - tidNode3 = (TId)nodeArrayList2.get(0); - - pprodnameNode1 = new AProdName(tidNode2, tidNode3); - } - nodeList.add(pprodnameNode1); - return nodeList; - } - - ArrayList new214() /* reduce AProdNameTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TId tidNode1; - tidNode1 = (TId)nodeArrayList2.get(0); - nodeList.add(tidNode1); - return nodeList; - } - - ArrayList new215() /* reduce AAparams1Params */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PTerm ptermNode1; - ptermNode1 = (PTerm)nodeArrayList1.get(0); - if(ptermNode1 != null) - { - listNode2.add(ptermNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new216() /* reduce AAparams2Params */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - PTerm ptermNode1; - TypedLinkedList listNode2 = new TypedLinkedList(); - ptermNode1 = (PTerm)nodeArrayList1.get(0); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(ptermNode1 != null) - { - listNode3.add(ptermNode1); - } - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new217() /* reduce AParamsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PTerm ptermNode1; - ptermNode1 = (PTerm)nodeArrayList2.get(0); - nodeList.add(ptermNode1); - return nodeList; - } - - ArrayList new218() /* reduce AAltName */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TId tidNode1; - tidNode1 = (TId)nodeArrayList2.get(0); - nodeList.add(tidNode1); - return nodeList; - } - - ArrayList new219() /* reduce AAelem1Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - Object nullNode2 = null; - Object nullNode3 = null; - TId tidNode4; - Object nullNode5 = null; - tidNode4 = (TId)nodeArrayList1.get(0); - - pelemNode1 = new AElem(null, null, tidNode4, null); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new220() /* reduce AAelem2Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - TId tidNode2; - Object nullNode3 = null; - TId tidNode4; - Object nullNode5 = null; - tidNode2 = (TId)nodeArrayList1.get(0); - tidNode4 = (TId)nodeArrayList2.get(0); - - pelemNode1 = new AElem(tidNode2, null, tidNode4, null); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new221() /* reduce AAelem3Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - Object nullNode2 = null; - PSpecifier pspecifierNode3; - TId tidNode4; - Object nullNode5 = null; - pspecifierNode3 = (PSpecifier)nodeArrayList1.get(0); - tidNode4 = (TId)nodeArrayList2.get(0); - - pelemNode1 = new AElem(null, pspecifierNode3, tidNode4, null); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new222() /* reduce AAelem4Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - TId tidNode2; - PSpecifier pspecifierNode3; - TId tidNode4; - Object nullNode5 = null; - tidNode2 = (TId)nodeArrayList1.get(0); - pspecifierNode3 = (PSpecifier)nodeArrayList2.get(0); - tidNode4 = (TId)nodeArrayList3.get(0); - - pelemNode1 = new AElem(tidNode2, pspecifierNode3, tidNode4, null); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new223() /* reduce AAelem5Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - Object nullNode2 = null; - Object nullNode3 = null; - TId tidNode4; - PUnOp punopNode5; - tidNode4 = (TId)nodeArrayList1.get(0); - punopNode5 = (PUnOp)nodeArrayList2.get(0); - - pelemNode1 = new AElem(null, null, tidNode4, punopNode5); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new224() /* reduce AAelem6Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - TId tidNode2; - Object nullNode3 = null; - TId tidNode4; - PUnOp punopNode5; - tidNode2 = (TId)nodeArrayList1.get(0); - tidNode4 = (TId)nodeArrayList2.get(0); - punopNode5 = (PUnOp)nodeArrayList3.get(0); - - pelemNode1 = new AElem(tidNode2, null, tidNode4, punopNode5); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new225() /* reduce AAelem7Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - Object nullNode2 = null; - PSpecifier pspecifierNode3; - TId tidNode4; - PUnOp punopNode5; - pspecifierNode3 = (PSpecifier)nodeArrayList1.get(0); - tidNode4 = (TId)nodeArrayList2.get(0); - punopNode5 = (PUnOp)nodeArrayList3.get(0); - - pelemNode1 = new AElem(null, pspecifierNode3, tidNode4, punopNode5); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new226() /* reduce AAelem8Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PElem pelemNode1; - { - TId tidNode2; - PSpecifier pspecifierNode3; - TId tidNode4; - PUnOp punopNode5; - tidNode2 = (TId)nodeArrayList1.get(0); - pspecifierNode3 = (PSpecifier)nodeArrayList2.get(0); - tidNode4 = (TId)nodeArrayList3.get(0); - punopNode5 = (PUnOp)nodeArrayList4.get(0); - - pelemNode1 = new AElem(tidNode2, pspecifierNode3, tidNode4, punopNode5); - } - nodeList.add(pelemNode1); - return nodeList; - } - - ArrayList new227() /* reduce AElemName */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TId tidNode1; - tidNode1 = (TId)nodeArrayList2.get(0); - nodeList.add(tidNode1); - return nodeList; - } - - ArrayList new228() /* reduce ATokenSpecifier */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PSpecifier pspecifierNode1; - { - - pspecifierNode1 = new ATokenSpecifier(); - } - nodeList.add(pspecifierNode1); - return nodeList; - } - - ArrayList new229() /* reduce AProductionSpecifier */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PSpecifier pspecifierNode1; - { - - pspecifierNode1 = new AProductionSpecifier(); - } - nodeList.add(pspecifierNode1); - return nodeList; - } - - ArrayList new230() /* reduce AAst */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAst pastNode1; - { - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode2 = new TypedLinkedList(); - listNode2 = (TypedLinkedList)nodeArrayList4.get(0); - if(listNode2 != null) + List<Object> nodeArrayList1 = pop(); + LinkedList listNode2 = new LinkedList(); { - listNode3.addAll(listNode2); + // Block + PAstAlt pastaltNode1; + pastaltNode1 = (PAstAlt)nodeArrayList1.get(0); + if(pastaltNode1 != null) + { + listNode2.add(pastaltNode1); } - } - - pastNode1 = new AAst(listNode3); + } + nodeList.add(listNode2); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList1); + return nodeList; } - nodeList.add(pastNode1); - return nodeList; - } - ArrayList new231() /* reduce AAstProd */ - { - ArrayList nodeList = new ArrayList(); - ArrayList nodeArrayList4 = (ArrayList) pop(); - ArrayList nodeArrayList3 = (ArrayList) pop(); - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAstProd pastprodNode1; + + private List<Object> new268() /* reduce ANonTerminal$AstAltsTail */ { - TId tidNode2; - TypedLinkedList listNode4 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList1.get(0); - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList3.get(0); - if(listNode3 != null) + List<Object> nodeList = new ArrayList<>(); + + List<Object> nodeArrayList2 = pop(); + List<Object> nodeArrayList1 = pop(); + LinkedList listNode3 = new LinkedList(); { - listNode4.addAll(listNode3); + // Block + LinkedList listNode1 = new LinkedList(); + PAstAlt pastaltNode2; + listNode1 = (LinkedList)nodeArrayList1.get(0); + pastaltNode2 = (PAstAlt)nodeArrayList2.get(0); + if(listNode1 != null) + { + if(!listNode3.isEmpty()){ + listNode3.addAll(listNode1); + }else{ + listNode3 = listNode1; + } } - } - - pastprodNode1 = new AAstProd(tidNode2, listNode4); - } - nodeList.add(pastprodNode1); - return nodeList; - } - - ArrayList new232() /* reduce AAastalts1AstAlts */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PAstAlt pastaltNode1; - pastaltNode1 = (PAstAlt)nodeArrayList1.get(0); - if(pastaltNode1 != null) - { - listNode2.add(pastaltNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new233() /* reduce AAastalts2AstAlts */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - PAstAlt pastaltNode1; - TypedLinkedList listNode2 = new TypedLinkedList(); - pastaltNode1 = (PAstAlt)nodeArrayList1.get(0); - listNode2 = (TypedLinkedList)nodeArrayList2.get(0); - if(pastaltNode1 != null) - { - listNode3.add(pastaltNode1); - } - if(listNode2 != null) - { - listNode3.addAll(listNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new234() /* reduce AAstAltsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAstAlt pastaltNode1; - pastaltNode1 = (PAstAlt)nodeArrayList2.get(0); - nodeList.add(pastaltNode1); - return nodeList; - } - - ArrayList new235() /* reduce AAastalt1AstAlt */ - { - ArrayList nodeList = new ArrayList(); - - PAstAlt pastaltNode1; - { - Object nullNode2 = null; - TypedLinkedList listNode3 = new TypedLinkedList(); - {} - - pastaltNode1 = new AAstAlt(null, listNode3); - } - nodeList.add(pastaltNode1); - return nodeList; - } - - ArrayList new236() /* reduce AAastalt2AstAlt */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAstAlt pastaltNode1; - { - TId tidNode2; - TypedLinkedList listNode3 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList1.get(0); - {} - - pastaltNode1 = new AAstAlt(tidNode2, listNode3); - } - nodeList.add(pastaltNode1); - return nodeList; - } - - ArrayList new237() /* reduce AAastalt3AstAlt */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAstAlt pastaltNode1; - { - Object nullNode2 = null; - TypedLinkedList listNode4 = new TypedLinkedList(); - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList1.get(0); - if(listNode3 != null) + if(pastaltNode2 != null) { - listNode4.addAll(listNode3); + listNode3.add(pastaltNode2); } - } - - pastaltNode1 = new AAstAlt(null, listNode4); - } - nodeList.add(pastaltNode1); - return nodeList; - } - - ArrayList new238() /* reduce AAastalt4AstAlt */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - PAstAlt pastaltNode1; - { - TId tidNode2; - TypedLinkedList listNode4 = new TypedLinkedList(); - tidNode2 = (TId)nodeArrayList1.get(0); - { - TypedLinkedList listNode3 = new TypedLinkedList(); - listNode3 = (TypedLinkedList)nodeArrayList2.get(0); - if(listNode3 != null) + } + nodeList.add(listNode3); + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList2); + return nodeList; + } + + + private static int[][][] actionTable; +/* { + {{-1, REDUCE, 0}, {1, SHIFT, 1}, {2, SHIFT, 2}, {3, SHIFT, 3}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, ERROR, 1}, {0, SHIFT, 16}, }, + {{-1, ERROR, 2}, {33, SHIFT, 18}, }, + {{-1, ERROR, 3}, {33, SHIFT, 20}, }, + {{-1, ERROR, 4}, {22, SHIFT, 23}, {33, SHIFT, 24}, }, + {{-1, ERROR, 5}, {4, SHIFT, 28}, }, + {{-1, ERROR, 6}, {33, SHIFT, 29}, }, + {{-1, ERROR, 7}, {8, SHIFT, 32}, }, + {{-1, ERROR, 8}, {38, ACCEPT, -1}, }, + {{-1, REDUCE, 1}, {2, SHIFT, 2}, {3, SHIFT, 3}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 2}, {2, SHIFT, 2}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 4}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 8}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 16}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 32}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 64}, }, + {{-1, ERROR, 16}, {14, SHIFT, 54}, {16, SHIFT, 55}, }, + {{-1, REDUCE, 128}, }, + {{-1, REDUCE, 135}, {29, SHIFT, 58}, }, + {{-1, ERROR, 19}, {16, SHIFT, 61}, }, + {{-1, ERROR, 20}, {17, SHIFT, 62}, }, + {{-1, REDUCE, 241}, }, + {{-1, REDUCE, 132}, {33, SHIFT, 20}, }, + {{-1, ERROR, 23}, {33, SHIFT, 64}, }, + {{-1, ERROR, 24}, {17, SHIFT, 65}, }, + {{-1, REDUCE, 245}, }, + {{-1, ERROR, 26}, {33, SHIFT, 66}, }, + {{-1, REDUCE, 138}, {22, SHIFT, 23}, {33, SHIFT, 24}, }, + {{-1, ERROR, 28}, {16, SHIFT, 68}, {33, SHIFT, 18}, }, + {{-1, ERROR, 29}, {17, SHIFT, 70}, {22, SHIFT, 71}, }, + {{-1, REDUCE, 253}, }, + {{-1, REDUCE, 175}, {33, SHIFT, 29}, }, + {{-1, ERROR, 32}, {9, SHIFT, 74}, }, + {{-1, REDUCE, 3}, {2, SHIFT, 2}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 5}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 9}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 17}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 33}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 65}, }, + {{-1, REDUCE, 6}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 10}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 18}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 34}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 66}, }, + {{-1, REDUCE, 12}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 20}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 36}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 68}, }, + {{-1, REDUCE, 24}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 40}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 72}, }, + {{-1, REDUCE, 48}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 80}, }, + {{-1, REDUCE, 96}, }, + {{-1, ERROR, 54}, {0, SHIFT, 110}, }, + {{-1, REDUCE, 129}, }, + {{-1, REDUCE, 239}, }, + {{-1, ERROR, 57}, {14, SHIFT, 54}, {16, SHIFT, 111}, }, + {{-1, ERROR, 58}, {33, SHIFT, 113}, }, + {{-1, REDUCE, 243}, }, + {{-1, REDUCE, 136}, {29, SHIFT, 58}, }, + {{-1, REDUCE, 134}, }, + {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, REDUCE, 242}, }, + {{-1, ERROR, 64}, {23, SHIFT, 129}, {29, SHIFT, 130}, {31, SHIFT, 131}, }, + {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, ERROR, 66}, {17, SHIFT, 136}, }, + {{-1, REDUCE, 246}, }, + {{-1, REDUCE, 150}, }, + {{-1, ERROR, 69}, {16, SHIFT, 137}, }, + {{-1, REDUCE, 183}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 141}, {33, SHIFT, 142}, }, + {{-1, ERROR, 71}, {31, SHIFT, 151}, }, + {{-1, ERROR, 72}, {17, SHIFT, 152}, }, + {{-1, REDUCE, 254}, }, + {{-1, ERROR, 74}, {33, SHIFT, 153}, }, + {{-1, REDUCE, 7}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 11}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 19}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 35}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 67}, }, + {{-1, REDUCE, 13}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 21}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 37}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 69}, }, + {{-1, REDUCE, 25}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 41}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 73}, }, + {{-1, REDUCE, 49}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 81}, }, + {{-1, REDUCE, 97}, }, + {{-1, REDUCE, 14}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 22}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 38}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 70}, }, + {{-1, REDUCE, 26}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 42}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 74}, }, + {{-1, REDUCE, 50}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 82}, }, + {{-1, REDUCE, 98}, }, + {{-1, REDUCE, 28}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 44}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 76}, }, + {{-1, REDUCE, 52}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 84}, }, + {{-1, REDUCE, 100}, }, + {{-1, REDUCE, 56}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 88}, }, + {{-1, REDUCE, 104}, }, + {{-1, REDUCE, 112}, }, + {{-1, REDUCE, 131}, }, + {{-1, REDUCE, 130}, }, + {{-1, REDUCE, 240}, }, + {{-1, REDUCE, 137}, }, + {{-1, REDUCE, 244}, }, + {{-1, ERROR, 115}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, REDUCE, 163}, }, + {{-1, REDUCE, 165}, }, + {{-1, REDUCE, 166}, }, + {{-1, REDUCE, 167}, }, + {{-1, REDUCE, 162}, }, + {{-1, ERROR, 122}, {16, SHIFT, 194}, }, + {{-1, REDUCE, 153}, {28, SHIFT, 195}, }, + {{-1, REDUCE, 251}, }, + {{-1, REDUCE, 158}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, + {{-1, REDUCE, 160}, }, + {{-1, REDUCE, 161}, }, + {{-1, REDUCE, 157}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, REDUCE, 143}, }, + {{-1, ERROR, 130}, {33, SHIFT, 203}, }, + {{-1, ERROR, 131}, {33, SHIFT, 204}, }, + {{-1, REDUCE, 247}, }, + {{-1, ERROR, 133}, {23, SHIFT, 205}, {29, SHIFT, 130}, }, + {{-1, ERROR, 134}, {23, SHIFT, 207}, {29, SHIFT, 130}, }, + {{-1, ERROR, 135}, {16, SHIFT, 209}, {30, SHIFT, 210}, }, + {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, REDUCE, 151}, }, + {{-1, ERROR, 138}, {14, SHIFT, 213}, }, + {{-1, ERROR, 139}, {14, SHIFT, 214}, }, + {{-1, ERROR, 140}, {33, SHIFT, 215}, }, + {{-1, ERROR, 141}, {31, SHIFT, 216}, {33, SHIFT, 217}, }, + {{-1, REDUCE, 219}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, + {{-1, ERROR, 143}, {16, SHIFT, 219}, }, + {{-1, REDUCE, 180}, {28, SHIFT, 220}, }, + {{-1, REDUCE, 187}, }, + {{-1, REDUCE, 184}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 223}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 255}, }, + {{-1, ERROR, 148}, {12, SHIFT, 138}, {13, SHIFT, 139}, {33, SHIFT, 226}, }, + {{-1, ERROR, 149}, {33, SHIFT, 228}, }, + {{-1, REDUCE, 185}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 223}, {33, SHIFT, 142}, }, + {{-1, ERROR, 151}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {23, SHIFT, 231}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 183}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 141}, {33, SHIFT, 142}, }, + {{-1, ERROR, 153}, {17, SHIFT, 234}, }, + {{-1, REDUCE, 265}, }, + {{-1, REDUCE, 230}, {33, SHIFT, 153}, }, + {{-1, REDUCE, 15}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 23}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 39}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 71}, }, + {{-1, REDUCE, 27}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 43}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 75}, }, + {{-1, REDUCE, 51}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 83}, }, + {{-1, REDUCE, 99}, }, + {{-1, REDUCE, 29}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 45}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 77}, }, + {{-1, REDUCE, 53}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 85}, }, + {{-1, REDUCE, 101}, }, + {{-1, REDUCE, 57}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 89}, }, + {{-1, REDUCE, 105}, }, + {{-1, REDUCE, 113}, }, + {{-1, REDUCE, 30}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 46}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 78}, }, + {{-1, REDUCE, 54}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 86}, }, + {{-1, REDUCE, 102}, }, + {{-1, REDUCE, 58}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 90}, }, + {{-1, REDUCE, 106}, }, + {{-1, REDUCE, 114}, }, + {{-1, REDUCE, 60}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 92}, }, + {{-1, REDUCE, 108}, }, + {{-1, REDUCE, 116}, }, + {{-1, REDUCE, 120}, }, + {{-1, ERROR, 191}, {24, SHIFT, 257}, {25, SHIFT, 258}, }, + {{-1, REDUCE, 160}, {15, SHIFT, 260}, }, + {{-1, ERROR, 193}, {21, SHIFT, 261}, }, + {{-1, REDUCE, 133}, }, + {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, REDUCE, 249}, }, + {{-1, REDUCE, 154}, {28, SHIFT, 195}, }, + {{-1, REDUCE, 172}, }, + {{-1, REDUCE, 171}, }, + {{-1, REDUCE, 170}, }, + {{-1, REDUCE, 159}, }, + {{-1, REDUCE, 252}, }, + {{-1, REDUCE, 147}, {31, SHIFT, 131}, }, + {{-1, REDUCE, 149}, }, + {{-1, REDUCE, 144}, }, + {{-1, ERROR, 206}, {23, SHIFT, 265}, {29, SHIFT, 130}, }, + {{-1, REDUCE, 145}, }, + {{-1, REDUCE, 248}, }, + {{-1, REDUCE, 139}, }, + {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, ERROR, 211}, {16, SHIFT, 267}, }, + {{-1, ERROR, 212}, {16, SHIFT, 268}, {30, SHIFT, 210}, }, + {{-1, REDUCE, 228}, }, + {{-1, REDUCE, 229}, }, + {{-1, ERROR, 215}, {19, SHIFT, 270}, }, + {{-1, ERROR, 216}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {23, SHIFT, 274}, {33, SHIFT, 275}, }, + {{-1, ERROR, 217}, {23, SHIFT, 279}, }, + {{-1, REDUCE, 223}, }, + {{-1, REDUCE, 176}, }, + {{-1, REDUCE, 183}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 141}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 257}, }, + {{-1, REDUCE, 181}, {28, SHIFT, 220}, }, + {{-1, ERROR, 223}, {31, SHIFT, 216}, }, + {{-1, REDUCE, 188}, }, + {{-1, REDUCE, 186}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 223}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 220}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, + {{-1, ERROR, 227}, {33, SHIFT, 284}, }, + {{-1, REDUCE, 221}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, + {{-1, REDUCE, 189}, }, + {{-1, REDUCE, 256}, }, + {{-1, REDUCE, 178}, }, + {{-1, ERROR, 232}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {23, SHIFT, 286}, {33, SHIFT, 142}, }, + {{-1, ERROR, 233}, {16, SHIFT, 287}, }, + {{-1, REDUCE, 235}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 288}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 266}, }, + {{-1, REDUCE, 31}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 47}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 79}, }, + {{-1, REDUCE, 55}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 87}, }, + {{-1, REDUCE, 103}, }, + {{-1, REDUCE, 59}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 91}, }, + {{-1, REDUCE, 107}, }, + {{-1, REDUCE, 115}, }, + {{-1, REDUCE, 61}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 93}, }, + {{-1, REDUCE, 109}, }, + {{-1, REDUCE, 117}, }, + {{-1, REDUCE, 121}, }, + {{-1, REDUCE, 62}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 94}, }, + {{-1, REDUCE, 110}, }, + {{-1, REDUCE, 118}, }, + {{-1, REDUCE, 122}, }, + {{-1, REDUCE, 124}, }, + {{-1, REDUCE, 173}, }, + {{-1, REDUCE, 174}, }, + {{-1, ERROR, 259}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, + {{-1, ERROR, 260}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, }, + {{-1, REDUCE, 164}, }, + {{-1, REDUCE, 155}, }, + {{-1, REDUCE, 250}, }, + {{-1, REDUCE, 148}, }, + {{-1, REDUCE, 146}, }, + {{-1, REDUCE, 152}, }, + {{-1, REDUCE, 141}, }, + {{-1, REDUCE, 140}, }, + {{-1, ERROR, 269}, {16, SHIFT, 302}, }, + {{-1, ERROR, 270}, {32, SHIFT, 303}, }, + {{-1, ERROR, 271}, {33, SHIFT, 304}, }, + {{-1, REDUCE, 201}, }, + {{-1, ERROR, 273}, {10, SHIFT, 306}, {12, SHIFT, 138}, {13, SHIFT, 139}, {19, SHIFT, 307}, {33, SHIFT, 308}, }, + {{-1, REDUCE, 191}, }, + {{-1, REDUCE, 197}, {14, SHIFT, 312}, }, + {{-1, REDUCE, 259}, }, + {{-1, ERROR, 277}, {33, SHIFT, 314}, }, + {{-1, ERROR, 278}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {23, SHIFT, 315}, {33, SHIFT, 275}, }, + {{-1, REDUCE, 218}, }, + {{-1, REDUCE, 182}, }, + {{-1, REDUCE, 258}, }, + {{-1, REDUCE, 190}, }, + {{-1, REDUCE, 224}, }, + {{-1, REDUCE, 222}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, + {{-1, REDUCE, 225}, }, + {{-1, REDUCE, 179}, }, + {{-1, REDUCE, 177}, }, + {{-1, ERROR, 288}, {33, SHIFT, 217}, }, + {{-1, REDUCE, 236}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {33, SHIFT, 142}, }, + {{-1, ERROR, 290}, {16, SHIFT, 319}, }, + {{-1, REDUCE, 232}, {28, SHIFT, 320}, }, + {{-1, REDUCE, 237}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 63}, {7, SHIFT, 7}, }, + {{-1, REDUCE, 95}, }, + {{-1, REDUCE, 111}, }, + {{-1, REDUCE, 119}, }, + {{-1, REDUCE, 123}, }, + {{-1, REDUCE, 125}, }, + {{-1, REDUCE, 126}, }, + {{-1, ERROR, 300}, {19, SHIFT, 324}, }, + {{-1, ERROR, 301}, {19, SHIFT, 325}, }, + {{-1, REDUCE, 142}, }, + {{-1, REDUCE, 227}, }, + {{-1, REDUCE, 212}, {14, SHIFT, 326}, }, + {{-1, ERROR, 305}, {20, SHIFT, 328}, }, + {{-1, ERROR, 306}, {33, SHIFT, 304}, }, + {{-1, REDUCE, 195}, }, + {{-1, REDUCE, 206}, {14, SHIFT, 312}, }, + {{-1, ERROR, 309}, {19, SHIFT, 331}, }, + {{-1, REDUCE, 202}, {29, SHIFT, 332}, }, + {{-1, ERROR, 311}, {33, SHIFT, 335}, }, + {{-1, ERROR, 312}, {33, SHIFT, 336}, }, + {{-1, REDUCE, 199}, }, + {{-1, REDUCE, 198}, {14, SHIFT, 312}, }, + {{-1, REDUCE, 192}, }, + {{-1, REDUCE, 260}, }, + {{-1, REDUCE, 226}, }, + {{-1, REDUCE, 238}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 231}, }, + {{-1, REDUCE, 235}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 288}, {33, SHIFT, 142}, }, + {{-1, REDUCE, 267}, }, + {{-1, REDUCE, 233}, {28, SHIFT, 320}, }, + {{-1, REDUCE, 127}, }, + {{-1, REDUCE, 168}, }, + {{-1, REDUCE, 169}, }, + {{-1, ERROR, 326}, {33, SHIFT, 340}, }, + {{-1, REDUCE, 213}, }, + {{-1, ERROR, 328}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {21, SHIFT, 341}, {33, SHIFT, 275}, }, + {{-1, ERROR, 329}, {20, SHIFT, 344}, }, + {{-1, REDUCE, 208}, }, + {{-1, REDUCE, 196}, }, + {{-1, ERROR, 332}, {10, SHIFT, 306}, {12, SHIFT, 138}, {13, SHIFT, 139}, {33, SHIFT, 308}, }, + {{-1, REDUCE, 261}, }, + {{-1, REDUCE, 203}, {29, SHIFT, 332}, }, + {{-1, REDUCE, 207}, {14, SHIFT, 312}, }, + {{-1, REDUCE, 211}, }, + {{-1, REDUCE, 200}, }, + {{-1, REDUCE, 234}, }, + {{-1, REDUCE, 268}, }, + {{-1, REDUCE, 214}, }, + {{-1, REDUCE, 193}, }, + {{-1, REDUCE, 215}, {29, SHIFT, 348}, }, + {{-1, ERROR, 343}, {21, SHIFT, 351}, }, + {{-1, ERROR, 344}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {21, SHIFT, 352}, {33, SHIFT, 275}, }, + {{-1, REDUCE, 210}, }, + {{-1, REDUCE, 262}, }, + {{-1, REDUCE, 209}, }, + {{-1, ERROR, 348}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {33, SHIFT, 275}, }, + {{-1, REDUCE, 263}, }, + {{-1, REDUCE, 216}, {29, SHIFT, 348}, }, + {{-1, REDUCE, 194}, }, + {{-1, REDUCE, 204}, }, + {{-1, ERROR, 353}, {21, SHIFT, 356}, }, + {{-1, REDUCE, 217}, }, + {{-1, REDUCE, 264}, }, + {{-1, REDUCE, 205}, }, + };*/ + private static int[][][] gotoTable; +/* { + {{-1, 8}, }, + {{-1, 9}, }, + {{-1, 17}, }, + {{-1, 56}, {57, 112}, }, + {{-1, 10}, {9, 33}, }, + {{-1, 21}, {22, 63}, }, + {{-1, 11}, {9, 34}, {10, 39}, {33, 75}, }, + {{-1, 19}, {28, 69}, }, + {{-1, 59}, {60, 114}, }, + {{-1, 12}, {9, 35}, {10, 40}, {11, 44}, {33, 76}, {34, 80}, {39, 90}, {75, 156}, }, + {{-1, 25}, {27, 67}, }, + {{-1, 26}, }, + {{-1, 132}, {134, 208}, {206, 208}, }, + {{-1, 133}, {203, 264}, }, + {{-1, 13}, {9, 36}, {10, 41}, {11, 45}, {12, 48}, {33, 77}, {34, 81}, {35, 84}, {39, 91}, {40, 94}, {44, 100}, {75, 157}, {76, 160}, {80, 166}, {90, 176}, {156, 236}, }, + {{-1, 211}, {212, 269}, }, + {{-1, 122}, {65, 135}, {116, 193}, {136, 212}, {210, 266}, }, + {{-1, 196}, {197, 263}, }, + {{-1, 123}, {195, 262}, }, + {{-1, 124}, {128, 202}, }, + {{-1, 125}, {115, 191}, {259, 300}, }, + {{-1, 126}, {115, 192}, {260, 301}, }, + {{-1, 127}, }, + {{-1, 201}, {142, 218}, {226, 283}, {228, 285}, {284, 317}, }, + {{-1, 259}, }, + {{-1, 14}, {9, 37}, {10, 42}, {11, 46}, {12, 49}, {13, 51}, {33, 78}, {34, 82}, {35, 85}, {36, 87}, {39, 92}, {40, 95}, {41, 97}, {44, 101}, {45, 103}, {48, 106}, {75, 158}, {76, 161}, {77, 163}, {80, 167}, {81, 169}, {84, 172}, {90, 177}, {91, 179}, {94, 182}, {100, 186}, {156, 237}, {157, 239}, {160, 242}, {166, 246}, {176, 251}, {236, 293}, }, + {{-1, 30}, {31, 73}, }, + {{-1, 72}, }, + {{-1, 143}, {152, 233}, }, + {{-1, 221}, {222, 281}, }, + {{-1, 144}, {220, 280}, }, + {{-1, 145}, {146, 224}, {150, 229}, {225, 282}, }, + {{-1, 342}, {216, 276}, {278, 316}, {348, 354}, }, + {{-1, 309}, }, + {{-1, 310}, {332, 345}, }, + {{-1, 333}, {334, 346}, }, + {{-1, 313}, {308, 330}, {314, 337}, {335, 347}, }, + {{-1, 305}, {306, 329}, }, + {{-1, 327}, }, + {{-1, 343}, {344, 353}, }, + {{-1, 349}, {350, 355}, }, + {{-1, 146}, {234, 289}, {320, 289}, }, + {{-1, 147}, {150, 230}, {225, 230}, {232, 230}, {292, 230}, {318, 230}, }, + {{-1, 148}, }, + {{-1, 149}, {148, 227}, {216, 277}, {273, 311}, {278, 277}, {328, 277}, {332, 311}, {344, 277}, {348, 277}, }, + {{-1, 15}, {9, 38}, {10, 43}, {11, 47}, {12, 50}, {13, 52}, {14, 53}, {33, 79}, {34, 83}, {35, 86}, {36, 88}, {37, 89}, {39, 93}, {40, 96}, {41, 98}, {42, 99}, {44, 102}, {45, 104}, {46, 105}, {48, 107}, {49, 108}, {51, 109}, {75, 159}, {76, 162}, {77, 164}, {78, 165}, {80, 168}, {81, 170}, {82, 171}, {84, 173}, {85, 174}, {87, 175}, {90, 178}, {91, 180}, {92, 181}, {94, 183}, {95, 184}, {97, 185}, {100, 187}, {101, 188}, {103, 189}, {106, 190}, {156, 238}, {157, 240}, {158, 241}, {160, 243}, {161, 244}, {163, 245}, {166, 247}, {167, 248}, {169, 249}, {172, 250}, {176, 252}, {177, 253}, {179, 254}, {182, 255}, {186, 256}, {236, 294}, {237, 295}, {239, 296}, {242, 297}, {246, 298}, {251, 299}, {293, 323}, }, + {{-1, 154}, {155, 235}, }, + {{-1, 290}, }, + {{-1, 321}, {322, 339}, }, + {{-1, 291}, {320, 338}, }, + {{-1, 57}, }, + {{-1, 22}, }, + {{-1, 60}, }, + {{-1, 27}, }, + {{-1, 134}, {133, 206}, }, + {{-1, 197}, }, + {{-1, 128}, }, + {{-1, 31}, }, + {{-1, 150}, {146, 225}, {151, 232}, {234, 292}, {289, 318}, {320, 292}, }, + {{-1, 222}, }, + {{-1, 278}, }, + {{-1, 334}, }, + {{-1, 350}, }, + {{-1, 155}, }, + {{-1, 322}, }, + };*/ + private static String[] errorMessages; +/* { + "expecting: 'Package', 'States', 'Helpers', 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", + "expecting: pkg id", + "expecting: id", + "expecting: '{', id", + "expecting: 'Tokens'", + "expecting: 'Syntax'", + "expecting: EOF", + "expecting: 'States', 'Helpers', 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", + "expecting: 'States', 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", + "expecting: 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", + "expecting: 'Ignored', 'Productions', 'Abstract', EOF", + "expecting: 'Productions', 'Abstract', EOF", + "expecting: 'Abstract', EOF", + "expecting: '.', ';'", + "expecting: ';', ','", + "expecting: ';'", + "expecting: '='", + "expecting: 'States', 'Tokens', 'Ignored', 'Productions', 'Abstract', id, EOF", + "expecting: 'Ignored', 'Productions', 'Abstract', '{', id, EOF", + "expecting: ';', id", + "expecting: '=', '{'", + "expecting: 'Abstract', id, EOF", + "expecting: 'Tree'", + "expecting: ';', '[', '(', '|', id, char, dec char, hex char, string", + "expecting: '}', ',', '->'", + "expecting: ';', '[', '(', '|', '/', id, char, dec char, hex char, string", + "expecting: 'T', 'P', ';', '[', '{', '|', id", + "expecting: '->'", + "expecting: '[', '(', id, char, dec char, hex char, string", + "expecting: '[', '(', ')', '|', id, char, dec char, hex char, string", + "expecting: ';', '[', ']', '(', ')', '+', '-', '?', '*', '|', '/', id, char, dec char, hex char, string", + "expecting: '..', ';', '[', ']', '(', ')', '+', '-', '?', '*', '|', '/', id, char, dec char, hex char, string", + "expecting: ';', ')', '|', '/'", + "expecting: ';', '[', '(', ')', '|', '/', id, char, dec char, hex char, string", + "expecting: ';', '[', '(', ')', '+', '?', '*', '|', '/', id, char, dec char, hex char, string", + "expecting: ';', '[', ']', '(', ')', '+', '?', '*', '|', '/', id, char, dec char, hex char, string", + "expecting: '}', ','", + "expecting: ';', '/'", + "expecting: '.'", + "expecting: '->', id", + "expecting: 'T', 'P', ';', '[', '{', '}', '+', '?', '*', '|', id", + "expecting: ';', '|'", + "expecting: 'T', 'P', ';', '[', '{', '}', '|', id", + "expecting: 'T', 'P', id", + "expecting: 'T', 'P', '[', '}', id", + "expecting: id, EOF", + "expecting: '+', '-'", + "expecting: '..', '+', '-'", + "expecting: ')'", + "expecting: 'T', 'P', ';', '[', '(', ')', '{', '}', '|', '/', id, char, dec char, hex char, string", + "expecting: ']'", + "expecting: 'New', 'Null', 'T', 'P', '[', '}', id", + "expecting: '}'", + "expecting: char, dec char, hex char", + "expecting: ':'", + "expecting: 'New', 'Null', 'T', 'P', '[', ')', '}', ',', id", + "expecting: 'New', 'T', 'P', ']', id", + "expecting: 'New', 'Null', 'T', 'P', '.', '[', ')', '}', ',', id", + "expecting: 'T', 'P', ';', '[', '|', id", + "expecting: '.', '('", + "expecting: '('", + "expecting: '.', ']', ','", + "expecting: ']', ','", + "expecting: 'New', 'Null', 'T', 'P', '[', ')', id", + "expecting: 'New', 'T', 'P', id", + "expecting: 'New', 'Null', 'T', 'P', '[', ']', ')', '}', ',', id", + "expecting: ')', ','", + "expecting: 'New', 'Null', 'T', 'P', '[', id", + };*/ + private static int[] errors; +/* { + 0, 1, 2, 2, 3, 4, 2, 5, 6, 7, 8, 9, 10, 11, 12, 6, 13, 7, 14, 15, 16, 17, 17, 2, 16, 18, 2, 18, 19, 20, 21, 21, 22, 8, 9, 10, 11, 12, 6, 9, 10, 11, 12, 6, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 1, 7, 13, 13, 2, 14, 14, 9, 23, 17, 24, 25, 16, 18, 11, 15, 26, 27, 16, 21, 2, 9, 10, 11, 12, 6, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 13, 7, 13, 14, 14, 28, 29, 30, 31, 31, 31, 30, 15, 32, 33, 34, 35, 30, 33, 2, 2, 2, 36, 36, 36, 37, 25, 11, 38, 38, 2, 39, 40, 15, 41, 41, 26, 42, 43, 2, 26, 44, 26, 16, 45, 45, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 12, 6, 6, 6, 6, 46, 47, 48, 17, 33, 32, 32, 49, 49, 49, 33, 33, 24, 36, 2, 36, 2, 36, 18, 23, 15, 37, 2, 2, 50, 51, 52, 42, 21, 26, 41, 41, 27, 41, 26, 40, 2, 40, 41, 42, 16, 44, 15, 26, 45, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 12, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 28, 28, 28, 53, 30, 32, 32, 36, 2, 15, 18, 18, 15, 54, 2, 55, 56, 41, 57, 51, 2, 51, 26, 41, 41, 41, 42, 40, 42, 16, 21, 2, 58, 15, 41, 58, 12, 6, 6, 6, 6, 6, 6, 50, 50, 18, 43, 59, 60, 2, 55, 61, 50, 62, 2, 2, 55, 57, 41, 51, 42, 58, 45, 26, 41, 41, 6, 30, 30, 2, 60, 63, 60, 62, 55, 64, 62, 62, 61, 65, 55, 41, 41, 60, 55, 66, 48, 63, 62, 62, 62, 67, 66, 66, 55, 62, 48, 66, 66, 62, + };*/ + + static + { + try { - listNode4.addAll(listNode3); - } - } - - pastaltNode1 = new AAstAlt(tidNode2, listNode4); - } - nodeList.add(pastaltNode1); - return nodeList; - } - - ArrayList new239() /* reduce ATerminal$PkgNameTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - TPkgId tpkgidNode1; - tpkgidNode1 = (TPkgId)nodeArrayList1.get(0); - if(tpkgidNode1 != null) - { - listNode2.add(tpkgidNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new240() /* reduce ANonTerminal$PkgNameTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - TPkgId tpkgidNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - tpkgidNode2 = (TPkgId)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(tpkgidNode2 != null) - { - listNode3.add(tpkgidNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new241() /* reduce ATerminal$HelperDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PHelperDef phelperdefNode1; - phelperdefNode1 = (PHelperDef)nodeArrayList1.get(0); - if(phelperdefNode1 != null) - { - listNode2.add(phelperdefNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new242() /* reduce ANonTerminal$HelperDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PHelperDef phelperdefNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - phelperdefNode2 = (PHelperDef)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(phelperdefNode2 != null) - { - listNode3.add(phelperdefNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new243() /* reduce ATerminal$IdListTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - TId tidNode1; - tidNode1 = (TId)nodeArrayList1.get(0); - if(tidNode1 != null) - { - listNode2.add(tidNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new244() /* reduce ANonTerminal$IdListTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - TId tidNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - tidNode2 = (TId)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(tidNode2 != null) - { - listNode3.add(tidNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new245() /* reduce ATerminal$TokenDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PTokenDef ptokendefNode1; - ptokendefNode1 = (PTokenDef)nodeArrayList1.get(0); - if(ptokendefNode1 != null) - { - listNode2.add(ptokendefNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new246() /* reduce ANonTerminal$TokenDef */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PTokenDef ptokendefNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - ptokendefNode2 = (PTokenDef)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(ptokendefNode2 != null) - { - listNode3.add(ptokendefNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new247() /* reduce ATerminal$StateListTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PStateListTail pstatelisttailNode1; - pstatelisttailNode1 = (PStateListTail)nodeArrayList1.get(0); - if(pstatelisttailNode1 != null) - { - listNode2.add(pstatelisttailNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new248() /* reduce ANonTerminal$StateListTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PStateListTail pstatelisttailNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - pstatelisttailNode2 = (PStateListTail)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(pstatelisttailNode2 != null) - { - listNode3.add(pstatelisttailNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new249() /* reduce ATerminal$RegExpTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PConcat pconcatNode1; - pconcatNode1 = (PConcat)nodeArrayList1.get(0); - if(pconcatNode1 != null) - { - listNode2.add(pconcatNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new250() /* reduce ANonTerminal$RegExpTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PConcat pconcatNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - pconcatNode2 = (PConcat)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(pconcatNode2 != null) - { - listNode3.add(pconcatNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new251() /* reduce ATerminal$UnExp */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PUnExp punexpNode1; - punexpNode1 = (PUnExp)nodeArrayList1.get(0); - if(punexpNode1 != null) - { - listNode2.add(punexpNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new252() /* reduce ANonTerminal$UnExp */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PUnExp punexpNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - punexpNode2 = (PUnExp)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(punexpNode2 != null) - { - listNode3.add(punexpNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new253() /* reduce ATerminal$Prod */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PProd pprodNode1; - pprodNode1 = (PProd)nodeArrayList1.get(0); - if(pprodNode1 != null) - { - listNode2.add(pprodNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new254() /* reduce ANonTerminal$Prod */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PProd pprodNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - pprodNode2 = (PProd)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(pprodNode2 != null) - { - listNode3.add(pprodNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new255() /* reduce ATerminal$Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PElem pelemNode1; - pelemNode1 = (PElem)nodeArrayList1.get(0); - if(pelemNode1 != null) - { - listNode2.add(pelemNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new256() /* reduce ANonTerminal$Elem */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PElem pelemNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - pelemNode2 = (PElem)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(pelemNode2 != null) - { - listNode3.add(pelemNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new257() /* reduce ATerminal$AltsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PAlt paltNode1; - paltNode1 = (PAlt)nodeArrayList1.get(0); - if(paltNode1 != null) - { - listNode2.add(paltNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new258() /* reduce ANonTerminal$AltsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PAlt paltNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - paltNode2 = (PAlt)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(paltNode2 != null) - { - listNode3.add(paltNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new259() /* reduce ATerminal$Term */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PTerm ptermNode1; - ptermNode1 = (PTerm)nodeArrayList1.get(0); - if(ptermNode1 != null) - { - listNode2.add(ptermNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new260() /* reduce ANonTerminal$Term */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PTerm ptermNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - ptermNode2 = (PTerm)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(ptermNode2 != null) - { - listNode3.add(ptermNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new261() /* reduce ATerminal$ListTermTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PListTerm plisttermNode1; - plisttermNode1 = (PListTerm)nodeArrayList1.get(0); - if(plisttermNode1 != null) - { - listNode2.add(plisttermNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new262() /* reduce ANonTerminal$ListTermTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PListTerm plisttermNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - plisttermNode2 = (PListTerm)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(plisttermNode2 != null) - { - listNode3.add(plisttermNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new263() /* reduce ATerminal$ParamsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PTerm ptermNode1; - ptermNode1 = (PTerm)nodeArrayList1.get(0); - if(ptermNode1 != null) - { - listNode2.add(ptermNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new264() /* reduce ANonTerminal$ParamsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PTerm ptermNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - ptermNode2 = (PTerm)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(ptermNode2 != null) - { - listNode3.add(ptermNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new265() /* reduce ATerminal$AstProd */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PAstProd pastprodNode1; - pastprodNode1 = (PAstProd)nodeArrayList1.get(0); - if(pastprodNode1 != null) - { - listNode2.add(pastprodNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new266() /* reduce ANonTerminal$AstProd */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PAstProd pastprodNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - pastprodNode2 = (PAstProd)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(pastprodNode2 != null) - { - listNode3.add(pastprodNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - ArrayList new267() /* reduce ATerminal$AstAltsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode2 = new TypedLinkedList(); - { - PAstAlt pastaltNode1; - pastaltNode1 = (PAstAlt)nodeArrayList1.get(0); - if(pastaltNode1 != null) - { - listNode2.add(pastaltNode1); - } - } - nodeList.add(listNode2); - return nodeList; - } - - ArrayList new268() /* reduce ANonTerminal$AstAltsTail */ - { - ArrayList nodeList = new ArrayList(); - - ArrayList nodeArrayList2 = (ArrayList) pop(); - ArrayList nodeArrayList1 = (ArrayList) pop(); - TypedLinkedList listNode3 = new TypedLinkedList(); - { - TypedLinkedList listNode1 = new TypedLinkedList(); - PAstAlt pastaltNode2; - listNode1 = (TypedLinkedList)nodeArrayList1.get(0); - pastaltNode2 = (PAstAlt)nodeArrayList2.get(0); - if(listNode1 != null) - { - listNode3.addAll(listNode1); - } - if(pastaltNode2 != null) - { - listNode3.add(pastaltNode2); - } - } - nodeList.add(listNode3); - return nodeList; - } - - private static int[][][] actionTable; - /* { - {{-1, REDUCE, 0}, {1, SHIFT, 1}, {2, SHIFT, 2}, {3, SHIFT, 3}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, ERROR, 1}, {0, SHIFT, 16}, }, - {{-1, ERROR, 2}, {33, SHIFT, 18}, }, - {{-1, ERROR, 3}, {33, SHIFT, 20}, }, - {{-1, ERROR, 4}, {22, SHIFT, 23}, {33, SHIFT, 24}, }, - {{-1, ERROR, 5}, {4, SHIFT, 28}, }, - {{-1, ERROR, 6}, {33, SHIFT, 29}, }, - {{-1, ERROR, 7}, {8, SHIFT, 32}, }, - {{-1, ERROR, 8}, {38, ACCEPT, -1}, }, - {{-1, REDUCE, 1}, {2, SHIFT, 2}, {3, SHIFT, 3}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 2}, {2, SHIFT, 2}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 4}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 8}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 16}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 32}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 64}, }, - {{-1, ERROR, 16}, {14, SHIFT, 54}, {16, SHIFT, 55}, }, - {{-1, REDUCE, 128}, }, - {{-1, REDUCE, 135}, {29, SHIFT, 58}, }, - {{-1, ERROR, 19}, {16, SHIFT, 61}, }, - {{-1, ERROR, 20}, {17, SHIFT, 62}, }, - {{-1, REDUCE, 241}, }, - {{-1, REDUCE, 132}, {33, SHIFT, 20}, }, - {{-1, ERROR, 23}, {33, SHIFT, 64}, }, - {{-1, ERROR, 24}, {17, SHIFT, 65}, }, - {{-1, REDUCE, 245}, }, - {{-1, ERROR, 26}, {33, SHIFT, 66}, }, - {{-1, REDUCE, 138}, {22, SHIFT, 23}, {33, SHIFT, 24}, }, - {{-1, ERROR, 28}, {16, SHIFT, 68}, {33, SHIFT, 18}, }, - {{-1, ERROR, 29}, {17, SHIFT, 70}, {22, SHIFT, 71}, }, - {{-1, REDUCE, 253}, }, - {{-1, REDUCE, 175}, {33, SHIFT, 29}, }, - {{-1, ERROR, 32}, {9, SHIFT, 74}, }, - {{-1, REDUCE, 3}, {2, SHIFT, 2}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 5}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 9}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 17}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 33}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 65}, }, - {{-1, REDUCE, 6}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 10}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 18}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 34}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 66}, }, - {{-1, REDUCE, 12}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 20}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 36}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 68}, }, - {{-1, REDUCE, 24}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 40}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 72}, }, - {{-1, REDUCE, 48}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 80}, }, - {{-1, REDUCE, 96}, }, - {{-1, ERROR, 54}, {0, SHIFT, 110}, }, - {{-1, REDUCE, 129}, }, - {{-1, REDUCE, 239}, }, - {{-1, ERROR, 57}, {14, SHIFT, 54}, {16, SHIFT, 111}, }, - {{-1, ERROR, 58}, {33, SHIFT, 113}, }, - {{-1, REDUCE, 243}, }, - {{-1, REDUCE, 136}, {29, SHIFT, 58}, }, - {{-1, REDUCE, 134}, }, - {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, REDUCE, 242}, }, - {{-1, ERROR, 64}, {23, SHIFT, 129}, {29, SHIFT, 130}, {31, SHIFT, 131}, }, - {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, ERROR, 66}, {17, SHIFT, 136}, }, - {{-1, REDUCE, 246}, }, - {{-1, REDUCE, 150}, }, - {{-1, ERROR, 69}, {16, SHIFT, 137}, }, - {{-1, REDUCE, 183}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 141}, {33, SHIFT, 142}, }, - {{-1, ERROR, 71}, {31, SHIFT, 151}, }, - {{-1, ERROR, 72}, {17, SHIFT, 152}, }, - {{-1, REDUCE, 254}, }, - {{-1, ERROR, 74}, {33, SHIFT, 153}, }, - {{-1, REDUCE, 7}, {4, SHIFT, 4}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 11}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 19}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 35}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 67}, }, - {{-1, REDUCE, 13}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 21}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 37}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 69}, }, - {{-1, REDUCE, 25}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 41}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 73}, }, - {{-1, REDUCE, 49}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 81}, }, - {{-1, REDUCE, 97}, }, - {{-1, REDUCE, 14}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 22}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 38}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 70}, }, - {{-1, REDUCE, 26}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 42}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 74}, }, - {{-1, REDUCE, 50}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 82}, }, - {{-1, REDUCE, 98}, }, - {{-1, REDUCE, 28}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 44}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 76}, }, - {{-1, REDUCE, 52}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 84}, }, - {{-1, REDUCE, 100}, }, - {{-1, REDUCE, 56}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 88}, }, - {{-1, REDUCE, 104}, }, - {{-1, REDUCE, 112}, }, - {{-1, REDUCE, 131}, }, - {{-1, REDUCE, 130}, }, - {{-1, REDUCE, 240}, }, - {{-1, REDUCE, 137}, }, - {{-1, REDUCE, 244}, }, - {{-1, ERROR, 115}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, REDUCE, 163}, }, - {{-1, REDUCE, 165}, }, - {{-1, REDUCE, 166}, }, - {{-1, REDUCE, 167}, }, - {{-1, REDUCE, 162}, }, - {{-1, ERROR, 122}, {16, SHIFT, 194}, }, - {{-1, REDUCE, 153}, {28, SHIFT, 195}, }, - {{-1, REDUCE, 251}, }, - {{-1, REDUCE, 158}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, - {{-1, REDUCE, 160}, }, - {{-1, REDUCE, 161}, }, - {{-1, REDUCE, 157}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, REDUCE, 143}, }, - {{-1, ERROR, 130}, {33, SHIFT, 203}, }, - {{-1, ERROR, 131}, {33, SHIFT, 204}, }, - {{-1, REDUCE, 247}, }, - {{-1, ERROR, 133}, {23, SHIFT, 205}, {29, SHIFT, 130}, }, - {{-1, ERROR, 134}, {23, SHIFT, 207}, {29, SHIFT, 130}, }, - {{-1, ERROR, 135}, {16, SHIFT, 209}, {30, SHIFT, 210}, }, - {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, REDUCE, 151}, }, - {{-1, ERROR, 138}, {14, SHIFT, 213}, }, - {{-1, ERROR, 139}, {14, SHIFT, 214}, }, - {{-1, ERROR, 140}, {33, SHIFT, 215}, }, - {{-1, ERROR, 141}, {31, SHIFT, 216}, {33, SHIFT, 217}, }, - {{-1, REDUCE, 219}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, - {{-1, ERROR, 143}, {16, SHIFT, 219}, }, - {{-1, REDUCE, 180}, {28, SHIFT, 220}, }, - {{-1, REDUCE, 187}, }, - {{-1, REDUCE, 184}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 223}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 255}, }, - {{-1, ERROR, 148}, {12, SHIFT, 138}, {13, SHIFT, 139}, {33, SHIFT, 226}, }, - {{-1, ERROR, 149}, {33, SHIFT, 228}, }, - {{-1, REDUCE, 185}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 223}, {33, SHIFT, 142}, }, - {{-1, ERROR, 151}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {23, SHIFT, 231}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 183}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 141}, {33, SHIFT, 142}, }, - {{-1, ERROR, 153}, {17, SHIFT, 234}, }, - {{-1, REDUCE, 265}, }, - {{-1, REDUCE, 230}, {33, SHIFT, 153}, }, - {{-1, REDUCE, 15}, {5, SHIFT, 5}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 23}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 39}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 71}, }, - {{-1, REDUCE, 27}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 43}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 75}, }, - {{-1, REDUCE, 51}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 83}, }, - {{-1, REDUCE, 99}, }, - {{-1, REDUCE, 29}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 45}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 77}, }, - {{-1, REDUCE, 53}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 85}, }, - {{-1, REDUCE, 101}, }, - {{-1, REDUCE, 57}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 89}, }, - {{-1, REDUCE, 105}, }, - {{-1, REDUCE, 113}, }, - {{-1, REDUCE, 30}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 46}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 78}, }, - {{-1, REDUCE, 54}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 86}, }, - {{-1, REDUCE, 102}, }, - {{-1, REDUCE, 58}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 90}, }, - {{-1, REDUCE, 106}, }, - {{-1, REDUCE, 114}, }, - {{-1, REDUCE, 60}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 92}, }, - {{-1, REDUCE, 108}, }, - {{-1, REDUCE, 116}, }, - {{-1, REDUCE, 120}, }, - {{-1, ERROR, 191}, {24, SHIFT, 257}, {25, SHIFT, 258}, }, - {{-1, REDUCE, 160}, {15, SHIFT, 260}, }, - {{-1, ERROR, 193}, {21, SHIFT, 261}, }, - {{-1, REDUCE, 133}, }, - {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, REDUCE, 249}, }, - {{-1, REDUCE, 154}, {28, SHIFT, 195}, }, - {{-1, REDUCE, 172}, }, - {{-1, REDUCE, 171}, }, - {{-1, REDUCE, 170}, }, - {{-1, REDUCE, 159}, }, - {{-1, REDUCE, 252}, }, - {{-1, REDUCE, 147}, {31, SHIFT, 131}, }, - {{-1, REDUCE, 149}, }, - {{-1, REDUCE, 144}, }, - {{-1, ERROR, 206}, {23, SHIFT, 265}, {29, SHIFT, 130}, }, - {{-1, REDUCE, 145}, }, - {{-1, REDUCE, 248}, }, - {{-1, REDUCE, 139}, }, - {{-1, REDUCE, 156}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, ERROR, 211}, {16, SHIFT, 267}, }, - {{-1, ERROR, 212}, {16, SHIFT, 268}, {30, SHIFT, 210}, }, - {{-1, REDUCE, 228}, }, - {{-1, REDUCE, 229}, }, - {{-1, ERROR, 215}, {19, SHIFT, 270}, }, - {{-1, ERROR, 216}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {23, SHIFT, 274}, {33, SHIFT, 275}, }, - {{-1, ERROR, 217}, {23, SHIFT, 279}, }, - {{-1, REDUCE, 223}, }, - {{-1, REDUCE, 176}, }, - {{-1, REDUCE, 183}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 141}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 257}, }, - {{-1, REDUCE, 181}, {28, SHIFT, 220}, }, - {{-1, ERROR, 223}, {31, SHIFT, 216}, }, - {{-1, REDUCE, 188}, }, - {{-1, REDUCE, 186}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 223}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 220}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, - {{-1, ERROR, 227}, {33, SHIFT, 284}, }, - {{-1, REDUCE, 221}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, - {{-1, REDUCE, 189}, }, - {{-1, REDUCE, 256}, }, - {{-1, REDUCE, 178}, }, - {{-1, ERROR, 232}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {23, SHIFT, 286}, {33, SHIFT, 142}, }, - {{-1, ERROR, 233}, {16, SHIFT, 287}, }, - {{-1, REDUCE, 235}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 288}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 266}, }, - {{-1, REDUCE, 31}, {6, SHIFT, 6}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 47}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 79}, }, - {{-1, REDUCE, 55}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 87}, }, - {{-1, REDUCE, 103}, }, - {{-1, REDUCE, 59}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 91}, }, - {{-1, REDUCE, 107}, }, - {{-1, REDUCE, 115}, }, - {{-1, REDUCE, 61}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 93}, }, - {{-1, REDUCE, 109}, }, - {{-1, REDUCE, 117}, }, - {{-1, REDUCE, 121}, }, - {{-1, REDUCE, 62}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 94}, }, - {{-1, REDUCE, 110}, }, - {{-1, REDUCE, 118}, }, - {{-1, REDUCE, 122}, }, - {{-1, REDUCE, 124}, }, - {{-1, REDUCE, 173}, }, - {{-1, REDUCE, 174}, }, - {{-1, ERROR, 259}, {18, SHIFT, 115}, {20, SHIFT, 116}, {33, SHIFT, 117}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, {37, SHIFT, 121}, }, - {{-1, ERROR, 260}, {34, SHIFT, 118}, {35, SHIFT, 119}, {36, SHIFT, 120}, }, - {{-1, REDUCE, 164}, }, - {{-1, REDUCE, 155}, }, - {{-1, REDUCE, 250}, }, - {{-1, REDUCE, 148}, }, - {{-1, REDUCE, 146}, }, - {{-1, REDUCE, 152}, }, - {{-1, REDUCE, 141}, }, - {{-1, REDUCE, 140}, }, - {{-1, ERROR, 269}, {16, SHIFT, 302}, }, - {{-1, ERROR, 270}, {32, SHIFT, 303}, }, - {{-1, ERROR, 271}, {33, SHIFT, 304}, }, - {{-1, REDUCE, 201}, }, - {{-1, ERROR, 273}, {10, SHIFT, 306}, {12, SHIFT, 138}, {13, SHIFT, 139}, {19, SHIFT, 307}, {33, SHIFT, 308}, }, - {{-1, REDUCE, 191}, }, - {{-1, REDUCE, 197}, {14, SHIFT, 312}, }, - {{-1, REDUCE, 259}, }, - {{-1, ERROR, 277}, {33, SHIFT, 314}, }, - {{-1, ERROR, 278}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {23, SHIFT, 315}, {33, SHIFT, 275}, }, - {{-1, REDUCE, 218}, }, - {{-1, REDUCE, 182}, }, - {{-1, REDUCE, 258}, }, - {{-1, REDUCE, 190}, }, - {{-1, REDUCE, 224}, }, - {{-1, REDUCE, 222}, {24, SHIFT, 198}, {26, SHIFT, 199}, {27, SHIFT, 200}, }, - {{-1, REDUCE, 225}, }, - {{-1, REDUCE, 179}, }, - {{-1, REDUCE, 177}, }, - {{-1, ERROR, 288}, {33, SHIFT, 217}, }, - {{-1, REDUCE, 236}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {33, SHIFT, 142}, }, - {{-1, ERROR, 290}, {16, SHIFT, 319}, }, - {{-1, REDUCE, 232}, {28, SHIFT, 320}, }, - {{-1, REDUCE, 237}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 63}, {7, SHIFT, 7}, }, - {{-1, REDUCE, 95}, }, - {{-1, REDUCE, 111}, }, - {{-1, REDUCE, 119}, }, - {{-1, REDUCE, 123}, }, - {{-1, REDUCE, 125}, }, - {{-1, REDUCE, 126}, }, - {{-1, ERROR, 300}, {19, SHIFT, 324}, }, - {{-1, ERROR, 301}, {19, SHIFT, 325}, }, - {{-1, REDUCE, 142}, }, - {{-1, REDUCE, 227}, }, - {{-1, REDUCE, 212}, {14, SHIFT, 326}, }, - {{-1, ERROR, 305}, {20, SHIFT, 328}, }, - {{-1, ERROR, 306}, {33, SHIFT, 304}, }, - {{-1, REDUCE, 195}, }, - {{-1, REDUCE, 206}, {14, SHIFT, 312}, }, - {{-1, ERROR, 309}, {19, SHIFT, 331}, }, - {{-1, REDUCE, 202}, {29, SHIFT, 332}, }, - {{-1, ERROR, 311}, {33, SHIFT, 335}, }, - {{-1, ERROR, 312}, {33, SHIFT, 336}, }, - {{-1, REDUCE, 199}, }, - {{-1, REDUCE, 198}, {14, SHIFT, 312}, }, - {{-1, REDUCE, 192}, }, - {{-1, REDUCE, 260}, }, - {{-1, REDUCE, 226}, }, - {{-1, REDUCE, 238}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 231}, }, - {{-1, REDUCE, 235}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 140}, {22, SHIFT, 288}, {33, SHIFT, 142}, }, - {{-1, REDUCE, 267}, }, - {{-1, REDUCE, 233}, {28, SHIFT, 320}, }, - {{-1, REDUCE, 127}, }, - {{-1, REDUCE, 168}, }, - {{-1, REDUCE, 169}, }, - {{-1, ERROR, 326}, {33, SHIFT, 340}, }, - {{-1, REDUCE, 213}, }, - {{-1, ERROR, 328}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {21, SHIFT, 341}, {33, SHIFT, 275}, }, - {{-1, ERROR, 329}, {20, SHIFT, 344}, }, - {{-1, REDUCE, 208}, }, - {{-1, REDUCE, 196}, }, - {{-1, ERROR, 332}, {10, SHIFT, 306}, {12, SHIFT, 138}, {13, SHIFT, 139}, {33, SHIFT, 308}, }, - {{-1, REDUCE, 261}, }, - {{-1, REDUCE, 203}, {29, SHIFT, 332}, }, - {{-1, REDUCE, 207}, {14, SHIFT, 312}, }, - {{-1, REDUCE, 211}, }, - {{-1, REDUCE, 200}, }, - {{-1, REDUCE, 234}, }, - {{-1, REDUCE, 268}, }, - {{-1, REDUCE, 214}, }, - {{-1, REDUCE, 193}, }, - {{-1, REDUCE, 215}, {29, SHIFT, 348}, }, - {{-1, ERROR, 343}, {21, SHIFT, 351}, }, - {{-1, ERROR, 344}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {21, SHIFT, 352}, {33, SHIFT, 275}, }, - {{-1, REDUCE, 210}, }, - {{-1, REDUCE, 262}, }, - {{-1, REDUCE, 209}, }, - {{-1, ERROR, 348}, {10, SHIFT, 271}, {11, SHIFT, 272}, {12, SHIFT, 138}, {13, SHIFT, 139}, {18, SHIFT, 273}, {33, SHIFT, 275}, }, - {{-1, REDUCE, 263}, }, - {{-1, REDUCE, 216}, {29, SHIFT, 348}, }, - {{-1, REDUCE, 194}, }, - {{-1, REDUCE, 204}, }, - {{-1, ERROR, 353}, {21, SHIFT, 356}, }, - {{-1, REDUCE, 217}, }, - {{-1, REDUCE, 264}, }, - {{-1, REDUCE, 205}, }, - };*/ - private static int[][][] gotoTable; - /* { - {{-1, 8}, }, - {{-1, 9}, }, - {{-1, 17}, }, - {{-1, 56}, {57, 112}, }, - {{-1, 10}, {9, 33}, }, - {{-1, 21}, {22, 63}, }, - {{-1, 11}, {9, 34}, {10, 39}, {33, 75}, }, - {{-1, 19}, {28, 69}, }, - {{-1, 59}, {60, 114}, }, - {{-1, 12}, {9, 35}, {10, 40}, {11, 44}, {33, 76}, {34, 80}, {39, 90}, {75, 156}, }, - {{-1, 25}, {27, 67}, }, - {{-1, 26}, }, - {{-1, 132}, {134, 208}, {206, 208}, }, - {{-1, 133}, {203, 264}, }, - {{-1, 13}, {9, 36}, {10, 41}, {11, 45}, {12, 48}, {33, 77}, {34, 81}, {35, 84}, {39, 91}, {40, 94}, {44, 100}, {75, 157}, {76, 160}, {80, 166}, {90, 176}, {156, 236}, }, - {{-1, 211}, {212, 269}, }, - {{-1, 122}, {65, 135}, {116, 193}, {136, 212}, {210, 266}, }, - {{-1, 196}, {197, 263}, }, - {{-1, 123}, {195, 262}, }, - {{-1, 124}, {128, 202}, }, - {{-1, 125}, {115, 191}, {259, 300}, }, - {{-1, 126}, {115, 192}, {260, 301}, }, - {{-1, 127}, }, - {{-1, 201}, {142, 218}, {226, 283}, {228, 285}, {284, 317}, }, - {{-1, 259}, }, - {{-1, 14}, {9, 37}, {10, 42}, {11, 46}, {12, 49}, {13, 51}, {33, 78}, {34, 82}, {35, 85}, {36, 87}, {39, 92}, {40, 95}, {41, 97}, {44, 101}, {45, 103}, {48, 106}, {75, 158}, {76, 161}, {77, 163}, {80, 167}, {81, 169}, {84, 172}, {90, 177}, {91, 179}, {94, 182}, {100, 186}, {156, 237}, {157, 239}, {160, 242}, {166, 246}, {176, 251}, {236, 293}, }, - {{-1, 30}, {31, 73}, }, - {{-1, 72}, }, - {{-1, 143}, {152, 233}, }, - {{-1, 221}, {222, 281}, }, - {{-1, 144}, {220, 280}, }, - {{-1, 145}, {146, 224}, {150, 229}, {225, 282}, }, - {{-1, 342}, {216, 276}, {278, 316}, {348, 354}, }, - {{-1, 309}, }, - {{-1, 310}, {332, 345}, }, - {{-1, 333}, {334, 346}, }, - {{-1, 313}, {308, 330}, {314, 337}, {335, 347}, }, - {{-1, 305}, {306, 329}, }, - {{-1, 327}, }, - {{-1, 343}, {344, 353}, }, - {{-1, 349}, {350, 355}, }, - {{-1, 146}, {234, 289}, {320, 289}, }, - {{-1, 147}, {150, 230}, {225, 230}, {232, 230}, {292, 230}, {318, 230}, }, - {{-1, 148}, }, - {{-1, 149}, {148, 227}, {216, 277}, {273, 311}, {278, 277}, {328, 277}, {332, 311}, {344, 277}, {348, 277}, }, - {{-1, 15}, {9, 38}, {10, 43}, {11, 47}, {12, 50}, {13, 52}, {14, 53}, {33, 79}, {34, 83}, {35, 86}, {36, 88}, {37, 89}, {39, 93}, {40, 96}, {41, 98}, {42, 99}, {44, 102}, {45, 104}, {46, 105}, {48, 107}, {49, 108}, {51, 109}, {75, 159}, {76, 162}, {77, 164}, {78, 165}, {80, 168}, {81, 170}, {82, 171}, {84, 173}, {85, 174}, {87, 175}, {90, 178}, {91, 180}, {92, 181}, {94, 183}, {95, 184}, {97, 185}, {100, 187}, {101, 188}, {103, 189}, {106, 190}, {156, 238}, {157, 240}, {158, 241}, {160, 243}, {161, 244}, {163, 245}, {166, 247}, {167, 248}, {169, 249}, {172, 250}, {176, 252}, {177, 253}, {179, 254}, {182, 255}, {186, 256}, {236, 294}, {237, 295}, {239, 296}, {242, 297}, {246, 298}, {251, 299}, {293, 323}, }, - {{-1, 154}, {155, 235}, }, - {{-1, 290}, }, - {{-1, 321}, {322, 339}, }, - {{-1, 291}, {320, 338}, }, - {{-1, 57}, }, - {{-1, 22}, }, - {{-1, 60}, }, - {{-1, 27}, }, - {{-1, 134}, {133, 206}, }, - {{-1, 197}, }, - {{-1, 128}, }, - {{-1, 31}, }, - {{-1, 150}, {146, 225}, {151, 232}, {234, 292}, {289, 318}, {320, 292}, }, - {{-1, 222}, }, - {{-1, 278}, }, - {{-1, 334}, }, - {{-1, 350}, }, - {{-1, 155}, }, - {{-1, 322}, }, - };*/ - private static String[] errorMessages; - /* { - "expecting: 'Package', 'States', 'Helpers', 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", - "expecting: pkg id", - "expecting: id", - "expecting: '{', id", - "expecting: 'Tokens'", - "expecting: 'Syntax'", - "expecting: EOF", - "expecting: 'States', 'Helpers', 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", - "expecting: 'States', 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", - "expecting: 'Tokens', 'Ignored', 'Productions', 'Abstract', EOF", - "expecting: 'Ignored', 'Productions', 'Abstract', EOF", - "expecting: 'Productions', 'Abstract', EOF", - "expecting: 'Abstract', EOF", - "expecting: '.', ';'", - "expecting: ';', ','", - "expecting: ';'", - "expecting: '='", - "expecting: 'States', 'Tokens', 'Ignored', 'Productions', 'Abstract', id, EOF", - "expecting: 'Ignored', 'Productions', 'Abstract', '{', id, EOF", - "expecting: ';', id", - "expecting: '=', '{'", - "expecting: 'Abstract', id, EOF", - "expecting: 'Tree'", - "expecting: ';', '[', '(', '|', id, char, dec char, hex char, string", - "expecting: '}', ',', '->'", - "expecting: ';', '[', '(', '|', '/', id, char, dec char, hex char, string", - "expecting: 'T', 'P', ';', '[', '{', '|', id", - "expecting: '->'", - "expecting: '[', '(', id, char, dec char, hex char, string", - "expecting: '[', '(', ')', '|', id, char, dec char, hex char, string", - "expecting: ';', '[', ']', '(', ')', '+', '-', '?', '*', '|', '/', id, char, dec char, hex char, string", - "expecting: '..', ';', '[', ']', '(', ')', '+', '-', '?', '*', '|', '/', id, char, dec char, hex char, string", - "expecting: ';', ')', '|', '/'", - "expecting: ';', '[', '(', ')', '|', '/', id, char, dec char, hex char, string", - "expecting: ';', '[', '(', ')', '+', '?', '*', '|', '/', id, char, dec char, hex char, string", - "expecting: ';', '[', ']', '(', ')', '+', '?', '*', '|', '/', id, char, dec char, hex char, string", - "expecting: '}', ','", - "expecting: ';', '/'", - "expecting: '.'", - "expecting: '->', id", - "expecting: 'T', 'P', ';', '[', '{', '}', '+', '?', '*', '|', id", - "expecting: ';', '|'", - "expecting: 'T', 'P', ';', '[', '{', '}', '|', id", - "expecting: 'T', 'P', id", - "expecting: 'T', 'P', '[', '}', id", - "expecting: id, EOF", - "expecting: '+', '-'", - "expecting: '..', '+', '-'", - "expecting: ')'", - "expecting: 'T', 'P', ';', '[', '(', ')', '{', '}', '|', '/', id, char, dec char, hex char, string", - "expecting: ']'", - "expecting: 'New', 'Null', 'T', 'P', '[', '}', id", - "expecting: '}'", - "expecting: char, dec char, hex char", - "expecting: ':'", - "expecting: 'New', 'Null', 'T', 'P', '[', ')', '}', ',', id", - "expecting: 'New', 'T', 'P', ']', id", - "expecting: 'New', 'Null', 'T', 'P', '.', '[', ')', '}', ',', id", - "expecting: 'T', 'P', ';', '[', '|', id", - "expecting: '.', '('", - "expecting: '('", - "expecting: '.', ']', ','", - "expecting: ']', ','", - "expecting: 'New', 'Null', 'T', 'P', '[', ')', id", - "expecting: 'New', 'T', 'P', id", - "expecting: 'New', 'Null', 'T', 'P', '[', ']', ')', '}', ',', id", - "expecting: ')', ','", - "expecting: 'New', 'Null', 'T', 'P', '[', id", - };*/ - private static int[] errors; - /* { - 0, 1, 2, 2, 3, 4, 2, 5, 6, 7, 8, 9, 10, 11, 12, 6, 13, 7, 14, 15, 16, 17, 17, 2, 16, 18, 2, 18, 19, 20, 21, 21, 22, 8, 9, 10, 11, 12, 6, 9, 10, 11, 12, 6, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 1, 7, 13, 13, 2, 14, 14, 9, 23, 17, 24, 25, 16, 18, 11, 15, 26, 27, 16, 21, 2, 9, 10, 11, 12, 6, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 13, 7, 13, 14, 14, 28, 29, 30, 31, 31, 31, 30, 15, 32, 33, 34, 35, 30, 33, 2, 2, 2, 36, 36, 36, 37, 25, 11, 38, 38, 2, 39, 40, 15, 41, 41, 26, 42, 43, 2, 26, 44, 26, 16, 45, 45, 10, 11, 12, 6, 11, 12, 6, 12, 6, 6, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 12, 6, 6, 6, 6, 46, 47, 48, 17, 33, 32, 32, 49, 49, 49, 33, 33, 24, 36, 2, 36, 2, 36, 18, 23, 15, 37, 2, 2, 50, 51, 52, 42, 21, 26, 41, 41, 27, 41, 26, 40, 2, 40, 41, 42, 16, 44, 15, 26, 45, 11, 12, 6, 12, 6, 6, 12, 6, 6, 6, 12, 6, 6, 6, 6, 12, 6, 6, 6, 6, 6, 28, 28, 28, 53, 30, 32, 32, 36, 2, 15, 18, 18, 15, 54, 2, 55, 56, 41, 57, 51, 2, 51, 26, 41, 41, 41, 42, 40, 42, 16, 21, 2, 58, 15, 41, 58, 12, 6, 6, 6, 6, 6, 6, 50, 50, 18, 43, 59, 60, 2, 55, 61, 50, 62, 2, 2, 55, 57, 41, 51, 42, 58, 45, 26, 41, 41, 6, 30, 30, 2, 60, 63, 60, 62, 55, 64, 62, 62, 61, 65, 55, 41, 41, 60, 55, 66, 48, 63, 62, 62, 62, 67, 66, 66, 55, 62, 48, 66, 66, 62, - };*/ - - static - { - try - { - DataInputStream s = new DataInputStream( - new BufferedInputStream( - Parser.class.getResourceAsStream("parser.dat"))); - - // read actionTable - int length = s.readInt(); - actionTable = new int[length][][]; - for(int i = 0; i < actionTable.length; i++) - { - length = s.readInt(); - actionTable[i] = new int[length][3]; - for(int j = 0; j < actionTable[i].length; j++) - { - for(int k = 0; k < 3; k++) - { - actionTable[i][j][k] = s.readInt(); - } - } - } - - // read gotoTable - length = s.readInt(); - gotoTable = new int[length][][]; - for(int i = 0; i < gotoTable.length; i++) - { - length = s.readInt(); - gotoTable[i] = new int[length][2]; - for(int j = 0; j < gotoTable[i].length; j++) - { - for(int k = 0; k < 2; k++) - { - gotoTable[i][j][k] = s.readInt(); - } - } - } - - // read errorMessages - length = s.readInt(); - errorMessages = new String[length]; - for(int i = 0; i < errorMessages.length; i++) - { - length = s.readInt(); - StringBuffer buffer = new StringBuffer(); - - for(int j = 0; j < length; j++) - { - buffer.append(s.readChar()); - } - errorMessages[i] = buffer.toString(); - } - - // read errors - length = s.readInt(); - errors = new int[length]; - for(int i = 0; i < errors.length; i++) - { - errors[i] = s.readInt(); - } - - s.close(); - } - catch(Exception e) - { - throw new RuntimeException("The file \"parser.dat\" is either missing or corrupted."); - } - } + InputStream resStream = Parser.class.getResourceAsStream("parser.dat"); + if(resStream == null) + { + throw new RuntimeException("The file \"parser.dat\" is missing."); + } + DataInputStream s = new DataInputStream(new BufferedInputStream(resStream)); + + // read actionTable + int length = s.readInt(); + Parser.actionTable = new int[length][][]; + for(int i = 0; i < Parser.actionTable.length; i++) + { + length = s.readInt(); + Parser.actionTable[i] = new int[length][3]; + for(int j = 0; j < Parser.actionTable[i].length; j++) + { + for(int k = 0; k < 3; k++) + { + Parser.actionTable[i][j][k] = s.readInt(); + } + } + } + + // read gotoTable + length = s.readInt(); + gotoTable = new int[length][][]; + for(int i = 0; i < gotoTable.length; i++) + { + length = s.readInt(); + gotoTable[i] = new int[length][2]; + for(int j = 0; j < gotoTable[i].length; j++) + { + for(int k = 0; k < 2; k++) + { + gotoTable[i][j][k] = s.readInt(); + } + } + } + + // read errorMessages + length = s.readInt(); + errorMessages = new String[length]; + for(int i = 0; i < errorMessages.length; i++) + { + length = s.readInt(); + StringBuilder buffer = new StringBuilder(); + + for(int j = 0; j < length; j++) + { + buffer.append(s.readChar()); + } + errorMessages[i] = buffer.toString(); + } + + // read errors + length = s.readInt(); + errors = new int[length]; + for(int i = 0; i < errors.length; i++) + { + errors[i] = s.readInt(); + } + + s.close(); + } + catch(IOException e) + { + throw new RuntimeException("The file \"parser.dat\" is either missing or corrupted.", e); + } + } } diff --git a/src/main/java/org/sablecc/sablecc/parser/ParserException.java b/src/main/java/org/sablecc/sablecc/parser/ParserException.java index da9525f3f358b2a190eaf50061eab78ed50437dd..518b8ecd4692c662aa3427323fd33837131eacec 100644 --- a/src/main/java/org/sablecc/sablecc/parser/ParserException.java +++ b/src/main/java/org/sablecc/sablecc/parser/ParserException.java @@ -4,18 +4,32 @@ package org.sablecc.sablecc.parser; import org.sablecc.sablecc.node.*; +@SuppressWarnings("serial") public class ParserException extends Exception { - Token token; + Token token; + String realMsg; - public ParserException(Token token, String message) - { - super(message); - this.token = token; - } + public ParserException(Token token, String message) + { + super(message); + this.token = token; + } - public Token getToken() - { - return token; - } + public ParserException(Token token, String prefix, String message) + { + super(prefix+message); + this.realMsg = message; + this.token = token; + } + + public Token getToken() + { + return this.token; + } + + public String getRealMsg() + { + return this.realMsg; + } } diff --git a/src/main/java/org/sablecc/sablecc/parser/State.java b/src/main/java/org/sablecc/sablecc/parser/State.java index 1807f8ca36e358e81dc214363c0c20aa2829ff7e..0673a4159937727a5bd3f1edf72580434afb0a16 100644 --- a/src/main/java/org/sablecc/sablecc/parser/State.java +++ b/src/main/java/org/sablecc/sablecc/parser/State.java @@ -2,16 +2,16 @@ package org.sablecc.sablecc.parser; -import java.util.ArrayList; +import java.util.List; final class State { - int state; - ArrayList nodes; + int state; + List<Object> nodes; // elements are of type Node or List<Node> - State(int state, ArrayList nodes) - { - this.state = state; - this.nodes = nodes; - } + State(int state, List<Object> nodes) + { + this.state = state; + this.nodes = nodes; + } } diff --git a/src/main/java/org/sablecc/sablecc/parser/TokenIndex.java b/src/main/java/org/sablecc/sablecc/parser/TokenIndex.java index 088f9486c7db1359716e764f9741f8e50af16d88..1876b21bd095f7f27fb0405c5c3efcb5a931ffa3 100644 --- a/src/main/java/org/sablecc/sablecc/parser/TokenIndex.java +++ b/src/main/java/org/sablecc/sablecc/parser/TokenIndex.java @@ -7,200 +7,239 @@ import org.sablecc.sablecc.analysis.*; class TokenIndex extends AnalysisAdapter { - int index; - - public void caseTPkgId(TPkgId node) - { - index = 0; - } - - public void caseTPackage(TPackage node) - { - index = 1; - } - - public void caseTStates(TStates node) - { - index = 2; - } - - public void caseTHelpers(THelpers node) - { - index = 3; - } - - public void caseTTokens(TTokens node) - { - index = 4; - } - - public void caseTIgnored(TIgnored node) - { - index = 5; - } - - public void caseTProductions(TProductions node) - { - index = 6; - } - - public void caseTAbstract(TAbstract node) - { - index = 7; - } - - public void caseTSyntax(TSyntax node) - { - index = 8; - } - - public void caseTTree(TTree node) - { - index = 9; - } - - public void caseTNew(TNew node) - { - index = 10; - } - - public void caseTNull(TNull node) - { - index = 11; - } - - public void caseTTokenSpecifier(TTokenSpecifier node) - { - index = 12; - } - - public void caseTProductionSpecifier(TProductionSpecifier node) - { - index = 13; - } - - public void caseTDot(TDot node) - { - index = 14; - } - - public void caseTDDot(TDDot node) - { - index = 15; - } - - public void caseTSemicolon(TSemicolon node) - { - index = 16; - } - - public void caseTEqual(TEqual node) - { - index = 17; - } - - public void caseTLBkt(TLBkt node) - { - index = 18; - } - - public void caseTRBkt(TRBkt node) - { - index = 19; - } - - public void caseTLPar(TLPar node) - { - index = 20; - } - - public void caseTRPar(TRPar node) - { - index = 21; - } - - public void caseTLBrace(TLBrace node) - { - index = 22; - } - - public void caseTRBrace(TRBrace node) - { - index = 23; - } - - public void caseTPlus(TPlus node) - { - index = 24; - } - - public void caseTMinus(TMinus node) - { - index = 25; - } - - public void caseTQMark(TQMark node) - { - index = 26; - } - - public void caseTStar(TStar node) - { - index = 27; - } - - public void caseTBar(TBar node) - { - index = 28; - } - - public void caseTComma(TComma node) - { - index = 29; - } - - public void caseTSlash(TSlash node) - { - index = 30; - } - - public void caseTArrow(TArrow node) - { - index = 31; - } - - public void caseTColon(TColon node) - { - index = 32; - } - - public void caseTId(TId node) - { - index = 33; - } - - public void caseTChar(TChar node) - { - index = 34; - } - - public void caseTDecChar(TDecChar node) - { - index = 35; - } - - public void caseTHexChar(THexChar node) - { - index = 36; - } - - public void caseTString(TString node) - { - index = 37; - } - - public void caseEOF(EOF node) - { - index = 38; - } + int index; + + @Override + public void caseTPkgId(TPkgId node) + { + this.index = 0; + } + + @Override + public void caseTPackage(TPackage node) + { + this.index = 1; + } + + @Override + public void caseTStates(TStates node) + { + this.index = 2; + } + + @Override + public void caseTHelpers(THelpers node) + { + this.index = 3; + } + + @Override + public void caseTTokens(TTokens node) + { + this.index = 4; + } + + @Override + public void caseTIgnored(TIgnored node) + { + this.index = 5; + } + + @Override + public void caseTProductions(TProductions node) + { + this.index = 6; + } + + @Override + public void caseTAbstract(TAbstract node) + { + this.index = 7; + } + + @Override + public void caseTSyntax(TSyntax node) + { + this.index = 8; + } + + @Override + public void caseTTree(TTree node) + { + this.index = 9; + } + + @Override + public void caseTNew(TNew node) + { + this.index = 10; + } + + @Override + public void caseTNull(TNull node) + { + this.index = 11; + } + + @Override + public void caseTTokenSpecifier(TTokenSpecifier node) + { + this.index = 12; + } + + @Override + public void caseTProductionSpecifier(TProductionSpecifier node) + { + this.index = 13; + } + + @Override + public void caseTDot(TDot node) + { + this.index = 14; + } + + @Override + public void caseTDDot(TDDot node) + { + this.index = 15; + } + + @Override + public void caseTSemicolon(TSemicolon node) + { + this.index = 16; + } + + @Override + public void caseTEqual(TEqual node) + { + this.index = 17; + } + + @Override + public void caseTLBkt(TLBkt node) + { + this.index = 18; + } + + @Override + public void caseTRBkt(TRBkt node) + { + this.index = 19; + } + + @Override + public void caseTLPar(TLPar node) + { + this.index = 20; + } + + @Override + public void caseTRPar(TRPar node) + { + this.index = 21; + } + + @Override + public void caseTLBrace(TLBrace node) + { + this.index = 22; + } + + @Override + public void caseTRBrace(TRBrace node) + { + this.index = 23; + } + + @Override + public void caseTPlus(TPlus node) + { + this.index = 24; + } + + @Override + public void caseTMinus(TMinus node) + { + this.index = 25; + } + + @Override + public void caseTQMark(TQMark node) + { + this.index = 26; + } + + @Override + public void caseTStar(TStar node) + { + this.index = 27; + } + + @Override + public void caseTBar(TBar node) + { + this.index = 28; + } + + @Override + public void caseTComma(TComma node) + { + this.index = 29; + } + + @Override + public void caseTSlash(TSlash node) + { + this.index = 30; + } + + @Override + public void caseTArrow(TArrow node) + { + this.index = 31; + } + + @Override + public void caseTColon(TColon node) + { + this.index = 32; + } + + @Override + public void caseTId(TId node) + { + this.index = 33; + } + + @Override + public void caseTChar(TChar node) + { + this.index = 34; + } + + @Override + public void caseTDecChar(TDecChar node) + { + this.index = 35; + } + + @Override + public void caseTHexChar(THexChar node) + { + this.index = 36; + } + + @Override + public void caseTString(TString node) + { + this.index = 37; + } + + @Override + public void caseEOF(EOF node) + { + this.index = 38; + } } diff --git a/src/main/resources/org/sablecc/sablecc/alternatives.txt b/src/main/resources/org/sablecc/sablecc/alternatives.txt index cf6e4952d37a198f84371eabca9a69e559af7bee..eb1569cd445760238f281c1b10430881090760ad 100644 --- a/src/main/resources/org/sablecc/sablecc/alternatives.txt +++ b/src/main/resources/org/sablecc/sablecc/alternatives.txt @@ -21,7 +21,7 @@ $ Macro:AlternativeHeader2 import $0$.*; - + public final class $1$ extends $2$ { @@ -78,30 +78,36 @@ $ Macro:CloneHeader - @Override - public Object clone() + public $0$($0$ node) { - return new $0$( + super(node); + $ Macro:CloneBodyNode + set$0$(cloneNode(node._$1$_)); - cloneNode(this._$1$_)$2$ $ Macro:CloneBodyList + set$0$(cloneList(node._$1$_)); - cloneList(this._$0$_)$1$ $ Macro:CloneTail -); + } + + @Override + public $0$ clone() + { + return new $0$(this); } $ Macro:Apply + @Override public void apply(Switch sw) { ((Analysis) sw).case$0$(this); @@ -147,8 +153,12 @@ Macro:GetSetList public void set$0$(List<$2$> list) { + for($2$ e : this._$1$_) + { + e.parent(null); + } this._$1$_.clear(); - this._$1$_.addAll(list); + for($2$ e : list) { if(e.parent() != null) @@ -157,6 +167,7 @@ Macro:GetSetList } e.parent(this); + this._$1$_.add(e); } } @@ -189,7 +200,7 @@ $ Macro:RemoveChildHeader @Override - void removeChild( Node child) + void removeChild(Node child) { // Remove child @@ -223,7 +234,7 @@ $ Macro:ReplaceChildHeader @Override - void replaceChild( Node oldChild, Node newChild) + void replaceChild(Node oldChild, Node newChild) { // Replace child diff --git a/src/main/resources/org/sablecc/sablecc/analyses.txt b/src/main/resources/org/sablecc/sablecc/analyses.txt index 5c0e344f8fb6cf9e767a234d4a817015ce0d0be5..f7c37c0826aa1b0b0a0d42521e32f4b83c8038cd 100644 --- a/src/main/resources/org/sablecc/sablecc/analyses.txt +++ b/src/main/resources/org/sablecc/sablecc/analyses.txt @@ -14,9 +14,28 @@ import $1$.*; public interface Analysis extends Switch { + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated Object getIn(Node node); + + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated void setIn(Node node, Object o); + + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated Object getOut(Node node); + + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated void setOut(Node node, Object o); @@ -47,9 +66,23 @@ import $1$.*; public class AnalysisAdapter implements Analysis { + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated private Hashtable<Node,Object> in; + + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated private Hashtable<Node,Object> out; + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override public Object getIn(Node node) { if(this.in == null) @@ -60,6 +93,11 @@ public class AnalysisAdapter implements Analysis return this.in.get(node); } + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override public void setIn(Node node, Object o) { if(this.in == null) @@ -77,6 +115,11 @@ public class AnalysisAdapter implements Analysis } } + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override public Object getOut(Node node) { if(this.out == null) @@ -87,6 +130,11 @@ public class AnalysisAdapter implements Analysis return this.out.get(node); } + /** + * @deprecated If you need a map field, declare it yourself. + */ + @Deprecated + @Override public void setOut(Node node, Object o) { if(this.out == null) @@ -108,6 +156,7 @@ $ Macro:AnalysisAdapterStart + @Override public void caseStart(Start node) { defaultCase(node); @@ -117,6 +166,7 @@ $ Macro:AnalysisAdapterBody + @Override public void case$0$($0$ node) { defaultCase(node); @@ -126,12 +176,13 @@ $ Macro:AnalysisAdapterTail + @Override public void caseEOF(EOF node) { defaultCase(node); } - public void defaultCase( Node node) + public void defaultCase(Node node) { // do nothing } @@ -162,12 +213,12 @@ public class DepthFirstAdapter extends AnalysisAdapter defaultOut(node); } - public void defaultIn( Node node) + public void defaultIn(Node node) { // Do nothing } - public void defaultOut( Node node) + public void defaultOut(Node node) { // Do nothing } @@ -206,12 +257,12 @@ public class ReversedDepthFirstAdapter extends AnalysisAdapter defaultOut(node); } - public void defaultIn( Node node) + public void defaultIn(Node node) { // Do nothing } - public void defaultOut( Node node) + public void defaultOut(Node node) { // Do nothing } diff --git a/src/main/resources/org/sablecc/sablecc/lexer.txt b/src/main/resources/org/sablecc/sablecc/lexer.txt index 776e506a9709555c720fe4951860e05608c8e95b..f9ccfb2dc96c980fd734deab2f20a2373e584280 100644 --- a/src/main/resources/org/sablecc/sablecc/lexer.txt +++ b/src/main/resources/org/sablecc/sablecc/lexer.txt @@ -32,7 +32,7 @@ import $1$.*; import de.hhu.stups.sablecc.patch.*; import java.util.concurrent.LinkedBlockingQueue; -@SuppressWarnings({"unused"}) +@SuppressWarnings({"unused"}) public class Lexer implements ITokenListContainer { protected Token token; @@ -43,32 +43,30 @@ public class Lexer implements ITokenListContainer protected int pos; private boolean cr; private boolean eof; - private final StringBuffer text = new StringBuffer(); - - private List<IToken> tokenList; - private final Queue<IToken> nextList = new LinkedBlockingQueue<IToken>(); + private final StringBuilder text = new StringBuilder(); - private IToken tok; + private List<IToken> tokenList; + private final Queue<IToken> nextList = new LinkedBlockingQueue<IToken>(); public Queue<IToken> getNextList() { return nextList; } - public List<IToken> getTokenList() { - return tokenList; - } - - private void setToken(Token t) { - tok = t; - token = t; - } - - - public void setTokenList(final List<IToken> list) { - tokenList = list; - } - - + @Override + public List<IToken> getTokenList() { + return tokenList; + } + + private void setToken(Token t) { + token = t; + } + + + public void setTokenList(final List<IToken> list) { + tokenList = list; + } + + protected void filter() throws LexerException, IOException { // Do nothing @@ -76,20 +74,20 @@ public class Lexer implements ITokenListContainer protected void filterWrap() throws LexerException, IOException { - filter(); - if (token != null) { - getTokenList().add(token); - nextList.add(token); - } + filter(); + if (token != null) { + getTokenList().add(token); + nextList.add(token); + } } - public Lexer( PushbackReader in) + public Lexer(PushbackReader in) { this.in = in; - setTokenList(new ArrayList<IToken>()); + setTokenList(new ArrayList<IToken>()); } - + public Token peek() throws LexerException, IOException { while(this.token == null) @@ -139,28 +137,28 @@ public class Lexer implements ITokenListContainer { switch(c) { - case 10: - if(this.cr) - { - this.cr = false; - } - else - { + case 10: + if(this.cr) + { + this.cr = false; + } + else + { + this.line++; + this.pos = 0; + } + break; + case 13: + case 8232: // Unicode line separator + case 8233: // Unicode paragraph separator this.line++; this.pos = 0; - } - break; - case 13: - case 8232: // Unicode line separator - case 8233: // Unicode paragraph separator - this.line++; - this.pos = 0; - this.cr = true; - break; - default: - this.pos++; - this.cr = false; - break; + this.cr = true; + break; + default: + this.pos++; + this.cr = false; + break; } this.text.append((char) c); @@ -179,7 +177,7 @@ public class Lexer implements ITokenListContainer // an entry {Low, Up, Id} -> means if Low <= c <= Up -> goto state Id while(low <= high) { - int middle = (low + high) / 2; + int middle = (low + high) >>> 1; int[] tmp2 = tmp1[middle]; if(c < tmp2[0]) @@ -224,9 +222,9 @@ public class Lexer implements ITokenListContainer $ Macro:LexerVariableToken - case $0$: + case $0$: { - Token token = new$0$( + Token token = new$0$( getText(accept_length), start_line + 1, start_pos + 1); @@ -237,9 +235,9 @@ Macro:LexerVariableToken $ Macro:LexerFixedToken - case $0$: + case $0$: { - Token token = new$0$( + Token token = new$0$( start_line + 1, start_pos + 1); pushBack(accept_length); @@ -282,7 +280,7 @@ Macro:LexerBody1 " Unknown token: " + this.text); } - EOF token = new EOF( + EOF token = new EOF( start_line + 1, start_pos + 1); return token; @@ -295,12 +293,12 @@ Macro:LexerBody1 $ Macro:LexerNewVariableToken - Token new$0$( String text, int line, int pos) { return new $1$(text, line, pos); } + Token new$0$(String text, int line, int pos) { return new $1$(text, line, pos); } $ Macro:LexerNewFixedToken - Token new$0$( int line, int pos) { return new $1$(line, pos); } + Token new$0$(int line, int pos) { return new $1$(line, pos); } $ @@ -334,9 +332,9 @@ Macro:LexerBody2 } } - protected void unread( Token token) throws IOException + protected void unread(Token token) throws IOException { - String text = token.getText(); + String text = token.getText(); int length = text.length(); for(int i = length - 1; i >= 0; i--) @@ -352,13 +350,7 @@ Macro:LexerBody2 private String getText(int acceptLength) { - StringBuffer s = new StringBuffer(acceptLength); - for(int i = 0; i < acceptLength; i++) - { - s.append(this.text.charAt(i)); - } - - return s.toString(); + return this.text.substring(0, acceptLength); } private static int[][][][] gotoTable; @@ -395,7 +387,7 @@ Macro:LexerStateTail private int id; - private State( int id) + private State(int id) { this.id = id; } @@ -410,13 +402,16 @@ $ Macro:LexerTail - static + static { try { - DataInputStream s = new DataInputStream( - new BufferedInputStream( - Lexer.class.getResourceAsStream("lexer.dat"))); + InputStream resStream = Lexer.class.getResourceAsStream("lexer.dat"); + if(resStream == null) + { + throw new RuntimeException("The file \"lexer.dat\" is missing."); + } + DataInputStream s = new DataInputStream(new BufferedInputStream(resStream)); // read gotoTable int length = s.readInt(); @@ -454,9 +449,9 @@ Macro:LexerTail s.close(); } - catch(Exception e) + catch(IOException e) { - throw new RuntimeException("The file \"lexer.dat\" is either missing or corrupted."); + throw new RuntimeException("The file \"lexer.dat\" is either missing or corrupted.", e); } } } diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt index 8d1dc232c77fce1985f3083ea3ad094acbfa4032..d6d876b18ead8e26bf711fa9d343eb7fc296c64f 100644 --- a/src/main/resources/org/sablecc/sablecc/parser.txt +++ b/src/main/resources/org/sablecc/sablecc/parser.txt @@ -19,15 +19,16 @@ import de.hhu.stups.sablecc.patch.*; import java.io.DataInputStream; import java.io.BufferedInputStream; +import java.io.InputStream; import java.io.IOException; @SuppressWarnings({"rawtypes","unchecked","unused"}) public class Parser implements IParser { - protected ArrayList nodeList; + protected List<Object> nodeList; private final Lexer lexer; - private final ListIterator stack = new LinkedList().listIterator(); + private final ListIterator<State> stack = new LinkedList<State>().listIterator(); private int last_pos; private int last_line; private Token last_token; @@ -38,159 +39,133 @@ public class Parser implements IParser private final static int REDUCE = 1; private final static int ACCEPT = 2; private final static int ERROR = 3; - - protected ArrayList firstPopped = null; - protected ArrayList lastPopped = null; - private ITokenListContainer lex; - public Parser( Lexer lexer) + public Parser(Lexer lexer) { this.lexer = lexer; - this.lex = lexer; } - - - private Map<PositionedNode, SourcecodeRange> mapping = new HashMap<PositionedNode, SourcecodeRange>(); - public Map<PositionedNode, SourcecodeRange> getMapping() { return this.mapping; } - protected void checkResult(Object elementToCheck) { - checkResult(elementToCheck, false); + + private Map<PositionedNode, SourcecodeRange> mapping = new HashMap<PositionedNode, SourcecodeRange>(); + @Override + public Map<PositionedNode, SourcecodeRange> getMapping() { return this.mapping; } + + private void checkResult(Object elementToCheck, List<Object> beginNodeList, List<Object> endNodeList) { + if (elementToCheck instanceof List<?>) { + /* + * special case: this is a list of nodes, for example an identifier + * list, so we don't want to check the list but the last element + * added to it + */ + final List<?> nodeList = (List<?>) elementToCheck; + + if (nodeList.size() > 0) { + elementToCheck = nodeList.get(nodeList.size() - 1); + } else { + // no positions for empty lists... + return; + } + } + + final PositionedNode node = (PositionedNode) elementToCheck; + + if (!this.getMapping().containsKey(node)) { + PositionedNode beginNode = findBeginNode(beginNodeList); + final int begin; + if (beginNode == null) { + /* + * Sometimes (haven't found out why) we get empty list here. In + * the only observed cases we were looking for the source range + * of the whole parse unit. Then the index is 0. + */ + beginNode = (PositionedNode)this.lexer.getTokenList().get(0); + begin = 0; + } else { + begin = findBeginPos(beginNode); + } + + PositionedNode endNode = findEndNode(endNodeList); + int end = findEndPos(endNode); + if (end == -1) end = begin; + final SourcecodeRange range = new SourcecodeRange(begin, end); + + this.getMapping().put(node, range); + + node.setStartPos(beginNode.getStartPos()); + node.setEndPos(endNode.getEndPos()); + } + } + + private PositionedNode findBeginNode(final List<Object> list) { + Object first = list.get(0); + if (first instanceof List<?>) { + List<?> list2 = (List<?>) first; + + if (list2.size() > 0) { + return (PositionedNode)list2.get(0); + } else { + return null; + } + } + + return (PositionedNode)first; + } + + private int findBeginPos(final PositionedNode node) { + if (node instanceof IToken) { + return findIndex((IToken) node); + } + + return this.getMapping().get(node).getBeginIndex(); + } + + private PositionedNode findEndNode(final List<Object> list) { + Object last = list.get(list.size() - 1); + if (last instanceof List<?>) { + final List<?> list2 = (List<?>) last; + return (PositionedNode)list2.get(list2.size() - 1); + } + + return (PositionedNode)last; + } + + private int findEndPos(final PositionedNode node) { + if (node instanceof IToken) { + return findIndex((IToken) node); + } + + final SourcecodeRange item = this.getMapping().get(node); + if (item == null) { + return -1; + } + return item.getEndIndex(); + } + + private int findIndex(final IToken token) { + final List<IToken> list = this.lexer.getTokenList(); + + for (int i = list.size() - 1; i >= 0; i--) { + if (list.get(i) == token) { + return i; + } + } + + return -1; + } + + /** + * @deprecated Overriding this method no longer has any effect. This optimization is now applied automatically iff it is safe. + */ + @Deprecated + protected boolean addElementsFromListToNewList(String productionRuleAsString) { + return true; } - - protected void checkResult(Object elementToCheck, boolean slurp) { - // nodes with no tokens or sub nodes at all may exist - if (this.firstPopped == null) { - return; - } - - if (elementToCheck instanceof LinkedList) { - /* - * special case: this is a list of nodes, for example an identifier - * list, so we don't want to check the list but the last element - * added to it - */ - final LinkedList nodeList = (LinkedList) elementToCheck; - - if (nodeList.size() > 0) { - elementToCheck = nodeList.get(nodeList.size() - 1); - } else { - // no positions for empty lists... - return; - } - } - - if (!(elementToCheck instanceof PositionedNode)) { - throw new Error( - "Unexpected elementToCheck (not instanceof PositionedNode): " - + elementToCheck.getClass().getSimpleName() + "/" - + elementToCheck); - } - - if (!this.getMapping().containsKey(elementToCheck) || slurp ) { - final PositionedNode node = (PositionedNode) elementToCheck; - - // dealing with a one-token element - if (this.lastPopped == null) { - this.lastPopped = this.firstPopped; - } - - final int begin = findBeginPos(this.lastPopped, node); - int end = findEndPos(this.firstPopped); - if (end == -1) end = begin; - final SourcecodeRange range = new SourcecodeRange(begin, end); - - this.getMapping().put(node, range); - - node.setStartPos(createBeginPos(begin)); - node.setEndPos(createEndPos(end)); - } - } - - - protected int findBeginPos(final ArrayList list, - PositionedNode n) { - Object first = list.get(0); - if (!(first instanceof PositionedNode) && !(first instanceof IToken)) { - List list2 = (List) first; - - if (list2.size() > 0) { - first = list2.get(0); - } else { - /* - * Sometimes (haven't found out why) we get empty list here. In - * the only observed cases we were looking for the source range - * of the whole parse unit. Then the index is 0. - */ - return 0; - } - } - - if (first instanceof IToken) { - return findIndex((IToken) first); - } - - final PositionedNode node = (PositionedNode) first; - final SourcecodeRange item = this.getMapping().get(node); - if (item == null){ - System.err.println(n.getClass().getSimpleName() + " / " + node.getClass().getSimpleName() + ": " + node); - } - return item.getBeginIndex(); - } - - - protected int findEndPos(final ArrayList list) { - Object last = list.get(list.size() - 1); - if (!(last instanceof PositionedNode) && !(last instanceof IToken)) { - final List list2 = (List) last; - last = list2.get(list2.size() - 1); - } - - if (last instanceof IToken) { - return findIndex((IToken) last); - } - - final PositionedNode node = (PositionedNode) last; - final SourcecodeRange item = this.getMapping().get(node); - if (item == null) - return -1; - return item.getEndIndex(); - } - - protected int findIndex(final IToken token) { - final List<IToken> list = this.lex.getTokenList(); - - for (int i = list.size() - 1; i >= 0; i--) { - if (list.get(i) == token) { - return i; - } - } - - return -1; - } - - protected SourcePosition createBeginPos(final int index) { - final List<IToken> list = this.lex.getTokenList(); - final IToken token = list.get(index); - return new SourcePosition(token.getLine(), token.getPos()); - } - - protected SourcePosition createEndPos(final int index) { - final List<IToken> list = this.lex.getTokenList(); - final IToken token = list.get(index); - return new SourcePosition(token.getLine(), token.getPos() - + token.getText().length()); - } - - protected boolean addElementsFromListToNewList(String productionRuleAsString) { - return true; - } - $ Macro:ParserInliningPushHeader - - private void push(int numstate, ArrayList listNode) throws ParserException, LexerException, IOException + + private void push(int numstate, List<Object> listNode) throws ParserException, LexerException, IOException { this.nodeList = listNode; @@ -203,7 +178,7 @@ Macro:ParserNoInliningPushHeader // Empty body } - private void push(int numstate, ArrayList listNode, boolean hidden) throws ParserException, LexerException, IOException + private void push(int numstate, List<Object> listNode, boolean hidden) throws ParserException, LexerException, IOException { this.nodeList = listNode; @@ -222,7 +197,7 @@ Macro:ParserCommon return; } - State s = (State) this.stack.next(); + State s = this.stack.next(); s.state = numstate; s.nodes = this.nodeList; } @@ -236,7 +211,7 @@ Macro:ParserCommon while(low <= high) { - int middle = (low + high) / 2; + int middle = (low + high) >>> 1; if(state < gotoTable[index][middle][0]) { @@ -258,20 +233,14 @@ Macro:ParserCommon private int state() { - State s = (State) this.stack.previous(); + State s = this.stack.previous(); this.stack.next(); return s.state; } - protected ArrayList pop() + private List<Object> pop() { - ArrayList list = ((State) this.stack.previous()).nodes; - if (this.firstPopped == null) { - this.firstPopped = list; - } else { - this.lastPopped = list; - } - return list; + return this.stack.previous().nodes; } private int index(Switchable token) @@ -281,11 +250,11 @@ Macro:ParserCommon return this.converter.index; } - + public Start parse() throws ParserException, LexerException, IOException { - this.getMapping().clear(); - + this.getMapping().clear(); + push(0, null$0$); while(true) { @@ -308,7 +277,7 @@ Macro:ParserCommon while(low <= high) { - int middle = (low + high) / 2; + int middle = (low + high) >>> 1; if(index < Parser.actionTable[state()][middle][0]) { @@ -329,12 +298,12 @@ Macro:ParserCommon switch(this.action[0]) { case SHIFT: - { - ArrayList list = new ArrayList(); - list.add(this.lexer.next()); - push(this.action[1], list$1$); - } - break; + { + List<Object> list = new ArrayList<Object>(); + list.add(this.lexer.next()); + push(this.action[1], list$1$); + } + break; case REDUCE: switch(this.action[1]) { @@ -342,22 +311,22 @@ Macro:ParserCommon $ Macro:ParserInliningReduce - case $0$: /* reduce $2$ */ - { - ArrayList list = new$0$(); - push(goTo($1$), list); - } - break; + case $0$: /* reduce $2$ */ + { + List<Object> list = new$0$(); + push(goTo($1$), list); + } + break; $ Macro:ParserNoInliningReduce - case $0$: /* reduce $3$ */ - { - ArrayList list = new$0$(); - push(goTo($1$), list, $2$); - } - break; + case $0$: /* reduce $3$ */ + { + List<Object> list = new$0$(); + push(goTo($1$), list, $2$); + } + break; $ @@ -365,12 +334,12 @@ Macro:ParserParseTail } break; case ACCEPT: - { - EOF node2 = (EOF) this.lexer.next(); - $0$ node1 = ($0$) pop().get(0); - Start node = new Start(node1, node2); - return node; - } + { + EOF node2 = (EOF) this.lexer.next(); + $0$ node1 = ($0$) pop().get(0); + Start node = new Start(node1, node2); + return node; + } case ERROR: throw new ParserException(this.last_token, "[" + this.last_line + "," + this.last_pos + "] " , @@ -385,24 +354,21 @@ $ Macro:ParserNewHeader - - protected ArrayList new$0$() /* reduce $1$ */ + + private List<Object> new$0$() /* reduce $1$ */ { - this.firstPopped = null; - this.lastPopped = null; - final boolean addElementsToNewList = addElementsFromListToNewList("$1$"); - ArrayList nodeList = new ArrayList(); + List<Object> nodeList = new ArrayList<>(); $ Macro:ParserNewBodyDecl - ArrayList nodeArrayList$0$ = pop(); + List<Object> nodeArrayList$0$ = pop(); $ Macro:ParserNewBodyDeclNull - ArrayList nodeArrayList$0$ = null; + List<Object> nodeArrayList$0$ = null; $ @@ -427,11 +393,6 @@ Macro:ParserListVariableDeclaration $ -Macro:ParserNullVariableDeclaration - Object nullNode$0$ = null; - -$ - Macro:ParserSimpleTerm $0$Node$1$ = ($2$)nodeArrayList$3$.get($4$); @@ -456,45 +417,37 @@ Macro:ParserNewBodyNewTail $ Macro:ParserTypedLinkedListAdd - if($2$Node$3$ != null) - { - $0$Node$1$.add($2$Node$3$); - } + if($2$Node$3$ != null) + { + $0$Node$1$.add($2$Node$3$); + } $ Macro:ParserTypedLinkedListAddAll - if($2$Node$3$ != null) //Macro:ParserTypedLinkedListAddAll - { - if(addElementsToNewList){ - $0$Node$1$.addAll($2$Node$3$); - }else{ - $0$Node$1$ = $2$Node$3$; - } - } + if($2$Node$3$ != null) + { + if(!$0$Node$1$.isEmpty()){ + $0$Node$1$.addAll($2$Node$3$); + }else{ + $0$Node$1$ = $2$Node$3$; + } + } $ -Macro:ParserTypedLinkedListAddAll2 - if($2$ != null) //Macro:ParserTypedLinkedListAddAll2 - { - $0$Node$1$.addAll($2$); - } +Macro:ParserNewBodyListAdd + nodeList.add($0$Node$1$); $ -Macro:ParserNewBodyListAdd - nodeList.add($0$Node$1$); +Macro:ParserNewCheck + checkResult(nodeList.get(0), nodeArrayList1, nodeArrayList$0$); $ Macro:ParserNewTail - // return nodeList; - final ArrayList containerList = nodeList; - Object elementToCheck = containerList.get(0); - checkResult(elementToCheck); - - return containerList; + return nodeList; } $ @@ -524,7 +477,7 @@ Macro:ParserGotoTail $ Macro:ParserErrorsHeader - protected static String[] errorMessages; + private static String[] errorMessages; /* { $ @@ -548,13 +501,16 @@ $ Macro:ParserTail - static + static { try { - DataInputStream s = new DataInputStream( - new BufferedInputStream( - Parser.class.getResourceAsStream("parser.dat"))); + InputStream resStream = Parser.class.getResourceAsStream("parser.dat"); + if(resStream == null) + { + throw new RuntimeException("The file \"parser.dat\" is missing."); + } + DataInputStream s = new DataInputStream(new BufferedInputStream(resStream)); // read actionTable int length = s.readInt(); @@ -565,10 +521,10 @@ Macro:ParserTail Parser.actionTable[i] = new int[length][3]; for(int j = 0; j < Parser.actionTable[i].length; j++) { - for(int k = 0; k < 3; k++) - { - Parser.actionTable[i][j][k] = s.readInt(); - } + for(int k = 0; k < 3; k++) + { + Parser.actionTable[i][j][k] = s.readInt(); + } } } @@ -581,10 +537,10 @@ Macro:ParserTail gotoTable[i] = new int[length][2]; for(int j = 0; j < gotoTable[i].length; j++) { - for(int k = 0; k < 2; k++) - { - gotoTable[i][j][k] = s.readInt(); - } + for(int k = 0; k < 2; k++) + { + gotoTable[i][j][k] = s.readInt(); + } } } @@ -594,11 +550,11 @@ Macro:ParserTail for(int i = 0; i < errorMessages.length; i++) { length = s.readInt(); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); for(int j = 0; j < length; j++) { - buffer.append(s.readChar()); + buffer.append(s.readChar()); } errorMessages[i] = buffer.toString(); } @@ -613,9 +569,9 @@ Macro:ParserTail s.close(); } - catch(Exception e) + catch(IOException e) { - throw new RuntimeException("The file \"parser.dat\" is either missing or corrupted."); + throw new RuntimeException("The file \"parser.dat\" is either missing or corrupted.", e); } } } @@ -639,7 +595,7 @@ $ Macro:TokenIndexBody @Override - public void case$0$( $0$ node) + public void case$0$($0$ node) { this.index = $1$; } @@ -649,7 +605,7 @@ $ Macro:TokenIndexTail @Override - public void caseEOF( EOF node) + public void caseEOF(EOF node) { this.index = $0$; } @@ -664,19 +620,19 @@ package $0$; import $1$.*; -@SuppressWarnings("serial") +@SuppressWarnings("serial") public class ParserException extends Exception { Token token; String realMsg; - public ParserException( Token token, String message) + public ParserException(Token token, String message) { super(message); this.token = token; } - public ParserException( Token token, String prefix, String message) + public ParserException(Token token, String prefix, String message) { super(prefix+message); this.realMsg = message; @@ -701,15 +657,14 @@ Macro:State package $0$; -import java.util.ArrayList; +import java.util.List; -@SuppressWarnings("rawtypes") final class State { int state; - ArrayList nodes; + List<Object> nodes; // elements are of type Node or List<Node> - State( int state, ArrayList nodes) + State(int state, List<Object> nodes) { this.state = state; this.nodes = nodes; diff --git a/src/main/resources/org/sablecc/sablecc/productions.txt b/src/main/resources/org/sablecc/sablecc/productions.txt index fae62410dd4386b3fc67323cef33c10df578324a..90b681ff3c59ce77a23edec8d605ceb9eb5b5017 100644 --- a/src/main/resources/org/sablecc/sablecc/productions.txt +++ b/src/main/resources/org/sablecc/sablecc/productions.txt @@ -12,7 +12,16 @@ package $0$; public abstract class $1$ extends Node { - // Empty body + public $1$() + {} + + public $1$($1$ node) + { + super(node); + } + + @Override + public abstract $1$ clone(); } $ diff --git a/src/main/resources/org/sablecc/sablecc/tokens.txt b/src/main/resources/org/sablecc/sablecc/tokens.txt index 479741c6989ac976952433868833e13eba646ca4..28294f026b95ce442b5e3fa99f1966350feeaac3 100644 --- a/src/main/resources/org/sablecc/sablecc/tokens.txt +++ b/src/main/resources/org/sablecc/sablecc/tokens.txt @@ -15,27 +15,31 @@ package $0$; import $1$.*; - + public final class $2$ extends Token { public $2$(String text) { - setText(text); + super(text); } public $2$(String text, int line, int pos) { - setText(text); - setLine(line); - setPos(pos); + super(text, line, pos); + } + + public $2$($2$ token) + { + super(token); } @Override - public Object clone() + public $2$ clone() { - return new $2$(getText(), getLine(), getPos()); + return new $2$(this); } + @Override public void apply(Switch sw) { ((Analysis) sw).case$2$(this); @@ -55,34 +59,38 @@ package $0$; import $1$.*; - + public final class $2$ extends Token { public $2$() { - super.setText("$3$"); + super("$3$"); } public $2$(int line, int pos) { - super.setText("$3$"); - setLine(line); - setPos(pos); + super("$3$", line, pos); + } + + public $2$($2$ token) + { + super(token); } @Override - public Object clone() + public $2$ clone() { - return new $2$(getLine(), getPos()); + return new $2$(this); } + @Override public void apply(Switch sw) { ((Analysis) sw).case$2$(this); } @Override - public void setText( String text) + public void setText(String text) { throw new RuntimeException("Cannot change $2$ text."); } diff --git a/src/main/resources/org/sablecc/sablecc/utils.txt b/src/main/resources/org/sablecc/sablecc/utils.txt index 98c8db0768659846510d232e57a324fc00bda5df..13ce65183810bdd68b5171378238c8e11090b6e0 100644 --- a/src/main/resources/org/sablecc/sablecc/utils.txt +++ b/src/main/resources/org/sablecc/sablecc/utils.txt @@ -23,21 +23,27 @@ public final class Start extends Node } public Start( - $2$ _$3$_, - EOF _eof_) + $2$ _$3$_, + EOF _eof_) { set$2$(_$3$_); setEOF(_eof_); } + public Start(Start node) + { + super(node); + set$2$(cloneNode(node._$3$_)); + setEOF(cloneNode(node._eof_)); + } + @Override - public Object clone() + public Start clone() { - return new Start( - cloneNode(this._$3$_), - cloneNode(this._eof_)); + return new Start(this); } + @Override public void apply(Switch sw) { ((Analysis) sw).caseStart(this); @@ -152,22 +158,26 @@ public final class EOF extends Token { public EOF() { - setText(""); + super(""); } public EOF(int line, int pos) { - setText(""); - setLine(line); - setPos(pos); + super("", line, pos); + } + + public EOF(EOF token) + { + super(token); } @Override - public Object clone() + public EOF clone() { - return new EOF(getLine(), getPos()); + return new EOF(this); } + @Override public void apply(Switch sw) { ((Analysis) sw).caseEOF(this); @@ -182,7 +192,7 @@ Macro:Token package $0$; import de.hhu.stups.sablecc.patch.IToken; - +import de.hhu.stups.sablecc.patch.SourcePosition; public abstract class Token extends Node implements IToken @@ -191,34 +201,103 @@ public abstract class Token extends Node implements IToken private int line; private int pos; + protected Token(String text, int line, int pos) + { + this.text = text; + this.line = line; + this.pos = pos; + } + + protected Token(String text) + { + this(text, 0, 0); + } + + protected Token() + { + this((String)null); + } + + protected Token(Token token) + { + super(token); + this.text = token.text; + this.line = token.line; + this.pos = token.pos; + } + + @Override + public abstract Token clone(); + + @Override public String getText() { return this.text; } - public void setText( String text) + @Override + public void setText(String text) { this.text = text; + // Invalidate any already calculated SourcePositions + setStartPos(null); + setEndPos(null); } + @Override public int getLine() { return this.line; } - public void setLine( int line) + @Override + public void setLine(int line) { this.line = line; + // Invalidate any already calculated SourcePositions + setStartPos(null); + setEndPos(null); } + @Override public int getPos() { return this.pos; } - public void setPos( int pos) + @Override + public void setPos(int pos) { this.pos = pos; + // Invalidate any already calculated SourcePositions + setStartPos(null); + setEndPos(null); + } + + // startPos and endPos are calculated lazily to avoid creating two SourcePosition objects for every token. + + @Override + public SourcePosition getStartPos() + { + SourcePosition startPos = super.getStartPos(); + if(startPos == null) + { + startPos = new SourcePosition(this.line, this.pos); + setStartPos(startPos); + } + return startPos; + } + + @Override + public SourcePosition getEndPos() + { + SourcePosition endPos = super.getEndPos(); + if(endPos == null) + { + endPos = new SourcePosition(this.line, this.pos + (this.text == null ? 0 : this.text.length())); + setEndPos(endPos); + } + return endPos; } @Override @@ -228,13 +307,13 @@ public abstract class Token extends Node implements IToken } @Override - void removeChild( Node child) + void removeChild(Node child) { throw new RuntimeException("Not a child."); } @Override - void replaceChild( Node oldChild, Node newChild) + void replaceChild(Node oldChild, Node newChild) { throw new RuntimeException("Not a child."); } @@ -247,23 +326,35 @@ Macro:Node package $0$; -import java.util.*; +import java.util.LinkedList; +import java.util.List; + import de.hhu.stups.sablecc.patch.PositionedNode; -@SuppressWarnings({"rawtypes","unchecked"}) public abstract class Node extends PositionedNode implements Switchable, Cloneable { private Node parent; + protected Node() + {} + + protected Node(Node node) + { + super(node); + // Copy constructor intentionally does not keep parent! + // The new copied node is not a child of the original parent anymore. + this.parent = null; + } + @Override - public abstract Object clone(); + public abstract Node clone(); public Node parent() { return this.parent; } - void parent( Node parent) + void parent(Node parent) { this.parent = parent; } @@ -276,7 +367,7 @@ public abstract class Node extends PositionedNode implements Switchable, Cloneab this.parent.replaceChild(this, node); } - protected String toString(Node node) + protected static String toString(Node node) { if(node != null) { @@ -286,20 +377,20 @@ public abstract class Node extends PositionedNode implements Switchable, Cloneab return ""; } - protected String toString(List list) + protected static String toString(List<?> list) { - StringBuffer s = new StringBuffer(); + StringBuilder s = new StringBuilder(); - for(Iterator i = list.iterator(); i.hasNext();) + for(Object o : list) { - s.append(i.next()); + s.append(o); } return s.toString(); } - - protected <T extends Node> T cloneNode(T node) + @SuppressWarnings("unchecked") + protected static <T extends Node> T cloneNode(T node) { if(node != null) { @@ -309,7 +400,8 @@ public abstract class Node extends PositionedNode implements Switchable, Cloneab return null; } - protected <T extends Node> List<T> cloneList(List<T> list) + @SuppressWarnings("unchecked") + protected static <T extends Node> List<T> cloneList(List<T> list) { List<T> clone = new LinkedList<T>(); @@ -331,7 +423,7 @@ package $0$; public interface Switch { - // Empty body + // Empty body } $ diff --git a/src/main/sablecc/sablecc-3x.sablecc3 b/src/main/sablecc/sablecc-3x.sablecc3 new file mode 100644 index 0000000000000000000000000000000000000000..5a2cbbea2802150df356575313a65046a5c85246 --- /dev/null +++ b/src/main/sablecc/sablecc-3x.sablecc3 @@ -0,0 +1,497 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * This file is part of SableCC. * + * See the file "LICENSE" for copyright information and the * + * terms and conditions for copying, distribution and * + * modification of SableCC. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +/* This grammar defines the SableCC 3.x input language. */ + +Package org.sablecc.sablecc; // Root Java package for generated files. + +Helpers + +/* These are character sets and regular expressions used in the + definition of tokens. */ + + all = [0 .. 0xFFFF]; + lowercase = ['a' .. 'z']; + uppercase = ['A' .. 'Z']; + digit = ['0' .. '9']; + hex_digit = [digit + [['a' .. 'f'] + ['A' .. 'F']]]; + + tab = 9; + cr = 13; + lf = 10; + eol = cr lf | cr | lf; // This takes care of different platforms + + not_cr_lf = [all - [cr + lf]]; + not_star = [all - '*']; + not_star_slash = [not_star - '/']; + + blank = (' ' | tab | eol)+; + + short_comment = '//' not_cr_lf* eol; + long_comment = + '/*' not_star* '*'+ (not_star_slash not_star* '*'+)* '/'; + comment = short_comment | long_comment; + + letter = lowercase | uppercase | '_' | '$'; + id_part = lowercase (lowercase | digit)*; + +States + normal, /* The first state is the initial state. */ + package; + +Tokens + +/* These are token definitions. It is allowed to use helper regular * + * expressions in the body of a token definition. * + * On a given input, the longest valid definition is chosen, In * + * case of a match, the definition that appears first is chosen. * + * Example: on input -> 's' <- "char" will have precedence on * + * "string", because it appears first. */ + +{package} + pkg_id = letter (letter | digit)*; + +{normal->package} + package = 'Package'; + + states = 'States'; + helpers = 'Helpers'; + tokens = 'Tokens'; + ignored = 'Ignored'; + productions = 'Productions'; + + abstract = 'Abstract'; + syntax = 'Syntax'; + tree = 'Tree'; + new = 'New'; + null = 'Null'; + + token_specifier = 'T'; + production_specifier = 'P'; + + dot = '.'; + d_dot = '..'; + +{normal, package->normal} + semicolon = ';'; + + equal = '='; + l_bkt = '['; + r_bkt = ']'; + l_par = '('; + r_par = ')'; + l_brace = '{'; + r_brace = '}'; + plus = '+'; + minus = '-'; + q_mark = '?'; + star = '*'; + bar = '|'; + comma = ','; + slash = '/'; + arrow = '->'; + colon = ':'; + + id = id_part ('_' id_part)*; + + char = ''' not_cr_lf '''; + dec_char = digit+; + hex_char = '0' ('x' | 'X') hex_digit+; + + string = ''' [not_cr_lf - ''']+ '''; + + blank = blank; + comment = comment; + +Ignored Tokens + +/* These tokens are simply ignored by the parser. */ + + blank, + comment; + +Productions + +/* These are the productions of the grammar. The first production is * + * used by the implicit start production: * + * start = (first production) EOF; * + * ?, * and + have the same meaning as in a regular expression. * + * In case a token and a production share the same name, the use of * + * P. (for production) or T. (for token) is required. * + * Each alternative can be explicitely named by preceding it with a * + * name enclosed in braces. * + * Each alternative element can be explicitely named by preceding it * + * with a name enclosed in brackets and followed by a colon. */ + + + grammar = + P.package? P.helpers? P.states? P.tokens? ign_tokens? P.productions? P.ast? + {-> New grammar([P.package.list_pkg_id], P.helpers, P.states, + P.tokens, P.ign_tokens, P.productions, P.ast) + }; + + package + {-> [list_pkg_id]:pkg_id*} = + T.package pkg_name + {-> [pkg_name.pkg_id] }; + + pkg_name + {-> pkg_id*} = + pkg_id [pkg_ids]:pkg_name_tail* semicolon + {-> [pkg_id, pkg_ids.pkg_id] }; + + pkg_name_tail + {-> pkg_id } = + dot pkg_id + {-> pkg_id }; + + helpers = + T.helpers [helper_defs]:helper_def+ + {-> New helpers([helper_defs]) }; + + helper_def = + id equal reg_exp semicolon + {-> New helper_def(id, reg_exp) }; + + states = + T.states id_list semicolon + {-> New states([id_list.id]) }; + + id_list + {-> id*} = + id [ids]:id_list_tail* + {-> [id, ids.id]}; + + id_list_tail + {-> id } = + comma id + {-> id}; + + tokens = + T.tokens [token_defs]:token_def+ + {-> New tokens([token_defs]) }; + + token_def = + state_list? id equal reg_exp look_ahead? semicolon + {-> New token_def(state_list, id, reg_exp, look_ahead.slash, look_ahead.reg_exp) }; + + state_list = + l_brace id transition? [state_lists]:state_list_tail* r_brace + {-> New state_list(id, transition, [state_lists])}; + + state_list_tail = + comma id transition? + {-> New state_list_tail(id, transition) }; + + transition = + arrow id + {-> New transition(id)}; + + ign_tokens = + ignored T.tokens id_list? semicolon + {-> New ign_tokens([id_list.id]) }; + + look_ahead + {-> slash reg_exp} = + slash reg_exp + {-> slash reg_exp}; + + reg_exp = + concat [concats]:reg_exp_tail* + {-> New reg_exp([concat, concats.concat])}; + + + reg_exp_tail + {-> concat } = + bar concat + {-> concat}; + + concat = + [un_exps]:un_exp* + {-> New concat([un_exps])}; + + un_exp = + basic un_op?; + + basic = + {char} P.char + {-> New basic.char(P.char)} | + {set} set + {-> New basic.set(set)} | + {string} string + {-> New basic.string(string)} | + {id} id + {-> New basic.id(id)} | + {reg_exp} l_par reg_exp r_par + {-> New basic.reg_exp(reg_exp)}; + + char = + {char} T.char | + {dec} dec_char | + {hex} hex_char; + + set = + {operation} l_bkt [left]:basic bin_op [right]:basic r_bkt + {-> New set.operation(left, bin_op, right) } | + {interval} l_bkt [left]:P.char d_dot [right]:P.char r_bkt + {-> New set.interval(left, right) }; + + un_op = + {star} star + {-> New un_op.star(star)} | + {q_mark} q_mark + {-> New un_op.q_mark(q_mark)} | + {plus} plus + {-> New un_op.plus(plus)}; + + bin_op = + {plus} plus + {-> New bin_op.plus()}| + {minus} minus + {-> New bin_op.minus()}; + + productions = + T.productions [prods]:prod+ + {-> New productions([prods]) }; + + prod = + id prod_transform? equal alts semicolon + {-> New prod(id, prod_transform.arrow, [prod_transform.elem], [alts.list_alt])}; + + prod_transform + {-> arrow elem*} = + l_brace arrow [elems]:elem* r_brace + {-> arrow [elems]}; + + alts + {-> [list_alt]:alt*} = + alt [alts]:alts_tail* + {-> [alt, alts.alt]}; + + alts_tail + {-> alt} = + bar alt + {-> alt}; + + alt = + alt_name? [elems]:elem* alt_transform? + {-> New alt(alt_name.id, [elems], alt_transform)}; + + alt_transform = + l_brace arrow [terms]: term* r_brace + {-> New alt_transform(l_brace, [terms], r_brace)}; + + term = + {new} new prod_name l_par params? r_par + {-> New term.new(prod_name, l_par, [params.list_term]) } | + + {list} l_bkt list_of_list_term? r_bkt + {-> New term.list(l_bkt, [list_of_list_term.list_terms])} | + + {simple} specifier? id simple_term_tail? + {-> New term.simple(specifier, id, simple_term_tail.id)} | + + {null} null + {-> New term.null()}; + + list_of_list_term + {-> [list_terms]:list_term* } = + list_term [list_terms]:list_term_tail* + {-> [list_term, list_terms.list_term] }; + + list_term = + {new} new prod_name l_par params? r_par + {-> New list_term.new(prod_name, l_par, [params.list_term])} | + {simple} specifier? id simple_term_tail? + {-> New list_term.simple(specifier, id, simple_term_tail.id)}; + + list_term_tail + {-> list_term} = + comma list_term + {-> list_term}; + + simple_term_tail + {-> id} = + dot id + {-> id}; + + prod_name = + id prod_name_tail? + {-> New prod_name(id, prod_name_tail.id)}; + + prod_name_tail + {-> id} = + dot id + {-> id}; + + params + {-> [list_term]:term*} = + term [params]:params_tail* + {-> [term, params.term]}; + + params_tail + {-> term} = + comma term + {-> term}; + + alt_name + {-> id} = + l_brace id r_brace + {-> id}; + + elem = + elem_name? specifier? id un_op? + {-> New elem(elem_name.id, specifier, id, un_op) }; + + elem_name + {-> id} = + l_bkt id r_bkt colon + {-> id}; + + specifier = + {token} token_specifier dot + {-> New specifier.token()} | + {production} production_specifier dot + {-> New specifier.production()}; + + ast = + abstract syntax tree [prods]:ast_prod+ + {-> New ast([prods]) }; + + ast_prod = + id equal [alts]:ast_alts semicolon + {-> New ast_prod(id, [alts.list_ast_alt])}; + + ast_alts + {-> [list_ast_alt]:ast_alt*} = + ast_alt [ast_alts]:ast_alts_tail* + {-> [ast_alt, ast_alts.ast_alt]}; + + ast_alts_tail + {-> ast_alt} = + bar ast_alt + {-> ast_alt}; + + ast_alt = + alt_name? [elems]:elem* + {-> New ast_alt(alt_name.id, [elems])}; + + +/*****************************************************************************************/ +/* */ +/* */ +/* */ +/* */ +/* */ +/*****************************************************************************************/ +Abstract Syntax Tree + + grammar = + [package]:pkg_id* P.helpers? P.states? P.tokens? P.ign_tokens? P.productions? P.ast?; + + helpers = + [helper_defs]:helper_def*; + + helper_def = + id reg_exp; + + states = + [list_id]:id*; + + tokens = + [token_defs]:token_def*; + + token_def = + state_list? id reg_exp slash? [look_ahead]:reg_exp?; + + state_list = + id transition? [state_lists]:state_list_tail*; + + state_list_tail = + id transition?; + + transition = + id; + + ign_tokens = + [list_id]:id*; + + reg_exp = + [concats]:concat*; + + concat = + [un_exps]: un_exp*; + + un_exp = + basic un_op?; + + basic = + {char} P.char | + {set} set | + {string} string | + {id} id | + {reg_exp} reg_exp; + + char = + {char} T.char | + {dec} dec_char | + {hex} hex_char; + + set = + {operation} [left]:basic bin_op [right]:basic | + {interval} [left]:P.char [right]:P.char ; + + un_op = + {star} star | + {q_mark} q_mark | + {plus} plus; + + bin_op = + {plus} | + {minus}; + + productions = + [prods]:prod*; + + prod = + id arrow? [prod_transform]:elem* [alts]:alt*; + + alt = + [alt_name]:id? [elems]:elem* alt_transform?; + + alt_transform = + l_brace [terms]:term* r_brace; + + term = + {new} prod_name l_par [params]:term* | + {list} l_bkt [list_terms]:list_term* | + {simple} specifier? id [simple_term_tail]:id? | + {null}; + + list_term = + {new} prod_name l_par [params]:term* | + {simple} specifier? id [simple_term_tail]:id?; + + prod_name = + id [prod_name_tail]:id?; + + elem = + [elem_name]:id? specifier? id un_op?; + + specifier = + {token} | + {production}; + + ast = + [prods]:ast_prod*; + + ast_prod = + id [alts]:ast_alt*; + + ast_alt = + [alt_name]:id? [elems]:elem*;