use of org.eclipse.n4js.jsdoc.dom.TagTitle in project n4js by eclipse.
the class InlineTagImpl method basicSetTitle.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTitle(TagTitle newTitle, NotificationChain msgs) {
TagTitle oldTitle = title;
title = newTitle;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomPackage.INLINE_TAG__TITLE, oldTitle, newTitle);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.jsdoc.dom.TagTitle 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;
}
use of org.eclipse.n4js.jsdoc.dom.TagTitle in project n4js by eclipse.
the class DescriptionParser method parseRegion.
/**
* Method used to parse Region encountered in text. Expects {@link JSDocCharScanner#nextNonWS()} to be beginning of
* region. It will use provided {@link TagDictionary} to recognize parse region. If no tags will mach parsed region,
* null is returned. If region is maching one of {@link InlineTag} definitions it will return result of parsing
* region with given tag.
*
* @param scanner
* JSDocCharScanner with offset_ before region
* @param inlineTagsDictinary
* Dictionary of tags used to parse given region
* @return Returns instance of Tag if parsed successfully, null otherwise.
*/
Tag parseRegion(JSDocCharScanner scanner, TagDictionary<AbstractInlineTagDefinition> inlineTagsDictinary) {
ScannerState stateBeforeRegion = scanner.saveState();
char _char = scanner.nextNonWS();
// unsafe if region is marked by more than one char
if (!regionStart(_char)) {
return null;
}
scanner.skipWS();
JSDocToken tokenTitle = TagTitleTokenizer.INSTANCE.nextToken(scanner);
if (tokenTitle != null) {
ITagDefinition iTagDefinition = inlineTagsDictinary.getDefinition(tokenTitle.token);
if (iTagDefinition != null) {
TagTitle tagTitle = createTagTitle(tokenTitle, iTagDefinition);
AbstractInlineTagDefinition tagDefinition = (AbstractInlineTagDefinition) iTagDefinition;
// although start of the region will be parsed twice (e.g. tag
// title) it allows given tag implementation to decide what to
// do with whole region, also might be important for nested
// regions detection.
scanner.restoreState(stateBeforeRegion);
InlineTag tag = (InlineTag) tagDefinition.parse(tagTitle, scanner);
tag.setRange(tokenTitle.start, scanner.offset());
return tag;
} else {
System.err.println("silent ignore of unrecognized InlineTag {" + tokenTitle.token + "}");
return null;
}
}
return null;
}
use of org.eclipse.n4js.jsdoc.dom.TagTitle in project n4js by eclipse.
the class TagImpl method basicSetTitle.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTitle(TagTitle newTitle, NotificationChain msgs) {
TagTitle oldTitle = title;
title = newTitle;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomPackage.TAG__TITLE, oldTitle, newTitle);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.jsdoc.dom.TagTitle in project n4js by eclipse.
the class AbstractJSDocParser method createTagTitle.
/**
* Creates tag title with actual and canonical title.
*/
protected TagTitle createTagTitle(JSDocToken token, ITagDefinition tagDefinition) {
TagTitle tagTitle = DomFactory.eINSTANCE.createTagTitle();
tagTitle.setTitle(tagDefinition.getTitle());
tagTitle.setActualTitle(token.token);
tagTitle.setBegin(token.start);
tagTitle.setEnd(token.end);
return tagTitle;
}
Aggregations