Search in sources :

Example 1 with TagTitleTokenizer

use of org.eclipse.n4js.jsdoc.tokenizers.TagTitleTokenizer in project n4js by eclipse.

the class DocletParser method parse.

/**
 * @param commentString
 *            Input string that will be parsed. Multiline comment expected.
 * @return Instance of Doclet (not null, but may have no contents).
 */
public Doclet parse(String commentString) {
    JSDocCharScanner scanner = new JSDocCharScanner(commentString);
    // parse main description
    Doclet doclet = parseMainDescription(scanner);
    TagTitleTokenizer tagTitleTokenizer = new TagTitleTokenizer();
    JSDocToken token;
    // TODO error handling
    while (null != (token = tagTitleTokenizer.nextToken(scanner))) {
        ITagDefinition tagDefinition = lineTagDictionary.getDefinition(token.token);
        int lineTagEnd = scanner.findLineTagEnd();
        scanner.fence(lineTagEnd);
        if (tagDefinition != null) {
            TagTitle tagTitle = createTagTitle(token, tagDefinition);
            LineTag tag = (LineTag) tagDefinition.parse(tagTitle, scanner, descriptionParser);
            tag.setRange(token.start, scanner.offset());
            doclet.getLineTags().add(tag);
        }
        scanner.unfence();
        scanner.setNextOffset(lineTagEnd);
    }
    doclet.setEnd(scanner.offset());
    return doclet;
}
Also used : TagTitleTokenizer(org.eclipse.n4js.jsdoc.tokenizers.TagTitleTokenizer) LineTag(org.eclipse.n4js.jsdoc.dom.LineTag) Doclet(org.eclipse.n4js.jsdoc.dom.Doclet) TagTitle(org.eclipse.n4js.jsdoc.dom.TagTitle)

Aggregations

Doclet (org.eclipse.n4js.jsdoc.dom.Doclet)1 LineTag (org.eclipse.n4js.jsdoc.dom.LineTag)1 TagTitle (org.eclipse.n4js.jsdoc.dom.TagTitle)1 TagTitleTokenizer (org.eclipse.n4js.jsdoc.tokenizers.TagTitleTokenizer)1