public String getValue() { return node.getValue(); } }
public EcmascriptNode<AstRoot> parse(final Reader reader) { try { final List<ParseProblem> parseProblems = new ArrayList<>(); final String sourceCode = IOUtils.toString(reader); final AstRoot astRoot = parseEcmascript(sourceCode, parseProblems); final EcmascriptTreeBuilder treeBuilder = new EcmascriptTreeBuilder(sourceCode, parseProblems); EcmascriptNode<AstRoot> tree = treeBuilder.build(astRoot); suppressMap = new HashMap<>(); if (astRoot.getComments() != null) { for (Comment comment : astRoot.getComments()) { int nopmd = comment.getValue().indexOf(suppressMarker); if (nopmd > -1) { String suppression = comment.getValue().substring(nopmd + suppressMarker.length()); EcmascriptNode<Comment> node = treeBuilder.build(comment); suppressMap.put(node.getBeginLine(), suppression); } } } return tree; } catch (IOException e) { throw new ParseException(e); } }
/** * Gets the JsDoc comment string attached to this node. * @return the comment string or {@code null} if no JsDoc is attached to * this node */ public String getJsDoc() { Comment comment = getJsDocNode(); if (comment != null) { return comment.getValue(); } return null; }
/** * Gets the JsDoc comment string attached to this node. * @return the comment string or {@code null} if no JsDoc is attached to * this node */ public String getJsDoc() { Comment comment = getJsDocNode(); if (comment != null) { return comment.getValue(); } return null; }
/** * Gets the JsDoc comment string attached to this node. * @return the comment string or {@code null} if no JsDoc is attached to * this node */ public String getJsDoc() { Comment comment = getJsDocNode(); if (comment != null) { return comment.getValue(); } return null; }
/** * Gets the JsDoc comment string attached to this node. * @return the comment string or {@code null} if no JsDoc is attached to * this node */ public String getJsDoc() { Comment comment = getJsDocNode(); if (comment != null) { return comment.getValue(); } return null; }
if (root.getComments() != null && !root.getComments().isEmpty()) final String rawHeaderDocs = root.getComments().first().getValue(); jsDoc.set(JsDocParser.parse(getId(), rawHeaderDocs));
@Override public boolean visit(AstNode node) { if (node instanceof AstRoot) return true; else { ITree t = buildTree(node); ITree p = trees.get(node.getParent()); p.addChild(t); if (node instanceof Name) { Name name = (Name) node; t.setLabel(name.getIdentifier()); } else if ( node instanceof StringLiteral) { StringLiteral literal = (StringLiteral) node; t.setLabel(literal.getValue()); } else if ( node instanceof NumberLiteral) { NumberLiteral l = (NumberLiteral) node; t.setLabel(l.getValue()); } else if ( node instanceof Comment) { Comment c = (Comment) node; t.setLabel(c.getValue()); } return true; } }