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


Java GeneratedParserUtilBase类代码示例

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


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

示例1: suggestKeywords

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
private static Collection<String> suggestKeywords(PsiElement position) {
    TextRange posRange = position.getTextRange();
    CupFile posFile = (CupFile) position.getContainingFile();
    TextRange range = new TextRange(0, posRange.getStartOffset());
    String text = range.isEmpty() ? CompletionInitializationContext.DUMMY_IDENTIFIER : range.substring(posFile.getText());
    int completionOffset = posRange.getStartOffset() - range.getStartOffset(); // = posRange.getStartOffset() ...

    PsiFile file = PsiFileFactory.getInstance(posFile.getProject()).createFileFromText("a.cup", CupLanguage.INSTANCE, text, true, false);
    GeneratedParserUtilBase.CompletionState state = new GeneratedParserUtilBase.CompletionState(completionOffset) {
        @Nullable
        @Override
        public String convertItem(Object o) {
            if (o == CupTypes.IDENTIFIER) {
                return null;
            }
            return o.toString();
        }
    };
    file.putUserData(GeneratedParserUtilBase.COMPLETION_STATE_KEY, state);
    TreeUtil.ensureParsed(file.getNode());

    return state.items;
}
 
开发者ID:Tirke,项目名称:cup-plugin,代码行数:24,代码来源:CupCompletionContributor.java

示例2: addCompletions

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext processingContext, @NotNull CompletionResultSet resultSet) {
    PsiElement position = parameters.getPosition();
    PsiElement parent = position.getParent();
    PsiElement grandParent = Optional.ofNullable(parent)
            .map(PsiElement::getParent)
            .orElse(null);
    if (parent instanceof ElmFile || parent instanceof GeneratedParserUtilBase.DummyBlock) {
        addCompletionsInInvalidExpression(position, resultSet);
    } else if (grandParent instanceof ElmLowerCasePath) {
        this.addValueOrFieldCompletions((ElmLowerCaseId) parent, resultSet);
    } else if (grandParent instanceof ElmMixedCasePath
            || grandParent instanceof ElmUpperCasePath) {
        addTypeOrModuleCompletions(parent, resultSet);
    } else if (grandParent instanceof ElmExposingClause) {
        this.addExposedValuesCompletion((ElmExposingClause)grandParent, resultSet);
    } else if (parent instanceof ElmUpperCaseId) {
        this.addExposedValuesCompletion((ElmUpperCaseId)parent, resultSet);
    } else if (parent instanceof ElmLowerCaseId && grandParent instanceof ElmModuleDeclaration) {
        this.singleModuleValueProvider.addCompletions((ElmFile)grandParent.getContainingFile(), resultSet);
    }
}
 
开发者ID:durkiewicz,项目名称:elm-plugin,代码行数:23,代码来源:ElmMainCompletionProvider.java

示例3: CaseOfParser

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
public CaseOfParser(
        GeneratedParserUtilBase.Parser header,
        GeneratedParserUtilBase.Parser branch,
        GeneratedParserUtilBase.Parser oneOrMoreSeparations
) {
    this.header = header;
    this.branch = branch;
    this.oneOrMoreSeparations = oneOrMoreSeparations;
}
 
开发者ID:durkiewicz,项目名称:elm-plugin,代码行数:10,代码来源:CaseOfParser.java

示例4: current_position_

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
/**
 * Returns current position in the {@link PsiBuilder}.
 *
 * @param builder_ builder
 * @return current position
 */
public static int current_position_(PsiBuilder builder_) {
    try {
        if (GeneratedParserUtilBase.class.getMethod("current_position_", PsiBuilder.class) != null) {
            return GeneratedParserUtilBase.current_position_(builder_);
        }
    } catch (NoSuchMethodException ignored) {
    }
    return 0;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:16,代码来源:IgnoreParserUtil.java

示例5: nextTokenIs

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
/**
 * Checks if next token of {@link PsiBuilder} is in the given tokens list.
 *
 * @param builder_  builder
 * @param frameName frame name
 * @param tokens    tokens list
 * @return builder is in the tokens list
 */
public static boolean nextTokenIs(PsiBuilder builder_, String frameName, IElementType... tokens) {
    try {
        if (GeneratedParserUtilBase.class.getMethod("nextTokenIs", PsiBuilder.class, String.class, IElementType.class) != null) {
            return GeneratedParserUtilBase.nextTokenIs(builder_, frameName, tokens);
        }
    } catch (NoSuchMethodException ignored) {
    }
    return true;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:18,代码来源:IgnoreParserUtil.java

示例6: empty_element_parsed_guard_

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
/**
 * Checks if at the given position there is empty element.
 *
 * @param builder_       builder
 * @param funcName_      function name
 * @param prev_position_ previous position
 * @return empty element at the given position
 */
public static boolean empty_element_parsed_guard_(PsiBuilder builder_, String funcName_, int prev_position_) {
    try {
        if (GeneratedParserUtilBase.class.getMethod("nextTokenIs", PsiBuilder.class, String.class, int.class) != null) {
            return GeneratedParserUtilBase.empty_element_parsed_guard_(builder_, funcName_, prev_position_);
        }
    } catch (NoSuchMethodException ignored) {
    }
    return true;
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:18,代码来源:IgnoreParserUtil.java

示例7: suggestKeywords

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
private Collection<String> suggestKeywords(@NotNull PsiElement position)
{
	PsiFile psiFile = position.getContainingFile();
	PsiElement topLevelElement = position;
	while(!(topLevelElement.getParent() instanceof PsiFile))
	{
		topLevelElement = topLevelElement.getParent();
	}
	PsiFile file = PsiFileFactory.getInstance(psiFile.getProject()).createFileFromText("a.thrift", ThriftLanguage.INSTANCE, topLevelElement.getText(), true, false);
	GeneratedParserUtilBase.CompletionState state = new GeneratedParserUtilBase.CompletionState(position.getTextOffset() - topLevelElement.getTextOffset());
	file.putUserData(GeneratedParserUtilBase.COMPLETION_STATE_KEY, state);
	TreeUtil.ensureParsed(file.getNode());
	return state.items;
}
 
开发者ID:consulo,项目名称:consulo-apache-thrift,代码行数:15,代码来源:ThriftKeywordCompletionContributor.java

示例8: suggestKeywords

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
private Collection<String> suggestKeywords(@NotNull PsiElement position) {
  PsiFile psiFile = position.getContainingFile();
  PsiElement topLevelElement = position;
  while (!(topLevelElement.getParent() instanceof PsiFile)) {
    topLevelElement = topLevelElement.getParent();
  }
  PsiFile file = PsiFileFactory.getInstance(psiFile.getProject())
    .createFileFromText("a.thrift", ThriftLanguage.INSTANCE, topLevelElement.getText(), true, false);
  GeneratedParserUtilBase.CompletionState state =
    new GeneratedParserUtilBase.CompletionState(position.getTextOffset() - topLevelElement.getTextOffset());
  file.putUserData(GeneratedParserUtilBase.COMPLETION_STATE_KEY, state);
  TreeUtil.ensureParsed(file.getNode());
  return state.items;
}
 
开发者ID:fkorotkov,项目名称:intellij-thrift,代码行数:15,代码来源:ThriftKeywordCompletionContributor.java

示例9: adapt_builder_

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
public static PsiBuilder adapt_builder_(IElementType root, PsiBuilder builder, PsiParser parser, TokenSet[] tokenSets) {
  PsiBuilder result = GeneratedParserUtilBase.adapt_builder_(root, builder, parser, tokenSets);
  ErrorState.get(result).altMode = true;
  return result;
}
 
开发者ID:shekn-itrtch,项目名称:DLangPlugin,代码行数:7,代码来源:DLangParserUtil.java

示例10: DummyRoot

import com.intellij.lang.parser.GeneratedParserUtilBase; //导入依赖的package包/类
public DummyRoot(PsiElement child) {
	super(GeneratedParserUtilBase.DUMMY_BLOCK);
	this.child = child;
}
 
开发者ID:antlr,项目名称:jetbrains,代码行数:5,代码来源:XPath.java


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