use of us.parr.bookish.model.SubSection in project bookish by parrt.
the class Translator method visitSection.
@Override
public OutputModelObject visitSection(BookishParser.SectionContext ctx) {
String title = ctx.sec.getText();
title = title.substring(title.indexOf(' ') + 1).trim();
Pair<String, String> results = splitSectionTitle(title);
title = results.a;
String anchor = results.b;
EntityDef def = null;
if (anchor != null) {
def = document.getEntity(anchor);
if (def == null) {
System.err.printf("line %d: Unknown label '%s'\n", ctx.start.getLine(), anchor);
return null;
}
}
List<ContainerWithTitle> subsections = new ArrayList<>();
for (ParseTree el : ctx.subsection()) {
subsections.add((SubSection) visit(el));
}
Join sec = (Join) visitSection_content(ctx.section_content());
return new Section(def, title, anchor, sec.elements, subsections);
}
use of us.parr.bookish.model.SubSection in project bookish by parrt.
the class Translator method visitSubsection.
@Override
public OutputModelObject visitSubsection(BookishParser.SubsectionContext ctx) {
String title = ctx.sec.getText();
title = title.substring(title.indexOf(' ') + 1).trim();
Pair<String, String> results = splitSectionTitle(title);
title = results.a;
String anchor = results.b;
EntityDef def = null;
if (anchor != null) {
def = document.getEntity(anchor);
if (def == null) {
System.err.printf("line %d: Unknown label '%s'\n", ctx.start.getLine(), anchor);
return null;
}
}
List<ContainerWithTitle> subsubsections = new ArrayList<>();
for (ParseTree el : ctx.subsubsection()) {
subsubsections.add((SubSection) visit(el));
}
Join sec = (Join) visitSection_content(ctx.section_content());
return new SubSection(def, title, anchor, sec != null ? sec.elements : null, subsubsections);
}
Aggregations