当前位置: 首页>>代码示例>>Java>>正文


Java Comment类代码示例

本文整理汇总了Java中com.sun.tools.javac.parser.Tokens.Comment的典型用法代码示例。如果您正苦于以下问题:Java Comment类的具体用法?Java Comment怎么用?Java Comment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Comment类属于com.sun.tools.javac.parser.Tokens包,在下文中一共展示了Comment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DocCommentParser

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
DocCommentParser(ParserFactory fac, DiagnosticSource diagSource, Comment comment) {
    this.fac = fac;
    this.diagSource = diagSource;
    this.comment = comment;
    names = fac.names;
    m = fac.docTreeMaker;

    Locale locale = (fac.locale == null) ? Locale.getDefault() : fac.locale;

    Options options = fac.options;
    boolean useBreakIterator = options.isSet("breakIterator");
    if (useBreakIterator || !locale.getLanguage().equals(Locale.ENGLISH.getLanguage()))
        sentenceBreaker = BreakIterator.getSentenceInstance(locale);

    initTagParsers();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:DocCommentParser.java

示例2: documentifyBase

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
private void documentifyBase(JCClassDecl base, boolean isTopLevel, boolean isFxStyle) {
    // add doc comment to class itself
    Comment comm = comment(docGen.getBaseComment(base, isTopLevel));
    curDocComments.putComment(base, comm);

    // add doc comments to members
    for (JCTree member : base.getMembers()) {
        switch (member.getTag()) {
            case VARDEF:
                documentifyField(base, (JCVariableDecl)member, isFxStyle);
                break;
            case METHODDEF:
                documentifyMethod(base, (JCMethodDecl)member, isFxStyle);
                break;
            case CLASSDEF:
                documentifyBase((JCClassDecl)member, false, isFxStyle);
                break;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Documentifier.java

示例3: attach

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
static void attach(final JCTree node, String docCommentContent, Object map_) {
	final String docCommentContent_ = docCommentContent;
	((DocCommentTable) map_).putComment(node, new Comment() {
		@Override public String getText() {
			return docCommentContent_;
		}
		
		@Override public int getSourcePos(int index) {
			return -1;
		}
		
		@Override public CommentStyle getStyle() {
			return CommentStyle.JAVADOC;
		}
		
		@Override public boolean isDeprecated() {
			return JavacHandlerUtil.nodeHasDeprecatedFlag(node);
		}
	});
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:DocCommentIntegrator.java

示例4: createJavadocComment

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
private static Comment createJavadocComment(final String text, final JavacNode field) {
	return new Comment() {
		@Override public String getText() {
			return text;
		}
		
		@Override public int getSourcePos(int index) {
			return -1;
		}
		
		@Override public CommentStyle getStyle() {
			return CommentStyle.JAVADOC;
		}
		
		@Override public boolean isDeprecated() {
			return text.contains("@deprecated") && field.getKind() == Kind.FIELD && isFieldDeprecated(field);
		}
	};
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:20,代码来源:JavacHandlerUtil.java

示例5: isApproximateMatchingComment

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
private static boolean isApproximateMatchingComment(Comment comment, String formal) {
  switch (comment.getStyle()) {
    case BLOCK:
    case LINE:
      // sometimes people use comments around arguments for higher level structuring - such as
      // dividing two separate blocks of arguments. In these cases we want to avoid concluding
      // that its a match. Therefore we also check to make sure that the comment is not really
      // long and that it doesn't contain acsii-art style markup.
      String commentText = Comments.getTextFromComment(comment);
      boolean textMatches =
          Arrays.asList(commentText.split("[^a-zA-Z0-9_]+", -1)).contains(formal);
      boolean tooLong = commentText.length() > formal.length() + 5 && commentText.length() > 50;
      boolean tooMuchMarkup = CharMatcher.anyOf("-*[email protected]<>").countIn(commentText) > 5;
      return textMatches && !tooLong && !tooMuchMarkup;
    default:
      return false;
  }
}
 
开发者ID:google,项目名称:error-prone,代码行数:19,代码来源:NamedParameterComment.java

示例6: classDeclaration

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
@Override
protected JCClassDecl classDeclaration(JCModifiers mods, Comment dc) {
    if (cancelService != null) {
        cancelService.abortIfCanceled();
    }
    return super.classDeclaration(mods, dc);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBParserFactory.java

示例7: interfaceDeclaration

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
@Override
protected JCClassDecl interfaceDeclaration(JCModifiers mods, Comment dc) {
    if (cancelService != null) {
        cancelService.abortIfCanceled();
    }
    return super.interfaceDeclaration(mods, dc);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBParserFactory.java

示例8: enumDeclaration

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
@Override
protected JCClassDecl enumDeclaration(JCModifiers mods, Comment dc) {
    if (cancelService != null) {
        cancelService.abortIfCanceled();
    }
    return super.enumDeclaration(mods, dc);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBParserFactory.java

示例9: methodDeclaratorRest

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
@Override
protected JCTree methodDeclaratorRest(int pos, JCModifiers mods, JCExpression type, Name name, List<JCTypeParameter> typarams, boolean isInterface, boolean isVoid, Comment dc) {
    if (cancelService != null) {
        cancelService.abortIfCanceled();
    }
    return super.methodDeclaratorRest(pos, mods, type, name, typarams, isInterface, isVoid, dc);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBParserFactory.java

示例10: DCDocComment

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
public DCDocComment(Comment comment,
        List<DCTree> firstSentence, List<DCTree> body, List<DCTree> tags) {
    this.comment = comment;
    this.firstSentence = firstSentence;
    this.body = body;
    this.tags = tags;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:DCTree.java

示例11: DocCommentParser

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
public DocCommentParser(ParserFactory fac, DiagnosticSource diagSource, Comment comment) {
    this.fac = fac;
    this.diagSource = diagSource;
    this.comment = comment;
    names = fac.names;
    m = fac.docTreeMaker;
    initTagParsers();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:DocCommentParser.java

示例12: DCDocComment

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
public DCDocComment(Comment comment,
                    List<DCTree> fullBody,
                    List<DCTree> firstSentence,
                    List<DCTree> body,
                    List<DCTree> tags) {
    this.comment = comment;
    this.firstSentence = firstSentence;
    this.fullBody = fullBody;
    this.body = body;
    this.tags = tags;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:DCTree.java

示例13: newDocCommentTree

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
@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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:DocTreeMaker.java

示例14: documentifyField

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
private void documentifyField(JCClassDecl base, JCVariableDecl field, boolean isFxStyle) {
    Kind baseKind = base.getKind();
    Set<Modifier> fieldMods = field.getModifiers().getFlags();
    String doc = (baseKind == Kind.ENUM
                  && fieldMods.contains(Modifier.PUBLIC)
                  && fieldMods.contains(Modifier.STATIC)
                  && fieldMods.contains(Modifier.FINAL)) ?
                 docGen.getConstComment() :
                 docGen.getFieldComment(base, field, isFxStyle);
    Comment comm = comment(doc);
    curDocComments.putComment(field, comm);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:Documentifier.java

示例15: comment

import com.sun.tools.javac.parser.Tokens.Comment; //导入依赖的package包/类
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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Documentifier.java


注:本文中的com.sun.tools.javac.parser.Tokens.Comment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。