use of org.eclipse.n4js.jsdoc.dom.ContentNode in project n4js by eclipse.
the class LineTagWithSimpleTextDefinition method parse.
/**
* Parses section content and set it as {@link #VALUE}.
*/
@Override
public Tag parse(TagTitle title, JSDocCharScanner scanner, DescriptionParser descriptionParser) {
ContentNode node = descriptionParser.parse(scanner, TagDictionary.emptyDict());
if (!(node instanceof Text)) {
// warning: node may now be null! (e.g. in case of a tag without content)
String asText = node != null ? JSDocSerializer.toJSDocString(node) : "";
if (asText.isEmpty()) {
node = null;
} else {
Text text = DomFactory.eINSTANCE.createText();
text.setText(asText);
if (node == null) {
text.setRange(scanner.nextOffset(), scanner.nextOffset());
} else {
text.setRange(node.getBegin(), node.getEnd());
}
node = text;
}
} else {
Text text = (Text) node;
if (text.getText().isEmpty()) {
node = null;
}
}
Tag tag = createLineTag(title);
if (node != null) {
addValue(tag, VALUE, node);
}
return tag;
}
Aggregations