com.sun.tools.javac.parser.Tokens.Comment.CommentStyle Java Examples

The following examples show how to use com.sun.tools.javac.parser.Tokens.Comment.CommentStyle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavacTokens.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
public CommentWithTextAndPosition(
    int pos, int endPos, AccessibleReader reader, CommentStyle style) {
  this.pos = pos;
  this.endPos = endPos;
  this.reader = reader;
  this.style = style;
}
 
Example #2
Source File: JavadocTokenizer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #3
Source File: JavadocTokenizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #4
Source File: JavaTokenizer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #5
Source File: JavaTokenizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #6
Source File: JavadocTokenizer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #7
Source File: JavaTokenizer.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #8
Source File: JavadocTokenizer.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #9
Source File: JavaTokenizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #10
Source File: JavadocTokenizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #11
Source File: JavaTokenizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #12
Source File: DocTreeMaker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public DCDocComment newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
    ListBuffer<DCTree> lb = new ListBuffer<>();
    lb.addAll(cast(fullBody));
    List<DCTree> fBody = lb.toList();

    // A dummy comment to keep the diagnostics logic happy.
    Comment c = new Comment() {
        @Override
        public String getText() {
            return null;
        }

        @Override
        public int getSourcePos(int index) {
            return Position.NOPOS;
        }

        @Override
        public CommentStyle getStyle() {
            return CommentStyle.JAVADOC;
        }

        @Override
        public boolean isDeprecated() {
            return false;
        }
    };
    Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
    DCDocComment tree = new DCDocComment(c, fBody, pair.fst, pair.snd, cast(tags));
    return tree;
}
 
Example #13
Source File: JavaTokenizer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #14
Source File: CommentCollectingTokenizer.java    From EasyMPermission with MIT License 5 votes vote down vote up
@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);
}
 
Example #15
Source File: JavadocTokenizer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #16
Source File: JavaTokenizer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #17
Source File: JavadocTokenizer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #18
Source File: JavaTokenizer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #19
Source File: JavadocTokenizer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #20
Source File: JavaTokenizer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a complete comment has been scanned. pos and endPos
 * will mark the comment boundary.
 */
protected Tokens.Comment processComment(int pos, int endPos, CommentStyle style) {
    if (scannerDebug)
        System.out.println("processComment(" + pos
                           + "," + endPos + "," + style + ")=|"
                           + new String(reader.getRawCharacters(pos, endPos))
                           + "|");
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new BasicComment<UnicodeReader>(new UnicodeReader(fac, buf, buf.length), style);
}
 
Example #21
Source File: Documentifier.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Comment comment(String docString) {
    StringBuilder docComment = new StringBuilder()
                               .append("/**")
                               .append(docString)
                               .append("*/");
    Scanner scanner = scanners.newScanner(docComment, true);
    scanner.nextToken();
    Token token = scanner.token();
    return token.comment(CommentStyle.JAVADOC);
}
 
Example #22
Source File: JavadocTokenizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getText() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return docComment;
}
 
Example #23
Source File: JavadocTokenizer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
JavadocComment(DocReader reader, CommentStyle cs) {
    super(reader, cs);
}
 
Example #24
Source File: JavadocTokenizer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Comment processComment(int pos, int endPos, CommentStyle style) {
    char[] buf = reader.getRawCharacters(pos, endPos);
    return new JavadocComment(new DocReader(fac, buf, buf.length, pos), style);
}
 
Example #25
Source File: JavaTokenizer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public boolean isDeprecated() {
    if (!scanned && cs == CommentStyle.JAVADOC) {
        scanDocComment();
    }
    return deprecatedFlag;
}
 
Example #26
Source File: JavaTokenizer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public CommentStyle getStyle() {
    return cs;
}
 
Example #27
Source File: JavaTokenizer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected BasicComment(U comment_reader, CommentStyle cs) {
    this.comment_reader = comment_reader;
    this.cs = cs;
}
 
Example #28
Source File: JavadocTokenizer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
JavadocComment(DocReader reader, CommentStyle cs) {
    super(reader, cs);
}
 
Example #29
Source File: JavaTokenizer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected BasicComment(U comment_reader, CommentStyle cs) {
    this.comment_reader = comment_reader;
    this.cs = cs;
}
 
Example #30
Source File: JavaTokenizer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public CommentStyle getStyle() {
    return cs;
}