From: lempinen Date: Mon, 29 Apr 2013 06:37:23 +0000 (+0000) Subject: Generated UnitParser files (refs #4093) X-Git-Tag: 1.8.1~319 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=c1d673402bfc45e0b02a067d36857b9620f6b55c;p=simantics%2Fsysdyn.git Generated UnitParser files (refs #4093) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27297 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/JJTUnitParserState.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/JJTUnitParserState.java new file mode 100644 index 00000000..9988da3e --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/JJTUnitParserState.java @@ -0,0 +1,123 @@ +/* Generated By:JavaCC: Do not edit this line. JJTUnitParserState.java Version 5.0 */ +package org.simantics.sysdyn.unitParser; + +public class JJTUnitParserState { + private java.util.List nodes; + private java.util.List marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + public JJTUnitParserState() { + nodes = new java.util.ArrayList(); + marks = new java.util.ArrayList(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + public boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called + automatically by the parser's ReInit() method. */ + public void reset() { + nodes.clear(); + marks.clear(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call + this after a successful parse. */ + public Node rootNode() { + return nodes.get(0); + } + + /* Pushes a node on to the stack. */ + public void pushNode(Node n) { + nodes.add(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + public Node popNode() { + if (--sp < mk) { + mk = marks.remove(marks.size()-1); + } + return nodes.remove(nodes.size()-1); + } + + /* Returns the node currently on the top of the stack. */ + public Node peekNode() { + return nodes.get(nodes.size()-1); + } + + /* Returns the number of children on the stack in the current node + scope. */ + public int nodeArity() { + return sp - mk; + } + + + public void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = marks.remove(marks.size()-1); + } + + + public void openNodeScope(Node n) { + marks.add(mk); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of + children. That number of nodes are popped from the stack and + made the children of the definite node. Then the definite node + is pushed on to the stack. */ + public void closeNodeScope(Node n, int num) { + mk = marks.remove(marks.size()-1); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All + the nodes that have been pushed since the node was opened are + made children of the conditional node, which is then pushed + on to the stack. If the condition is false the node is not + constructed and they are left on the stack. */ + public void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = marks.remove(marks.size()-1); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = marks.remove(marks.size()-1); + node_created = false; + } + } +} +/* JavaCC - OriginalChecksum=d0c8ac05372006e3b61e33c0a234ef07 (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/Node.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/Node.java new file mode 100644 index 00000000..bb89e6ac --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/Node.java @@ -0,0 +1,36 @@ +/* Generated By:JJTree: Do not edit this line. Node.java Version 4.3 */ +/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=true,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=UnitCheckingNodeFactory,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package org.simantics.sysdyn.unitParser; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public +interface Node { + + /** This method is called after the node has been made the current + node. It indicates that child nodes can now be added to it. */ + public void jjtOpen(); + + /** This method is called after all the child nodes have been + added. */ + public void jjtClose(); + + /** This pair of methods are used to inform the node of its + parent. */ + public void jjtSetParent(Node n); + public Node jjtGetParent(); + + /** This method tells the node to add its argument to the node's + list of children. */ + public void jjtAddChild(Node n, int i); + + /** This method returns a child node. The children are numbered + from zero, left to right. */ + public Node jjtGetChild(int i); + + /** Return the number of children the node has. */ + public int jjtGetNumChildren(); +} +/* JavaCC - OriginalChecksum=851e4a7b403fad4367cc9f6859ec9c32 (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/ParseException.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/ParseException.java new file mode 100644 index 00000000..fa6de90b --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/ParseException.java @@ -0,0 +1,187 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ +package org.simantics.sysdyn.unitParser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + } + + /** Constructor with message. */ + public ParseException(String message) { + super(message); + } + + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * It uses "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, + int[][] expectedTokenSequences, + String[] tokenImage) { + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} +/* JavaCC - OriginalChecksum=4af9901dc6c68e7e4e08ab85f10baa96 (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/SimpleCharStream.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/SimpleCharStream.java new file mode 100644 index 00000000..a7b4b80b --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/SimpleCharStream.java @@ -0,0 +1,471 @@ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package org.simantics.sysdyn.unitParser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (without unicode processing). + */ + +public class SimpleCharStream +{ +/** Whether parser is static. */ + public static final boolean staticFlag = false; + int bufsize; + int available; + int tokenBegin; +/** Position in buffer. */ + public int bufpos = -1; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } + + + protected void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos += (bufsize - tokenBegin)); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos -= tokenBegin); + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + + bufsize += 2048; + available = bufsize; + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException + { + if (maxNextCharInd == available) + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = maxNextCharInd = 0; + available = tokenBegin; + } + else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + int i; + try { + if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + --bufpos; + backup(0); + if (tokenBegin == -1) + tokenBegin = bufpos; + throw e; + } + } + +/** Start. */ + public char BeginToken() throws java.io.IOException + { + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; + + return c; + } + + protected void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (tabSize - (column % tabSize)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + +/** Read a character. */ + public char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + if (++bufpos >= maxNextCharInd) + FillBuff(); + + char c = buffer[bufpos]; + + UpdateLineColumn(c); + return c; + } + + @Deprecated + /** + * @deprecated + * @see #getEndColumn + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + @Deprecated + /** + * @deprecated + * @see #getEndLine + */ + + public int getLine() { + return bufline[bufpos]; + } + + /** Get token end column number. */ + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + /** Get token end line number. */ + public int getEndLine() { + return bufline[bufpos]; + } + + /** Get token beginning column number. */ + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + /** Get token beginning line number. */ + public int getBeginLine() { + return bufline[tokenBegin]; + } + +/** Backup a number of characters. */ + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + bufpos = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, 1, 1, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + /** Get token literal value. */ + public String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + /** Get the suffix. */ + public char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + /** Reset buffer when finished. */ + public void Done() + { + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + */ + public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} +/* JavaCC - OriginalChecksum=e3053baa4fc0756909ee8daa9c548c97 (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/SimpleNode.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/SimpleNode.java new file mode 100644 index 00000000..0eab39ad --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/SimpleNode.java @@ -0,0 +1,94 @@ +/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */ +/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=true,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=UnitCheckingNodeFactory,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package org.simantics.sysdyn.unitParser; + +public +class SimpleNode implements Node { + + protected Node parent; + protected Node[] children; + protected int id; + protected Object value; + protected UnitParser parser; + protected Token firstToken; + protected Token lastToken; + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(UnitParser p, int i) { + this(i); + parser = p; + } + + public static Node jjtCreate(int id) { + return new SimpleNode(id); + } + + public static Node jjtCreate(UnitParser p, int id) { + return new SimpleNode(p, id); + } + + public void jjtOpen() { + } + + public void jjtClose() { + } + + public void jjtSetParent(Node n) { parent = n; } + public Node jjtGetParent() { return parent; } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + public void jjtSetValue(Object value) { this.value = value; } + public Object jjtGetValue() { return value; } + + public Token jjtGetFirstToken() { return firstToken; } + public void jjtSetFirstToken(Token token) { this.firstToken = token; } + public Token jjtGetLastToken() { return lastToken; } + public void jjtSetLastToken(Token token) { this.lastToken = token; } + + /* You can override these two methods in subclasses of SimpleNode to + customize the way the node appears when the tree is dumped. If + your output uses more than one line you should override + toString(String), otherwise overriding toString() is probably all + you need to do. */ + + public String toString() { return UnitParserTreeConstants.jjtNodeName[id]; } + public String toString(String prefix) { return prefix + toString(); } + + /* Override this method if you want to customize how the node dumps + out its children. */ + + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (int i = 0; i < children.length; ++i) { + SimpleNode n = (SimpleNode)children[i]; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } +} + +/* JavaCC - OriginalChecksum=97c0294de1ef3976f0b09baf888d3564 (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/Token.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/Token.java new file mode 100644 index 00000000..7e6124ee --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/Token.java @@ -0,0 +1,131 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package org.simantics.sysdyn.unitParser; + +/** + * Describes the input token stream. + */ + +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** The line number of the first character of this Token. */ + public int beginLine; + /** The column number of the first character of this Token. */ + public int beginColumn; + /** The line number of the last character of this Token. */ + public int endLine; + /** The column number of the last character of this Token. */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + public String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + * + * case MyParserConstants.ID : return new IDToken(ofKind, image); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) + { + return newToken(ofKind, null); + } + +} +/* JavaCC - OriginalChecksum=61dd11be23a2b24c2ed31564a8c7855c (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/TokenMgrError.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/TokenMgrError.java new file mode 100644 index 00000000..d9e2ec75 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/TokenMgrError.java @@ -0,0 +1,147 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* JavaCCOptions: */ +package org.simantics.sysdyn.unitParser; + +/** Token Manager Error. */ +public class TokenMgrError extends Error +{ + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occurred. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt was made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexical error + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + /** No arg constructor. */ + public TokenMgrError() { + } + + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + /** Full Constructor. */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} +/* JavaCC - OriginalChecksum=1a840694e4f0cebfb591db26400a3167 (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.java new file mode 100644 index 00000000..1579b6cd --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.java @@ -0,0 +1,1976 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. UnitParser.java */ +package org.simantics.sysdyn.unitParser; + +public class UnitParser/*@bgen(jjtree)*/implements UnitParserTreeConstants, UnitParserConstants {/*@bgen(jjtree)*/ + protected JJTUnitParserState jjtree = new JJTUnitParserState(); + +/*** Parser ********************************************************/ + +// https://javacc.dev.java.net/doc/javaccgrm.html +// add_op -> add_op() +// [ add_op ] -> ( add_op() )? +// { add_op term } -> ( add_op() term() )* + final public SimpleNode expr() throws ParseException { + /*@bgen(jjtree) expr */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTEXPR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 0: + case 6: + case 12: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + simple_expression(); + break; + default: + jj_la1[0] = jj_gen; + ; + } + jj_consume_token(0); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.jjtSetLastToken(getToken(0)); + {if (true) return jjtn000;} + break; + case 31: + ifthenelse(); + jj_consume_token(0); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.jjtSetLastToken(getToken(0)); + {if (true) return jjtn000;} + break; + default: + jj_la1[1] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + throw new Error("Missing return statement in function"); + } + + final public void expression() throws ParseException { + /*@bgen(jjtree) expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + simple_expression(); + break; + case 31: + ifthenelse(); + break; + default: + jj_la1[2] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void ifthenelse() throws ParseException { + /*@bgen(jjtree) ifthenelse */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTIFTHENELSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(31); + condition(); + jj_consume_token(28); + expression(); + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_1; + } + jj_consume_token(20); + condition(); + jj_consume_token(28); + expression(); + } + jj_consume_token(15); + expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void condition() throws ParseException { + /*@bgen(jjtree) condition */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCONDITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void simple_expression() throws ParseException { + /*@bgen(jjtree) simple_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTSIMPLE_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + logical_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 67: + jj_consume_token(67); + logical_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 67: + jj_consume_token(67); + logical_expression(); + break; + default: + jj_la1[4] = jj_gen; + ; + } + break; + default: + jj_la1[5] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void logical_expression() throws ParseException { + /*@bgen(jjtree) logical_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTLOGICAL_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + logical_term(); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 22: + ; + break; + default: + jj_la1[6] = jj_gen; + break label_2; + } + jj_consume_token(22); + logical_term(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void logical_term() throws ParseException { + /*@bgen(jjtree) logical_term */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTLOGICAL_TERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + logical_factor(); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 9: + ; + break; + default: + jj_la1[7] = jj_gen; + break label_3; + } + jj_consume_token(9); + logical_factor(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void logical_factor() throws ParseException { + /*@bgen(jjtree) logical_factor */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTLOGICAL_FACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 12: + jj_consume_token(12); + break; + default: + jj_la1[8] = jj_gen; + ; + } + relation(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void relation() throws ParseException { + /*@bgen(jjtree) relation */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTRELATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + arithmetic_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + rel_op(); + arithmetic_expression(); + break; + default: + jj_la1[9] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void rel_op() throws ParseException { + /*@bgen(jjtree) rel_op */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTREL_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 70: + jj_consume_token(70); + break; + case 71: + jj_consume_token(71); + break; + case 72: + jj_consume_token(72); + break; + case 73: + jj_consume_token(73); + break; + case 74: + jj_consume_token(74); + break; + case 75: + jj_consume_token(75); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void arithmetic_expression() throws ParseException { + /*@bgen(jjtree) arithmetic_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTARITHMETIC_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 76: + case 77: + case 78: + case 79: + add_op(); + break; + default: + jj_la1[11] = jj_gen; + ; + } + term(); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 76: + case 77: + case 78: + case 79: + ; + break; + default: + jj_la1[12] = jj_gen; + break label_4; + } + add_op(); + term(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void add_op() throws ParseException { + /*@bgen(jjtree) add_op */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTADD_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 76: + jj_consume_token(76); + break; + case 77: + jj_consume_token(77); + break; + case 78: + jj_consume_token(78); + break; + case 79: + jj_consume_token(79); + break; + default: + jj_la1[13] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void term() throws ParseException { + /*@bgen(jjtree) term */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTTERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + factor(); + label_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 80: + case 81: + case 82: + case 83: + ; + break; + default: + jj_la1[14] = jj_gen; + break label_5; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 80: + case 82: + multiplication(); + break; + case 81: + case 83: + divide(); + break; + default: + jj_la1[15] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + factor(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void factor() throws ParseException { + /*@bgen(jjtree) factor */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + primary(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 84: + case 85: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 84: + jj_consume_token(84); + primary(); + break; + case 85: + jj_consume_token(85); + primary(); + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[17] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void multiplication() throws ParseException { + /*@bgen(jjtree) multiplication */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTMULTIPLICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 80: + jj_consume_token(80); + break; + case 82: + jj_consume_token(82); + break; + default: + jj_la1[18] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void divide() throws ParseException { + /*@bgen(jjtree) divide */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTDIVIDE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 81: + jj_consume_token(81); + break; + case 83: + jj_consume_token(83); + break; + default: + jj_la1[19] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void primary() throws ParseException { + /*@bgen(jjtree) primary */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPRIMARY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 33: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + value(); + break; + default: + jj_la1[21] = jj_gen; + if (jj_2_1(2147483647)) { + function_call(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + component_reference_full(); + break; + case 60: + parenthesis_expression(); + break; + case 64: + jj_consume_token(64); + expression_list(); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + ; + break; + default: + jj_la1[20] = jj_gen; + break label_6; + } + jj_consume_token(68); + expression_list(); + } + jj_consume_token(65); + break; + case 62: + jj_consume_token(62); + function_arguments(); + jj_consume_token(63); + break; + case 35: + jj_consume_token(35); + break; + default: + jj_la1[22] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void component_reference_full() throws ParseException { + /*@bgen(jjtree) component_reference_full */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCOMPONENT_REFERENCE_FULL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + component_reference(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void function_call() throws ParseException { + /*@bgen(jjtree) function_call */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFUNCTION_CALL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + name(); + function_call_args(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void parenthesis_expression() throws ParseException { + /*@bgen(jjtree) parenthesis_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPARENTHESIS_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + parenthesis_open(); + expression(); + parenthesis_close(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void value() throws ParseException { + /*@bgen(jjtree) value */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTVALUE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNSIGNED_NUMBER: + jj_consume_token(UNSIGNED_NUMBER); + break; + case UNSIGNED_INTEGER: + jj_consume_token(UNSIGNED_INTEGER); + break; + case STRING: + jj_consume_token(STRING); + break; + case 6: + jj_consume_token(6); + break; + case 33: + jj_consume_token(33); + break; + default: + jj_la1[23] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void parenthesis_open() throws ParseException { + /*@bgen(jjtree) parenthesis_open */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPARENTHESIS_OPEN); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(60); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void parenthesis_close() throws ParseException { + /*@bgen(jjtree) parenthesis_close */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPARENTHESIS_CLOSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(61); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void name() throws ParseException { + /*@bgen(jjtree) name */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTNAME); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + jj_consume_token(66); + name(); + break; + default: + jj_la1[24] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void component_reference() throws ParseException { + /*@bgen(jjtree) component_reference */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCOMPONENT_REFERENCE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + component_identity(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 64: + array_subscripts(); + break; + default: + jj_la1[25] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + jj_consume_token(66); + component_reference(); + break; + default: + jj_la1[26] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void component_identity() throws ParseException { + /*@bgen(jjtree) component_identity */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCOMPONENT_IDENTITY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(IDENT); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void function_call_args() throws ParseException { + /*@bgen(jjtree) function_call_args */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFUNCTION_CALL_ARGS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + parenthesis_open(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + function_arguments(); + break; + default: + jj_la1[27] = jj_gen; + ; + } + parenthesis_close(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void function_arguments() throws ParseException { + /*@bgen(jjtree) function_arguments */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFUNCTION_ARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + if (jj_2_2(2)) { + named_argument(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + function_arguments(); + break; + default: + jj_la1[28] = jj_gen; + ; + } + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 21: + case 69: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + function_arguments(); + break; + case 21: + jj_consume_token(21); + for_indices(); + break; + default: + jj_la1[29] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[30] = jj_gen; + ; + } + break; + default: + jj_la1[31] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void for_indices() throws ParseException { + /*@bgen(jjtree) for_indices */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFOR_INDICES); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + for_index(); + label_7: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + ; + break; + default: + jj_la1[32] = jj_gen; + break label_7; + } + jj_consume_token(69); + for_index(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void for_index() throws ParseException { + /*@bgen(jjtree) for_index */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFOR_INDEX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 41: + jj_consume_token(41); + expression(); + break; + default: + jj_la1[33] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + +/* Removed by Teemu. Refactored in function_arguments) +void named_arguments() : { +} { + named_argument() ( "," named_arguments() )? +} +*/ + final public void named_argument() throws ParseException { + /*@bgen(jjtree) named_argument */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTNAMED_ARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(IDENT); + jj_consume_token(86); + expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void output_expression_list() throws ParseException { + /*@bgen(jjtree) output_expression_list */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTOUTPUT_EXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[34] = jj_gen; + ; + } + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + ; + break; + default: + jj_la1[35] = jj_gen; + break label_8; + } + jj_consume_token(69); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 60: + case 62: + case 64: + case 76: + case 77: + case 78: + case 79: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[36] = jj_gen; + ; + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void expression_list() throws ParseException { + /*@bgen(jjtree) expression_list */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTEXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + expression(); + label_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + ; + break; + default: + jj_la1[37] = jj_gen; + break label_9; + } + jj_consume_token(69); + expression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void array_subscripts() throws ParseException { + /*@bgen(jjtree) array_subscripts */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTARRAY_SUBSCRIPTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + jj_consume_token(64); + subscript(); + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + ; + break; + default: + jj_la1[38] = jj_gen; + break label_10; + } + jj_consume_token(69); + subscript(); + } + jj_consume_token(65); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void subscript() throws ParseException { + /*@bgen(jjtree) subscript */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTSUBSCRIPT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 67: + jj_consume_token(67); + break; + default: + jj_la1[40] = jj_gen; + if (jj_2_3(2147483647)) { + name(); + function_call_args(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + case UNSIGNED_INTEGER: + rangeIndex(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 67: + jj_consume_token(67); + rangeIndex(); + break; + default: + jj_la1[39] = jj_gen; + ; + } + break; + default: + jj_la1[41] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + final public void rangeIndex() throws ParseException { + /*@bgen(jjtree) rangeIndex */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTRANGEINDEX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNSIGNED_INTEGER: + jj_consume_token(UNSIGNED_INTEGER); + break; + case IDENT: + jj_consume_token(IDENT); + break; + default: + jj_la1[42] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } + } + + private boolean jj_2_1(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_1(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(0, xla); } + } + + private boolean jj_2_2(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_2(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(1, xla); } + } + + private boolean jj_2_3(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_3(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(2, xla); } + } + + private boolean jj_3_2() { + if (jj_3R_13()) return true; + return false; + } + + private boolean jj_3R_11() { + if (jj_scan_token(IDENT)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_14()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_14() { + if (jj_scan_token(66)) return true; + if (jj_3R_11()) return true; + return false; + } + + private boolean jj_3_3() { + if (jj_3R_11()) return true; + if (jj_3R_12()) return true; + return false; + } + + private boolean jj_3R_12() { + if (jj_scan_token(60)) return true; + return false; + } + + private boolean jj_3R_13() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(86)) return true; + return false; + } + + private boolean jj_3_1() { + if (jj_3R_11()) return true; + if (jj_3R_12()) return true; + return false; + } + + /** Generated Token Manager. */ + public UnitParserTokenManager token_source; + SimpleCharStream jj_input_stream; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + private int jj_gen; + final private int[] jj_la1 = new int[43]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + static private int[] jj_la1_2; + static { + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x1040,0x80001041,0x80001040,0x100000,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x40,0x0,0x0,0x0,0x80001040,0x0,0x200000,0x200000,0x80001040,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x5000000a,0x5000000a,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x50000008,0x2,0x0,0x0,0x0,0x5000000a,0x0,0x0,0x0,0x5000000a,0x0,0x200,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0xf00f001,0xf00f001,0xf00f001,0x0,0x8,0x8,0x0,0x0,0x0,0xfc0,0xfc0,0xf000,0xf000,0xf000,0xf0000,0xf0000,0x300000,0x300000,0x50000,0xa0000,0x10,0xe000000,0x1000001,0xe000000,0x4,0x1,0x4,0xf00f001,0x20,0x20,0x20,0xf00f001,0x20,0x0,0xf00f001,0x20,0xf00f001,0x20,0x20,0x8,0x8,0x5000000,0x5000000,}; + } + final private JJCalls[] jj_2_rtns = new JJCalls[3]; + private boolean jj_rescan = false; + private int jj_gc = 0; + + /** Constructor with InputStream. */ + public UnitParser(java.io.InputStream stream) { + this(stream, null); + } + /** Constructor with InputStream and supplied encoding */ + public UnitParser(java.io.InputStream stream, String encoding) { + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new UnitParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream, String encoding) { + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Constructor. */ + public UnitParser(java.io.Reader stream) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new UnitParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Constructor with generated Token Manager. */ + public UnitParser(UnitParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(UnitParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 43; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { } + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; + } + + +/** Get the next Token. */ + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + +/** Get the specific Token. */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList(); + private int[] jj_expentry; + private int jj_kind = -1; + private int[] jj_lasttokens = new int[100]; + private int jj_endpos; + + private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + int[] oldentry = (int[])(it.next()); + if (oldentry.length == jj_expentry.length) { + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + continue jj_entries_loop; + } + } + jj_expentries.add(jj_expentry); + break jj_entries_loop; + } + } + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + + /** Generate ParseException. */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[92]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 43; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + } + } + p = p.next; + } while (p != null); + } catch(LookaheadSuccess ls) { } + } + jj_rescan = false; + } + + private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } + +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj new file mode 100644 index 00000000..c5d0883e --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj @@ -0,0 +1,1173 @@ +/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. UnitParser.jj */ +/*@egen*/options { + JDK_VERSION = "1.6"; + STATIC = false; + + + +} + +PARSER_BEGIN(UnitParser) +package org.simantics.sysdyn.unitParser; + +public class UnitParser/*@bgen(jjtree)*/implements UnitParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/ + protected JJTUnitParserState jjtree = new JJTUnitParserState(); + +/*@egen*/ + + + +} +PARSER_END(UnitParser) + +/*** Lexer *********************************************************/ + +SKIP: +{ +| +| +} + +TOKEN: +{ +"algorithm" | "discrete" | "false" | "model" | "redeclare" +| "and" | "each" | "final" | "not" | "replaceable" +| "annotation" | "else" | "flow" | "operator" | "return" +|"assert" | "elseif" | "for" | "or" | "stream" +| "block" | "elsewhen" | "function" | "outer" | "then" +| "break" | "encapsulated" | "if" | "output" | "true" +| "class" | "end" | "import" | "package" | "type" +| "connect" | "enumeration" | "in" | "parameter" | "when" +| "connector" | "equation" | /*"initial" |*/ "partial" | "while" +| "constant" | "expandable" | "inner" | "protected" | "within" +| "constrainedby" | "extends" | "input" | "public" +| /*"der" |*/ "external" | "loop" | "record" +| "(" | ")" | "{" | "}" | "[" | "]" | "." | ":" | ";" | "," +| "<" | "<=" | ">" | ">=" | "==" | "<>" +| "+" | "-" | ".+" | ".-" +| "*" | "/" | ".*" | "./" +| "^" | ".^" +| "=" | ":=" +| +| + { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); } +| +| "." ()? (["e","E"] )? + | "." (["e","E"] )? + | ["e","E"] + ) > +} + +/*** Parser ********************************************************/ + +// https://javacc.dev.java.net/doc/javaccgrm.html +// add_op -> add_op() +// [ add_op ] -> ( add_op() )? +// { add_op term } -> ( add_op() term() )* + +SimpleNode expr() : {/*@bgen(jjtree) expr */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTEXPR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) expr */ + try { +/*@egen*/ + (simple_expression())? /*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.jjtSetLastToken(getToken(0)); + } +/*@egen*/ + { + return jjtn000; + } + | + ifthenelse() /*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.jjtSetLastToken(getToken(0)); + } +/*@egen*/ + { + return jjtn000; + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void expression() : {/*@bgen(jjtree) expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) expression */ + try { +/*@egen*/ + simple_expression() + | ifthenelse()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void ifthenelse() : {/*@bgen(jjtree) ifthenelse */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTIFTHENELSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ } {/*@bgen(jjtree) ifthenelse */ + try { +/*@egen*/ + "if" condition() "then" expression() ( "elseif" condition() "then" expression() )* "else" expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void condition() : {/*@bgen(jjtree) condition */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCONDITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) condition */ + try { +/*@egen*/ + expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void simple_expression() : {/*@bgen(jjtree) simple_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTSIMPLE_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) simple_expression */ + try { +/*@egen*/ + logical_expression() ( ":" logical_expression() ( ":" logical_expression() )? )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void logical_expression() : {/*@bgen(jjtree) logical_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTLOGICAL_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) logical_expression */ + try { +/*@egen*/ + logical_term() ( "or" logical_term() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void logical_term() : {/*@bgen(jjtree) logical_term */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTLOGICAL_TERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) logical_term */ + try { +/*@egen*/ + logical_factor() ( "and" logical_factor() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void logical_factor() : {/*@bgen(jjtree) logical_factor */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTLOGICAL_FACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) logical_factor */ + try { +/*@egen*/ + ( "not" )? relation()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void relation() : {/*@bgen(jjtree) relation */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTRELATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) relation */ + try { +/*@egen*/ + arithmetic_expression() ( rel_op() arithmetic_expression() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void rel_op() : {/*@bgen(jjtree) rel_op */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTREL_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) rel_op */ + try { +/*@egen*/ + "<" | "<=" | ">" | ">=" | "==" | "<>"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void arithmetic_expression() : {/*@bgen(jjtree) arithmetic_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTARITHMETIC_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) arithmetic_expression */ + try { +/*@egen*/ + (add_op())? term() (add_op() term())*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void add_op() : {/*@bgen(jjtree) add_op */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTADD_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) add_op */ + try { +/*@egen*/ + "+" | "-" | ".+" | ".-"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void term() : {/*@bgen(jjtree) term */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTTERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) term */ + try { +/*@egen*/ + factor() ( (multiplication() | divide()) factor() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void factor() : {/*@bgen(jjtree) factor */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) factor */ + try { +/*@egen*/ + primary() ( "^" primary() | ".^" primary() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void multiplication() : {/*@bgen(jjtree) multiplication */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTMULTIPLICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) multiplication */ + try { +/*@egen*/ + "*" | ".*"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void divide() : {/*@bgen(jjtree) divide */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTDIVIDE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) divide */ + try { +/*@egen*/ + "/" | "./"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void primary() : {/*@bgen(jjtree) primary */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPRIMARY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) primary */ + try { +/*@egen*/ + value() + | LOOKAHEAD( name() parenthesis_open() ) function_call() + | component_reference_full() + /*| "(" output_expression_list() ")"*/ // Not needed, replaced with following: + | parenthesis_expression() + | "[" expression_list() ( ";" expression_list() )* "]" + | "{" function_arguments() "}" + | "end"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void component_reference_full() : {/*@bgen(jjtree) component_reference_full */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCOMPONENT_REFERENCE_FULL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) component_reference_full */ + try { +/*@egen*/ + component_reference()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void function_call() : {/*@bgen(jjtree) function_call */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFUNCTION_CALL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) function_call */ + try { +/*@egen*/ + name() function_call_args()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void parenthesis_expression() : {/*@bgen(jjtree) parenthesis_expression */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPARENTHESIS_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ } {/*@bgen(jjtree) parenthesis_expression */ + try { +/*@egen*/ parenthesis_open() expression() parenthesis_close()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void value() : {/*@bgen(jjtree) value */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTVALUE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ } {/*@bgen(jjtree) value */ + try { +/*@egen*/ + + | + | + | "false" + | "true"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void parenthesis_open() : {/*@bgen(jjtree) parenthesis_open */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPARENTHESIS_OPEN); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) parenthesis_open */ + try { +/*@egen*/ + "("/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void parenthesis_close() : {/*@bgen(jjtree) parenthesis_close */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTPARENTHESIS_CLOSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) parenthesis_close */ + try { +/*@egen*/ + ")"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void name() : {/*@bgen(jjtree) name */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTNAME); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) name */ + try { +/*@egen*/ + ( "." name() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void component_reference() : {/*@bgen(jjtree) component_reference */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCOMPONENT_REFERENCE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) component_reference */ + try { +/*@egen*/ + //IDENT [ array_subscripts ] [ "." component_reference ] + component_identity() ( array_subscripts() )? ( "." component_reference() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void component_identity() : {/*@bgen(jjtree) component_identity */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTCOMPONENT_IDENTITY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) component_identity */ + try { +/*@egen*/ /*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void function_call_args() : {/*@bgen(jjtree) function_call_args */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFUNCTION_CALL_ARGS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) function_call_args */ + try { +/*@egen*/ + parenthesis_open() ( function_arguments() )? parenthesis_close()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void function_arguments() : {/*@bgen(jjtree) function_arguments */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFUNCTION_ARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) function_arguments */ + try { +/*@egen*/ + //expression [ "," function_arguments | for for_indices ] + //| named_arguments + LOOKAHEAD(2) named_argument() ( "," function_arguments() )? + | expression() ( "," function_arguments() | "for" for_indices() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ + +} + +void for_indices() : {/*@bgen(jjtree) for_indices */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFOR_INDICES); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) for_indices */ + try { +/*@egen*/ + //for_index {"," for_index} + for_index() ("," for_index())*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void for_index() : {/*@bgen(jjtree) for_index */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTFOR_INDEX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) for_index */ + try { +/*@egen*/ + //IDENT [ in expression ] + ( "in" expression() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +/* Removed by Teemu. Refactored in function_arguments) +void named_arguments() : { +} { + named_argument() ( "," named_arguments() )? +} +*/ + +void named_argument() : {/*@bgen(jjtree) named_argument */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTNAMED_ARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) named_argument */ + try { +/*@egen*/ + "=" expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void output_expression_list() : {/*@bgen(jjtree) output_expression_list */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTOUTPUT_EXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) output_expression_list */ + try { +/*@egen*/ + ( expression() )? ( "," ( expression() )? )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + + +void expression_list() : {/*@bgen(jjtree) expression_list */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTEXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) expression_list */ + try { +/*@egen*/ + expression() ( "," expression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void array_subscripts() : {/*@bgen(jjtree) array_subscripts */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTARRAY_SUBSCRIPTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) array_subscripts */ + try { +/*@egen*/ + "[" subscript() ( "," subscript() )* "]"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void subscript() : {/*@bgen(jjtree) subscript */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTSUBSCRIPT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) subscript */ + try { +/*@egen*/ ":" + | LOOKAHEAD( name() parenthesis_open() ) name() function_call_args() + | rangeIndex() ( ":" rangeIndex())?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + +void rangeIndex() : {/*@bgen(jjtree) rangeIndex */ + UnitCheckingNode jjtn000 = (UnitCheckingNode)UnitCheckingNodeFactory.jjtCreate(JJTRANGEINDEX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtn000.jjtSetFirstToken(getToken(1)); +/*@egen*/ +} {/*@bgen(jjtree) rangeIndex */ + try { +/*@egen*/ + | /*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtn000.jjtSetLastToken(getToken(0)); + } + } +/*@egen*/ +} + diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserConstants.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserConstants.java new file mode 100644 index 00000000..1cef5de9 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserConstants.java @@ -0,0 +1,127 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. UnitParserConstants.java */ +package org.simantics.sysdyn.unitParser; + + +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ +public interface UnitParserConstants { + + /** End of File. */ + int EOF = 0; + /** RegularExpression Id. */ + int WHITESPACE = 1; + /** RegularExpression Id. */ + int COMMENT1 = 2; + /** RegularExpression Id. */ + int COMMENT2 = 3; + /** RegularExpression Id. */ + int IDENT = 88; + /** RegularExpression Id. */ + int STRING = 89; + /** RegularExpression Id. */ + int UNSIGNED_INTEGER = 90; + /** RegularExpression Id. */ + int UNSIGNED_NUMBER = 91; + + /** Lexical state. */ + int DEFAULT = 0; + + /** Literal token values. */ + String[] tokenImage = { + "", + "", + "", + "", + "\"algorithm\"", + "\"discrete\"", + "\"false\"", + "\"model\"", + "\"redeclare\"", + "\"and\"", + "\"each\"", + "\"final\"", + "\"not\"", + "\"replaceable\"", + "\"annotation\"", + "\"else\"", + "\"flow\"", + "\"operator\"", + "\"return\"", + "\"assert\"", + "\"elseif\"", + "\"for\"", + "\"or\"", + "\"stream\"", + "\"block\"", + "\"elsewhen\"", + "\"function\"", + "\"outer\"", + "\"then\"", + "\"break\"", + "\"encapsulated\"", + "\"if\"", + "\"output\"", + "\"true\"", + "\"class\"", + "\"end\"", + "\"import\"", + "\"package\"", + "\"type\"", + "\"connect\"", + "\"enumeration\"", + "\"in\"", + "\"parameter\"", + "\"when\"", + "\"connector\"", + "\"equation\"", + "\"partial\"", + "\"while\"", + "\"constant\"", + "\"expandable\"", + "\"inner\"", + "\"protected\"", + "\"within\"", + "\"constrainedby\"", + "\"extends\"", + "\"input\"", + "\"public\"", + "\"external\"", + "\"loop\"", + "\"record\"", + "\"(\"", + "\")\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\".\"", + "\":\"", + "\";\"", + "\",\"", + "\"<\"", + "\"<=\"", + "\">\"", + "\">=\"", + "\"==\"", + "\"<>\"", + "\"+\"", + "\"-\"", + "\".+\"", + "\".-\"", + "\"*\"", + "\"/\"", + "\".*\"", + "\"./\"", + "\"^\"", + "\".^\"", + "\"=\"", + "\":=\"", + "", + "", + "", + "", + }; + +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java new file mode 100644 index 00000000..c4473fa3 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java @@ -0,0 +1,1323 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. UnitParserTokenManager.java */ +package org.simantics.sysdyn.unitParser; + +/** Token Manager. */ +public class UnitParserTokenManager implements UnitParserConstants +{ + + /** Debug output. */ + public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) +{ + switch (pos) + { + case 0: + if ((active0 & 0xffffffffffffff0L) != 0L) + { + jjmatchedKind = 88; + return 2; + } + if ((active1 & 0x20000L) != 0L) + return 13; + if ((active1 & 0x2cc004L) != 0L) + return 9; + return -1; + case 1: + if ((active0 & 0x84020080400000L) != 0L) + return 2; + if ((active0 & 0xf7bfdff7fbffff0L) != 0L) + { + if (jjmatchedPos != 1) + { + jjmatchedKind = 88; + jjmatchedPos = 1; + } + return 2; + } + return -1; + case 2: + if ((active0 & 0x800201200L) != 0L) + return 2; + if ((active0 & 0xffffdf77f9fedf0L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 2; + return 2; + } + return -1; + case 3: + if ((active0 & 0x400084212118400L) != 0L) + return 2; + if ((active0 & 0xbfff5b56d8e69f0L) != 0L) + { + if (jjmatchedPos != 3) + { + jjmatchedKind = 88; + jjmatchedPos = 3; + } + return 2; + } + return -1; + case 4: + if ((active0 & 0x848004290008c0L) != 0L) + return 2; + if ((active0 & 0xb7b75b1469e6130L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 4; + return 2; + } + return -1; + case 5: + if ((active0 & 0x9100011009c0000L) != 0L) + return 2; + if ((active0 & 0x26b75a046026130L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 5; + return 2; + } + return -1; + case 6: + if ((active0 & 0x4050a000000000L) != 0L) + return 2; + if ((active0 & 0x22b250046026130L) != 0L) + { + if (jjmatchedPos != 6) + { + jjmatchedKind = 88; + jjmatchedPos = 6; + } + return 2; + } + return -1; + case 7: + if ((active0 & 0x201200006020020L) != 0L) + return 2; + if ((active0 & 0x2a150040006110L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 7; + return 2; + } + return -1; + case 8: + if ((active0 & 0x22010040006000L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 8; + return 2; + } + if ((active0 & 0x8140000000110L) != 0L) + return 2; + return -1; + case 9: + if ((active0 & 0x2000000004000L) != 0L) + return 2; + if ((active0 & 0x20010040002000L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 9; + return 2; + } + return -1; + case 10: + if ((active0 & 0x10000002000L) != 0L) + return 2; + if ((active0 & 0x20000040000000L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 10; + return 2; + } + return -1; + case 11: + if ((active0 & 0x40000000L) != 0L) + return 2; + if ((active0 & 0x20000000000000L) != 0L) + { + jjmatchedKind = 88; + jjmatchedPos = 11; + return 2; + } + return -1; + default : + return -1; + } +} +private final int jjStartNfa_0(int pos, long active0, long active1) +{ + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); +} +private int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 40: + return jjStopAtPos(0, 60); + case 41: + return jjStopAtPos(0, 61); + case 42: + return jjStopAtPos(0, 80); + case 43: + return jjStopAtPos(0, 76); + case 44: + return jjStopAtPos(0, 69); + case 45: + return jjStopAtPos(0, 77); + case 46: + jjmatchedKind = 66; + return jjMoveStringLiteralDfa1_0(0x0L, 0x2cc000L); + case 47: + return jjStartNfaWithStates_0(0, 81, 13); + case 58: + jjmatchedKind = 67; + return jjMoveStringLiteralDfa1_0(0x0L, 0x800000L); + case 59: + return jjStopAtPos(0, 68); + case 60: + jjmatchedKind = 70; + return jjMoveStringLiteralDfa1_0(0x0L, 0x880L); + case 61: + jjmatchedKind = 86; + return jjMoveStringLiteralDfa1_0(0x0L, 0x400L); + case 62: + jjmatchedKind = 72; + return jjMoveStringLiteralDfa1_0(0x0L, 0x200L); + case 91: + return jjStopAtPos(0, 64); + case 93: + return jjStopAtPos(0, 65); + case 94: + return jjStopAtPos(0, 84); + case 97: + return jjMoveStringLiteralDfa1_0(0x84210L, 0x0L); + case 98: + return jjMoveStringLiteralDfa1_0(0x21000000L, 0x0L); + case 99: + return jjMoveStringLiteralDfa1_0(0x21108400000000L, 0x0L); + case 100: + return jjMoveStringLiteralDfa1_0(0x20L, 0x0L); + case 101: + return jjMoveStringLiteralDfa1_0(0x242210842108400L, 0x0L); + case 102: + return jjMoveStringLiteralDfa1_0(0x4210840L, 0x0L); + case 105: + return jjMoveStringLiteralDfa1_0(0x84021080000000L, 0x0L); + case 108: + return jjMoveStringLiteralDfa1_0(0x400000000000000L, 0x0L); + case 109: + return jjMoveStringLiteralDfa1_0(0x80L, 0x0L); + case 110: + return jjMoveStringLiteralDfa1_0(0x1000L, 0x0L); + case 111: + return jjMoveStringLiteralDfa1_0(0x108420000L, 0x0L); + case 112: + return jjMoveStringLiteralDfa1_0(0x108442000000000L, 0x0L); + case 114: + return jjMoveStringLiteralDfa1_0(0x800000000042100L, 0x0L); + case 115: + return jjMoveStringLiteralDfa1_0(0x800000L, 0x0L); + case 116: + return jjMoveStringLiteralDfa1_0(0x4210000000L, 0x0L); + case 119: + return jjMoveStringLiteralDfa1_0(0x10880000000000L, 0x0L); + case 123: + return jjStopAtPos(0, 62); + case 125: + return jjStopAtPos(0, 63); + default : + return jjMoveNfa_0(0, 0); + } +} +private int jjMoveStringLiteralDfa1_0(long active0, long active1) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(0, active0, active1); + return 1; + } + switch(curChar) + { + case 42: + if ((active1 & 0x40000L) != 0L) + return jjStopAtPos(1, 82); + break; + case 43: + if ((active1 & 0x4000L) != 0L) + return jjStopAtPos(1, 78); + break; + case 45: + if ((active1 & 0x8000L) != 0L) + return jjStopAtPos(1, 79); + break; + case 47: + if ((active1 & 0x80000L) != 0L) + return jjStopAtPos(1, 83); + break; + case 61: + if ((active1 & 0x80L) != 0L) + return jjStopAtPos(1, 71); + else if ((active1 & 0x200L) != 0L) + return jjStopAtPos(1, 73); + else if ((active1 & 0x400L) != 0L) + return jjStopAtPos(1, 74); + else if ((active1 & 0x800000L) != 0L) + return jjStopAtPos(1, 87); + break; + case 62: + if ((active1 & 0x800L) != 0L) + return jjStopAtPos(1, 75); + break; + case 94: + if ((active1 & 0x200000L) != 0L) + return jjStopAtPos(1, 85); + break; + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x442000000440L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0x800000000042100L, active1, 0L); + case 102: + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(1, 31, 2); + break; + case 104: + return jjMoveStringLiteralDfa2_0(active0, 0x880010000000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0x10000000000820L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa2_0(active0, 0x403118010L, active1, 0L); + case 109: + return jjMoveStringLiteralDfa2_0(active0, 0x1000000000L, active1, 0L); + case 110: + if ((active0 & 0x20000000000L) != 0L) + { + jjmatchedKind = 41; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x84010840004200L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa2_0(active0, 0x421108000201080L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa2_0(active0, 0x20000L, active1, 0L); + case 113: + return jjMoveStringLiteralDfa2_0(active0, 0x200000000000L, active1, 0L); + case 114: + if ((active0 & 0x400000L) != 0L) + return jjStartNfaWithStates_0(1, 22, 2); + return jjMoveStringLiteralDfa2_0(active0, 0x8000220000000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa2_0(active0, 0x80000L, active1, 0L); + case 116: + return jjMoveStringLiteralDfa2_0(active0, 0x800000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x10000010c000000L, active1, 0L); + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x242000000000000L, active1, 0L); + case 121: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(0, active0, active1); +} +private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(0, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(1, active0, 0L); + return 2; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa3_0(active0, 0x400000000L); + case 98: + return jjMoveStringLiteralDfa3_0(active0, 0x100000000000000L); + case 99: + return jjMoveStringLiteralDfa3_0(active0, 0x800002040000400L); + case 100: + if ((active0 & 0x200L) != 0L) + return jjStartNfaWithStates_0(2, 9, 2); + else if ((active0 & 0x800000000L) != 0L) + return jjStartNfaWithStates_0(2, 35, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x180L); + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x80030020000L); + case 103: + return jjMoveStringLiteralDfa3_0(active0, 0x10L); + case 105: + return jjMoveStringLiteralDfa3_0(active0, 0x800000000000L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x40L); + case 110: + return jjMoveStringLiteralDfa3_0(active0, 0x25108004004800L); + case 111: + return jjMoveStringLiteralDfa3_0(active0, 0x408000001010000L); + case 112: + return jjMoveStringLiteralDfa3_0(active0, 0x82005000002000L); + case 114: + if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(2, 21, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x440000800000L); + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x2188020L); + case 116: + if ((active0 & 0x1000L) != 0L) + return jjStartNfaWithStates_0(2, 12, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x250000108040000L); + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x210200000000L); + default : + break; + } + return jjStartNfa_0(1, active0, 0L); +} +private int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(1, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(2, active0, 0L); + return 3; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x2240060000800L); + case 99: + return jjMoveStringLiteralDfa4_0(active0, 0x5000020L); + case 101: + if ((active0 & 0x8000L) != 0L) + { + jjmatchedKind = 15; + jjmatchedPos = 3; + } + else if ((active0 & 0x200000000L) != 0L) + return jjStartNfaWithStates_0(3, 33, 2); + else if ((active0 & 0x4000000000L) != 0L) + return jjStartNfaWithStates_0(3, 38, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x24400000a980180L); + case 104: + if ((active0 & 0x400L) != 0L) + return jjStartNfaWithStates_0(3, 10, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L); + case 107: + return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L); + case 108: + return jjMoveStringLiteralDfa4_0(active0, 0x100800000002000L); + case 109: + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000L); + case 110: + if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_0(3, 28, 2); + else if ((active0 & 0x80000000000L) != 0L) + return jjStartNfaWithStates_0(3, 43, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x108000000000L); + case 111: + return jjMoveStringLiteralDfa4_0(active0, 0x800001000004010L); + case 112: + if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 58, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x100000000L); + case 114: + return jjMoveStringLiteralDfa4_0(active0, 0x20000L); + case 115: + return jjMoveStringLiteralDfa4_0(active0, 0x21000400000040L); + case 116: + return jjMoveStringLiteralDfa4_0(active0, 0x8400000000000L); + case 117: + return jjMoveStringLiteralDfa4_0(active0, 0x80000000040000L); + case 119: + if ((active0 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(3, 16, 2); + break; + default : + break; + } + return jjStartNfa_0(2, active0, 0L); +} +private int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(2, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(3, active0, 0L); + return 4; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa5_0(active0, 0x2000822000L); + case 99: + return jjMoveStringLiteralDfa5_0(active0, 0x100L); + case 101: + if ((active0 & 0x40L) != 0L) + return jjStartNfaWithStates_0(4, 6, 2); + else if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_0(4, 47, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x8118000000000L); + case 105: + return jjMoveStringLiteralDfa5_0(active0, 0x110400000100000L); + case 107: + if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(4, 24, 2); + else if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_0(4, 29, 2); + break; + case 108: + if ((active0 & 0x80L) != 0L) + return jjStartNfaWithStates_0(4, 7, 2); + else if ((active0 & 0x800L) != 0L) + return jjStartNfaWithStates_0(4, 11, 2); + break; + case 109: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L); + case 110: + return jjMoveStringLiteralDfa5_0(active0, 0x42000000000000L); + case 112: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000L); + case 114: + if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(4, 27, 2); + else if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 50, 2); + return jjMoveStringLiteralDfa5_0(active0, 0xa000010000c0030L); + case 115: + if ((active0 & 0x400000000L) != 0L) + return jjStartNfaWithStates_0(4, 34, 2); + break; + case 116: + if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 55, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x21200004004000L); + case 117: + return jjMoveStringLiteralDfa5_0(active0, 0x100000000L); + case 119: + return jjMoveStringLiteralDfa5_0(active0, 0x2000000L); + default : + break; + } + return jjStartNfa_0(3, active0, 0L); +} +private int jjMoveStringLiteralDfa5_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(3, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(4, active0, 0L); + return 5; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x1400000004000L); + case 99: + if ((active0 & 0x100000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 56, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x8108000002000L); + case 100: + if ((active0 & 0x800000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 59, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x42000000000000L); + case 101: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000020L); + case 102: + if ((active0 & 0x100000L) != 0L) + return jjStartNfaWithStates_0(5, 20, 2); + break; + case 103: + return jjMoveStringLiteralDfa6_0(active0, 0x2000000000L); + case 104: + return jjMoveStringLiteralDfa6_0(active0, 0x2000000L); + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x200004000010L); + case 108: + return jjMoveStringLiteralDfa6_0(active0, 0x100L); + case 109: + if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(5, 23, 2); + break; + case 110: + if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(5, 18, 2); + else if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 52, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x200000000000000L); + case 114: + return jjMoveStringLiteralDfa6_0(active0, 0x20010000000000L); + case 115: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000L); + case 116: + if ((active0 & 0x80000L) != 0L) + return jjStartNfaWithStates_0(5, 19, 2); + else if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(5, 32, 2); + else if ((active0 & 0x1000000000L) != 0L) + return jjStartNfaWithStates_0(5, 36, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x20000L); + default : + break; + } + return jjStartNfa_0(4, active0, 0L); +} +private int jjMoveStringLiteralDfa6_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(4, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(5, active0, 0L); + return 6; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa7_0(active0, 0x222010000000100L); + case 101: + if ((active0 & 0x2000000000L) != 0L) + return jjStartNfaWithStates_0(6, 37, 2); + return jjMoveStringLiteralDfa7_0(active0, 0x2002000L); + case 108: + if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_0(6, 46, 2); + break; + case 110: + return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000L); + case 111: + return jjMoveStringLiteralDfa7_0(active0, 0x200004020000L); + case 115: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_0(6, 54, 2); + break; + case 116: + if ((active0 & 0x8000000000L) != 0L) + { + jjmatchedKind = 39; + jjmatchedPos = 6; + } + return jjMoveStringLiteralDfa7_0(active0, 0x8140000004030L); + case 117: + return jjMoveStringLiteralDfa7_0(active0, 0x40000000L); + default : + break; + } + return jjStartNfa_0(5, active0, 0L); +} +private int jjMoveStringLiteralDfa7_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(5, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(6, active0, 0L); + return 7; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa8_0(active0, 0x2000L); + case 98: + return jjMoveStringLiteralDfa8_0(active0, 0x2000000000000L); + case 101: + if ((active0 & 0x20L) != 0L) + return jjStartNfaWithStates_0(7, 5, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x8040000000000L); + case 104: + return jjMoveStringLiteralDfa8_0(active0, 0x10L); + case 105: + return jjMoveStringLiteralDfa8_0(active0, 0x20000000004000L); + case 108: + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 57, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x40000000L); + case 110: + if ((active0 & 0x2000000L) != 0L) + return jjStartNfaWithStates_0(7, 25, 2); + else if ((active0 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(7, 26, 2); + else if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_0(7, 45, 2); + break; + case 111: + return jjMoveStringLiteralDfa8_0(active0, 0x100000000000L); + case 114: + if ((active0 & 0x20000L) != 0L) + return jjStartNfaWithStates_0(7, 17, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x100L); + case 116: + if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 48, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x10000000000L); + default : + break; + } + return jjStartNfa_0(6, active0, 0L); +} +private int jjMoveStringLiteralDfa8_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(6, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(7, active0, 0L); + return 8; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000L); + case 98: + return jjMoveStringLiteralDfa9_0(active0, 0x2000L); + case 100: + if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_0(8, 51, 2); + break; + case 101: + if ((active0 & 0x100L) != 0L) + return jjStartNfaWithStates_0(8, 8, 2); + break; + case 105: + return jjMoveStringLiteralDfa9_0(active0, 0x10000000000L); + case 108: + return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000L); + case 109: + if ((active0 & 0x10L) != 0L) + return jjStartNfaWithStates_0(8, 4, 2); + break; + case 110: + return jjMoveStringLiteralDfa9_0(active0, 0x20000000000000L); + case 111: + return jjMoveStringLiteralDfa9_0(active0, 0x4000L); + case 114: + if ((active0 & 0x40000000000L) != 0L) + return jjStartNfaWithStates_0(8, 42, 2); + else if ((active0 & 0x100000000000L) != 0L) + return jjStartNfaWithStates_0(8, 44, 2); + break; + default : + break; + } + return jjStartNfa_0(7, active0, 0L); +} +private int jjMoveStringLiteralDfa9_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(7, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(8, active0, 0L); + return 9; + } + switch(curChar) + { + case 101: + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_0(9, 49, 2); + return jjMoveStringLiteralDfa10_0(active0, 0x20000000000000L); + case 108: + return jjMoveStringLiteralDfa10_0(active0, 0x2000L); + case 110: + if ((active0 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(9, 14, 2); + break; + case 111: + return jjMoveStringLiteralDfa10_0(active0, 0x10000000000L); + case 116: + return jjMoveStringLiteralDfa10_0(active0, 0x40000000L); + default : + break; + } + return jjStartNfa_0(8, active0, 0L); +} +private int jjMoveStringLiteralDfa10_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(8, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(9, active0, 0L); + return 10; + } + switch(curChar) + { + case 100: + return jjMoveStringLiteralDfa11_0(active0, 0x20000000000000L); + case 101: + if ((active0 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(10, 13, 2); + return jjMoveStringLiteralDfa11_0(active0, 0x40000000L); + case 110: + if ((active0 & 0x10000000000L) != 0L) + return jjStartNfaWithStates_0(10, 40, 2); + break; + default : + break; + } + return jjStartNfa_0(9, active0, 0L); +} +private int jjMoveStringLiteralDfa11_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(9, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(10, active0, 0L); + return 11; + } + switch(curChar) + { + case 98: + return jjMoveStringLiteralDfa12_0(active0, 0x20000000000000L); + case 100: + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_0(11, 30, 2); + break; + default : + break; + } + return jjStartNfa_0(10, active0, 0L); +} +private int jjMoveStringLiteralDfa12_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(10, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(11, active0, 0L); + return 12; + } + switch(curChar) + { + case 121: + if ((active0 & 0x20000000000000L) != 0L) + return jjStartNfaWithStates_0(12, 53, 2); + break; + default : + break; + } + return jjStartNfa_0(11, active0, 0L); +} +private int jjStartNfaWithStates_0(int pos, int kind, int state) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return pos + 1; } + return jjMoveNfa_0(state, pos + 1); +} +static final long[] jjbitVec0 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +private int jjMoveNfa_0(int startState, int curPos) +{ + int startsAt = 0; + jjnewStateCnt = 31; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + do + { + switch(jjstateSet[--i]) + { + case 13: + if (curChar == 47) + { + if (kind > 3) + kind = 3; + jjCheckNAdd(20); + } + else if (curChar == 42) + jjCheckNAddStates(0, 2); + break; + case 0: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 90) + kind = 90; + jjCheckNAddStates(3, 7); + } + else if ((0x100002600L & l) != 0L) + { + if (kind > 1) + kind = 1; + } + else if (curChar == 47) + jjAddStates(8, 9); + else if (curChar == 46) + jjCheckNAdd(9); + else if (curChar == 34) + jjCheckNAddStates(10, 12); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 88) + kind = 88; + jjstateSet[jjnewStateCnt++] = 2; + break; + case 3: + if (curChar == 34) + jjCheckNAddStates(10, 12); + break; + case 4: + if ((0xfffffffbfffffbffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 6: + if ((0xfffffffffffffbffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 7: + if (curChar == 34 && kind > 89) + kind = 89; + break; + case 8: + if (curChar == 46) + jjCheckNAdd(9); + break; + case 9: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 91) + kind = 91; + jjCheckNAddTwoStates(9, 10); + break; + case 11: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 91) + kind = 91; + jjstateSet[jjnewStateCnt++] = 11; + break; + case 12: + if (curChar == 47) + jjAddStates(8, 9); + break; + case 14: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddStates(0, 2); + break; + case 15: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 16; + break; + case 16: + if ((0xffff7fffffffffffL & l) != 0L) + jjCheckNAddStates(0, 2); + break; + case 17: + if (curChar == 47 && kind > 2) + kind = 2; + break; + case 18: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 19: + if (curChar != 47) + break; + if (kind > 3) + kind = 3; + jjCheckNAdd(20); + break; + case 20: + if ((0xfffffffffffffbffL & l) == 0L) + break; + if (kind > 3) + kind = 3; + jjCheckNAdd(20); + break; + case 21: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 90) + kind = 90; + jjCheckNAddStates(3, 7); + break; + case 22: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 90) + kind = 90; + jjCheckNAdd(22); + break; + case 23: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(23, 24); + break; + case 24: + if (curChar != 46) + break; + if (kind > 91) + kind = 91; + jjCheckNAddTwoStates(25, 26); + break; + case 25: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 91) + kind = 91; + jjCheckNAddTwoStates(25, 26); + break; + case 27: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 91) + kind = 91; + jjstateSet[jjnewStateCnt++] = 27; + break; + case 28: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(28, 29); + break; + case 30: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 91) + kind = 91; + jjstateSet[jjnewStateCnt++] = 30; + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 0: + case 2: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 88) + kind = 88; + jjCheckNAdd(2); + break; + case 4: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 5: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 6: + jjCheckNAddStates(10, 12); + break; + case 10: + if ((0x2000000020L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 14: + case 16: + jjCheckNAddStates(0, 2); + break; + case 20: + if (kind > 3) + kind = 3; + jjstateSet[jjnewStateCnt++] = 20; + break; + case 26: + if ((0x2000000020L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 29: + if ((0x2000000020L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 30; + break; + default : break; + } + } while(i != startsAt); + } + else + { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 4: + case 6: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(10, 12); + break; + case 14: + case 16: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(0, 2); + break; + case 20: + if ((jjbitVec0[i2] & l2) == 0L) + break; + if (kind > 3) + kind = 3; + jjstateSet[jjnewStateCnt++] = 20; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 31 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return curPos; } + } +} +static final int[] jjnextStates = { + 14, 15, 18, 22, 23, 24, 28, 29, 13, 19, 4, 5, 7, +}; + +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, "\141\154\147\157\162\151\164\150\155", +"\144\151\163\143\162\145\164\145", "\146\141\154\163\145", "\155\157\144\145\154", +"\162\145\144\145\143\154\141\162\145", "\141\156\144", "\145\141\143\150", "\146\151\156\141\154", "\156\157\164", +"\162\145\160\154\141\143\145\141\142\154\145", "\141\156\156\157\164\141\164\151\157\156", "\145\154\163\145", +"\146\154\157\167", "\157\160\145\162\141\164\157\162", "\162\145\164\165\162\156", +"\141\163\163\145\162\164", "\145\154\163\145\151\146", "\146\157\162", "\157\162", +"\163\164\162\145\141\155", "\142\154\157\143\153", "\145\154\163\145\167\150\145\156", +"\146\165\156\143\164\151\157\156", "\157\165\164\145\162", "\164\150\145\156", "\142\162\145\141\153", +"\145\156\143\141\160\163\165\154\141\164\145\144", "\151\146", "\157\165\164\160\165\164", "\164\162\165\145", +"\143\154\141\163\163", "\145\156\144", "\151\155\160\157\162\164", "\160\141\143\153\141\147\145", +"\164\171\160\145", "\143\157\156\156\145\143\164", +"\145\156\165\155\145\162\141\164\151\157\156", "\151\156", "\160\141\162\141\155\145\164\145\162", "\167\150\145\156", +"\143\157\156\156\145\143\164\157\162", "\145\161\165\141\164\151\157\156", "\160\141\162\164\151\141\154", +"\167\150\151\154\145", "\143\157\156\163\164\141\156\164", +"\145\170\160\141\156\144\141\142\154\145", "\151\156\156\145\162", "\160\162\157\164\145\143\164\145\144", +"\167\151\164\150\151\156", "\143\157\156\163\164\162\141\151\156\145\144\142\171", +"\145\170\164\145\156\144\163", "\151\156\160\165\164", "\160\165\142\154\151\143", +"\145\170\164\145\162\156\141\154", "\154\157\157\160", "\162\145\143\157\162\144", "\50", "\51", "\173", "\175", +"\133", "\135", "\56", "\72", "\73", "\54", "\74", "\74\75", "\76", "\76\75", +"\75\75", "\74\76", "\53", "\55", "\56\53", "\56\55", "\52", "\57", "\56\52", "\56\57", +"\136", "\56\136", "\75", "\72\75", null, null, null, null, }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffffffff1L, 0xfffffffL, +}; +static final long[] jjtoSkip = { + 0xeL, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[31]; +private final int[] jjstateSet = new int[62]; +private final StringBuilder jjimage = new StringBuilder(); +private StringBuilder image = jjimage; +private int jjimageLen; +private int lengthOfMatch; +protected char curChar; +/** Constructor. */ +public UnitParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public UnitParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 31; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +/** Get the next Token. */ +public Token getNextToken() +{ + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + image = jjimage; + image.setLength(0); + jjimageLen = 0; + + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + TokenLexicalActions(matchedToken); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +void TokenLexicalActions(Token matchedToken) +{ + switch(jjmatchedKind) + { + case 89 : + image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); + matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); + break; + default : + break; + } +} +private void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} + +private void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} + +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTreeConstants.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTreeConstants.java new file mode 100644 index 00000000..d790ceb2 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTreeConstants.java @@ -0,0 +1,83 @@ +/* Generated By:JavaCC: Do not edit this line. UnitParserTreeConstants.java Version 5.0 */ +package org.simantics.sysdyn.unitParser; + +public interface UnitParserTreeConstants +{ + public int JJTEXPR = 0; + public int JJTEXPRESSION = 1; + public int JJTIFTHENELSE = 2; + public int JJTCONDITION = 3; + public int JJTSIMPLE_EXPRESSION = 4; + public int JJTLOGICAL_EXPRESSION = 5; + public int JJTLOGICAL_TERM = 6; + public int JJTLOGICAL_FACTOR = 7; + public int JJTRELATION = 8; + public int JJTREL_OP = 9; + public int JJTARITHMETIC_EXPRESSION = 10; + public int JJTADD_OP = 11; + public int JJTTERM = 12; + public int JJTFACTOR = 13; + public int JJTMULTIPLICATION = 14; + public int JJTDIVIDE = 15; + public int JJTPRIMARY = 16; + public int JJTCOMPONENT_REFERENCE_FULL = 17; + public int JJTFUNCTION_CALL = 18; + public int JJTPARENTHESIS_EXPRESSION = 19; + public int JJTVALUE = 20; + public int JJTPARENTHESIS_OPEN = 21; + public int JJTPARENTHESIS_CLOSE = 22; + public int JJTNAME = 23; + public int JJTCOMPONENT_REFERENCE = 24; + public int JJTCOMPONENT_IDENTITY = 25; + public int JJTFUNCTION_CALL_ARGS = 26; + public int JJTFUNCTION_ARGUMENTS = 27; + public int JJTFOR_INDICES = 28; + public int JJTFOR_INDEX = 29; + public int JJTNAMED_ARGUMENT = 30; + public int JJTOUTPUT_EXPRESSION_LIST = 31; + public int JJTEXPRESSION_LIST = 32; + public int JJTARRAY_SUBSCRIPTS = 33; + public int JJTSUBSCRIPT = 34; + public int JJTRANGEINDEX = 35; + + + public String[] jjtNodeName = { + "expr", + "expression", + "ifthenelse", + "condition", + "simple_expression", + "logical_expression", + "logical_term", + "logical_factor", + "relation", + "rel_op", + "arithmetic_expression", + "add_op", + "term", + "factor", + "multiplication", + "divide", + "primary", + "component_reference_full", + "function_call", + "parenthesis_expression", + "value", + "parenthesis_open", + "parenthesis_close", + "name", + "component_reference", + "component_identity", + "function_call_args", + "function_arguments", + "for_indices", + "for_index", + "named_argument", + "output_expression_list", + "expression_list", + "array_subscripts", + "subscript", + "rangeIndex", + }; +} +/* JavaCC - OriginalChecksum=e2f99f7df8969b486d8da5159d18ad81 (do not edit this line) */