use of org.eclipse.n4js.jsdoc.JSDocToken in project n4js by eclipse.
the class TextTokenizerTest method test.
@SuppressWarnings("javadoc")
@Test
public void test() {
TextTokenizer TEXT = TextTokenizer.INSTANCE;
assertEquals(new JSDocToken("Hello World", 0, 10), TEXT.nextToken(new JSDocCharScanner("Hello World")));
assertEquals(new JSDocToken("Hello World", 7, 17), TEXT.nextToken(new JSDocCharScanner("/**\n * Hello World")));
assertEquals(new JSDocToken("Hello World", 7, 17), TEXT.nextToken(new JSDocCharScanner("/**\n * Hello World", 7)));
assertEquals(new JSDocToken("Hello World", 7, 17), TEXT.nextToken(new JSDocCharScanner("/**\n * Hello World */", 7)));
assertEquals(new JSDocToken("Hello World ", 7, 18), TEXT.nextToken(new JSDocCharScanner("/**\n * Hello World {@code sample} */")));
}
use of org.eclipse.n4js.jsdoc.JSDocToken in project n4js by eclipse.
the class StubLineTagWithRegionDefinition method parse.
@Override
public Tag parse(TagTitle title, JSDocCharScanner scanner, DescriptionParser descriptionParser) {
Tag paramTag = createLineTag(title);
scanner.skipWS();
JSDocToken region = InlineTagTokenizer.INSTANCE.nextToken(scanner);
if (region != null) {
addValue(paramTag, REGION, region);
}
// silent ignore no region
scanner.skipWS();
// expect no tags in descritpion
TagDictionary<AbstractInlineTagDefinition> dictionary = new TagDictionary<>();
ContentNode description = descriptionParser.parse(scanner, dictionary);
if (description != null) {
addValue(paramTag, DESCR, description);
}
return paramTag;
}
use of org.eclipse.n4js.jsdoc.JSDocToken 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