Skip to content
Snippets Groups Projects
Commit 5baad82b authored by Michael Leuschel's avatar Michael Leuschel
Browse files

support tuple definitions in UNCHANGED

UNCHANGED can now contain definitions
which themselves are tuples
parent 5c1854a6
No related branches found
No related tags found
No related merge requests found
...@@ -378,16 +378,20 @@ public class BOperation extends BuiltInOPs implements ASTConstants, ...@@ -378,16 +378,20 @@ public class BOperation extends BuiltInOPs implements ASTConstants,
OpApplNode var = (OpApplNode) k.getArgs()[i]; OpApplNode var = (OpApplNode) k.getArgs()[i];
//findUnchangedVariablesInOpApplNode(var); //findUnchangedVariablesInOpApplNode(var);
// System.out.println("var.getOperator() = " + var.getOperator().getName() + " at " + var.getOperator() + " of class " + var.getOperator().getClass().getSimpleName()); // System.out.println("var.getOperator() = " + var.getOperator().getName() + " at " + var.getOperator() + " of class " + var.getOperator().getClass().getSimpleName());
// TO DO: support OpDefNode
if(var.getOperator() instanceof OpDefNode) { if(var.getOperator() instanceof OpDefNode) {
// we have a definition
OpDefNode def = (OpDefNode) var.getOperator(); OpDefNode def = (OpDefNode) var.getOperator();
if(def.getParams().length > 0) { if(def.getParams().length > 0) {
// we do not support definitions with arguments yet
throw new RuntimeException("Declaration with parameters not supported for UNCHANGED: " + var.getOperator().getName() + " " + var.getLocation()); throw new RuntimeException("Declaration with parameters not supported for UNCHANGED: " + var.getOperator().getName() + " " + var.getLocation());
} }
ExprNode body = def.getBody(); ExprNode body = def.getBody();
//if(body instanceof OpApplNode)
// System.out.println("Body = " + body + " of class " + body.getClass().getSimpleName()); // System.out.println("Body = " + body + " of class " + body.getClass().getSimpleName());
throw new RuntimeException("Declaration not yet supported for UNCHANGED: " + var.getOperator().getName() + " defined at " + body + " used at " + var.getLocation()); if(body instanceof OpApplNode) {
OpApplNode obody = (OpApplNode) body;
// System.out.println("Operator = " + obody.getOperator()); // In module --TLA+ BUILTINS--
findUnchangedVariablesInOpApplNode(obody);
}
} else if(!(var.getOperator() instanceof OpDeclNode)) { } else if(!(var.getOperator() instanceof OpDeclNode)) {
throw new RuntimeException("cannot convert to list of unchanged variables: " + var.getOperator().getName() + " " + var.getLocation()); throw new RuntimeException("cannot convert to list of unchanged variables: " + var.getOperator().getName() + " " + var.getLocation());
} else { } else {
...@@ -404,6 +408,11 @@ public class BOperation extends BuiltInOPs implements ASTConstants, ...@@ -404,6 +408,11 @@ public class BOperation extends BuiltInOPs implements ASTConstants,
} }
} }
private void addUnchangedVariablesInOpApplNodeTuple(OpApplNode k) {
}
} }
class PrimedVariablesFinder extends AbstractASTVisitor { class PrimedVariablesFinder extends AbstractASTVisitor {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment