use of org.tautua.markdownpapers.ast.ResourceDefinition in project ceylon by eclipse.
the class Markdown method extractBetween.
private static Document extractBetween(SectionsMarkdownVisitor v, Node parent, Header header1, Header header2) {
/*Node parent1 = header1 != null ? header1.jjtGetParent() : null;
Node parent2 = header2 != null ? header2.jjtGetParent() : null;
/*if (parent1 != null
&& parent2 != null
&& parent1 != parent2) {
throw new RuntimeException();
}* /
Node parent = parent1 != null ? parent1 : parent2;*/
Document doc = new Document(Parser.JJTDOCUMENT);
final int numChildren = parent.jjtGetNumChildren();
final int start = header1 != null ? Markdown.getIndexInParent(header1) + 1 : 0;
final int end = header2 != null ? Markdown.getIndexInParent(header2) - 1 : numChildren - 1;
for (int nodeIndex = start; nodeIndex <= end; nodeIndex++) {
Node child = parent.jjtGetChild(nodeIndex);
child.jjtSetParent(doc);
doc.jjtAddChild(child, nodeIndex - start);
}
// to each document
for (ResourceDefinition rd : v.resourceDefinitions) {
ResourceDefinition copy = copy(rd);
copy.jjtSetParent(doc);
doc.jjtAddChild(copy, doc.jjtGetNumChildren());
}
return doc;
}
use of org.tautua.markdownpapers.ast.ResourceDefinition in project ceylon by eclipse.
the class Markdown method copy.
private static ResourceDefinition copy(ResourceDefinition rd) {
ResourceDefinition copy = new ResourceDefinition(Parser.JJTRESOURCEDEFINITION);
copy.setId(rd.getId());
copy.setResource(rd.getResource());
return copy;
}
Aggregations