use of de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment in project probparsers by bendisposto.
the class PragmaTest 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.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment in project probparsers by bendisposto.
the class Definitions method assignIdsToNodes.
@Override
public void assignIdsToNodes(NodeIdAssignment nodeIdMapping, List<File> machineFilesLoaded) {
if (file != null) {
machineFilesLoaded.add(file);
final int fileNumber = machineFilesLoaded.indexOf(file) + 1;
for (PDefinition def : definitionsMap.values()) {
nodeIdMapping.assignIdentifiers(fileNumber, def);
}
}
for (IDefinitions defintions : super.referencedDefinitions) {
defintions.assignIdsToNodes(nodeIdMapping, machineFilesLoaded);
}
}
use of de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment in project probparsers by bendisposto.
the class Helpers method printAsProlog.
public static void printAsProlog(final Start start, final IPrologTermOutput pout) {
final NodeIdAssignment nodeIds = new NodeIdAssignment();
nodeIds.assignIdentifiers(1, start);
final ClassicalPositionPrinter pprinter = new ClassicalPositionPrinter(nodeIds);
final ASTProlog prolog = new ASTProlog(pout, pprinter);
pout.openTerm("machine");
start.apply(prolog);
pout.closeTerm();
pout.fullstop();
pout.flush();
}
use of de.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment 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.be4.classicalb.core.parser.analysis.prolog.NodeIdAssignment in project probparsers by bendisposto.
the class BMachine method printAsProlog.
public void printAsProlog(final IPrologTermOutput pout, NodeIdAssignment nodeIdMapping) {
assert start != null;
final ClassicalPositionPrinter pprinter = new ClassicalPositionPrinter(nodeIdMapping);
pprinter.printSourcePositions(parsingBehaviour.isAddLineNumbers());
final ASTProlog prolog = new ASTProlog(pout, pprinter);
pout.openTerm("machine");
// if (parsingBehaviour.isAddLineNumbers()) {
// pprinter.setSourcePositions(
// new SourcePositions(new ArrayList<IToken>(), new HashMap<PositionedNode, SourcecodeRange>()));
// }
start.apply(prolog);
pout.closeTerm();
pout.fullstop();
}
Aggregations