Search in sources :

Example 6 with ContentNode

use of org.eclipse.n4js.jsdoc.dom.ContentNode in project n4js by eclipse.

the class DocletParser method parseMainDescription.

private Doclet parseMainDescription(JSDocCharScanner scanner) {
    Doclet doclet = DomFactory.eINSTANCE.createDoclet();
    doclet.setBegin(scanner.offset());
    ContentNode description = descriptionParser.parse(scanner, inlineTagDictionary);
    if (description != null) {
        doclet.getContents().add(description);
    }
    return doclet;
}
Also used : Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode)

Example 7 with ContentNode

use of org.eclipse.n4js.jsdoc.dom.ContentNode in project n4js by eclipse.

the class LineTagWithFullMemberReferenceTest method test_fullRef_symbolName.

@SuppressWarnings("javadoc")
@Test
public void test_fullRef_symbolName() {
    String in = "/** foo." + "\n * @testee n4/model/collections/DataSet.DataSet.#iterator" + "\n */";
    AbstractLineTagDefinition tagDef = new LineTagWithFullMemberReference("testee");
    DocletParser docletParser = new DocletParser(new TagDictionary<>(Arrays.asList(tagDef)), new TagDictionary<AbstractInlineTagDefinition>());
    Doclet doclet = docletParser.parse(in);
    LineTag lineTag = doclet.getLineTags().get(0);
    EList<ContentNode> contents = lineTag.getValueByKey(LineTagWithFullElementReference.REF).getContents();
    FullMemberReference ref = (FullMemberReference) contents.get(0);
    assertEquals("n4/model/collections/DataSet", ref.getModuleName());
    assertEquals("DataSet", ref.getTypeName());
    assertEquals("#iterator", ref.getMemberName());
}
Also used : LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) DocletParser(org.eclipse.n4js.jsdoc.DocletParser) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode) FullMemberReference(org.eclipse.n4js.jsdoc.dom.FullMemberReference) Test(org.junit.Test)

Example 8 with ContentNode

use of org.eclipse.n4js.jsdoc.dom.ContentNode 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;
}
Also used : TagDictionary(org.eclipse.n4js.jsdoc.TagDictionary) Tag(org.eclipse.n4js.jsdoc.dom.Tag) JSDocToken(org.eclipse.n4js.jsdoc.JSDocToken) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode)

Example 9 with ContentNode

use of org.eclipse.n4js.jsdoc.dom.ContentNode 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());
}
Also used : AbstractInlineTagDefinition(org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) Text(org.eclipse.n4js.jsdoc.dom.Text) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode) Test(org.junit.Test)

Example 10 with ContentNode

use of org.eclipse.n4js.jsdoc.dom.ContentNode in project n4js by eclipse.

the class DefaultLineTagDefinition method parse.

/**
 * Parses section content and set it as {@link #CONTENTS}.
 */
@Override
public Tag parse(TagTitle title, JSDocCharScanner scanner, DescriptionParser descriptionParser) {
    ContentNode node = descriptionParser.parse(scanner, inlineTags);
    Tag tag = createLineTag(title);
    if (node != null) {
        addValue(tag, CONTENTS, node);
    }
    return tag;
}
Also used : Tag(org.eclipse.n4js.jsdoc.dom.Tag) ContentNode(org.eclipse.n4js.jsdoc.dom.ContentNode)

Aggregations

ContentNode (org.eclipse.n4js.jsdoc.dom.ContentNode)11 Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)8 Test (org.junit.Test)7 Text (org.eclipse.n4js.jsdoc.dom.Text)6 DocletParser (org.eclipse.n4js.jsdoc.DocletParser)3 Composite (org.eclipse.n4js.jsdoc.dom.Composite)3 InlineTag (org.eclipse.n4js.jsdoc.dom.InlineTag)3 LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)3 Tag (org.eclipse.n4js.jsdoc.dom.Tag)3 TagValue (org.eclipse.n4js.jsdoc.dom.TagValue)3 AbstractInlineTagDefinition (org.eclipse.n4js.jsdoc.tags.AbstractInlineTagDefinition)3 FullMemberReference (org.eclipse.n4js.jsdoc.dom.FullMemberReference)2 JSDocToken (org.eclipse.n4js.jsdoc.JSDocToken)1 TagDictionary (org.eclipse.n4js.jsdoc.TagDictionary)1