Commit 6b41f975 authored by Jonathan Shahen's avatar Jonathan Shahen

Updating feild names and removing unused field "mode" from SpecHelper

parent 90a0296e
......@@ -8,7 +8,6 @@ import org.apache.commons.cli.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import mohawk.converter.generated.MohawkTARBACParser;
import mohawk.converter.helper.SpecHelper;
import mohawk.converter.logging.MohawkCSVFileFormatter;
import mohawk.converter.logging.MohawkConsoleFormatter;
......@@ -18,6 +17,7 @@ import mohawk.converter.to.mohawk.ConvertToMohawk;
import mohawk.converter.to.tred.ConvertToTRole;
import mohawk.global.FileExtensions;
import mohawk.global.helper.RoleHelper;
import mohawk.global.parser.mohawkT.MohawkTARBACParser;
import mohawk.global.pieces.MohawkT;
import mohawk.global.pieces.Rule;
import mohawk.global.timing.MohawkTiming;
......@@ -78,7 +78,7 @@ public class ConverterInstance {
logger.info("Processing File (" + i + "/" + specHelper.specFiles.size() + "): "
+ specFile.getAbsolutePath());
MohawkTARBACParser parser = specHelper.parseSpecFile(specFile);
MohawkTARBACParser parser = specHelper.parseMohawkTFile(specFile);
/* Timing */timing.stopTimer("parseFile (" + i + ")");
MohawkT m = parser.mohawkT;
......@@ -116,7 +116,7 @@ public class ConverterInstance {
m2.addRules(workableRules);
FileWriter fw = new FileWriter(specFile.getAbsolutePath() + "_ONLY_" + onlyOpt);
fw.write(m2.getString("\n\n", true, true));
fw.write(m2.getString(null, true, true));
fw.close();
}
} else {
......@@ -309,7 +309,7 @@ public class ConverterInstance {
options.addOption(OptionBuilder.withArgName("extension")
.withDescription("File extention used when searching for SPEC files when the 'bulk' option is used. "
+ "Default:'" + specHelper.specFileExt + "'")
+ "Default:'" + specHelper.fileExt + "'")
.hasArg().create(OptionString.SPECEXT.toString()));
// Add Functional Options
......@@ -459,9 +459,9 @@ public class ConverterInstance {
if (cmd.hasOption(OptionString.SPECEXT.toString())) {
logger.fine("[OPTION] Using a specific SPEC File Extension: "
+ cmd.getOptionValue(OptionString.SPECEXT.toString()));
specHelper.specFileExt = cmd.getOptionValue(OptionString.SPECEXT.toString());
specHelper.fileExt = cmd.getOptionValue(OptionString.SPECEXT.toString());
} else {
logger.fine("[OPTION] Using the default SPEC File Extension: " + specHelper.specFileExt);
logger.fine("[OPTION] Using the default SPEC File Extension: " + specHelper.fileExt);
}
// Load more than one file from the SPEC File?
......
package mohawk.converter.helper;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.*;
import java.util.ArrayList;
import java.util.logging.Logger;
import mohawk.converter.generated.MohawkTARBACParser;
import mohawk.converter.testing.BooleanErrorListener;
import mohawk.converter.testing.ConverterRegressionTests;
import mohawk.global.helper.ParserHelper;
import mohawk.global.parser.mohawkT.MohawkTARBACParser;
public class SpecHelper {
public final static Logger logger = Logger.getLogger("mohawk");
public String smvFilepath = "latestRBAC2SMV.smv";
public Boolean smvDeleteFile = false;
public String specFile = "";
public String specFileExt = ".spec";
public String fileExt = ".spec";
public ArrayList<File> specFiles = new ArrayList<File>();
public boolean bulk = false;
public int mode = 3; // 1 for bmc, 2 for smc, 3 for both
public Long TIMEOUT_SECONDS = (long) 120; // Default 2 minutes
public BooleanErrorListener error = new BooleanErrorListener();
......@@ -48,7 +45,7 @@ public class SpecHelper {
}
for (File f : folder.listFiles()) {
if (f.getName().endsWith(specFileExt)) {
if (f.getName().endsWith(fileExt)) {
logger.fine("Adding file to specFiles: " + f.getAbsolutePath());
specFiles.add(f);
}
......@@ -104,11 +101,11 @@ public class SpecHelper {
return nusmvFile;
}
public MohawkTARBACParser parseSpecFile(File specFile) throws IOException {
public MohawkTARBACParser parseMohawkTFile(File specFile) throws IOException {
FileInputStream fis = new FileInputStream(specFile);
error.errorFound = false; // reset the error listener
MohawkTARBACParser parser = ConverterRegressionTests.runParser(fis, error, false);
MohawkTARBACParser parser = ParserHelper.runParser(fis, error, false);
if (error.errorFound) {
logger.warning("Unable to parse the file: " + specFile.getAbsolutePath());
......
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