Skip to content
Snippets Groups Projects
Commit a4f6b584 authored by hansen's avatar hansen
Browse files

added renamer to trace printer

parent fc2af107
No related branches found
No related tags found
No related merge requests found
......@@ -121,6 +121,7 @@ public class TLC4B {
tlc4b.printResults(results, false);
//System.out.println(results.getTrace());
System.exit(0);
}
}
......
......@@ -49,24 +49,28 @@ public class TracePrinter {
this.trace = trace;
this.tlcOutputInfo = tlcOutputInfo;
setup();
}
private void setup() {
constants = new ArrayList<OpDeclNode>();
variables = new ArrayList<OpDeclNode>();
for (int i = 0; i < TLCState.vars.length; i++) {
String id = TLCState.vars[i].getName().toString();
if (tlcOutputInfo.constants.contains(id)) {
String tlaName = TLCState.vars[i].getName().toString();
String bName = tlcOutputInfo.getBName(tlaName);
if (tlcOutputInfo.constants.contains(bName)) {
constants.add(TLCState.vars[i]);
} else {
variables.add(TLCState.vars[i]);
}
}
evalTrace();
}
public TracePrinter(TLCState initialState, TLCOutputInfo tlcOutputInfo) {
this.initialState = initialState;
this.tlcOutputInfo = tlcOutputInfo;
evalTrace();
setup();
}
public StringBuilder getTrace() {
......@@ -103,10 +107,11 @@ public class TracePrinter {
expression.append(" & ");
}
UniqueString var = constants.get(i).getName();
String bName = tlcOutputInfo.getBName(var.toString());
BType type = tlcOutputInfo.getBType(var.toString());
String value = parseValue(state.lookup(var), type)
.toString();
expression.append(var).append(" = ").append(value);
expression.append(bName).append(" = ").append(value);
}
}
expression.append("\n");
......@@ -122,9 +127,10 @@ public class TracePrinter {
expression.append(" & ");
}
UniqueString var = variables.get(i).getName();
String bName = tlcOutputInfo.getBName(var.toString());
BType type = tlcOutputInfo.getBType(var.toString());
String value = parseValue(state.lookup(var), type).toString();
expression.append(var).append(" = ").append(value);
expression.append(bName).append(" = ").append(value);
}
return expression;
}
......@@ -165,13 +171,20 @@ public class TracePrinter {
res.append(")");
return res;
} else if (type instanceof FunctionType) {
if(((TupleValue) val).elems.length == 0){
res.append("{}");
return res;
}else{
BType subtype = ((FunctionType) type).getRange();
res.append("[");
System.out.println();
res.append(parseEnumerationValue(((TupleValue) val).elems,
subtype));
res.append("]");
return res;
}
}
return null;
case RECORDVALUE: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment