use of de.prob.prolog.output.PrologTermOutput in project probparsers by bendisposto.
the class UnitPragmaTest method printAST.
private String printAST(final Node node) {
final StringWriter swriter = new StringWriter();
NodeIdAssignment nodeids = new NodeIdAssignment();
node.apply(nodeids);
IPrologTermOutput pout = new PrologTermOutput(new PrintWriter(swriter), false);
PositionPrinter pprinter = new ClassicalPositionPrinter(nodeids);
ASTProlog prolog = new ASTProlog(pout, pprinter);
node.apply(prolog);
swriter.flush();
return swriter.toString();
}
use of de.prob.prolog.output.PrologTermOutput in project probparsers by bendisposto.
the class CreateFreetypeTest method main.
public static void main(String[] args) throws IOException {
final String filename = "freetypetest.prob";
CreateFreetypeTest test = new CreateFreetypeTest();
final OutputStream file = new FileOutputStream(filename);
final PrologTermOutput pto = new PrologTermOutput(file);
// parser_version(none).
pto.openTerm("parser_version");
pto.printAtom("none");
pto.closeTerm();
pto.fullstop();
// classical_b(machine_name, [filename])
pto.openTerm("classical_b");
pto.printAtom(MACHINE_NAME);
pto.openList();
pto.printAtom(filename);
pto.closeList();
pto.closeTerm();
pto.fullstop();
// machine(...)
pto.openTerm("machine");
test.printProlog(pto);
pto.closeTerm();
pto.fullstop();
pto.flush();
file.close();
}
use of de.prob.prolog.output.PrologTermOutput in project probparsers by bendisposto.
the class PrologExceptionPrinter method printException.
public static void printException(final OutputStream out, final IOException e, final String filename, boolean useIndentation, boolean lineOneOff) {
IPrologTermOutput pto = new PrologTermOutput(out, useIndentation);
pto.openTerm("io_exception");
printMsg(pto, e, filename, useIndentation, lineOneOff, false);
pto.closeTerm();
pto.fullstop();
pto.flush();
}
use of de.prob.prolog.output.PrologTermOutput in project probparsers by bendisposto.
the class RecursiveMachineLoader method printAsProlog.
public void printAsProlog(final PrintWriter out) {
final IPrologTermOutput pout = new PrologTermOutput(out, parsingBehaviour.isUseIndention());
printAsProlog(pout);
}
Aggregations