public static class ExistentialFrame {
THashSet<String> variables = new THashSet<String>(4);
ArrayList<Variable> blanks = new ArrayList<Variable>(2);
- boolean disallowNewExistentials;
+ public boolean disallowNewExistentials;
+
+ public EVariable createBlank(long location) {
+ Variable variable = new Variable("_");
+ blanks.add(variable);
+ EVariable result = new EVariable(variable);
+ result.location = location;
+ return result;
+ }
}
THashMap<String, Variable> variables = new THashMap<String, Variable>();
}
case '_': {
if(name.length()==1) {
- variable = new Variable("_");
ExistentialFrame existentialFrame = getCurrentExistentialFrame();
if(existentialFrame == null || existentialFrame.disallowNewExistentials) {
errorLog.log(location, "Blank variables can be used only in queries.");
return new EError(location);
}
- existentialFrame.blanks.add(variable);
- return new EVariable(variable);
+ return existentialFrame.createBlank(location);
}
break;
}
return null;
}
- private ExistentialFrame getCurrentExistentialFrame() {
+ public ExistentialFrame getCurrentExistentialFrame() {
int size = existentialFrames.size();
if(size == 0)
return null;