Search in sources :

Example 6 with CommentInfo

use of lombok.javac.CommentInfo in project lombok by rzwitserloot.

the class CommentCollectingParser method parseCompilationUnit.

public JCCompilationUnit parseCompilationUnit() {
    JCCompilationUnit result = super.parseCompilationUnit();
    if (lexer instanceof CommentCollectingScanner) {
        List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
        JCCompilationUnit_comments.set(result, comments);
    }
    return result;
}
Also used : JCCompilationUnit(com.sun.tools.javac.tree.JCTree.JCCompilationUnit) CommentInfo(lombok.javac.CommentInfo)

Example 7 with CommentInfo

use of lombok.javac.CommentInfo in project lombok by rzwitserloot.

the class CommentCollectingScanner method processComment.

@Override
protected void processComment(CommentStyle style) {
    int prevEndPos = Math.max(prevEndPos(), endComment);
    int pos = pos();
    int endPos = endPos();
    endComment = endPos;
    String content = new String(getRawCharacters(pos, endPos));
    StartConnection start = determineStartConnection(prevEndPos, pos);
    EndConnection end = determineEndConnection(endPos);
    CommentInfo comment = new CommentInfo(prevEndPos, pos, endPos, content, start, end);
    comments.append(comment);
    super.processComment(style);
}
Also used : EndConnection(lombok.javac.CommentInfo.EndConnection) StartConnection(lombok.javac.CommentInfo.StartConnection) CommentInfo(lombok.javac.CommentInfo)

Example 8 with CommentInfo

use of lombok.javac.CommentInfo in project lombok by rzwitserloot.

the class CommentCollectingParser method parseCompilationUnit.

public JCCompilationUnit parseCompilationUnit() {
    JCCompilationUnit result = super.parseCompilationUnit();
    if (lexer instanceof CommentCollectingScanner) {
        List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
        JCCompilationUnit_comments.set(result, comments);
    }
    return result;
}
Also used : JCCompilationUnit(com.sun.tools.javac.tree.JCTree.JCCompilationUnit) CommentInfo(lombok.javac.CommentInfo)

Example 9 with CommentInfo

use of lombok.javac.CommentInfo in project lombok by rzwitserloot.

the class CommentCollectingTokenizer method processComment.

@Override
protected Comment processComment(int pos, int endPos, CommentStyle style) {
    int prevEndPos = Math.max(prevEndPosition, endComment);
    endComment = endPos;
    String content = new String(reader.getRawCharacters(pos, endPos));
    StartConnection start = determineStartConnection(prevEndPos, pos);
    EndConnection end = determineEndConnection(endPos);
    CommentInfo comment = new CommentInfo(prevEndPos, pos, endPos, content, start, end);
    comments.append(comment);
    return super.processComment(pos, endPos, style);
}
Also used : EndConnection(lombok.javac.CommentInfo.EndConnection) StartConnection(lombok.javac.CommentInfo.StartConnection) CommentInfo(lombok.javac.CommentInfo)

Aggregations

CommentInfo (lombok.javac.CommentInfo)9 JCCompilationUnit (com.sun.tools.javac.tree.JCTree.JCCompilationUnit)3 EndConnection (lombok.javac.CommentInfo.EndConnection)3 StartConnection (lombok.javac.CommentInfo.StartConnection)3 JCTree (com.sun.tools.javac.tree.JCTree)1 ArrayList (java.util.ArrayList)1