use of org.eclipse.n4js.jsdoc.dom.Text in project n4js by eclipse.
the class StubInlineTagDefinition method convertToText.
/**
* Converts the given token to a DOM text element.
*/
@Override
protected Text convertToText(JSDocToken descr) {
Text text = DOM.createText();
text.setText(descr.token);
text.setBegin(descr.start);
text.setEnd(descr.end);
return text;
}
use of org.eclipse.n4js.jsdoc.dom.Text in project n4js by eclipse.
the class DescriptionParser method saveTextTokens.
private void saveTextTokens(ComposedContent description, int start, int end, StringBuilder strb) {
Text text = DomFactory.eINSTANCE.createText();
JSDocToken token = new JSDocToken(strb.toString(), start, end);
text.setText(token.token);
text.setBegin(token.start);
text.setEnd(token.end);
description.getContents().add(text);
}
use of org.eclipse.n4js.jsdoc.dom.Text in project n4js by eclipse.
the class DocletDescriptionParserTest method testDescriptionWithUnknownInlineTag.
@SuppressWarnings("javadoc")
@Test
public void testDescriptionWithUnknownInlineTag() {
String in = "/** This is the description with {@unkonwnInlineTag parsed as text} ..and finish description. \n */";
AbstractInlineTagDefinition inlineTag = new StubInlineTagDefinition("inline");
DocletParser docletParser = new DocletParser(null, new TagDictionary<>(Arrays.asList(inlineTag)));
Doclet doclet = docletParser.parse(in);
EList<ContentNode> contents = doclet.getContents();
Text descr = (Text) contents.get(0);
assertEquals("This is the description with {@unkonwnInlineTag parsed as text} ..and finish description.", descr.getText());
}
use of org.eclipse.n4js.jsdoc.dom.Text in project n4js by eclipse.
the class LineTagTest method testLineTagWithRegion.
@SuppressWarnings("javadoc")
@Test
public void testLineTagWithRegion() {
String in = "/** foo.\n * @stubLineTagTitle {@region value} \n */";
AbstractLineTagDefinition tag = new StubLineTagWithRegionDefinition("stubLineTagTitle");
DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tag)), new TagDictionary<AbstractInlineTagDefinition>());
Doclet doclet = docletParser.parse(in);
LineTag lineTag = doclet.getLineTags().get(0);
TagValue region = lineTag.getValueByKey(StubLineTagWithRegionDefinition.REGION);
Text strcturedText = (Text) region.getContents().get(0);
assertEquals("@region value", strcturedText.getText());
}
use of org.eclipse.n4js.jsdoc.dom.Text in project n4js by eclipse.
the class StubInlineTagDefinition method parse.
@Override
public Tag parse(TagTitle title, JSDocCharScanner scanner) {
Tag paramTag = createInlineTag(title);
scanner.skipWS();
JSDocToken description = InlineTagTokenizer.INSTANCE.nextToken(scanner);
if (description != null) {
String raw = convertToText(description).getText();
int titleOff = raw.indexOf(title.getTitle());
int titleLen = title.getTitle().length();
int fix = titleOff + titleLen;
raw = raw.substring(fix);
Text text = DOM.createText();
text.setText(raw);
text.setBegin(description.start + fix);
text.setEnd(description.end);
addValue(paramTag, PARAM_VALUE, text);
}
return paramTag;
}
Aggregations