本文整理汇总了Java中com.intellij.lexer.MergingLexerAdapter类的典型用法代码示例。如果您正苦于以下问题:Java MergingLexerAdapter类的具体用法?Java MergingLexerAdapter怎么用?Java MergingLexerAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MergingLexerAdapter类属于com.intellij.lexer包,在下文中一共展示了MergingLexerAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPlainTextLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public static Lexer createPlainTextLexer() {
ArrayList<TokenParser> tokenParsers = new ArrayList<TokenParser>();
tokenParsers.add(new WhitespaceParser());
tokenParsers.addAll(BraceTokenParser.getBraces());
tokenParsers.addAll(BraceTokenParser.getParens());
tokenParsers.addAll(BraceTokenParser.getBrackets());
tokenParsers.addAll(BraceTokenParser.getAngleBrackets());
return new MergingLexerAdapter(new AbstractCustomLexer(tokenParsers), TokenSet.create(CustomHighlighterTokenType.CHARACTER));
}
示例2: TemplateHighlighter
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public TemplateHighlighter() {
myLexer = new MergingLexerAdapter(new TemplateTextLexer(), TokenSet.create(TemplateTokenType.TEXT));
}
示例3: parseContents
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
@Override
public ASTNode parseContents(ASTNode chameleon) {
final CharTable table = SharedImplUtil.findCharTableByTree(chameleon);
final FileElement treeElement = new DummyHolder(((TreeElement)chameleon).getManager(), null, table).getTreeElement();
final FileElement fileElement = TreeUtil.getFileElement((TreeElement)chameleon);
final PsiFile file = (PsiFile)fileElement.getPsi();
PsiFile originalFile = file.getOriginalFile();
final TemplateLanguageFileViewProvider viewProvider = (TemplateLanguageFileViewProvider)originalFile.getViewProvider();
final Language language = getTemplateFileLanguage(viewProvider);
final CharSequence chars = chameleon.getChars();
final PsiFile templateFile = createTemplateFile(file, language, chars, viewProvider);
final FileElement parsed = ((PsiFileImpl)templateFile).calcTreeElement();
DebugUtil.startPsiModification("template language parsing");
try {
prepareParsedTemplateFile(parsed);
Lexer langLexer = LanguageParserDefinitions.INSTANCE.forLanguage(language).createLexer(file.getProject());
final Lexer lexer = new MergingLexerAdapter(
new TemplateBlackAndWhiteLexer(createBaseLexer(viewProvider), langLexer, myTemplateElementType, myOuterElementType),
TokenSet.create(myTemplateElementType, myOuterElementType));
lexer.start(chars);
insertOuters(parsed, lexer, table);
if (parsed != null) {
final TreeElement element = parsed.getFirstChildNode();
if (element != null) {
parsed.rawRemoveAllChildren();
treeElement.rawAddChildren(element);
}
}
}
finally {
DebugUtil.finishPsiModification();
}
treeElement.subtreeChanged();
TreeElement childNode = treeElement.getFirstChildNode();
DebugUtil.checkTreeStructure(parsed);
DebugUtil.checkTreeStructure(treeElement);
DebugUtil.checkTreeStructure(chameleon);
if (fileElement != chameleon) {
DebugUtil.checkTreeStructure(file.getNode());
DebugUtil.checkTreeStructure(originalFile.getNode());
}
return childNode;
}
示例4: TemplateHighlighter
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public TemplateHighlighter() {
myLexer = new MergingLexerAdapter(new FlexAdapter(new FileTemplateTextLexer()), TokenSet.create(FileTemplateTokenType.TEXT));
}
示例5: GroovyLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public GroovyLexer() {
super(new MergingLexerAdapter(new FlexAdapter(new _GroovyLexer((Reader) null)), tokensToMerge));
}
示例6: parseContents
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
@Override
public ASTNode parseContents(ASTNode chameleon) {
final CharTable table = SharedImplUtil.findCharTableByTree(chameleon);
final FileElement treeElement = new DummyHolder(((TreeElement)chameleon).getManager(), null, table).getTreeElement();
final PsiFile file = (PsiFile)TreeUtil.getFileElement((TreeElement)chameleon).getPsi();
PsiFile originalFile = file.getOriginalFile();
final TemplateLanguageFileViewProvider viewProvider = (TemplateLanguageFileViewProvider)originalFile.getViewProvider();
final Language language = getTemplateFileLanguage(viewProvider);
final CharSequence chars = chameleon.getChars();
final PsiFile templateFile = createTemplateFile(file, language, chars, viewProvider);
final FileElement parsed = ((PsiFileImpl)templateFile).calcTreeElement();
prepareParsedTemplateFile(parsed);
Lexer langLexer = LanguageParserDefinitions.INSTANCE.forLanguage(language).createLexer(file.getProject());
final Lexer lexer = new MergingLexerAdapter(
new TemplateBlackAndWhiteLexer(createBaseLexer(viewProvider), langLexer, myTemplateElementType, myOuterElementType),
TokenSet.create(myTemplateElementType, myOuterElementType));
lexer.start(chars);
insertOuters(parsed, lexer, table);
if (parsed != null) {
final TreeElement element = parsed.getFirstChildNode();
if (element != null) {
parsed.rawRemoveAllChildren();
treeElement.rawAddChildren(element);
}
}
treeElement.subtreeChanged();
TreeElement childNode = treeElement.getFirstChildNode();
DebugUtil.checkTreeStructure(parsed);
DebugUtil.checkTreeStructure(treeElement);
DebugUtil.checkTreeStructure(chameleon);
DebugUtil.checkTreeStructure(file.getNode());
DebugUtil.checkTreeStructure(originalFile.getNode());
return childNode;
}
示例7: GroovyLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public GroovyLexer() {
super(new MergingLexerAdapter(new GroovyFlexLexer(), tokensToMerge));
}
示例8: HaxeLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public HaxeLexer(Project project) {
super(new MergingLexerAdapter(new HaxeFlexLexer(project), tokensToMerge));
myProject = project;
}
示例9: XQueryLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public XQueryLexer() {
super(new MergingLexerAdapter(new FlexAdapter(new _XQueryLexer()), orSet(COMMENTS, WHITE_SPACES, CHARACTER_CONTENTS)));
}
示例10: HaxeLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public HaxeLexer() {
super(new MergingLexerAdapter(new HaxeFlexLexer(), tokensToMerge));
myProject = null;
}
示例11: PlayBaseTemplateLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public PlayBaseTemplateLexer()
{
super(new MergingLexerAdapter(new FlexAdapter(new _PlayBaseTemplateLexer((Reader) null)), TokenSet.create(TEMPLATE_TEXT, WHITE_SPACE)));
}
示例12: DylanLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
public DylanLexer() {
super(new MergingLexerAdapter(new DylanFlexLexer(), tokensToMerge));
}
示例13: createLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
@NotNull
@Override
public Lexer createLexer()
{
return new MergingLexerAdapter(createInnerLexer(), TokenSet.create(CfsTokens.TEXT));
}
示例14: createDefaultLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
@Nonnull
@VisibleForTesting
static Lexer createDefaultLexer() {
return new MergingLexerAdapter(new FileTemplateTextLexer(), TokenSet.create(FileTemplateTokenType.TEXT));
}
示例15: createLexer
import com.intellij.lexer.MergingLexerAdapter; //导入依赖的package包/类
@Override
@Nullable
protected Lexer createLexer()
{
return new MergingLexerAdapter(new FlexAdapter(new _JSDocLexer(false)), JSDocTokenTypes.TOKENS_TO_MERGE);
}