diff --git a/src/Main.java b/src/Main.java index 5d8404c1be14063af49ca9f1c5fe019c4fb9edef..f478cc1b9fd628d66099b6249e5c47327edc0f5b 100755 --- a/src/Main.java +++ b/src/Main.java @@ -133,7 +133,9 @@ public class Main implements ActionListener { img = (new ImageIcon(imageURL)).getImage(); splashFrame = JStartingWindow.splash(img, "Loading TTool's elements"); //splashFrame.setLicenceMessage("An open-source toolkit from:"); - splashFrame.setMiddleMessage("version " + DefaultText.getVersion()); + if (splashFrame != null) { + splashFrame.setMiddleMessage("version " + DefaultText.getVersion()); + } //System.out.println("helly"); } else { System.err.println("Starting image not found"); @@ -147,7 +149,9 @@ public class Main implements ActionListener { // Starting window // setting default language - splashFrame.setMessage("Setting language"); + if (splashFrame != null) { + splashFrame.setMessage("Setting language"); + } Locale.setDefault(new Locale("en")); boolean startLauncher = false; @@ -247,13 +251,16 @@ public class Main implements ActionListener { } // Icons - splashFrame.setMessage("Loading images"); + if (splashFrame != null) { + splashFrame.setMessage("Loading images"); + } IconManager icma = new IconManager(); icma.loadImg(); // Loading configuration - splashFrame.setMessage("Loading configuration file: " + config); - + if (splashFrame != null) { + splashFrame.setMessage("Loading configuration file: " + config); + } try { ConfigurationTTool.loadConfiguration(config, systemc); @@ -281,9 +288,13 @@ public class Main implements ActionListener { } // making main window - splashFrame.setMessage("Creating main window"); + if (splashFrame != null) { + splashFrame.setMessage("Creating main window"); + } MainGUI mainGUI = new MainGUI(systemc, lotos, proactive, tpn, os, uppaal, nc, avatar, proverif); - splashFrame.setMessage("Building graphical components"); + if (splashFrame != null) { + splashFrame.setMessage("Building graphical components"); + } mainGUI.build(); // loading configuration @@ -293,8 +304,9 @@ public class Main implements ActionListener { ErrorGUI.exit(ErrorGUI.GUI); } - - splashFrame.setMessage("Starting TTool ..."); + if (splashFrame != null) { + splashFrame.setMessage("Starting TTool ..."); + } main.waitFinish(); mainGUI.start(); diff --git a/src/avatartranslator/directsimulation/AvatarSimulationBlock.java b/src/avatartranslator/directsimulation/AvatarSimulationBlock.java index 866b5d9538ba0e2ff2bb9e2f00cb2f46a0b3c828..12c8ccb8790b86dd93df5319130f9bfd52a6d2f2 100644 --- a/src/avatartranslator/directsimulation/AvatarSimulationBlock.java +++ b/src/avatartranslator/directsimulation/AvatarSimulationBlock.java @@ -652,6 +652,9 @@ public class AvatarSimulationBlock { String act = _expr; int cpt = 0; for(String attrValue: _attributeValues) { + if (attrValue.trim().startsWith("-")) { + attrValue = "(0" + attrValue + ")"; + } act = Conversion.putVariableValueInString(AvatarSpecification.ops, act, getAttributeName(cpt), attrValue); cpt ++; } diff --git a/src/compiler/tmlgrammar/JJTTMLExprParserState.java b/src/compiler/tmlgrammar/JJTTMLExprParserState.java index c74715f1ae77b560ab812ef8946f493a3099ef7b..939df05a04cd4b4e182d309690b7490d89383700 100755 --- a/src/compiler/tmlgrammar/JJTTMLExprParserState.java +++ b/src/compiler/tmlgrammar/JJTTMLExprParserState.java @@ -1,52 +1,15 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/* Generated By:JJTree: Do not edit this line. ./JJTTMLExprParserState.java */ - -class JJTTMLExprParserState { - private java.util.Stack nodes; - private java.util.Stack marks; - - private int sp; // number of nodes on stack - private int mk; // current mark +/* Generated By:JavaCC: Do not edit this line. JJTTMLExprParserState.java Version 5.0 */ +public class JJTTMLExprParserState { + private java.util.List<Node> nodes; + private java.util.List<Integer> marks; + + private int sp; // number of nodes on stack + private int mk; // current mark private boolean node_created; - JJTTMLExprParserState() { - nodes = new java.util.Stack(); - marks = new java.util.Stack(); + public JJTTMLExprParserState() { + nodes = new java.util.ArrayList<Node>(); + marks = new java.util.ArrayList<Integer>(); sp = 0; mk = 0; } @@ -54,62 +17,62 @@ class JJTTMLExprParserState { /* Determines whether the current node was actually closed and pushed. This should only be called in the final user action of a node scope. */ - boolean nodeCreated() { + public boolean nodeCreated() { return node_created; } /* Call this to reinitialize the node stack. It is called automatically by the parser's ReInit() method. */ - void reset() { - nodes.removeAllElements(); - marks.removeAllElements(); + 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. */ - Node rootNode() { - return (Node)nodes.elementAt(0); + public Node rootNode() { + return nodes.get(0); } /* Pushes a node on to the stack. */ - void pushNode(Node n) { - nodes.push(n); + public void pushNode(Node n) { + nodes.add(n); ++sp; } /* Returns the node on the top of the stack, and remove it from the stack. */ - Node popNode() { + public Node popNode() { if (--sp < mk) { - mk = ((Integer)marks.pop()).intValue(); + mk = marks.remove(marks.size()-1); } - return (Node)nodes.pop(); + return nodes.remove(nodes.size()-1); } /* Returns the node currently on the top of the stack. */ - Node peekNode() { - return (Node)nodes.peek(); + public Node peekNode() { + return nodes.get(nodes.size()-1); } /* Returns the number of children on the stack in the current node scope. */ - int nodeArity() { + public int nodeArity() { return sp - mk; } - void clearNodeScope(Node n) { + public void clearNodeScope(Node n) { while (sp > mk) { popNode(); } - mk = ((Integer)marks.pop()).intValue(); + mk = marks.remove(marks.size()-1); } - void openNodeScope(Node n) { - marks.push(new Integer(mk)); + public void openNodeScope(Node n) { + marks.add(mk); mk = sp; n.jjtOpen(); } @@ -119,8 +82,8 @@ class JJTTMLExprParserState { 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. */ - void closeNodeScope(Node n, int num) { - mk = ((Integer)marks.pop()).intValue(); + public void closeNodeScope(Node n, int num) { + mk = marks.remove(marks.size()-1); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); @@ -134,24 +97,25 @@ class JJTTMLExprParserState { /* 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 the conditional node, which is then pushed + 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. */ - void closeNodeScope(Node n, boolean condition) { + public void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); - mk = ((Integer)marks.pop()).intValue(); + mk = marks.remove(marks.size()-1); while (a-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, a); + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { - mk = ((Integer)marks.pop()).intValue(); + mk = marks.remove(marks.size()-1); node_created = false; } } } +/* JavaCC - OriginalChecksum=46dfc20b4af3a63efd8d952df60c4ca8 (do not edit this line) */ diff --git a/src/compiler/tmlgrammar/Node.java b/src/compiler/tmlgrammar/Node.java index 49ee9c6a827c082b675c4f9cb2972979f9d25756..62eed1c8878dee4c8230794ecaf3cb4ea1d99230 100755 --- a/src/compiler/tmlgrammar/Node.java +++ b/src/compiler/tmlgrammar/Node.java @@ -1,46 +1,11 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/* Generated By:JJTree: Do not edit this line. Node.java */ - +/* Generated By:JJTree: Do not edit this line. Node.java Version 4.3 */ +/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /* All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships between nodes. */ -public interface Node { +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. */ @@ -66,3 +31,4 @@ public interface Node { /** Return the number of children the node has. */ public int jjtGetNumChildren(); } +/* JavaCC - OriginalChecksum=51a365986f30b3d8da41a4f7d049ee04 (do not edit this line) */ diff --git a/src/compiler/tmlgrammar/ParseException.java b/src/compiler/tmlgrammar/ParseException.java index 9a00bdf4c94394c52a6dc6c72af71c9e3533441d..e51f46ca5fe68aebb30c82ca2a8f6b54fc087463 100755 --- a/src/compiler/tmlgrammar/ParseException.java +++ b/src/compiler/tmlgrammar/ParseException.java @@ -1,40 +1,5 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by @@ -46,25 +11,25 @@ package compiler.tmlparser; */ public class ParseException extends Exception { + /** + * The version identifier for this Serializable class. + * Increment only if the <i>serialized</i> 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. The boolean - * flag "specialConstructor" is also set to true to indicate that - * this constructor was used to create this object. - * This constructor calls its super class with the empty string - * to force the "toString" method of parent class "Throwable" to - * print the error message in the form: - * ParseException: <result of getMessage> + * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { - super(""); - specialConstructor = true; + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; @@ -82,20 +47,13 @@ public class ParseException extends Exception { public ParseException() { super(); - specialConstructor = false; } + /** Constructor with message. */ public ParseException(String message) { super(message); - specialConstructor = false; } - /** - * This variable determines which constructor was used to create - * this object and thereby affects the semantics of the - * "getMessage" method (see below). - */ - protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If @@ -119,19 +77,16 @@ public class ParseException extends Exception { public String[] tokenImage; /** - * This method has the standard behavior when this object has been - * created using the standard constructors. Otherwise, it uses - * "currentToken" and "expectedTokenSequences" to generate a parse + * 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), then this method is called during the printing - * of the final stack trace, and hence the correct error message + * from the parser) the correct error message * gets displayed. */ - public String getMessage() { - if (!specialConstructor) { - return super.getMessage(); - } + 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++) { @@ -139,7 +94,7 @@ public class ParseException extends Exception { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" "); + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); @@ -154,8 +109,11 @@ public class ParseException extends Exception { retval += tokenImage[0]; break; } + retval += " " + tokenImage[tok.kind]; + retval += " \""; retval += add_escapes(tok.image); - tok = tok.next; + retval += " \""; + tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; @@ -172,13 +130,13 @@ public class ParseException extends Exception { * 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. */ - protected String add_escapes(String str) { + static String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { @@ -224,3 +182,4 @@ public class ParseException extends Exception { } } +/* JavaCC - OriginalChecksum=c5a983a229aa877dc2b3b3b9933cdd6b (do not edit this line) */ diff --git a/src/compiler/tmlgrammar/SimpleCharStream.java b/src/compiler/tmlgrammar/SimpleCharStream.java index 02b1bc85b9f5894a5e01a8816481a85335691a8c..db12e2dc20f0dc9dc6150728157d439607a8c66d 100755 --- a/src/compiler/tmlgrammar/SimpleCharStream.java +++ b/src/compiler/tmlgrammar/SimpleCharStream.java @@ -1,40 +1,5 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). @@ -42,10 +7,12 @@ package compiler.tmlparser; 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[]; @@ -69,210 +36,218 @@ public class SimpleCharStream protected void ExpandBuff(boolean wrapAround) { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; + 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()); - } + 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; + bufsize += 2048; + available = bufsize; + tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { - if (maxNextCharInd == available) - { - if (available == bufsize) + if (maxNextCharInd == available) + { + if (available == bufsize) + { + if (tokenBegin > 2048) { - if (tokenBegin > 2048) - { - bufpos = maxNextCharInd = 0; - available = tokenBegin; - } - else if (tokenBegin < 0) - bufpos = maxNextCharInd = 0; - else - ExpandBuff(false); + bufpos = maxNextCharInd = 0; + available = tokenBegin; } - else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); + else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; else - available = tokenBegin; - } + 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; - } + 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; + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; - return c; + return c; } protected void UpdateLineColumn(char c) { - column++; + column++; - if (prevCharIsLF) - { - prevCharIsLF = false; + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else 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; + } + + 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 (inBuf > 0) + { + --inBuf; - if (++bufpos == bufsize) - bufpos = 0; + if (++bufpos == bufsize) + bufpos = 0; - return buffer[bufpos]; - } + return buffer[bufpos]; + } - if (++bufpos >= maxNextCharInd) - FillBuff(); + if (++bufpos >= maxNextCharInd) + FillBuff(); - char c = buffer[bufpos]; + char c = buffer[bufpos]; - UpdateLineColumn(c); - return (c); + UpdateLineColumn(c); + return c; } + @Deprecated /** - * @deprecated + * @deprecated * @see #getEndColumn */ public int getColumn() { - return bufcolumn[bufpos]; + return bufcolumn[bufpos]; } + @Deprecated /** - * @deprecated + * @deprecated * @see #getEndLine */ public int getLine() { - return bufline[bufpos]; + return bufline[bufpos]; } + /** Get token end column number. */ public int getEndColumn() { - return bufcolumn[bufpos]; + 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]; + return bufcolumn[tokenBegin]; } + /** Get token beginning line number. */ public int getBeginLine() { - return bufline[tokenBegin]; + return bufline[tokenBegin]; } +/** Backup a number of characters. */ public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) - bufpos += bufsize; + bufpos += bufsize; } + /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { @@ -286,16 +261,20 @@ public class SimpleCharStream bufcolumn = new int[buffersize]; } + /** Constructor. */ public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { - this(dstream, startline, startcolumn, 4096); + this(dstream, startline, startcolumn, 4096); } + /** Constructor. */ public SimpleCharStream(java.io.Reader dstream) { - this(dstream, 1, 1, 4096); + this(dstream, 1, 1, 4096); } + + /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { @@ -315,111 +294,128 @@ public class SimpleCharStream bufpos = -1; } + /** Reinitialise. */ public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); + ReInit(dstream, startline, startcolumn, 4096); } + /** Reinitialise. */ public void ReInit(java.io.Reader dstream) { - ReInit(dstream, 1, 1, 4096); + 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); + 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); + 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); + this(dstream, encoding, startline, startcolumn, 4096); } + /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { - this(dstream, startline, startcolumn, 4096); + this(dstream, startline, startcolumn, 4096); } + /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, 1, 1, 4096); + this(dstream, encoding, 1, 1, 4096); } + /** Constructor. */ public SimpleCharStream(java.io.InputStream dstream) { - this(dstream, 1, 1, 4096); + 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); + 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); + 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); + ReInit(dstream, encoding, 1, 1, 4096); } + /** Reinitialise. */ public void ReInit(java.io.InputStream dstream) { - ReInit(dstream, 1, 1, 4096); + 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); + ReInit(dstream, encoding, startline, startcolumn, 4096); } + /** Reinitialise. */ public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); + 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); + 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]; + 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); - } + 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; + return ret; } + /** Reset buffer when finished. */ public void Done() { - buffer = null; - bufline = null; - bufcolumn = null; + buffer = null; + bufline = null; + bufcolumn = null; } /** @@ -427,47 +423,47 @@ public class SimpleCharStream */ 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; - } - } + 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]; + line = bufline[j]; + column = bufcolumn[j]; } } +/* JavaCC - OriginalChecksum=b0bce35239226f00f9dd0fa14ab3ad17 (do not edit this line) */ diff --git a/src/compiler/tmlgrammar/SimpleNode.java b/src/compiler/tmlgrammar/SimpleNode.java index 5d9b3fa994edc0b1b68300ed0a1a6500e1f6b809..93157d72d3d0e8613cef6cf4ce596d713727c67a 100755 --- a/src/compiler/tmlgrammar/SimpleNode.java +++ b/src/compiler/tmlgrammar/SimpleNode.java @@ -1,188 +1,77 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille +/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */ +/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +public +class SimpleNode implements Node { -ludovic.apvrille AT enst.fr + protected Node parent; + protected Node[] children; + protected int id; + protected Object value; + protected TMLExprParser parser; -This software is a computer program whose purpose is to allow the -edition of TURTLE analysis, design and deployment diagrams, to -allow the generation of RT-LOTOS or Java code from this diagram, -and at last to allow the analysis of formal validation traces -obtained from external tools, e.g. RTL from LAAS-CNRS and CADP -from INRIA Rhone-Alpes. + public SimpleNode(int i) { + id = i; + } -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". + public SimpleNode(TMLExprParser p, int i) { + this(i); + parser = p; + } -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. + public void jjtOpen() { + } -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. + public void jjtClose() { + } -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms. + public void jjtSetParent(Node n) { parent = n; } + public Node jjtGetParent() { return parent; } -/** - * Class SimpleNode - * Creation: 04/06/2008 - * @version 1.0 04/06/2008 - * @author Ludovic APVRILLE - * @see - */ + 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; } + + /* 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. */ - /* Has been partially generated by: JJTree */ -/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ + public String toString() { return TMLExprParserTreeConstants.jjtNodeName[id]; } + public String toString(String prefix) { return prefix + toString(); } -import java.util.*; + /* Override this method if you want to customize how the node dumps + out its children. */ -public class SimpleNode implements Node { - protected Node parent; - protected Node[] children; - protected int id; - protected TMLExprParser parser; - - public String kind = "noKind", value="noValue"; - - public SimpleNode(int i) { - id = i; - } - - public SimpleNode(TMLExprParser p, int i) { - this(i); - parser = p; - } - - public void setInfo(String _kind, String _value) { - kind = _kind; - value = _value; + 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 + " "); + } + } } - - 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; - } - - /* 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 TMLExprParserTreeConstants.jjtNodeName[id]; } - public String toString() { - return TMLExprParserTreeConstants.jjtNodeName[id] + "/" + kind + "/" + value; - } - 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 + " "); - } - } - } - } - - public ArrayList<String> getVariables() { - ArrayList<String> list = new ArrayList<String>(); - getVariables(list); - return list; - } - - public void getVariables(ArrayList<String> list) { - String s; - - s = TMLExprParserTreeConstants.jjtNodeName[id]; - if (s.indexOf("ID") > -1) { - list.add(value); - } - - if (children != null) { - for (int i = 0; i < children.length; ++i) { - SimpleNode n = (SimpleNode)children[i]; - if (n != null) { - n.getVariables(list); - } - } - } - } + } } +/* JavaCC - OriginalChecksum=289de6763ae76fb0310db86a24689904 (do not edit this line) */ diff --git a/src/compiler/tmlgrammar/TMLExprParser.java b/src/compiler/tmlgrammar/TMLExprParser.java index 69173eaad4628494186182c0ee62ca3db7dce960..419907c59f24372a3ee54daa1eeb36cc97685327 100755 --- a/src/compiler/tmlgrammar/TMLExprParser.java +++ b/src/compiler/tmlgrammar/TMLExprParser.java @@ -1,39 +1,3 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - /* Generated By:JJTree&JavaCC: Do not edit this line. TMLExprParser.java */ public class TMLExprParser/*@bgen(jjtree)*/implements TMLExprParserTreeConstants, TMLExprParserConstants {/*@bgen(jjtree)*/ protected JJTTMLExprParserState jjtree = new JJTTMLExprParserState();private int x; @@ -1646,35 +1610,35 @@ void BoolExtendedExpressionAfterIDComparisonID() : } } - final private boolean jj_2_1(int xla) { + 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); } } - final private boolean jj_2_2(int 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); } } - final private boolean jj_2_3(int 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); } } - final private boolean jj_2_4(int xla) { + private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } - final private boolean jj_3_2() { + private boolean jj_3_2() { if (jj_3R_4()) return true; if (jj_3R_5()) return true; if (jj_3R_6()) return true; @@ -1684,7 +1648,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_5() { + private boolean jj_3R_5() { Token xsp; xsp = jj_scanpos; if (jj_3_1()) { @@ -1703,7 +1667,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3_1() { + private boolean jj_3_1() { if (jj_3R_1()) return true; if (jj_3R_2()) return true; if (jj_3R_1()) return true; @@ -1713,7 +1677,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_14() { + private boolean jj_3R_14() { if (jj_3R_22()) return true; Token xsp; xsp = jj_scanpos; @@ -1721,7 +1685,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_13() { + private boolean jj_3R_13() { if (jj_3R_20()) return true; Token xsp; xsp = jj_scanpos; @@ -1729,7 +1693,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_12() { + private boolean jj_3R_12() { if (jj_3R_18()) return true; Token xsp; xsp = jj_scanpos; @@ -1737,7 +1701,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_11() { + private boolean jj_3R_11() { if (jj_3R_4()) return true; if (jj_3R_1()) return true; if (jj_3R_6()) return true; @@ -1747,7 +1711,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_1() { + private boolean jj_3R_1() { Token xsp; xsp = jj_scanpos; if (jj_3R_11()) { @@ -1763,7 +1727,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_49() { + private boolean jj_3R_49() { if (jj_scan_token(DESTROY)) return true; if (jj_3R_4()) return true; if (jj_3R_1()) return true; @@ -1773,7 +1737,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_48() { + private boolean jj_3R_48() { if (jj_scan_token(DEQUEUE)) return true; if (jj_3R_4()) return true; if (jj_3R_37()) return true; @@ -1781,7 +1745,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_47() { + private boolean jj_3R_47() { if (jj_scan_token(ENQUEUE)) return true; if (jj_3R_4()) return true; if (jj_3R_1()) return true; @@ -1791,7 +1755,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_44() { + private boolean jj_3R_44() { Token xsp; xsp = jj_scanpos; if (jj_3R_47()) { @@ -1804,7 +1768,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_2() { + private boolean jj_3R_2() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(35)) { @@ -1823,7 +1787,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_8() { + private boolean jj_3R_8() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(11)) { @@ -1833,39 +1797,39 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_43() { + private boolean jj_3R_43() { if (jj_3R_46()) return true; return false; } - final private boolean jj_3R_3() { + private boolean jj_3R_3() { if (jj_3R_15()) return true; return false; } - final private boolean jj_3R_45() { + private boolean jj_3R_45() { if (jj_scan_token(QUEUE_LITERAL)) return true; return false; } - final private boolean jj_3R_42() { + private boolean jj_3R_42() { if (jj_3R_45()) return true; return false; } - final private boolean jj_3R_41() { + private boolean jj_3R_41() { if (jj_3R_44()) return true; return false; } - final private boolean jj_3R_40() { + private boolean jj_3R_40() { if (jj_3R_4()) return true; if (jj_3R_37()) return true; if (jj_3R_6()) return true; return false; } - final private boolean jj_3R_37() { + private boolean jj_3R_37() { Token xsp; xsp = jj_scanpos; if (jj_3R_40()) { @@ -1881,7 +1845,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_24() { + private boolean jj_3R_24() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(70)) { @@ -1894,7 +1858,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_32() { + private boolean jj_3R_32() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(48)) { @@ -1913,28 +1877,28 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_20() { + private boolean jj_3R_20() { if (jj_scan_token(NATURAL_LITERAL)) return true; return false; } - final private boolean jj_3R_27() { + private boolean jj_3R_27() { if (jj_3R_32()) return true; if (jj_3R_1()) return true; return false; } - final private boolean jj_3R_6() { + private boolean jj_3R_6() { if (jj_scan_token(RPAREN)) return true; return false; } - final private boolean jj_3R_7() { + private boolean jj_3R_7() { if (jj_3R_15()) return true; return false; } - final private boolean jj_3R_39() { + private boolean jj_3R_39() { if (jj_scan_token(LAST)) return true; if (jj_3R_4()) return true; if (jj_3R_37()) return true; @@ -1942,7 +1906,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_38() { + private boolean jj_3R_38() { if (jj_scan_token(FIRST)) return true; if (jj_3R_4()) return true; if (jj_3R_37()) return true; @@ -1950,12 +1914,12 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_4() { + private boolean jj_3R_4() { if (jj_scan_token(LPAREN)) return true; return false; } - final private boolean jj_3R_34() { + private boolean jj_3R_34() { Token xsp; xsp = jj_scanpos; if (jj_3R_38()) { @@ -1965,17 +1929,17 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_10() { + private boolean jj_3R_10() { if (jj_scan_token(IDENTIFIER)) return true; return false; } - final private boolean jj_3R_17() { + private boolean jj_3R_17() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3R_33() { + private boolean jj_3R_33() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(73)) { @@ -1985,22 +1949,22 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_36() { + private boolean jj_3R_36() { if (jj_scan_token(EMPTY)) return true; return false; } - final private boolean jj_3R_26() { + private boolean jj_3R_26() { if (jj_3R_15()) return true; return false; } - final private boolean jj_3R_29() { + private boolean jj_3R_29() { if (jj_3R_34()) return true; return false; } - final private boolean jj_3R_18() { + private boolean jj_3R_18() { Token xsp; xsp = jj_scanpos; if (jj_3R_28()) { @@ -2010,7 +1974,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_28() { + private boolean jj_3R_28() { if (jj_3R_33()) return true; if (jj_3R_4()) return true; if (jj_3R_1()) return true; @@ -2020,17 +1984,17 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_35() { + private boolean jj_3R_35() { if (jj_scan_token(NOT)) return true; return false; } - final private boolean jj_3R_9() { + private boolean jj_3R_9() { if (jj_3R_15()) return true; return false; } - final private boolean jj_3R_31() { + private boolean jj_3R_31() { if (jj_3R_36()) return true; if (jj_3R_4()) return true; if (jj_3R_37()) return true; @@ -2038,13 +2002,13 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_15() { + private boolean jj_3R_15() { if (jj_3R_24()) return true; if (jj_3R_5()) return true; return false; } - final private boolean jj_3R_30() { + private boolean jj_3R_30() { if (jj_3R_35()) return true; if (jj_3R_4()) return true; if (jj_3R_5()) return true; @@ -2052,7 +2016,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_25() { + private boolean jj_3R_25() { Token xsp; xsp = jj_scanpos; if (jj_3R_30()) { @@ -2062,17 +2026,17 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_21() { + private boolean jj_3R_21() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3R_46() { + private boolean jj_3R_46() { if (jj_scan_token(IDENTIFIER)) return true; return false; } - final private boolean jj_3R_16() { + private boolean jj_3R_16() { if (jj_3R_25()) return true; Token xsp; xsp = jj_scanpos; @@ -2080,27 +2044,27 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } - final private boolean jj_3R_19() { + private boolean jj_3R_19() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3_4() { + private boolean jj_3_4() { if (jj_3R_10()) return true; return false; } - final private boolean jj_3R_23() { + private boolean jj_3R_23() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3R_22() { + private boolean jj_3R_22() { if (jj_scan_token(IDENTIFIER)) return true; return false; } - final private boolean jj_3_3() { + private boolean jj_3_3() { if (jj_3R_8()) return true; Token xsp; xsp = jj_scanpos; @@ -2108,40 +2072,44 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } + /** Generated Token Manager. */ public TMLExprParserTokenManager token_source; SimpleCharStream jj_input_stream; - public Token token, jj_nt; + /** 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; - public boolean lookingAhead = false; - private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[44]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; static { - jj_la1_0(); - jj_la1_1(); - jj_la1_2(); + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); } - private static void jj_la1_0() { + private static void jj_la1_init_0() { jj_la1_0 = new int[] {0xe0fff800,0x0,0x0,0x0,0x0,0xc0000000,0xc0000000,0x0,0xc0000000,0x0,0x18000000,0x18000000,0x0,0x0,0x0,0x0,0x20000000,0x20000000,0x0,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x1800,0x0,0x0,0x0,0x1800,0x3000000,0x1800,0x1800,}; } - private static void jj_la1_1() { + private static void jj_la1_init_1() { jj_la1_1 = new int[] {0x0,0x8f0000,0x8f0000,0x8f0000,0x8f0000,0x0,0x0,0x0,0x0,0x8f0000,0x1,0x1,0x100,0x100,0x100,0x100,0x0,0x0,0x100,0x0,0x70c,0xc,0x50,0x0,0x50,0x50,0x50,0x0,0x50,0x50,0x50,0x50,0x0,0x50,0x50,0x50,0x0,0x50,0x50,0x50,0x0,0x0,0x0,0x0,}; } - private static void jj_la1_2() { + private static void jj_la1_init_2() { jj_la1_2 = new int[] {0x4a700,0x0,0x0,0x0,0x0,0x4a600,0x600,0x600,0x0,0x0,0x4c000,0x0,0xc0,0xc0,0xc0,0xc0,0x100,0x100,0xc0,0xc0,0x0,0x0,0x0,0xa000,0x0,0x0,0x800000,0xa000,0x0,0x0,0x0,0x0,0xa000,0x0,0x0,0x800000,0xa000,0x0,0x0,0x0,0xa000,0x0,0x2000,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[4]; private boolean jj_rescan = false; private int jj_gc = 0; + /** Constructor with InputStream. */ public TMLExprParser(java.io.InputStream stream) { this(stream, null); } + /** Constructor with InputStream and supplied encoding */ public TMLExprParser(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 TMLExprParserTokenManager(jj_input_stream); @@ -2152,9 +2120,11 @@ void BoolExtendedExpressionAfterIDComparisonID() : 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); @@ -2166,6 +2136,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Constructor. */ public TMLExprParser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new TMLExprParserTokenManager(jj_input_stream); @@ -2176,6 +2147,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : 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); @@ -2187,6 +2159,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Constructor with generated Token Manager. */ public TMLExprParser(TMLExprParserTokenManager tm) { token_source = tm; token = new Token(); @@ -2196,6 +2169,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Reinitialise. */ public void ReInit(TMLExprParserTokenManager tm) { token_source = tm; token = new Token(); @@ -2206,7 +2180,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } - final private Token jj_consume_token(int kind) throws ParseException { + 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(); @@ -2232,7 +2206,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : static private final class LookaheadSuccess extends java.lang.Error { } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - final private boolean jj_scan_token(int kind) { + private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { @@ -2253,6 +2227,8 @@ void BoolExtendedExpressionAfterIDComparisonID() : return false; } + +/** Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); @@ -2261,8 +2237,9 @@ void BoolExtendedExpressionAfterIDComparisonID() : return token; } +/** Get the specific Token. */ final public Token getToken(int index) { - Token t = lookingAhead ? jj_scanpos : token; + Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); @@ -2270,14 +2247,14 @@ void BoolExtendedExpressionAfterIDComparisonID() : return t; } - final private int jj_ntk() { + 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.Vector jj_expentries = new java.util.Vector(); + private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; @@ -2292,31 +2269,26 @@ void BoolExtendedExpressionAfterIDComparisonID() : for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } - boolean exists = false; - for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { - int[] oldentry = (int[])(e.nextElement()); + jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) { + int[] oldentry = (int[])(it.next()); if (oldentry.length == jj_expentry.length) { - exists = true; for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { - exists = false; - break; + continue jj_entries_loop; } } - if (exists) break; + jj_expentries.add(jj_expentry); + break jj_entries_loop; } } - if (!exists) jj_expentries.addElement(jj_expentry); if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } + /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.removeAllElements(); + jj_expentries.clear(); boolean[] la1tokens = new boolean[89]; - for (int i = 0; i < 89; i++) { - la1tokens[i] = false; - } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; @@ -2340,7 +2312,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; - jj_expentries.addElement(jj_expentry); + jj_expentries.add(jj_expentry); } } jj_endpos = 0; @@ -2348,18 +2320,20 @@ void BoolExtendedExpressionAfterIDComparisonID() : jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = (int[])jj_expentries.elementAt(i); + exptokseq[i] = jj_expentries.get(i); } return new ParseException(token, exptokseq, tokenImage); } + /** Enable tracing. */ final public void enable_tracing() { } + /** Disable tracing. */ final public void disable_tracing() { } - final private void jj_rescan_token() { + private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 4; i++) { try { @@ -2381,7 +2355,7 @@ void BoolExtendedExpressionAfterIDComparisonID() : jj_rescan = false; } - final private void jj_save(int index, int xla) { + 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; } diff --git a/src/compiler/tmlgrammar/TMLExprParserConstants.java b/src/compiler/tmlgrammar/TMLExprParserConstants.java index 668d86c2b5acec65cc7b27fa525cc0ec89401836..f96b728aefd635b9e814210cc547d359869a558f 100755 --- a/src/compiler/tmlgrammar/TMLExprParserConstants.java +++ b/src/compiler/tmlgrammar/TMLExprParserConstants.java @@ -1,129 +1,184 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - /* Generated By:JJTree&JavaCC: Do not edit this line. TMLExprParserConstants.java */ + +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ public interface TMLExprParserConstants { + /** End of File. */ int EOF = 0; + /** RegularExpression Id. */ int SINGLE_LINE_COMMENT = 6; + /** RegularExpression Id. */ int FORMAL_COMMENT = 7; + /** RegularExpression Id. */ int MULTI_LINE_COMMENT = 8; + /** RegularExpression Id. */ int ABSTRACT = 9; + /** RegularExpression Id. */ int BOOLEAN = 10; + /** RegularExpression Id. */ int TRUE = 11; + /** RegularExpression Id. */ int FALSE = 12; + /** RegularExpression Id. */ int ASSIGNMENT_NAT = 13; + /** RegularExpression Id. */ int ASSIGNMENT_BOOL = 14; + /** RegularExpression Id. */ int ASSIGNMENT_QUEUE_NAT = 15; + /** RegularExpression Id. */ int GUARD = 16; + /** RegularExpression Id. */ int ACTION_NAT = 17; + /** RegularExpression Id. */ int ACTION_BOOL = 18; + /** RegularExpression Id. */ int ACTION_QUEUE_NAT = 19; + /** RegularExpression Id. */ int ACTION_GATE = 20; + /** RegularExpression Id. */ int ACTION_GATE_VALUE = 21; + /** RegularExpression Id. */ int NAT_ID = 22; + /** RegularExpression Id. */ int NAT_NUMERAL = 23; + /** RegularExpression Id. */ int NAT_TYPE = 24; + /** RegularExpression Id. */ int BOOL_TYPE = 25; + /** RegularExpression Id. */ int QUEUE_NAT_TYPE = 26; + /** RegularExpression Id. */ int ENQUEUE = 27; + /** RegularExpression Id. */ int DEQUEUE = 28; + /** RegularExpression Id. */ int EMPTY = 29; + /** RegularExpression Id. */ int FIRST = 30; + /** RegularExpression Id. */ int LAST = 31; + /** RegularExpression Id. */ int DESTROY = 32; + /** RegularExpression Id. */ int ASSIGN = 33; + /** RegularExpression Id. */ int GT = 34; + /** RegularExpression Id. */ int LT = 35; + /** RegularExpression Id. */ int BANG = 36; + /** RegularExpression Id. */ int TILDE = 37; + /** RegularExpression Id. */ int HOOK = 38; + /** RegularExpression Id. */ int COLON = 39; + /** RegularExpression Id. */ int EQ = 40; + /** RegularExpression Id. */ int LE = 41; + /** RegularExpression Id. */ int GE = 42; + /** RegularExpression Id. */ int NE = 43; + /** RegularExpression Id. */ int SC_OR = 44; + /** RegularExpression Id. */ int SC_AND = 45; + /** RegularExpression Id. */ int INCR = 46; + /** RegularExpression Id. */ int DECR = 47; + /** RegularExpression Id. */ int PLUS = 48; + /** RegularExpression Id. */ int MINUS = 49; + /** RegularExpression Id. */ int STAR = 50; + /** RegularExpression Id. */ int SLASH = 51; + /** RegularExpression Id. */ int BIT_AND = 52; + /** RegularExpression Id. */ int BIT_OR = 53; + /** RegularExpression Id. */ int XOR = 54; + /** RegularExpression Id. */ int REM = 55; + /** RegularExpression Id. */ int LSHIFT = 56; + /** RegularExpression Id. */ int RSIGNEDSHIFT = 57; + /** RegularExpression Id. */ int RUNSIGNEDSHIFT = 58; + /** RegularExpression Id. */ int PLUSASSIGN = 59; + /** RegularExpression Id. */ int MINUSASSIGN = 60; + /** RegularExpression Id. */ int STARASSIGN = 61; + /** RegularExpression Id. */ int SLASHASSIGN = 62; + /** RegularExpression Id. */ int ANDASSIGN = 63; + /** RegularExpression Id. */ int ORASSIGN = 64; + /** RegularExpression Id. */ int XORASSIGN = 65; + /** RegularExpression Id. */ int REMASSIGN = 66; + /** RegularExpression Id. */ int LSHIFTASSIGN = 67; + /** RegularExpression Id. */ int RSIGNEDSHIFTASSIGN = 68; + /** RegularExpression Id. */ int RUNSIGNEDSHIFTASSIGN = 69; + /** RegularExpression Id. */ int AND = 70; + /** RegularExpression Id. */ int OR = 71; + /** RegularExpression Id. */ int NOT = 72; + /** RegularExpression Id. */ int MIN = 73; + /** RegularExpression Id. */ int MAX = 74; + /** RegularExpression Id. */ int DIV = 75; + /** RegularExpression Id. */ int MOD = 76; + /** RegularExpression Id. */ int NATURAL_LITERAL = 77; + /** RegularExpression Id. */ int QUEUE_LITERAL = 78; + /** RegularExpression Id. */ int IDENTIFIER = 79; + /** RegularExpression Id. */ int LETTER = 80; + /** RegularExpression Id. */ int DIGIT = 81; + /** RegularExpression Id. */ int LPAREN = 82; + /** RegularExpression Id. */ int RPAREN = 83; + /** RegularExpression Id. */ int COMMA = 84; + /** RegularExpression Id. */ int LBRACKET = 85; + /** RegularExpression Id. */ int RBRACKET = 86; + /** RegularExpression Id. */ int LBRACE = 87; + /** RegularExpression Id. */ int RBRACE = 88; + /** Lexical state. */ int DEFAULT = 0; + /** Literal token values. */ String[] tokenImage = { "<EOF>", "\" \"", diff --git a/src/compiler/tmlgrammar/TMLExprParserTokenManager.java b/src/compiler/tmlgrammar/TMLExprParserTokenManager.java index cc139cb202433c0345ffb5fc6b09eec30629c4db..bf87dd7fa7e366a2bf01ac8c53e6a799d29bf121 100755 --- a/src/compiler/tmlgrammar/TMLExprParserTokenManager.java +++ b/src/compiler/tmlgrammar/TMLExprParserTokenManager.java @@ -1,44 +1,12 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - /* Generated By:JJTree&JavaCC: Do not edit this line. TMLExprParserTokenManager.java */ +/** Token Manager. */ public class TMLExprParserTokenManager implements TMLExprParserConstants { + + /** 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) { @@ -199,21 +167,13 @@ private final int jjStartNfa_0(int pos, long active0, long active1) { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); } -private final int jjStopAtPos(int pos, int kind) +private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } -private final 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); -} -private final int jjMoveStringLiteralDfa0_0() +private int jjMoveStringLiteralDfa0_0() { switch(curChar) { @@ -307,7 +267,7 @@ private final int jjMoveStringLiteralDfa0_0() return jjMoveNfa_0(0, 0); } } -private final int jjMoveStringLiteralDfa1_0(long active0, long active1) +private int jjMoveStringLiteralDfa1_0(long active0, long active1) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { @@ -401,10 +361,10 @@ private final int jjMoveStringLiteralDfa1_0(long active0, long active1) } return jjStartNfa_0(0, active0, active1); } -private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long 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); + return jjStartNfa_0(0, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(1, active0, active1); @@ -477,10 +437,10 @@ private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, } return jjStartNfa_0(1, active0, active1); } -private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) +private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) - return jjStartNfa_0(1, old0, old1); + return jjStartNfa_0(1, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0, active1); @@ -526,10 +486,10 @@ private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, } return jjStartNfa_0(2, active0, active1); } -private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) +private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) - return jjStartNfa_0(2, old0, old1); + return jjStartNfa_0(2, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0, 0L); @@ -568,7 +528,7 @@ private final int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, } return jjStartNfa_0(3, active0, 0L); } -private final int jjMoveStringLiteralDfa5_0(long old0, long active0) +private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0, 0L); @@ -602,7 +562,7 @@ private final int jjMoveStringLiteralDfa5_0(long old0, long active0) } return jjStartNfa_0(4, active0, 0L); } -private final int jjMoveStringLiteralDfa6_0(long old0, long active0) +private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0, 0L); @@ -646,7 +606,7 @@ private final int jjMoveStringLiteralDfa6_0(long old0, long active0) } return jjStartNfa_0(5, active0, 0L); } -private final int jjMoveStringLiteralDfa7_0(long old0, long active0) +private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0, 0L); @@ -676,7 +636,7 @@ private final int jjMoveStringLiteralDfa7_0(long old0, long active0) } return jjStartNfa_0(6, active0, 0L); } -private final int jjMoveStringLiteralDfa8_0(long old0, long active0) +private int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(6, old0, 0L); @@ -706,7 +666,7 @@ private final int jjMoveStringLiteralDfa8_0(long old0, long active0) } return jjStartNfa_0(7, active0, 0L); } -private final int jjMoveStringLiteralDfa9_0(long old0, long active0) +private int jjMoveStringLiteralDfa9_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(7, old0, 0L); @@ -739,7 +699,7 @@ private final int jjMoveStringLiteralDfa9_0(long old0, long active0) } return jjStartNfa_0(8, active0, 0L); } -private final int jjMoveStringLiteralDfa10_0(long old0, long active0) +private int jjMoveStringLiteralDfa10_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(8, old0, 0L); @@ -763,7 +723,7 @@ private final int jjMoveStringLiteralDfa10_0(long old0, long active0) } return jjStartNfa_0(9, active0, 0L); } -private final int jjMoveStringLiteralDfa11_0(long old0, long active0) +private int jjMoveStringLiteralDfa11_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(9, old0, 0L); @@ -783,7 +743,7 @@ private final int jjMoveStringLiteralDfa11_0(long old0, long active0) } return jjStartNfa_0(10, active0, 0L); } -private final int jjMoveStringLiteralDfa12_0(long old0, long active0) +private int jjMoveStringLiteralDfa12_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(10, old0, 0L); @@ -803,7 +763,7 @@ private final int jjMoveStringLiteralDfa12_0(long old0, long active0) } return jjStartNfa_0(11, active0, 0L); } -private final int jjMoveStringLiteralDfa13_0(long old0, long active0) +private int jjMoveStringLiteralDfa13_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(11, old0, 0L); @@ -825,7 +785,7 @@ private final int jjMoveStringLiteralDfa13_0(long old0, long active0) } return jjStartNfa_0(12, active0, 0L); } -private final int jjMoveStringLiteralDfa14_0(long old0, long active0) +private int jjMoveStringLiteralDfa14_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(12, old0, 0L); @@ -845,35 +805,13 @@ private final int jjMoveStringLiteralDfa14_0(long old0, long active0) } return jjStartNfa_0(13, active0, 0L); } -private final void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private final void jjAddStates(int start, int end) +private int jjStartNfaWithStates_0(int pos, int kind, int state) { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private final void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} -private final void jjCheckNAddStates(int start, int end) -{ - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); -} -private final void jjCheckNAddStates(int start) -{ - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); + 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 = { 0x1ff00000fffffffeL, 0xffffffffffffc000L, 0xffffffffL, 0x600000000000000L @@ -896,14 +834,13 @@ static final long[] jjbitVec6 = { static final long[] jjbitVec7 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; -private final int jjMoveNfa_0(int startState, int curPos) +private int jjMoveNfa_0(int startState, int curPos) { - int[] nextStates; int startsAt = 0; jjnewStateCnt = 24; int i = 1; jjstateSet[0] = startState; - int j, kind = 0x7fffffff; + int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) @@ -911,7 +848,7 @@ private final int jjMoveNfa_0(int startState, int curPos) if (curChar < 64) { long l = 1L << curChar; - MatchLoop: do + do { switch(jjstateSet[--i]) { @@ -1051,7 +988,7 @@ private final int jjMoveNfa_0(int startState, int curPos) else if (curChar < 128) { long l = 1L << (curChar & 077); - MatchLoop: do + do { switch(jjstateSet[--i]) { @@ -1091,7 +1028,7 @@ private final int jjMoveNfa_0(int startState, int curPos) long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); - MatchLoop: do + do { switch(jjstateSet[--i]) { @@ -1159,7 +1096,7 @@ private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, lo return ((jjbitVec5[i2] & l2) != 0L); case 61: return ((jjbitVec6[i2] & l2) != 0L); - default : + default : if ((jjbitVec0[i1] & l1) != 0L) return true; return false; @@ -1171,10 +1108,12 @@ private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, lo { case 0: return ((jjbitVec7[i2] & l2) != 0L); - default : + default : return false; } } + +/** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, null, "\141\142\163\164\162\141\143\164", "\142\157\157\154\145\141\156", "\164\162\165\145", "\146\141\154\163\145", @@ -1192,8 +1131,10 @@ public static final String[] jjstrLiteralImages = { "\76\76\75", "\76\76\76\75", "\141\156\144", "\157\162", "\156\157\164", "\155\151\156", "\155\141\170", "\144\151\166", "\155\157\144", null, "\116\151\154", null, null, null, "\50", "\51", "\54", "\133", "\135", "\173", "\175", }; + +/** Lexer state names. */ public static final String[] lexStateNames = { - "DEFAULT", + "DEFAULT", }; static final long[] jjtoToken = { 0xfffffffffffffe01L, 0x1fcffffL, @@ -1208,15 +1149,20 @@ protected SimpleCharStream input_stream; private final int[] jjrounds = new int[24]; private final int[] jjstateSet = new int[48]; protected char curChar; +/** Constructor. */ public TMLExprParserTokenManager(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 TMLExprParserTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } + +/** Reinitialise parser. */ public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; @@ -1224,18 +1170,22 @@ public void ReInit(SimpleCharStream stream) input_stream = stream; ReInitRounds(); } -private final void ReInitRounds() +private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 24; 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) @@ -1246,14 +1196,25 @@ public void SwitchTo(int lexState) protected Token jjFillToken() { - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); + 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; } @@ -1264,22 +1225,22 @@ int jjround; int jjmatchedPos; int jjmatchedKind; +/** Get the next Token. */ public Token getNextToken() { - int kind; Token specialToken = null; Token matchedToken; int curPos = 0; EOFLoop : for (;;) - { - try - { + { + try + { curChar = input_stream.BeginToken(); - } + } catch(java.io.IOException e) - { + { jjmatchedKind = 0; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; @@ -1343,4 +1304,31 @@ public Token getNextToken() } } +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/src/compiler/tmlgrammar/TMLExprParserTreeConstants.java b/src/compiler/tmlgrammar/TMLExprParserTreeConstants.java index 8efbc784625707ffac5dcb73049001774fb0dad4..6302edb468f466c4a0d6b84fe3446ab3f775ebb9 100755 --- a/src/compiler/tmlgrammar/TMLExprParserTreeConstants.java +++ b/src/compiler/tmlgrammar/TMLExprParserTreeConstants.java @@ -1,41 +1,4 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/* Generated By:JJTree: Do not edit this line. ./TMLExprParserTreeConstants.java */ - +/* Generated By:JavaCC: Do not edit this line. TMLExprParserTreeConstants.java Version 5.0 */ public interface TMLExprParserTreeConstants { public int JJTROOT = 0; @@ -113,3 +76,4 @@ public interface TMLExprParserTreeConstants "BooleanLiteral", }; } +/* JavaCC - OriginalChecksum=db856ae5b69969f6a69b1ddc524e97d8 (do not edit this line) */ diff --git a/src/compiler/tmlgrammar/Token.java b/src/compiler/tmlgrammar/Token.java index ba9eb4e77d7b9ea20b789ff992c1d0e45d7d6e62..be1a9084859209c616f0ffe5a55fbc0ea3574079 100755 --- a/src/compiler/tmlgrammar/Token.java +++ b/src/compiler/tmlgrammar/Token.java @@ -1,45 +1,17 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ +/* 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 */ /** * Describes the input token stream. */ -public class Token { +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the <i>serialized</i> form of the + * class changes. + */ + private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering @@ -48,12 +20,14 @@ public class Token { */ public int kind; - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; + /** 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. @@ -84,12 +58,46 @@ public class Token { */ 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; + return image; } /** @@ -97,19 +105,25 @@ public class Token { * 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, simlpy add something like : + * you want to create if ofKind is ID, simply add something like : * - * case MyParserConstants.ID : return new IDToken(); + * 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 it in your lexical actions. + * variable to the appropriate type and use sit in your lexical actions. */ - public static final Token newToken(int ofKind) + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) { - switch(ofKind) - { - default : return new Token(); - } + return newToken(ofKind, null); } } +/* JavaCC - OriginalChecksum=6145f5d5b504ccb4f95e09f2ce3e748a (do not edit this line) */ diff --git a/src/compiler/tmlgrammar/TokenMgrError.java b/src/compiler/tmlgrammar/TokenMgrError.java index 2322ddd1ed280947bcdcdbbadffa79feff3c3963..1e6f62ec3638b96d5e6fa2d365d9bba7cbfa36cb 100755 --- a/src/compiler/tmlgrammar/TokenMgrError.java +++ b/src/compiler/tmlgrammar/TokenMgrError.java @@ -1,167 +1,145 @@ -/**Copyright GET / ENST / Ludovic Apvrille - -ludovic.apvrille at enst.fr - -This software is a computer program whose purpose is to edit TURTLE -diagrams, generate RT-LOTOS code from these TURTLE diagrams, and at -last to analyse results provided from externalm formal validation tools. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms.*/ - -package compiler.tmlparser; - -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* JavaCCOptions: */ +/** Token Manager Error. */ public class TokenMgrError extends Error { - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - /** - * Lexical error occured. - */ - static final int LEXICAL_ERROR = 0; + /** + * The version identifier for this Serializable class. + * Increment only if the <i>serialized</i> form of the + * class changes. + */ + private static final long serialVersionUID = 1L; - /** - * An attempt wass made to create a second instance of a static token manager. - */ - static final int STATIC_LEXER_ERROR = 1; + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ - /** - * Tried to change to an invalid lexical state. - */ - static final int INVALID_LEXICAL_STATE = 2; + /** + * Lexical error occurred. + */ + static final int LEXICAL_ERROR = 0; - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - static final int LOOP_DETECTED = 3; + /** + * An attempt was made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; - /** - * Replaces unprintable characters by their espaced (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; - } + /** + * 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(); - } + } + 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 lexicl error - * curLexState : lexical state in which this error occured - * errorLine : line number when the error occured - * errorColumn : column number when the error occured - * errorAfter : prefix that was seen before this error occured - * 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 ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } + /** + * 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 ? "<EOF> " : ("\"" + 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(); - } + /** + * 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. - */ + /* + * Constructors of various flavors follow. + */ - public TokenMgrError() { - } + /** No arg constructor. */ + public TokenMgrError() { + } - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } - 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); - } + /** 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=3f827858bf5c87e5502cccca67d9b325 (do not edit this line) */ diff --git a/src/myutil/BoolExpressionEvaluator.java b/src/myutil/BoolExpressionEvaluator.java index e2d16df2bf44bd9006dfb503452aaad81516b0ad..311c6d2a2cea7f759c234ce92b4c977c7bfdac74 100755 --- a/src/myutil/BoolExpressionEvaluator.java +++ b/src/myutil/BoolExpressionEvaluator.java @@ -61,11 +61,11 @@ public class BoolExpressionEvaluator { public static final int LT_TOKEN = -4; public static final int GT_TOKEN = -5; public static final int NEG_TOKEN = -6; - public static final int OR_TOKEN = -6; - public static final int AND_TOKEN = -7; - public static final int LTEQ_TOKEN = -8; - public static final int GTEQ_TOKEN = -9; - public static final int EOLN_TOKEN = -10; + public static final int OR_TOKEN = -7; + public static final int AND_TOKEN = -8; + public static final int LTEQ_TOKEN = -9; + public static final int GTEQ_TOKEN = -10; + public static final int EOLN_TOKEN = -11; private StringTokenizer tokens; private String errorMessage = null; @@ -73,6 +73,8 @@ public class BoolExpressionEvaluator { private int currentType; private int currentValue; + private int nbOpen; + public BoolExpressionEvaluator() { } @@ -93,6 +95,8 @@ public class BoolExpressionEvaluator { //TraceManager.addDev("Evaluating bool expr: " + _expr); //_expr = Conversion.replaceAllString(_expr, "not", "!").trim(); + nbOpen = 0; + String tmp = Conversion.replaceAllString(_expr, "==", "$").trim(); tmp = Conversion.replaceAllString(tmp, ">=", ":").trim(); tmp = Conversion.replaceAllString(tmp, "<=", ";").trim(); @@ -124,6 +128,7 @@ public class BoolExpressionEvaluator { } + //TraceManager.addDev("Computing:" + _expr); tokens = new java.util.StringTokenizer(_expr," \t\n\r+-*/!=&|<>:;()",true); @@ -131,18 +136,28 @@ public class BoolExpressionEvaluator { computeNextToken(); int result = (int)(parseExpression()); + if (errorMessage != null) { + TraceManager.addDev("Error:" + errorMessage); + } + + if ((errorMessage == null) && (nbOpen!=0)) { + errorMessage = "Badly placed parenthesis"; + result = -1; + } + if (result == TRUE_VALUE) { - //TraceManager.addDev("equal true"); + TraceManager.addDev("equal true"); return true; } if (result == FALSE_VALUE) { - //TraceManager.addDev("equal false"); + TraceManager.addDev("equal false"); return false; } errorMessage = "Not a boolean expression: " + _expr; + TraceManager.addDev("Error:" + errorMessage); return false; } @@ -552,6 +567,21 @@ public class BoolExpressionEvaluator { return; } + if (s.compareTo(")") == 0) { + currentType = c1; + nbOpen --; + if (nbOpen < 0) { + TraceManager.addDev("Boolean expr: Found pb with a parenthesis"); + } + return; + } + + if (s.compareTo("(") == 0) { + currentType = c1; + nbOpen ++; + return; + } + // Any other single character that is not // white space is a token. diff --git a/src/myutil/IntExpressionEvaluator.java b/src/myutil/IntExpressionEvaluator.java index e9e9df887abaf3881f8007592dc68561b388a3ee..7385885d989acaaf76c9fdd6f55d543a960e86c5 100755 --- a/src/myutil/IntExpressionEvaluator.java +++ b/src/myutil/IntExpressionEvaluator.java @@ -57,6 +57,7 @@ public class IntExpressionEvaluator { private int currentType; private int currentValue; + private int nbOpen; public IntExpressionEvaluator() { } @@ -74,11 +75,25 @@ public class IntExpressionEvaluator { } public double getResultOf(String _expr) { - //TraceManager.addDev("Computing:" + _expr); + TraceManager.addDev("Computing:" + _expr); tokens = new java.util.StringTokenizer(_expr," \t\n\r+-*/()",true); computeNextToken(); - return parseExpression(); + double d = parseExpression(); + + + + if ((errorMessage == null) && (nbOpen!=0)) { + errorMessage = "Badly placed parenthesis"; + } + + if (errorMessage != null) { + TraceManager.addDev("Expr contains an error:" + errorMessage); + } else { + TraceManager.addDev("Expr is correct"); + } + + return d; } @@ -246,6 +261,24 @@ public class IntExpressionEvaluator { } return; } + + else if (c1 == ')') { + currentType = c1; + nbOpen --; + TraceManager.addDev(") met: Nb of open=" + nbOpen); + if (nbOpen < 0) { + TraceManager.addDev("int Expr: found pb with a parenthesis"); + } + return; + } + + else if (c1 == '(') { + nbOpen ++; + TraceManager.addDev("( met: Nb of open=" + nbOpen); + currentType = c1; + + return; + } // Any other single character that is not // white space is a token. diff --git a/src/ui/window/JStartingWindow.java b/src/ui/window/JStartingWindow.java index e38b49058cd24324c13c8b14670ccd3d9fd8bc67..e52ae89f942d131e043a009bfb1bf34fc9b8a60f 100755 --- a/src/ui/window/JStartingWindow.java +++ b/src/ui/window/JStartingWindow.java @@ -171,11 +171,16 @@ public class JStartingWindow extends Window { */ public static JStartingWindow splash(Image splashImage, String msg) { - Frame f = new Frame(); - JStartingWindow w = new JStartingWindow(f, splashImage, msg); - // Show the window. - w.toFront(); - w.show(); + JStartingWindow w = null; + try { + Frame f = new Frame(); + w = new JStartingWindow(f, splashImage, msg); + // Show the window. + w.toFront(); + w.show(); + } catch (Exception e) { + return null; + } // Note: To make sure the user gets a chance to see the // splash window we wait until its paint method has been