Commit 126a35d7 authored by Sarah Grebing's avatar Sarah Grebing

Changes to jars and commented exceptions

parent 0597ba77
Pipeline #13603 failed with stage
in 2 minutes and 19 seconds
# Execute this in this folder. # Execute this in this folder.
# Set to key/key/deployment/components/ # Set to key/key/deployment/components/
COMPONENTS=~/work/key/key/deployment/components/ COMPONENTS=${COMPONENTS:-~/work/key/key/deployment/components/}
mvn install:install-file -Dfile=$COMPONENTS/key.core.jar \ mvn install:install-file -Dfile=$COMPONENTS/key.core.jar \
......
# Execute this in this folder. # Execute this in this folder.
# Set to key/key/deployment/components/ # Set to key/key/deployment/components/
COMPONENTS=~/work/key/key/deployment/components/ COMPONENTS=${COMPONENTS:-~/work/key/key/deployment/components/}
mvn install:install-file -Dfile=$COMPONENTS/key.core.jar \ mvn install:install-file -Dfile=$COMPONENTS/key.core.jar \
......
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
<snapshot> <snapshot>
<localCopy>true</localCopy> <localCopy>true</localCopy>
</snapshot> </snapshot>
<lastUpdated>20170911152346</lastUpdated> <lastUpdated>20170912105152</lastUpdated>
<snapshotVersions> <snapshotVersions>
<snapshotVersion> <snapshotVersion>
<extension>jar</extension> <extension>jar</extension>
<value>2.7-SNAPSHOT</value> <value>2.7-SNAPSHOT</value>
<updated>20170911152346</updated> <updated>20170912105152</updated>
</snapshotVersion> </snapshotVersion>
<snapshotVersion> <snapshotVersion>
<extension>pom</extension> <extension>pom</extension>
<value>2.7-SNAPSHOT</value> <value>2.7-SNAPSHOT</value>
<updated>20170911152346</updated> <updated>20170912103022</updated>
</snapshotVersion> </snapshotVersion>
</snapshotVersions> </snapshotVersions>
</versioning> </versioning>
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
<versions> <versions>
<version>2.7-SNAPSHOT</version> <version>2.7-SNAPSHOT</version>
</versions> </versions>
<lastUpdated>20170911152346</lastUpdated> <lastUpdated>20170912105152</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
<snapshot> <snapshot>
<localCopy>true</localCopy> <localCopy>true</localCopy>
</snapshot> </snapshot>
<lastUpdated>20170911152349</lastUpdated> <lastUpdated>20170912105155</lastUpdated>
<snapshotVersions> <snapshotVersions>
<snapshotVersion> <snapshotVersion>
<extension>jar</extension> <extension>jar</extension>
<value>2.7-SNAPSHOT</value> <value>2.7-SNAPSHOT</value>
<updated>20170911152349</updated> <updated>20170912105155</updated>
</snapshotVersion> </snapshotVersion>
<snapshotVersion> <snapshotVersion>
<extension>pom</extension> <extension>pom</extension>
<value>2.7-SNAPSHOT</value> <value>2.7-SNAPSHOT</value>
<updated>20170911152349</updated> <updated>20170912103024</updated>
</snapshotVersion> </snapshotVersion>
</snapshotVersions> </snapshotVersions>
</versioning> </versioning>
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
<versions> <versions>
<version>2.7-SNAPSHOT</version> <version>2.7-SNAPSHOT</version>
</versions> </versions>
<lastUpdated>20170911152349</lastUpdated> <lastUpdated>20170912105155</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
<snapshot> <snapshot>
<localCopy>true</localCopy> <localCopy>true</localCopy>
</snapshot> </snapshot>
<lastUpdated>20170911152351</lastUpdated> <lastUpdated>20170912105158</lastUpdated>
<snapshotVersions> <snapshotVersions>
<snapshotVersion> <snapshotVersion>
<extension>jar</extension> <extension>jar</extension>
<value>2.7-SNAPSHOT</value> <value>2.7-SNAPSHOT</value>
<updated>20170911152351</updated> <updated>20170912105158</updated>
</snapshotVersion> </snapshotVersion>
<snapshotVersion> <snapshotVersion>
<extension>pom</extension> <extension>pom</extension>
<value>2.7-SNAPSHOT</value> <value>2.7-SNAPSHOT</value>
<updated>20170911152351</updated> <updated>20170912103027</updated>
</snapshotVersion> </snapshotVersion>
</snapshotVersions> </snapshotVersions>
</versioning> </versioning>
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
<versions> <versions>
<version>2.7-SNAPSHOT</version> <version>2.7-SNAPSHOT</version>
</versions> </versions>
<lastUpdated>20170911152351</lastUpdated> <lastUpdated>20170912105158</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
<versions> <versions>
<version>2.7</version> <version>2.7</version>
</versions> </versions>
<lastUpdated>20170911152354</lastUpdated> <lastUpdated>20170912105201</lastUpdated>
</versioning> </versioning>
</metadata> </metadata>
...@@ -19,6 +19,23 @@ import java.util.stream.Collectors; ...@@ -19,6 +19,23 @@ import java.util.stream.Collectors;
* @version 1 (11.09.17) * @version 1 (11.09.17)
*/ */
public class GenDoc { public class GenDoc {
private static final Set<String> FORBBIDEN = new TreeSet<>();
static {
FORBBIDEN.add("exit");
FORBBIDEN.add("focus");
FORBBIDEN.add("javascript");
FORBBIDEN.add("leave");
FORBBIDEN.add("let \n");
/*TODO
script
schemaVar
select
set
skip
*/
}
private static File basedir = new File(".."); private static File basedir = new File("..");
private static File propertiesFile = new File(basedir, "rt-key/src/main/resources/edu/kit/iti/formal/psdbg/taclets.properties.xml"); private static File propertiesFile = new File(basedir, "rt-key/src/main/resources/edu/kit/iti/formal/psdbg/taclets.properties.xml");
private static File dummyFile = new File(basedir, "rt-key/src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/contraposition.key"); private static File dummyFile = new File(basedir, "rt-key/src/test/resources/edu/kit/iti/formal/psdbg/interpreter/contraposition/contraposition.key");
...@@ -58,7 +75,7 @@ public class GenDoc { ...@@ -58,7 +75,7 @@ public class GenDoc {
"\n\nCovering the *default* taclets of [KeY](http://key-project.org)."); "\n\nCovering the *default* taclets of [KeY](http://key-project.org).");
for (Taclet t : taclets) { for (Taclet t : taclets) {
stream.write("\n\n## ${t.displayName()}\n\n"); stream.write("\n\n## " + t.displayName() + "\n\n");
stream.write("```\n" + t.toString() + "\n```"); stream.write("```\n" + t.toString() + "\n```");
} }
...@@ -143,7 +160,8 @@ public class GenDoc { ...@@ -143,7 +160,8 @@ public class GenDoc {
commands.sort(Comparator.comparing(ProofScriptCommand::getName)); commands.sort(Comparator.comparing(ProofScriptCommand::getName));
for (ProofScriptCommand t : commands) { for (ProofScriptCommand t : commands) {
stream.write(helpForCommand(t) + "\n\n"); if (!FORBBIDEN.contains(t.getName()))
stream.write(helpForCommand(t) + "\n\n");
} }
stream.close(); stream.close();
} catch (IOException e) { } catch (IOException e) {
......
...@@ -69,8 +69,8 @@ expression ...@@ -69,8 +69,8 @@ expression
substExpressionList substExpressionList
: :
(scriptVar '/' expression (scriptVar '\\' expression
(',' scriptVar '/' expression)* (',' scriptVar '\\' expression)*
)? )?
; ;
......
...@@ -5,6 +5,7 @@ import lombok.Data; ...@@ -5,6 +5,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -17,6 +18,10 @@ import java.util.List; ...@@ -17,6 +18,10 @@ import java.util.List;
public class TermType implements Type { public class TermType implements Type {
private List<Type> argTypes = new ArrayList<>(); private List<Type> argTypes = new ArrayList<>();
public TermType(Type... sortType) {
this(Arrays.asList(sortType));
}
@Override @Override
public String symbol() { public String symbol() {
return "Term<" + return "Term<" +
......
...@@ -26,11 +26,12 @@ termPattern : ...@@ -26,11 +26,12 @@ termPattern :
| <assoc=right> termPattern op=(DIV|MOD) termPattern #divMod | <assoc=right> termPattern op=(DIV|MOD) termPattern #divMod
| termPattern op=(PLUS|MINUS) termPattern #plusMinus | termPattern op=(PLUS|MINUS) termPattern #plusMinus
| termPattern op=(LE|GE|LEQ|GEQ) termPattern #comparison | termPattern op=(LE|GE|LEQ|GEQ) termPattern #comparison
| termPattern op=(NEQ|EQ) termPattern #equality | termPattern op=(NEQ|EQ) termPattern #equality
| termPattern AND termPattern #and | termPattern AND termPattern #and
| termPattern OR termPattern #or | termPattern OR termPattern #or
| termPattern IMP termPattern #impl | termPattern IMP termPattern #impl
| termPattern XOR termPattern #xor | termPattern XOR termPattern #xor
// | termPattern EQUIV termPattern #equivalence
//| termPattern EQUIV termPattern already covered by EQ/NEQ //| termPattern EQUIV termPattern already covered by EQ/NEQ
| MINUS termPattern #exprNegate | MINUS termPattern #exprNegate
| NOT termPattern #exprNot | NOT termPattern #exprNot
...@@ -61,6 +62,7 @@ EQ : '=' ; ...@@ -61,6 +62,7 @@ EQ : '=' ;
NEQ : '!=' ; NEQ : '!=' ;
GEQ : '>=' ; GEQ : '>=' ;
LEQ : '<=' ; LEQ : '<=' ;
EQUIV : '<->';
GE : '>' ; GE : '>' ;
LE : '<' ; LE : '<' ;
AND : '&' ; AND : '&' ;
......
...@@ -12,10 +12,12 @@ public class Utils { ...@@ -12,10 +12,12 @@ public class Utils {
* @param formula * @param formula
* @return parsable Stringversion of Term * @return parsable Stringversion of Term
*/ */
@Deprecated
public static String toPrettyTerm(Term formula) { public static String toPrettyTerm(Term formula) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
Operator op = formula.op(); Operator op = formula.op();
//ugly if/else //ugly if/else
if (op.equals(Junctor.IMP)) { if (op.equals(Junctor.IMP)) {
sb.append("(" + toPrettyTerm(formula.sub(0)) + ") -> (" + toPrettyTerm(formula.sub(1)) + ")"); sb.append("(" + toPrettyTerm(formula.sub(0)) + ") -> (" + toPrettyTerm(formula.sub(1)) + ")");
......
...@@ -3,9 +3,9 @@ package edu.kit.iti.formal.psdbg.interpreter; ...@@ -3,9 +3,9 @@ package edu.kit.iti.formal.psdbg.interpreter;
import de.uka.ilkd.key.api.ScriptApi; import de.uka.ilkd.key.api.ScriptApi;
import de.uka.ilkd.key.api.VariableAssignments; import de.uka.ilkd.key.api.VariableAssignments;
import de.uka.ilkd.key.logic.Name; import de.uka.ilkd.key.logic.Name;
import de.uka.ilkd.key.logic.SequentFormula;
import de.uka.ilkd.key.logic.Term; import de.uka.ilkd.key.logic.Term;
import de.uka.ilkd.key.logic.op.SchemaVariable; import de.uka.ilkd.key.logic.op.SchemaVariable;
import de.uka.ilkd.key.pp.LogicPrinter;
import de.uka.ilkd.key.proof.ApplyStrategy; import de.uka.ilkd.key.proof.ApplyStrategy;
import de.uka.ilkd.key.proof.Goal; import de.uka.ilkd.key.proof.Goal;
import de.uka.ilkd.key.proof.Proof; import de.uka.ilkd.key.proof.Proof;
...@@ -15,9 +15,9 @@ import de.uka.ilkd.key.rule.Taclet; ...@@ -15,9 +15,9 @@ import de.uka.ilkd.key.rule.Taclet;
import de.uka.ilkd.key.rule.TacletApp; import de.uka.ilkd.key.rule.TacletApp;
import edu.kit.iti.formal.psdbg.interpreter.data.GoalNode; import edu.kit.iti.formal.psdbg.interpreter.data.GoalNode;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData; import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import edu.kit.iti.formal.psdbg.interpreter.data.SortType;
import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment; import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import edu.kit.iti.formal.psdbg.parser.ast.Signature; import edu.kit.iti.formal.psdbg.parser.ast.Signature;
import edu.kit.iti.formal.psdbg.parser.ast.TermLiteral;
import edu.kit.iti.formal.psdbg.parser.ast.Variable; import edu.kit.iti.formal.psdbg.parser.ast.Variable;
import edu.kit.iti.formal.psdbg.parser.data.Value; import edu.kit.iti.formal.psdbg.parser.data.Value;
import edu.kit.iti.formal.psdbg.parser.types.SimpleType; import edu.kit.iti.formal.psdbg.parser.types.SimpleType;
...@@ -25,7 +25,6 @@ import edu.kit.iti.formal.psdbg.parser.types.TermType; ...@@ -25,7 +25,6 @@ import edu.kit.iti.formal.psdbg.parser.types.TermType;
import edu.kit.iti.formal.psdbg.parser.types.Type; import edu.kit.iti.formal.psdbg.parser.types.Type;
import edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade; import edu.kit.iti.formal.psdbg.termmatcher.MatcherFacade;
import edu.kit.iti.formal.psdbg.termmatcher.Matchings; import edu.kit.iti.formal.psdbg.termmatcher.Matchings;
import edu.kit.iti.formal.psdbg.termmatcher.Utils;
import edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath; import edu.kit.iti.formal.psdbg.termmatcher.mp.MatchPath;
import org.key_project.util.collection.ImmutableList; import org.key_project.util.collection.ImmutableList;
...@@ -197,13 +196,46 @@ public class KeYMatcher implements MatcherApi<KeyData> { ...@@ -197,13 +196,46 @@ public class KeYMatcher implements MatcherApi<KeyData> {
// System.out.println("Matched " + keyMatchResult.size() + " goals from " + currentState.toString() + " with pattern " + term); // System.out.println("Matched " + keyMatchResult.size() + " goals from " + currentState.toString() + " with pattern " + term);
List<VariableAssignment> transformedMatchResults = new ArrayList<>(); List<VariableAssignment> transformedMatchResults = new ArrayList<>();
for (VariableAssignments mResult : keyMatchResult) { for (VariableAssignments mResult : keyMatchResult) {
transformedMatchResults.add(from(mResult)); transformedMatchResults.add(from(mResult, currentState.getData()));
} }
//keyMatchResult.forEach(r -> transformedMatchResults.add(from(r))); //keyMatchResult.forEach(r -> transformedMatchResults.add(from(r)));
return transformedMatchResults; return transformedMatchResults;
} }
/**
* Transforms a KeY Variable Assignment into an assignment for the interpreter
*
* @param keyAssignments
* @param currentState
* @return
*/
public VariableAssignment from(VariableAssignments keyAssignments, KeyData currentState) {
VariableAssignment interpreterAssignments = new VariableAssignment(null);
Map<String, VariableAssignments.VarType> keyTypeMap = keyAssignments.getTypeMap();
keyTypeMap.entrySet().forEach(e -> interpreterAssignments.declare(e.getKey(), interpreter.getTypeConversionBiMap().inverse().get(e.getValue())));
keyTypeMap.keySet().forEach(k -> {
try {
interpreterAssignments.assign(k, toValueTerm(currentState, (Term) keyAssignments.getVarValue(k)));
//System.out.println(keyAssignments.getVarValue(k));
} catch (Exception e) {
e.printStackTrace();
}
});
return interpreterAssignments;
}
private Value<String> toValueTerm(KeyData currentState, Term matched) {
String reprTerm = LogicPrinter.quickPrintTerm(matched, currentState.getEnv().getServices());
return new Value<>(
new TermType(new SortType(matched.sort())),
reprTerm
);
}
@Override @Override
public List<VariableAssignment> matchSeq(GoalNode<KeyData> currentState, String data, Signature sig) { public List<VariableAssignment> matchSeq(GoalNode<KeyData> currentState, String data, Signature sig) {
System.out.println("State that will be matched " + currentState.getData().getNode().sequent() + " with pattern " + data); System.out.println("State that will be matched " + currentState.getData().getNode().sequent() + " with pattern " + data);
...@@ -225,9 +257,10 @@ public class KeYMatcher implements MatcherApi<KeyData> { ...@@ -225,9 +257,10 @@ public class KeYMatcher implements MatcherApi<KeyData> {
s = s.replaceFirst("\\?", ""); s = s.replaceFirst("\\?", "");
} }
va.declare(s, new TermType()); Value<String> value = toValueTerm(currentState.getData(), matched);
va.assign(s, Value.from(from(matched))); va.declare(s, value.getType());
System.out.println("Variable " + s + " : " + Value.from(from(matched))); va.assign(s, value);
System.out.println("Variable " + s + " : " + value);
} }
} }
List<VariableAssignment> retList = new LinkedList(); List<VariableAssignment> retList = new LinkedList();
...@@ -237,35 +270,8 @@ public class KeYMatcher implements MatcherApi<KeyData> { ...@@ -237,35 +270,8 @@ public class KeYMatcher implements MatcherApi<KeyData> {
} }
} }
/**
* Transforms a KeY Variable Assignment into an assignment for the interpreter
*
* @param keyAssignments
* @return
*/
public VariableAssignment from(VariableAssignments keyAssignments) {
VariableAssignment interpreterAssignments = new VariableAssignment(null);
Map<String, VariableAssignments.VarType> keyTypeMap = keyAssignments.getTypeMap();
keyTypeMap.entrySet().forEach(e -> interpreterAssignments.declare(e.getKey(), interpreter.getTypeConversionBiMap().inverse().get(e.getValue())));
keyTypeMap.keySet().forEach(k -> {
try {
interpreterAssignments.assign(k, Value.from(from((Term) keyAssignments.getVarValue(k))));
//System.out.println(keyAssignments.getVarValue(k));
} catch (Exception e) {
e.printStackTrace();
}
});
return interpreterAssignments;
}
private TermLiteral from(Term t) {
//TODO rewrite operator
return new TermLiteral(Utils.toPrettyTerm(t));
}
private TermLiteral from(SequentFormula sf) { //private TermLiteral from(SequentFormula sf) {
return new TermLiteral(sf.toString()); // return new TermLiteral(sf.toString());
} //}
} }
package edu.kit.iti.formal.psdbg.interpreter.data;
import de.uka.ilkd.key.logic.sort.Sort;
import edu.kit.iti.formal.psdbg.parser.types.Type;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class SortType implements Type {
@Getter
private final Sort sort;
@Override
public String symbol() {
return sort.toString();
}
}
...@@ -2,7 +2,9 @@ package edu.kit.iti.formal.psdbg.interpreter; ...@@ -2,7 +2,9 @@ package edu.kit.iti.formal.psdbg.interpreter;
import static edu.kit.iti.formal.psdbg.TestHelper.getFile; import static edu.kit.iti.formal.psdbg.TestHelper.getFile;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData; import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import edu.kit.iti.formal.psdbg.interpreter.data.State;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.io.IOException; import java.io.IOException;
...@@ -51,7 +53,10 @@ public class ExecuteTest { ...@@ -51,7 +53,10 @@ public class ExecuteTest {
getFile(getClass(), "contraposition/contraposition.key"), getFile(getClass(), "contraposition/contraposition.key"),
"-s", getFile(getClass(), "contraposition/cutTest.kps")); "-s", getFile(getClass(), "contraposition/cutTest.kps"));
Interpreter<KeyData> i = execute.run(); Interpreter<KeyData> i = execute.run();
System.out.println(i.getCurrentState()); State<KeyData> currentState = i.getCurrentState();
System.out.println(currentState);
//This reveals a bug in the cases merge
Assert.assertEquals("Number of goals has to be two ", 2, i.getCurrentGoals().size());
} }
} }
\ No newline at end of file
script cutTest(){ script cutTest(){
//auto step=2;
//cut `p`;
cases{ cases{
//X:TERM :=`p`;
case match `==>?X -> ?Y`: case match `==>?X -> ?Y`:
//auto steps=100; cut `?X`[?X \ Y];
cut `?Y`[];
} }
//cut #2=`p`;
//auto steps=100;
} }
\ No newline at end of file
...@@ -40,7 +40,7 @@ public class ANTLR4LexerHighlighter { ...@@ -40,7 +40,7 @@ public class ANTLR4LexerHighlighter {
return spansBuilder.create(); return spansBuilder.create();
} catch (StringIndexOutOfBoundsException e) { } catch (StringIndexOutOfBoundsException e) {
e.printStackTrace(); // e.printStackTrace();
} }
return null; return null;
} }
......
...@@ -235,13 +235,4 @@ public class Utils { ...@@ -235,13 +235,4 @@ public class Utils {
return String.valueOf(t.getData().getNode().serialNr()); return String.valueOf(t.getData().getNode().serialNr());
} }
/**