Commit 95ffbb79 authored by Jonathan Shahen's avatar Jonathan Shahen

Relocate the parser to the Global Repo

parent 51c85085
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
<property name="dist" location="${bin}/dist" /> <property name="dist" location="${bin}/dist" />
<property name="qtest" location="${data}/testcases" /> <property name="qtest" location="${data}/testcases" />
<property name="mohawksrc" location="${src}/mohawk" /> <property name="mohawksrc" location="${src}/mohawk" />
<property name="antlr-script" location="${mohawksrc}/rbac/generated" />
<property name="template" location="${mohawksrc}/output" /> <property name="template" location="${mohawksrc}/output" />
<property name="rbac" location="${mohawksrc}/rbac/generated" />
<property name="antlr" location="${lib}/antlr-4.4-complete.jar" /> <property name="antlr" location="${lib}/antlr-4.4-complete.jar" />
<property name="junit" location="${lib}/junit-4.12.jar" /> <property name="junit" location="${lib}/junit-4.12.jar" />
...@@ -44,25 +42,7 @@ ...@@ -44,25 +42,7 @@
<mkdir dir="${dist}" /> <mkdir dir="${dist}" />
</target> </target>
<target name="parser" depends="init" description="generate parser files"> <target name="compile" depends="init" description="compile the source ">
<!-- Create the parser files -->
<!--
<antlr target="${rbac}/Mohawk.g4" outputdirectory="${rbac}">
<classpath>
<pathelement location="${antlr}" />
</classpath>
</antlr>
-->
<java jar="${antlr}" fork="true">
<arg value="-o" />
<arg value="${antlr-script}" />
<arg value="-package" />
<arg value="${parser-package}" />
<arg value="${antlr-script}/Mohawk.g4" />
</java>
</target>
<target name="compile" depends="parser" description="compile the source ">
<!-- compile the java code from ${src} into ${build} --> <!-- compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" debug="on" deprecation="true"> <javac srcdir="${src}" destdir="${build}" debug="on" deprecation="true">
<src path="${src}" /> <src path="${src}" />
......
...@@ -33,11 +33,11 @@ import java.util.*; ...@@ -33,11 +33,11 @@ import java.util.*;
import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.*;
import mohawk.global.parser.mohawk.v1.MohawkLexer;
import mohawk.global.parser.mohawk.v1.MohawkParser;
import mohawk.global.pieces.mohawk.CAEntry; import mohawk.global.pieces.mohawk.CAEntry;
import mohawk.global.pieces.mohawk.CREntry; import mohawk.global.pieces.mohawk.CREntry;
import mohawk.output.WriteNuSMV; import mohawk.output.WriteNuSMV;
import mohawk.rbac.generated.MohawkLexer;
import mohawk.rbac.generated.MohawkParser;
/** /**
* @author Karthick Jayaraman This is the main class that will serve as an entry point to the tool. * @author Karthick Jayaraman This is the main class that will serve as an entry point to the tool.
...@@ -95,7 +95,8 @@ public class RBAC2SMV { ...@@ -95,7 +95,8 @@ public class RBAC2SMV {
try { try {
parser.init(); parser.init();
rbac = parser.getRBAC(); rbac = new RBACInstance(parser.vRoles, parser.vUsers, parser.vAdmin, parser.mUA, parser.mCR, parser.mCA,
parser.vSpec);
} catch (RecognitionException e) { } catch (RecognitionException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -9,8 +9,8 @@ import java.util.*; ...@@ -9,8 +9,8 @@ import java.util.*;
import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.*;
import org.stringtemplate.v4.ST; import org.stringtemplate.v4.ST;
import mohawk.rbac.generated.MohawkLexer; import mohawk.global.parser.mohawk.v1.MohawkLexer;
import mohawk.rbac.generated.MohawkParser; import mohawk.global.parser.mohawk.v1.MohawkParser;
import mohawk.global.pieces.mohawk.*; import mohawk.global.pieces.mohawk.*;
/** /**
...@@ -60,7 +60,8 @@ public class RBACPAT { ...@@ -60,7 +60,8 @@ public class RBACPAT {
try { try {
parser.init(); parser.init();
rbac = parser.getRBAC(); rbac = new RBACInstance(parser.vRoles, parser.vUsers, parser.vAdmin, parser.mUA, parser.mCR, parser.mCA,
parser.vSpec);
} catch (RecognitionException e) { } catch (RecognitionException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -8,8 +8,8 @@ import java.util.logging.Logger; ...@@ -8,8 +8,8 @@ import java.util.logging.Logger;
import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.*;
import mohawk.rbac.generated.MohawkLexer; import mohawk.global.parser.mohawk.v1.MohawkLexer;
import mohawk.rbac.generated.MohawkParser; import mohawk.global.parser.mohawk.v1.MohawkParser;
/** /**
* @author Karthick Jayaraman * @author Karthick Jayaraman
...@@ -35,7 +35,8 @@ public class RBACSpecReader { ...@@ -35,7 +35,8 @@ public class RBACSpecReader {
try { try {
parser.init(); parser.init();
rbac = parser.getRBAC(); rbac = new RBACInstance(parser.vRoles, parser.vUsers, parser.vAdmin, parser.mUA, parser.mCR, parser.mCA,
parser.vSpec);
} catch (RecognitionException e) { } catch (RecognitionException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -60,7 +61,8 @@ public class RBACSpecReader { ...@@ -60,7 +61,8 @@ public class RBACSpecReader {
parser.initRbac(); parser.initRbac();
parser.init(); parser.init();
rbac = parser.getRBAC(); rbac = new RBACInstance(parser.vRoles, parser.vUsers, parser.vAdmin, parser.mUA, parser.mCR, parser.mCA,
parser.vSpec);
} catch (RecognitionException | IOException e) { } catch (RecognitionException | IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -8,10 +8,10 @@ import java.util.logging.Logger; ...@@ -8,10 +8,10 @@ import java.util.logging.Logger;
import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.*;
import mohawk.global.parser.mohawk.v1.MohawkLexer;
import mohawk.global.parser.mohawk.v1.MohawkParser;
import mohawk.output.WriteRBACSpec; import mohawk.output.WriteRBACSpec;
import mohawk.rbac.RBACInstance; import mohawk.rbac.RBACInstance;
import mohawk.rbac.generated.MohawkLexer;
import mohawk.rbac.generated.MohawkParser;
/** /**
* @author Karthick Jayaraman * @author Karthick Jayaraman
...@@ -48,7 +48,8 @@ public class RemoveCR { ...@@ -48,7 +48,8 @@ public class RemoveCR {
try { try {
parser.init(); parser.init();
rbac = parser.getRBAC(); rbac = new RBACInstance(parser.vRoles, parser.vUsers, parser.vAdmin, parser.mUA, parser.mCR, parser.mCA,
parser.vSpec);
} catch (RecognitionException e) { } catch (RecognitionException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -9,11 +9,11 @@ import java.util.logging.Logger; ...@@ -9,11 +9,11 @@ import java.util.logging.Logger;
import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.*;
import mohawk.global.parser.mohawk.v1.MohawkLexer;
import mohawk.global.parser.mohawk.v1.MohawkParser;
import mohawk.global.pieces.mohawk.CAEntry; import mohawk.global.pieces.mohawk.CAEntry;
import mohawk.global.pieces.mohawk.CREntry; import mohawk.global.pieces.mohawk.CREntry;
import mohawk.rbac.RBACInstance; import mohawk.rbac.RBACInstance;
import mohawk.rbac.generated.MohawkLexer;
import mohawk.rbac.generated.MohawkParser;
/** /**
* @author Karthick Jayaraman * @author Karthick Jayaraman
...@@ -47,7 +47,8 @@ public class SizeOfRBAC { ...@@ -47,7 +47,8 @@ public class SizeOfRBAC {
try { try {
parser.init(); parser.init();
rbac = parser.getRBAC(); rbac = new RBACInstance(parser.vRoles, parser.vUsers, parser.vAdmin, parser.mUA, parser.mCR, parser.mCA,
parser.vSpec);
} catch (RecognitionException e) { } catch (RecognitionException e) {
e.printStackTrace(); e.printStackTrace();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment