Commit 305ec7cc authored by Jonathan Shahen's avatar Jonathan Shahen
Browse files

Fixed error for printing out timing; tested and can run and convert to smv...

Fixed error for printing out timing; tested and can run and convert to smv closing branch and merging to master
parent 60fd5eb2
Pipeline #7932 skipped
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
......
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
......@@ -8,8 +8,10 @@
<property name="src" location="src"/>
<property name="lib" location="lib"/>
<property name="bin" location="bin" />
<property name="data" location="data"/>
<property name="build" location="${bin}/build"/>
<property name="dist" location="${bin}/dist"/>
<property name="qtest" location="${data}/testcases"/>
<target name="init">
<!-- create the build directory structure used by compile -->
......@@ -55,6 +57,21 @@
</jar>
</target>
<target name="qtest" depends="compile" description="generate a JAR file that will be placed close to the data for quick testing" >
<!-- @author Jonathan Shahen -->
<!-- put everything in ${build} into the jar file -->
<jar destfile="${qtest}/${ant.project.name}.jar" basedir="${build}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="mohawk.MohawkMain" />
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="${build}" />
<zipfileset src="${lib}/stringtemplate.jar" />
<zipfileset src="${lib}/antlr-3.2.jar" />
</jar>
</target>
<target name="clean" description="clean up">
<!-- delete the ${build} and ${dist} directory trees -->
<delete dir="${bin}"/>
......
......@@ -96,6 +96,9 @@ public class MohawkMain {
+ "' has not been implemented. "
+ "Please see use 'mohawk -help' to see which Run Options have been implemented");
}
tests.done();
logger.info("[TIMING] " + tests.timing);
}
} catch (ParseException e) {
if (logger.getLevel() == Level.FINEST) {
......
......@@ -3,40 +3,45 @@
package mohawk;
import java.io.InputStream;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.TokenStreamRecognitionException;
import antlr.CharStreamException;
import antlr.CharStreamIOException;
import java.io.Reader;
import java.util.Hashtable;
import antlr.InputBuffer;
import antlr.ANTLRHashString;
import antlr.ByteBuffer;
import antlr.CharBuffer;
import antlr.Token;
import antlr.RecognitionException;
import antlr.CharStreamException;
import antlr.CharStreamIOException;
import antlr.InputBuffer;
import antlr.LexerSharedInputState;
import antlr.NoViableAltForCharException;
import antlr.RecognitionException;
import antlr.Token;
import antlr.TokenStream;
import antlr.ANTLRHashString;
import antlr.LexerSharedInputState;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.TokenStreamRecognitionException;
import antlr.collections.impl.BitSet;
public class RBACLexer extends antlr.CharScanner implements RBACParserTokenTypes, TokenStream
{
public RBACLexer(InputStream in) {
public class RBACLexer extends antlr.CharScanner implements
RBACParserTokenTypes, TokenStream {
public RBACLexer(InputStream in) {
this(new ByteBuffer(in));
}
public RBACLexer(Reader in) {
}
public RBACLexer(Reader in) {
this(new CharBuffer(in));
}
public RBACLexer(InputBuffer ib) {
}
public RBACLexer(InputBuffer ib) {
this(new LexerSharedInputState(ib));
}
public RBACLexer(LexerSharedInputState state) {
}
@SuppressWarnings("unchecked")
public RBACLexer(LexerSharedInputState state) {
super(state);
caseSensitiveLiterals = true;
setCaseSensitive(true);
literals = new Hashtable();
literals = new Hashtable<ANTLRHashString, Integer>();
literals.put(new ANTLRHashString("TRUE", this), new Integer(14));
literals.put(new ANTLRHashString("CR", this), new Integer(16));
literals.put(new ANTLRHashString("UA", this), new Integer(8));
......@@ -45,379 +50,519 @@ public RBACLexer(LexerSharedInputState state) {
literals.put(new ANTLRHashString("Roles", this), new Integer(4));
literals.put(new ANTLRHashString("SPEC", this), new Integer(18));
literals.put(new ANTLRHashString("ADMIN", this), new Integer(17));
}
}
@Override
public Token nextToken() throws TokenStreamException {
Token theRetToken=null;
tryAgain:
for (;;) {
@Override
public Token nextToken() throws TokenStreamException {
Token theRetToken = null;
tryAgain: for (;;) {
Token _token = null;
int _ttype = Token.INVALID_TYPE;
resetText();
try { // for char stream error handling
try { // for lexical error handling
switch ( LA(1)) {
case 'A': case 'B': case 'C': case 'D':
case 'E': case 'F': case 'G': case 'H':
case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P':
case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z': case '_': case 'a':
case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i':
case 'j': case 'k': case 'l': case 'm':
case 'n': case 'o': case 'p': case 'q':
case 'r': case 's': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y':
case 'z':
{
switch (LA(1)) {
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z': {
mID(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case '<':
{
case '<': {
mLANGLE(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case '>':
{
case '>': {
mRANGLE(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case ',':
{
case ',': {
mCOMMA(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case '&':
{
case '&': {
mCOND(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case '-':
{
case '-': {
mNOT(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case ';':
{
case ';': {
mSEMI(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case '\t': case '\n': case '\r': case ' ':
{
case '\t':
case '\n':
case '\r':
case ' ': {
mWS(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
case '/':
{
case '/': {
mCOMMENT(true);
theRetToken=_returnToken;
theRetToken = _returnToken;
break;
}
default:
{
if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
else {throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
default: {
if (LA(1) == EOF_CHAR) {
uponEOF();
_returnToken = makeToken(Token.EOF_TYPE);
} else {
throw new NoViableAltForCharException(LA(1),
getFilename(), getLine(), getColumn());
}
}
}
if ( _returnToken==null ) continue tryAgain; // found SKIP token
if (_returnToken == null)
continue tryAgain; // found SKIP token
_ttype = _returnToken.getType();
_ttype = testLiteralsTable(_ttype);
_returnToken.setType(_ttype);
return _returnToken;
}
catch (RecognitionException e) {
} catch (RecognitionException e) {
throw new TokenStreamRecognitionException(e);
}
}
catch (CharStreamException cse) {
if ( cse instanceof CharStreamIOException ) {
throw new TokenStreamIOException(((CharStreamIOException)cse).io);
}
else {
} catch (CharStreamException cse) {
if (cse instanceof CharStreamIOException) {
throw new TokenStreamIOException(
((CharStreamIOException) cse).io);
} else {
throw new TokenStreamException(cse.getMessage());
}
}
}
}
}
public final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
public final void mID(boolean _createToken) throws RecognitionException,
CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = ID;
int _saveIndex;
{
switch ( LA(1)) {
case 'a': case 'b': case 'c': case 'd':
case 'e': case 'f': case 'g': case 'h':
case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p':
case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
{
matchRange('a','z');
switch (LA(1)) {
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z': {
matchRange('a', 'z');
break;
}
case 'A': case 'B': case 'C': case 'D':
case 'E': case 'F': case 'G': case 'H':
case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P':
case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
{
matchRange('A','Z');
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z': {
matchRange('A', 'Z');
break;
}
case '_':
{
case '_': {
match('_');
break;
}
default:
{
throw new NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
}
}
}
{
_loop38:
do {
switch ( LA(1)) {
case 'a': case 'b': case 'c': case 'd':
case 'e': case 'f': case 'g': case 'h':
case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p':
case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
{
matchRange('a','z');
default: {
throw new NoViableAltForCharException(LA(1), getFilename(),
getLine(), getColumn());
}
}
}
{
_loop38: do {
switch (LA(1)) {
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z': {
matchRange('a', 'z');
break;
}
case 'A': case 'B': case 'C': case 'D':
case 'E': case 'F': case 'G': case 'H':
case 'I': case 'J': case 'K': case 'L':
case 'M': case 'N': case 'O': case 'P':
case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
{
matchRange('A','Z');
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z': {
matchRange('A', 'Z');
break;
}
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9':
{
matchRange('0','9');
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': {
matchRange('0', '9');
break;
}
case '_':
{
case '_': {
match('_');
break;
}
default:
{
default: {
break _loop38;
}
}
} while (true);
}
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
_token.setText(new String(text.getBuffer(), _begin, text.length()
- _begin));
}
_returnToken = _token;
}
public final void mLANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
public final void mLANGLE(boolean _createToken)
throws RecognitionException, CharStreamException,
TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = LANGLE;
int _saveIndex;
match('<');
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
_token.setText(new String(text.getBuffer(), _begin, text.length()
- _begin));
}
_returnToken = _token;
}
public final void mRANGLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
public final void mRANGLE(boolean _createToken)
throws RecognitionException, CharStreamException,
TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = RANGLE;
int _saveIndex;
match('>');
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
if (_createToken && _token == null && _ttype != Token.SKIP) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
_token.setText(new String(text.getBuffer(), _begin, text.length()
- _begin));
}
_returnToken = _token;
}
public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
public final void mCOMMA(boolean _createToken) throws RecognitionException,
CharStreamException, TokenStreamException {
int _ttype;
Token _token = null;
int _begin = text.length();
_ttype = COMMA;
int _saveIndex;
match(',');
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {