use of org.btrplace.safeplace.spec.antlr.CstrSpecParser in project scheduler by btrplace.
the class SpecScanner method parseCore2.
/**
* @throws SpecException
*/
private Constraint parseCore2(CoreConstraint core) throws IOException {
CommonTokenStream tokens = getTokens(core.inv());
CstrSpecParser parser = new CstrSpecParser(tokens);
ParseTree tree = parser.formula();
MyCstrSpecVisitor v = new MyCstrSpecVisitor().library(functions);
Proposition p = v.getProposition(core.name(), tree);
return new Constraint(core.name(), p);
}
use of org.btrplace.safeplace.spec.antlr.CstrSpecParser in project scheduler by btrplace.
the class SpecScanner method makeArgs.
/**
* @throws SpecException
*/
private List<UserVar<?>> makeArgs(String cl, String[] strings) throws IOException {
List<UserVar<?>> args = new ArrayList<>();
for (String arg : strings) {
CstrSpecParser parser = new CstrSpecParser(getTokens(arg));
ParseTree tree = parser.typedef();
MyCstrSpecVisitor v = new MyCstrSpecVisitor().library(functions);
args.add(v.getUserVar(cl, tree));
}
return args;
}
use of org.btrplace.safeplace.spec.antlr.CstrSpecParser in project scheduler by btrplace.
the class SpecScanner method parseSide.
/**
* @throws SpecException
*/
private org.btrplace.safeplace.spec.Constraint parseSide(Side s, List<Constraint> known) throws IOException {
List<UserVar<?>> args = makeArgs(s.impl.getSimpleName(), s.s.args());
CstrSpecParser parser = new CstrSpecParser(getTokens(s.s.inv()));
ParseTree tree = parser.formula();
MyCstrSpecVisitor v = new MyCstrSpecVisitor().library(functions).args(args).constraints(known);
Proposition p = v.getProposition(s.impl.getSimpleName(), tree);
return new org.btrplace.safeplace.spec.Constraint(s.impl.getSimpleName(), p).args(args).impl(s.impl);
}
Aggregations