Java 类com.intellij.lang.java.parser.JavaParserUtil 实例源码

项目:intellij-ce-playground    文件:PsiJavaParserFacadeImpl.java   
@NotNull
@Override
public PsiJavaCodeReferenceElement createReferenceFromText(@NotNull final String text, @Nullable final PsiElement context) throws IncorrectOperationException {
  final boolean isStaticImport = context instanceof PsiImportStaticStatement &&
                                 !((PsiImportStaticStatement)context).isOnDemand();
  final boolean mayHaveDiamonds = context instanceof PsiNewExpression &&
                                  PsiUtil.getLanguageLevel(context).isAtLeast(LanguageLevel.JDK_1_7);
  final JavaParserUtil.ParserWrapper wrapper = isStaticImport ? STATIC_IMPORT_REF : mayHaveDiamonds ? DIAMOND_REF : REFERENCE;
  final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, wrapper, level(context)), context);
  final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
  if (!(element instanceof PsiJavaCodeReferenceElement)) {
    throw new IncorrectOperationException("Incorrect reference '" + text + "'");
  }
  return (PsiJavaCodeReferenceElement)element;
}
项目:intellij-ce-playground    文件:JavaDummyElement.java   
public JavaDummyElement(@Nullable final CharSequence text,
                        @NotNull final JavaParserUtil.ParserWrapper parser,
                        @NotNull final LanguageLevel level,
                        final boolean consumeAll) {
  super(JavaElementType.DUMMY_ELEMENT, text);
  myParser = parser;
  myLanguageLevel = level;
  myConsumeAll = consumeAll;
}
项目:tools-idea    文件:PsiJavaParserFacadeImpl.java   
@NotNull
@Override
public PsiJavaCodeReferenceElement createReferenceFromText(@NotNull final String text, @Nullable final PsiElement context) throws IncorrectOperationException {
  final boolean isStaticImport = context instanceof PsiImportStaticStatement &&
                                 !((PsiImportStaticStatement)context).isOnDemand();
  final boolean mayHaveDiamonds = context instanceof PsiNewExpression &&
                                  PsiUtil.getLanguageLevel(context).isAtLeast(LanguageLevel.JDK_1_7);
  final JavaParserUtil.ParserWrapper wrapper = isStaticImport ? STATIC_IMPORT_REF : mayHaveDiamonds ? DIAMOND_REF : REFERENCE;
  final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, wrapper, level(context)), context);
  final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
  if (!(element instanceof PsiJavaCodeReferenceElement)) {
    throw new IncorrectOperationException("Incorrect reference \"" + text + "\".");
  }
  return (PsiJavaCodeReferenceElement)element;
}
项目:tools-idea    文件:JavaDummyElement.java   
public JavaDummyElement(@Nullable final CharSequence text,
                        @NotNull final JavaParserUtil.ParserWrapper parser,
                        @NotNull final LanguageLevel level,
                        final boolean consumeAll) {
  super(JavaElementType.DUMMY_ELEMENT, text);
  myParser = parser;
  myLanguageLevel = level;
  myConsumeAll = consumeAll;
}
项目:consulo-javaee    文件:JspJavaFileElementType.java   
@NotNull
private PsiBuilder doParse(@NotNull ASTNode chameleon, Project project, LanguageVersion languageVersion)
{
    LanguageLevel languageLevel = LanguageLevel.HIGHEST;
    PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new JspJavaLexer(languageLevel), JavaLanguage.INSTANCE, languageVersion, chameleon.getChars());
    JavaParserUtil.setLanguageLevel(builder, languageLevel);
    PsiParser parser = new JavaInJspParser();
    parser.parse(this, builder, languageVersion);
    return builder;
}
项目:consulo-java    文件:PsiJavaParserFacadeImpl.java   
@NotNull
@Override
public PsiJavaCodeReferenceElement createReferenceFromText(@NotNull final String text, @Nullable final PsiElement context) throws IncorrectOperationException
{
    final boolean isStaticImport = context instanceof PsiImportStaticStatement && !((PsiImportStaticStatement) context).isOnDemand();
    final boolean mayHaveDiamonds = context instanceof PsiNewExpression && PsiUtil.getLanguageLevel(context).isAtLeast(LanguageLevel.JDK_1_7);
    final JavaParserUtil.ParserWrapper wrapper = isStaticImport ? STATIC_IMPORT_REF : mayHaveDiamonds ? DIAMOND_REF : REFERENCE;
    final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, wrapper, level(context)), context);
    final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
    if(!(element instanceof PsiJavaCodeReferenceElement))
    {
        throw new IncorrectOperationException("Incorrect reference '" + text + "'");
    }
    return (PsiJavaCodeReferenceElement) element;
}
项目:consulo-java    文件:JavaElementType.java   
@Override
public ASTNode parseContents(final ASTNode chameleon)
{
    final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
    JavaParser.INSTANCE.getStatementParser().parseCodeBlockDeep(builder, true);
    return builder.getTreeBuilt().getFirstChildNode();
}
项目:consulo-java    文件:JavaElementType.java   
@Override
public FlyweightCapableTreeStructure<LighterASTNode> parseContents(final LighterLazyParseableNode chameleon)
{
    final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
    JavaParser.INSTANCE.getStatementParser().parseCodeBlockDeep(builder, true);
    return builder.getLightTree();
}
项目:consulo-java    文件:JavaDummyElement.java   
public JavaDummyElement(@Nullable final CharSequence text,
                        @NotNull final JavaParserUtil.ParserWrapper parser,
                        @NotNull final LanguageLevel level,
                        final boolean consumeAll) {
  super(JavaElementType.DUMMY_ELEMENT, text);
  myParser = parser;
  myLanguageLevel = level;
  myConsumeAll = consumeAll;
}
项目:consulo-java    文件:JavaFileElementType.java   
@Override
public FlyweightCapableTreeStructure<LighterASTNode> parseContentsLight(final ASTNode chameleon)
{
    final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
    doParse(builder);
    return builder.getLightTree();
}
项目:consulo-java    文件:JavaFileElementType.java   
@Override
public ASTNode parseContents(final ASTNode chameleon)
{
    final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
    doParse(builder);
    return builder.getTreeBuilt().getFirstChildNode();
}
项目:intellij-ce-playground    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser, false, LanguageLevel.JDK_1_3);
}
项目:intellij-ce-playground    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser, false, LanguageLevel.JDK_1_3);
}
项目:intellij-ce-playground    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:intellij-ce-playground    文件:JavaElementType.java   
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  JavaParser.INSTANCE.getStatementParser().parseCodeBlockDeep(builder, true);
  return builder.getTreeBuilt().getFirstChildNode();
}
项目:intellij-ce-playground    文件:JavaElementType.java   
@Override
public FlyweightCapableTreeStructure<LighterASTNode> parseContents(final LighterLazyParseableNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  JavaParser.INSTANCE.getStatementParser().parseCodeBlockDeep(builder, true);
  return builder.getLightTree();
}
项目:intellij-ce-playground    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:intellij-ce-playground    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:intellij-ce-playground    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:intellij-ce-playground    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:intellij-ce-playground    文件:JavaDummyElement.java   
public JavaDummyElement(@Nullable final CharSequence text,
                        @NotNull final JavaParserUtil.ParserWrapper parser,
                        @NotNull final LanguageLevel level) {
  this(text, parser, level, false);
}
项目:intellij-ce-playground    文件:JavaDummyElement.java   
@NotNull
public JavaParserUtil.ParserWrapper getParser() {
  return myParser;
}
项目:intellij-ce-playground    文件:JavaFileElementType.java   
@Override
public FlyweightCapableTreeStructure<LighterASTNode> parseContentsLight(final ASTNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  doParse(builder);
  return builder.getLightTree();
}
项目:intellij-ce-playground    文件:JavaFileElementType.java   
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  doParse(builder);
  return builder.getTreeBuilt().getFirstChildNode();
}
项目:tools-idea    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser, false, LanguageLevel.JDK_1_3);
}
项目:tools-idea    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser, false, LanguageLevel.JDK_1_3);
}
项目:tools-idea    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:tools-idea    文件:JavaElementType.java   
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  JavaParser.INSTANCE.getStatementParser().parseCodeBlockDeep(builder, true);
  return builder.getTreeBuilt().getFirstChildNode();
}
项目:tools-idea    文件:JavaElementType.java   
@Override
public FlyweightCapableTreeStructure<LighterASTNode> parseContents(final LighterLazyParseableNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  JavaParser.INSTANCE.getStatementParser().parseCodeBlockDeep(builder, true);
  return builder.getLightTree();
}
项目:tools-idea    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:tools-idea    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:tools-idea    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:tools-idea    文件:JavaElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  return JavaParserUtil.parseFragment(chameleon, myParser);
}
项目:tools-idea    文件:JavaDummyElement.java   
public JavaDummyElement(@Nullable final CharSequence text,
                        @NotNull final JavaParserUtil.ParserWrapper parser,
                        @NotNull final LanguageLevel level) {
  this(text, parser, level, false);
}
项目:tools-idea    文件:JavaDummyElement.java   
@NotNull
public JavaParserUtil.ParserWrapper getParser() {
  return myParser;
}
项目:tools-idea    文件:JavaFileElementType.java   
@Override
public FlyweightCapableTreeStructure<LighterASTNode> parseContentsLight(final ASTNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  doParse(builder);
  return builder.getLightTree();
}
项目:tools-idea    文件:JavaFileElementType.java   
@Override
public ASTNode parseContents(final ASTNode chameleon) {
  final PsiBuilder builder = JavaParserUtil.createBuilder(chameleon);
  doParse(builder);
  return builder.getTreeBuilt().getFirstChildNode();
}
项目:consulo-java    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon)
{
    return JavaParserUtil.parseFragment(chameleon, myParser, false, LanguageLevel.JDK_1_3);
}
项目:consulo-java    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon)
{
    return JavaParserUtil.parseFragment(chameleon, myParser, false, LanguageLevel.JDK_1_3);
}
项目:consulo-java    文件:JavaDocElementType.java   
@Nullable
@Override
public ASTNode parseContents(final ASTNode chameleon)
{
    return JavaParserUtil.parseFragment(chameleon, myParser);
}