本文整理汇总了Java中com.intellij.lang.PsiBuilderFactory类的典型用法代码示例。如果您正苦于以下问题:Java PsiBuilderFactory类的具体用法?Java PsiBuilderFactory怎么用?Java PsiBuilderFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PsiBuilderFactory类属于com.intellij.lang包,在下文中一共展示了PsiBuilderFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DtdParsing
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
public DtdParsing(CharSequence chars,
final IElementType type,
final XmlEntityDecl.EntityContextType contextType,
PsiFile contextFile
) {
this(
type,
contextType,
PsiBuilderFactory.getInstance().createBuilder(
LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
new DtdLexer(false) {
final int myInitialState = getLexerInitialState(type, contextType);
@Override
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
super.start(buffer, startOffset, endOffset, myInitialState);
}
}, chars
)
);
if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
示例2: parseImpl
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
private ASTNode parseImpl(ASTNode chameleon) {
final PsiElement parentElement = chameleon.getTreeParent().getPsi();
final Project project = parentElement.getProject();
final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new GroovyLexer(), getLanguage(), chameleon.getText());
PsiBuilder.Marker rootMarker = builder.mark();
if (BUILT_IN_TYPES.contains(chameleon.getText())) {
builder.advanceLexer();
} else {
ReferenceElement.parse(builder, false, false, false, false, false);
while (!builder.eof()) {
builder.advanceLexer();
}
}
rootMarker.done(this);
return builder.getTreeBuilt().getFirstChildNode();
}
示例3: doParseContents
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@Override protected ASTNode doParseContents(final ASTNode chameleon, final PsiElement psi) {
final Project project = psi.getProject();
final MetaborgIdeaLanguage language = getMetaborgIdeaLanguage();
final PsiBuilder builder =
PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, language, chameleon.getChars());
@Nullable final FileObject resource = getResource(psi, builder);
final ILanguageImpl languageImpl = getLanguageImpl(resource, psi, this);
final String text = builder.getOriginalText().toString();
final ISpoofaxInputUnit input = unitService.inputUnit(resource, text, languageImpl, null);
final ISpoofaxParseUnit parseResult = parseAll(input);
final AstBuilder astBuilder =
new AstBuilder(languageImpl, this.elementTypeProviderFactory, this.tokenTypesManager);
final ASTNode tree = astBuilder.build(parseResult, this, builder);
final ASTNode rootNode = tree.getFirstChildNode();
final MetaborgFile file = (MetaborgFile) psi;
file.putUserData(MetaborgFile.PARSE_RESULT_KEY, parseResult);
return rootNode;
}
示例4: DtdParsing
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
public DtdParsing(CharSequence chars,
final IElementType type,
final XmlEntityDecl.EntityContextType contextType,
PsiFile contextFile
) {
this(
type,
contextType,
PsiBuilderFactory.getInstance().createBuilder(
LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
new DtdLexer(false) {
final int myInitialState = getLexerInitialState(type, contextType);
@Override
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
super.start(buffer, startOffset, endOffset, myInitialState);
}
}, chars
)
);
if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
示例5: createElementType
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@NotNull
private static IElementType createElementType(String id, BiConsumer<PsiBuilder, LanguageVersion> consumer)
{
return new IFileElementType(id, CSharpLanguage.INSTANCE)
{
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
final Project project = psi.getProject();
final Language languageForParser = getLanguageForParser(psi);
final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, languageVersion, chameleon.getChars());
consumer.accept(builder, languageVersion);
while(!builder.eof())
{
builder.advanceLexer();
}
return builder.getTreeBuilt();
}
};
}
示例6: doParseContents
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
final PsiBuilderFactory factory = PsiBuilderFactory.getInstance();
final PsiBuilder psiBuilder = factory.createBuilder(getProject(), chameleon, LanguageVersionUtil.findDefaultVersion(getLanguage()));
final PsiBuilder builder = adapt_builder_(HaxeTokenTypes.EXPRESSION, psiBuilder, new HaxeParser());
final PsiBuilder.Marker marker = builder.mark();
enter_section_(builder, 0, _NONE_, "<code fragment>");
HaxeParser.expression(builder, 1);
while(builder.getTokenType() != null)
{
builder.advanceLexer();
}
marker.done(HaxeTokenTypes.EXPRESSION);
return builder.getTreeBuilt();
}
示例7: parseContents
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@Override
public ASTNode parseContents(ASTNode chameleon)
{
Project project = chameleon.getTreeParent().getPsi().getProject();
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new GroovyLexer(), GroovyFileType.GROOVY_LANGUAGE,
LanguageVersionUtil.findDefaultVersion(GroovyFileType.GROOVY_LANGUAGE), chameleon.getText());
PsiBuilder.Marker mark = builder.mark();
GroovyParser.parseExpression(builder);
if(!builder.eof())
{
builder.error("expression expected");
while(!builder.eof())
{
builder.advanceLexer();
}
}
mark.done(GroovyParserDefinition.GROOVY_FILE);
return builder.getTreeBuilt().getFirstChildNode();
}
示例8: PsiManagerImpl
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
public PsiManagerImpl(Project project,
FileDocumentManager fileDocumentManager,
PsiBuilderFactory psiBuilderFactory,
FileIndexFacade fileIndex,
MessageBus messageBus,
PsiModificationTracker modificationTracker) {
myProject = project;
myFileIndex = fileIndex;
myMessageBus = messageBus;
myModificationTracker = modificationTracker;
//We need to initialize PsiBuilderFactory service so it won't initialize under PsiLock from ChameleonTransform
@SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"}) Object used = psiBuilderFactory;
myFileManager = new FileManagerImpl(this, fileDocumentManager, fileIndex);
myTreeChangePreprocessors.add((PsiTreeChangePreprocessor)modificationTracker);
Disposer.register(project, () -> myIsDisposed = true);
}
示例9: DtdParsing
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
public DtdParsing(CharSequence chars,
final IElementType type,
final XmlEntityDecl.EntityContextType contextType,
PsiFile contextFile
) {
this(
type,
contextType,
PsiBuilderFactory.getInstance().createBuilder(
LanguageParserDefinitions.INSTANCE.forLanguage(DTDLanguage.INSTANCE),
new DtdLexer(false) {
final int myInitialState = getLexerInitialState(type, contextType);
@Override
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
super.start(buffer, startOffset, endOffset, myInitialState);
}
}, LanguageVersionUtil.findDefaultVersion(DTDLanguage.INSTANCE), chars
)
);
if (contextFile != null) myBuilder.putUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY, contextFile);
}
示例10: PsiManagerImpl
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
public PsiManagerImpl(Project project,
FileDocumentManager fileDocumentManager,
PsiBuilderFactory psiBuilderFactory,
FileIndexFacade fileIndex,
MessageBus messageBus,
PsiModificationTracker modificationTracker) {
myProject = project;
myFileIndex = fileIndex;
myMessageBus = messageBus;
myModificationTracker = modificationTracker;
//We need to initialize PsiBuilderFactory service so it won't initialize under PsiLock from ChameleonTransform
@SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"}) Object used = psiBuilderFactory;
boolean isProjectDefault = project.isDefault();
myFileManager = isProjectDefault ? new EmptyFileManager(this) : new FileManagerImpl(this, fileDocumentManager, fileIndex);
myTreeChangePreprocessors.add((PsiTreeChangePreprocessor)modificationTracker);
Collections.addAll(myTreeChangePreprocessors, Extensions.getExtensions(PsiTreeChangePreprocessor.EP_NAME, myProject));
Disposer.register(project, new Disposable() {
@Override
public void dispose() {
myIsDisposed = true;
}
});
}
示例11: parseContents
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@Override
public ASTNode parseContents(final ASTNode chameleon) {
final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(chameleon.getTreeParent().getPsi().getProject(),
chameleon,
new SquirrelDocLexer(),
getLanguage(),
chameleon.getChars());
doParse(builder);
return builder.getTreeBuilt().getFirstChildNode();
}
示例12: PsiManagerImpl
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
public PsiManagerImpl(Project project,
FileDocumentManager fileDocumentManager,
PsiBuilderFactory psiBuilderFactory,
FileIndexFacade excludedFileIndex,
MessageBus messageBus,
PsiModificationTracker modificationTracker) {
myProject = project;
myExcludedFileIndex = excludedFileIndex;
myMessageBus = messageBus;
myModificationTracker = modificationTracker;
//We need to initialize PsiBuilderFactory service so it won't initialize under PsiLock from ChameleonTransform
@SuppressWarnings({"UnusedDeclaration", "UnnecessaryLocalVariable"}) Object used = psiBuilderFactory;
boolean isProjectDefault = project.isDefault();
myFileManager = isProjectDefault ? new EmptyFileManager(this) : new FileManagerImpl(this, fileDocumentManager, excludedFileIndex);
myTreeChangePreprocessors.add((PsiTreeChangePreprocessor)modificationTracker);
Collections.addAll(myTreeChangePreprocessors, Extensions.getExtensions(PsiTreeChangePreprocessor.EP_NAME, myProject));
Disposer.register(project, new Disposable() {
@Override
public void dispose() {
myIsDisposed = true;
}
});
}
示例13: doParseContents
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@Override
protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
{
final Project project = psi.getProject();
final Language languageForParser = getLanguageForParser(psi);
final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, new _CSharpMacroLexer(), languageForParser, languageVersion, chameleon.getChars());
final PsiParser parser = LanguageParserDefinitions.INSTANCE.forLanguage(languageForParser).createParser(languageVersion);
return parser.parse(this, builder, languageVersion).getFirstChildNode();
}
示例14: doParseContents
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@Override
protected ASTNode doParseContents(@NotNull final ASTNode chameleon, @NotNull final PsiElement psi)
{
final Project project = psi.getProject();
final Language languageForParser = getLanguageForParser(psi);
final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, languageVersion,
chameleon.getChars());
return ourExpressionParser.parse(this, builder, languageVersion).getFirstChildNode();
}
示例15: doParseContents
import com.intellij.lang.PsiBuilderFactory; //导入依赖的package包/类
@Override
protected ASTNode doParseContents(@NotNull final ASTNode chameleon, @NotNull final PsiElement psi)
{
final Project project = psi.getProject();
final Language languageForParser = getLanguageForParser(psi);
CSharpReferenceLexer lexer = new CSharpReferenceLexer();
PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, lexer, languageForParser, languageForParser.getVersions()[0], chameleon.getChars());
return ourParser.parse(this, builder, languageForParser.getVersions()[0]).getFirstChildNode();
}