Skip to content
Snippets Groups Projects
Commit bd261f38 authored by hansene's avatar hansene
Browse files

Adapted the translator to the new parser version

parent e7870dde
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,6 @@ apply plugin: 'findbugs' ...@@ -7,8 +7,6 @@ apply plugin: 'findbugs'
project.version = '1.0.5-SNAPSHOT' project.version = '1.0.5-SNAPSHOT'
project.group = 'de.prob' project.group = 'de.prob'
sourceCompatibility = 1.5
repositories { repositories {
mavenCentral() mavenCentral()
maven { maven {
...@@ -20,7 +18,7 @@ configurations { // configuration that holds jars to copy into lib ...@@ -20,7 +18,7 @@ configurations { // configuration that holds jars to copy into lib
releaseJars releaseJars
} }
def parser_version = '2.4.28-SNAPSHOT' def parser_version = '2.5.0-SNAPSHOT'
dependencies { dependencies {
//compile (group: 'com.microsoft', name: 'tla2tools', version: '1.4.6') //compile (group: 'com.microsoft', name: 'tla2tools', version: '1.4.6')
...@@ -43,32 +41,34 @@ dependencies { ...@@ -43,32 +41,34 @@ dependencies {
} }
jacoco { jacoco {
toolVersion = "0.6.2.201302030002" toolVersion = "0.7.1.201405082137"
reportsDir = file("$buildDir/customJacocoReportDir") reportsDir = file("$buildDir/customJacocoReportDir")
} }
jacocoTestReport { // type 'gradle tla2b jacocoIntegrationTestReport' in order to run the jacoco code coverage analysis
reports { task jacocoIntegrationTestReport(type: JacocoReport) {
xml.enabled false sourceSets sourceSets.main
csv.enabled false //executionData files('build/jacoco/integrationTests.exec')
html.destination "${buildDir}/jacocoHtml" executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
}
} }
tasks.withType(FindBugs) { tasks.withType(FindBugs) {
// disable findbugs by default
// in order to run findbugs type 'gradle tlc4b findbugsMain findbugsTest'
task -> enabled = gradle.startParameter.taskNames.contains(task.name)
reports { reports {
xml.enabled = false xml.enabled = false
html.enabled = true html.enabled = true
} }
}
findbugs {
ignoreFailures = true ignoreFailures = true
} }
test { test {
exclude('testing') exclude('testing')
allJvmArgs = [ "-Xss515m" ]
} }
jar { from sourceSets.main.allJava } jar { from sourceSets.main.allJava }
...@@ -79,7 +79,6 @@ jar { ...@@ -79,7 +79,6 @@ jar {
jar { jar {
manifest { manifest {
attributes "Main-Class" : 'de.tla2b.TLA2B' attributes "Main-Class" : 'de.tla2b.TLA2B'
attributes "Class-Path": './tla/ tlatools.jar'
} }
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package de.tla2b.analysis; package de.tla2b.analysis;
import de.tla2b.exceptions.NotImplementedException; import de.tla2b.exceptions.NotImplementedException;
import tla2sany.semantic.ExprOrOpArgNode;
import tla2sany.semantic.OpApplNode; import tla2sany.semantic.OpApplNode;
import tla2sany.semantic.OpDefNode; import tla2sany.semantic.OpDefNode;
import tlc2.tool.BuiltInOPs; import tlc2.tool.BuiltInOPs;
...@@ -24,28 +23,28 @@ public class RecursiveFunktion extends BuiltInOPs { ...@@ -24,28 +23,28 @@ public class RecursiveFunktion extends BuiltInOPs {
} }
/** // /**
* @throws NotImplementedException // * @throws NotImplementedException
* // *
*/ // */
private void evalDef() throws NotImplementedException { // private void evalDef() throws NotImplementedException {
ExprOrOpArgNode e = rfs.getArgs()[0]; // ExprOrOpArgNode e = rfs.getArgs()[0];
//System.out.println(rfs.toString(5)); // //System.out.println(rfs.toString(5));
if (e instanceof OpApplNode) { // if (e instanceof OpApplNode) {
OpApplNode o = (OpApplNode) e; // OpApplNode o = (OpApplNode) e;
switch (getOpCode(o.getOperator().getName())) { // switch (getOpCode(o.getOperator().getName())) {
case OPCODE_ite: { // IF THEN ELSE // case OPCODE_ite: { // IF THEN ELSE
ifThenElse = o; // ifThenElse = o;
return; // return;
} // }
} // }
throw new NotImplementedException( // throw new NotImplementedException(
"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function."); // "Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
} else { // } else {
throw new NotImplementedException( // throw new NotImplementedException(
"Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function."); // "Only IF/THEN/ELSE or CASE constructs are supported at the body of a recursive function.");
} // }
} // }
public OpDefNode getOpDefNode() { public OpDefNode getOpDefNode() {
return def; return def;
......
...@@ -10,9 +10,7 @@ import java.util.List; ...@@ -10,9 +10,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import de.be4.classicalb.core.parser.BParser; import de.be4.classicalb.core.parser.BParser;
import de.be4.classicalb.core.parser.analysis.pragma.Pragma;
import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog; import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog;
import de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment;
import de.be4.classicalb.core.parser.analysis.prolog.RecursiveMachineLoader; import de.be4.classicalb.core.parser.analysis.prolog.RecursiveMachineLoader;
import de.be4.classicalb.core.parser.node.Node; import de.be4.classicalb.core.parser.node.Node;
import de.be4.classicalb.core.parser.node.Start; import de.be4.classicalb.core.parser.node.Start;
...@@ -84,14 +82,6 @@ public class PrologPrinter { ...@@ -84,14 +82,6 @@ public class PrologPrinter {
pout.fullstop(); pout.fullstop();
} }
if (bParser.getPragmas().size() > 0) {
NodeIdAssignment ids = pprinter.nodeIds;
List<Pragma> pragmas = bParser.getPragmas();
for (Pragma pragma : pragmas) {
pragma.printProlog(pout, ids);
pout.fullstop();
}
}
pout.flush(); pout.flush();
} }
} }
...@@ -6,14 +6,20 @@ import util.FilenameToStream; ...@@ -6,14 +6,20 @@ import util.FilenameToStream;
public class SimpleResolver implements FilenameToStream { public class SimpleResolver implements FilenameToStream {
private File file;
public boolean isStandardModule(String arg0) { public boolean isStandardModule(String arg0) {
return false; return false;
} }
public File resolve(String arg0, boolean arg1) { public File resolve(String arg0, boolean arg1) {
File file = new File(arg0); file = new File(arg0);
return file; return file;
} }
public String getFullPath() {
return file.getAbsolutePath();
}
} }
\ No newline at end of file
...@@ -93,7 +93,14 @@ public class Translator implements TranslationGlobals { ...@@ -93,7 +93,14 @@ public class Translator implements TranslationGlobals {
} }
} }
// used to for external use /**
* External interface
* @param moduleName
* @param moduleString
* @param configString
* @return
* @throws TLA2BException
*/
public static String translateModuleString(String moduleName, public static String translateModuleString(String moduleName,
String moduleString, String configString) throws TLA2BException { String moduleString, String configString) throws TLA2BException {
Translator translator = new Translator(moduleName, moduleString, Translator translator = new Translator(moduleName, moduleString,
...@@ -371,8 +378,7 @@ public class Translator implements TranslationGlobals { ...@@ -371,8 +378,7 @@ public class Translator implements TranslationGlobals {
final File f, final BParser bparser) throws BException { final File f, final BParser bparser) throws BException {
final RecursiveMachineLoader rml = new RecursiveMachineLoader( final RecursiveMachineLoader rml = new RecursiveMachineLoader(
f.getParent(), bparser.getContentProvider()); f.getParent(), bparser.getContentProvider());
rml.loadAllMachines(f, ast, null, bparser.getDefinitions(), rml.loadAllMachines(f, ast, null, bparser.getDefinitions());
bparser.getPragmas());
return rml; return rml;
} }
......
...@@ -6,10 +6,6 @@ package de.tla2b.util; ...@@ -6,10 +6,6 @@ package de.tla2b.util;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import util.FileUtil; import util.FileUtil;
import de.be4.classicalb.core.parser.BParser; import de.be4.classicalb.core.parser.BParser;
import de.be4.classicalb.core.parser.exceptions.BException; import de.be4.classicalb.core.parser.exceptions.BException;
...@@ -20,7 +16,6 @@ import de.tla2b.exceptions.TLA2BException; ...@@ -20,7 +16,6 @@ import de.tla2b.exceptions.TLA2BException;
import de.tla2b.output.ASTPrettyPrinter; import de.tla2b.output.ASTPrettyPrinter;
import de.tla2b.output.Renamer; import de.tla2b.output.Renamer;
import de.tla2bAst.Translator; import de.tla2bAst.Translator;
import tla2sany.semantic.AbortException;
import util.ToolIO; import util.ToolIO;
public class TestUtil { public class TestUtil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment