use of de.be4.classicalb.core.parser.util.PrettyPrinter in project probparsers by bendisposto.
the class RulesUtil method getRulesMachineAsBMachine.
public static String getRulesMachineAsBMachine(File file) {
RulesProject rulesProject = new RulesProject();
rulesProject.parseProject(file);
rulesProject.checkAndTranslateProject();
List<IModel> bModels = rulesProject.getBModels();
List<BException> bExceptionList = rulesProject.getBExceptionList();
if (!bExceptionList.isEmpty()) {
throw new RuntimeException(bExceptionList.get(0));
}
IModel model = bModels.get(bModels.size() - 2);
PrettyPrinter pp = new PrettyPrinter();
model.getStart().apply(pp);
return pp.getPrettyPrint();
}
use of de.be4.classicalb.core.parser.util.PrettyPrinter in project probparsers by bendisposto.
the class PrettyPredicatePrinterTest method testExpression.
@Test
public void testExpression() throws Exception {
Start parse = BParser.parse(PREFIX + theString);
PrettyPrinter prettyprinter = new PrettyPrinter();
parse.apply(prettyprinter);
String prettyPrint = prettyprinter.getPrettyPrint();
Start parse2 = BParser.parse(PREFIX + prettyPrint);
PrettyPrinter prettyprinter2 = new PrettyPrinter();
parse2.apply(prettyprinter2);
assertEquals(Ast2String.getTreeAsString(parse), Ast2String.getTreeAsString(parse2));
assertEquals(prettyPrint, prettyprinter2.getPrettyPrint());
}
use of de.be4.classicalb.core.parser.util.PrettyPrinter in project prob2 by bendisposto.
the class ClassicalB method prettyprint.
private static String prettyprint(final Node predicate) {
final PrettyPrinter prettyPrinter = new PrettyPrinter();
predicate.apply(prettyPrinter);
return prettyPrinter.getPrettyPrint();
}
Aggregations