Search in sources :

Example 16 with ASTProlog

use of de.be4.classicalb.core.parser.analysis.prolog.ASTProlog in project probparsers by bendisposto.

the class ClassicalBParser method printAst.

private void printAst(final IPrologTermOutput pto, Start ast, final boolean wrap, final String wrapper) {
    NodeIdAssignment na = new NodeIdAssignment();
    ast.apply(na);
    ClassicalPositionPrinter pprinter = new ClassicalPositionPrinter(na, -1, 0);
    final ASTProlog prologPrinter = new ASTProlog(pto, pprinter);
    if (wrap) {
        pto.openTerm(wrapper);
    }
    ast.apply(prologPrinter);
    if (wrap) {
        pto.closeTerm();
    }
}
Also used : ClassicalPositionPrinter(de.be4.classicalb.core.parser.analysis.prolog.ClassicalPositionPrinter) ASTProlog(de.be4.classicalb.core.parser.analysis.prolog.ASTProlog) NodeIdAssignment(de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment)

Example 17 with ASTProlog

use of de.be4.classicalb.core.parser.analysis.prolog.ASTProlog in project prob2 by bendisposto.

the class EventB method printProlog.

@Override
public void printProlog(final IPrologTermOutput pout) {
    if (ast == null) {
        ensureParsed();
    }
    if (EvalElementType.ASSIGNMENT.equals(getKind())) {
        throw new EvaluationException("Assignments are currently unsupported for evaluation");
    }
    assert ast != null;
    final ASTProlog prolog = new ASTProlog(pout, null);
    ast.apply(prolog);
}
Also used : ASTProlog(de.be4.classicalb.core.parser.analysis.prolog.ASTProlog)

Aggregations

ASTProlog (de.be4.classicalb.core.parser.analysis.prolog.ASTProlog)16 ClassicalPositionPrinter (de.be4.classicalb.core.parser.analysis.prolog.ClassicalPositionPrinter)10 NodeIdAssignment (de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment)8 Start (de.be4.classicalb.core.parser.node.Start)5 PositionPrinter (de.be4.classicalb.core.parser.analysis.prolog.PositionPrinter)4 IPrologTermOutput (de.prob.prolog.output.IPrologTermOutput)4 PrologTermOutput (de.prob.prolog.output.PrologTermOutput)4 PrintWriter (java.io.PrintWriter)4 StringWriter (java.io.StringWriter)4 PrologTermStringOutput (de.prob.prolog.output.PrologTermStringOutput)3 BParser (de.be4.classicalb.core.parser.BParser)2 BCompoundException (de.be4.classicalb.core.parser.exceptions.BCompoundException)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 LexerException (de.be4.classicalb.core.parser.lexer.LexerException)1 AConstructorFreetypeConstructor (de.be4.classicalb.core.parser.node.AConstructorFreetypeConstructor)1 AFreetype (de.be4.classicalb.core.parser.node.AFreetype)1 AFreetypesMachineClause (de.be4.classicalb.core.parser.node.AFreetypesMachineClause)1 AIntegerSetExpression (de.be4.classicalb.core.parser.node.AIntegerSetExpression)1