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


Java LanguageHierarchy类代码示例

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


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

示例1: NO_LANG

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
private static Language<TokenId> NO_LANG() {
    if (NO_LANG == null) {
        NO_LANG = new LanguageHierarchy<TokenId>() {
            @Override
            protected Lexer<TokenId> createLexer(LexerRestartInfo<TokenId> info) {
                return null;
            }
            @Override
            protected Collection<TokenId> createTokenIds() {
                return Collections.emptyList();
            }
            @Override
            protected String mimeType() {
                return "obscure/no-language-marker"; //NOI18N
            }
        }.language();
    }
    return NO_LANG;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:LanguageManager.java

示例2: findEmbedding

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
/**
 * Find the language embedding for the given parameters.
 * <br/>
 * First the <code>LanguageHierarchy.embedding()</code> method is queried
 * and if no embedding is found then the <code>LanguageProvider.findLanguageEmbedding()</code>.
 */
public static <T extends TokenId> LanguageEmbedding<?>
findEmbedding(LanguageHierarchy<T> languageHierarchy, AbstractToken<T> token,
LanguagePath languagePath, InputAttributes inputAttributes) {
    LanguageEmbedding<?> embedding =
            LexerSpiPackageAccessor.get().embedding(
            languageHierarchy, token, languagePath, inputAttributes);

    if (embedding == null) {
        // try language embeddings registered in Lookup
        embedding = LanguageManager.getInstance().findLanguageEmbedding(
                token, languagePath, inputAttributes);
    }
    
    return embedding;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LexerUtilsConstants.java

示例3: findLanguagePaths

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
/**
 * Find the language paths either for this language only
 * or from TokenHierarchyOperation when adding a new default or custom embedding
 * to the token hierarchy.
 * <br/>
 * As a language may finally be embedded in itself (e.g. someone might
 * want to syntax color java code snippet embedded in javadoc)
 * this method must prevent creation of infinite language paths
 * by using exploredLanguages parameter.
 * 
 * @param existingLanguagePaths set of language paths that are already known.
 *  This set is not modified by the method.
 * @param newLanguagePaths newly discovered language paths will be added to this set.
 * @param exploredLanguages used for checking whether the subpaths containing
 *  this language were already discovered.
 * @param lp language path that will be checked. Its innermost language
 *  will be checked for embeddings automatically.
 */
public static <T extends TokenId> void findLanguagePaths(
Set<LanguagePath> existingLanguagePaths, Set<LanguagePath> newLanguagePaths,
Set<Language<?>> exploredLanguages, LanguagePath lp) {
    // Get the complete language path
    if (!existingLanguagePaths.contains(lp)) {
        newLanguagePaths.add(lp);
    }
    Language<T> language = (Language<T>)LexerUtilsConstants.<T>innerLanguage(lp);
    if (!exploredLanguages.contains(language)) {
        exploredLanguages.add(language);
        Set<T> ids = language.tokenIds();
        for (T id : ids) {
            // Create a fake empty token
            DefaultToken<T> emptyToken = new DefaultToken<T>(new WrapTokenId<T>(id));
            // Find embedding for non-flyweight token
            LanguageHierarchy<T> languageHierarchy = LexerUtilsConstants.innerLanguageHierarchy(lp);
            LanguageEmbedding<?> embedding = LexerUtilsConstants.findEmbedding(
                    languageHierarchy, emptyToken, lp, null);
            if (embedding != null) {
                LanguagePath elp = LanguagePath.get(lp, embedding.language());
                findLanguagePaths(existingLanguagePaths, newLanguagePaths,
                        exploredLanguages, elp);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:45,代码来源:LanguageOperation.java

示例4: LanguageOperation

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public LanguageOperation(LanguageHierarchy<T> languageHierarchy, Language<T> language) {
    this.languageHierarchy = languageHierarchy;
    this.language = language; // Should not be operated during constructor (not inited yet)

    // Listen on changes in language manager
    LanguageManager.getInstance().addPropertyChangeListener(
    WeakListeners.create(PropertyChangeListener.class, this, LanguageManager.getInstance()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:LanguageOperation.java

示例5: get

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public static LexerSpiPackageAccessor get() {
    if (INSTANCE == null) {
        // Cause spi accessor impl to get initialized
        try {
            Class.forName(LanguageHierarchy.class.getName(), true, LexerSpiPackageAccessor.class.getClassLoader());
        } catch (ClassNotFoundException e) {
        // Should never happen
        }
    }
    return INSTANCE;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:LexerSpiPackageAccessor.java

示例6: LexerInputOperation

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public LexerInputOperation(TokenList<T> tokenList, int tokenIndex, Object lexerRestartState) {
    this.tokenList = tokenList;
    LanguagePath languagePath = tokenList.languagePath();
    Language<T> language = tokenList.language();
    this.languageOperation = LexerUtilsConstants.languageOperation(language);
    
    // Determine flyTokenSequenceLength setting
    while (--tokenIndex >= 0 && tokenList.tokenOrEmbedding(tokenIndex).token().isFlyweight()) {
        flyTokenSequenceLength++;
    }

    LanguageHierarchy<T> languageHierarchy = LexerApiPackageAccessor.get().languageHierarchy(
            LexerUtilsConstants.<T>innerLanguage(languagePath));
    TokenFactory<T> tokenFactory = LexerSpiPackageAccessor.get().createTokenFactory(this);
    LexerInput lexerInput = LexerSpiPackageAccessor.get().createLexerInput(this);

    LexerRestartInfo<T> info = LexerSpiPackageAccessor.get().createLexerRestartInfo(
            lexerInput, tokenFactory, lexerRestartState,
            languagePath, tokenList.inputAttributes());
    lexer = LexerSpiPackageAccessor.get().createLexer(languageHierarchy, info);

    wrapTokenIdCache = tokenList.tokenHierarchyOperation().getWrapTokenIdCache(language);

    if (LOG.isLoggable(Level.FINE)) {
        LOG.log(Level.INFO, "LexerInputOperation created for " +
                tokenList.tokenHierarchyOperation().inputSource(), new Exception()); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:LexerInputOperation.java

示例7: createLanguage

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public <T extends TokenId> Language<T> createLanguage(
LanguageHierarchy<T> languageHierarchy) {
    return new Language<T>(languageHierarchy);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:Language.java

示例8: languageHierarchy

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public <T extends TokenId> LanguageHierarchy<T> languageHierarchy(
Language<T> language) {
    return language.languageHierarchy();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:Language.java

示例9: languageHierarchy

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public static <T extends TokenId> LanguageHierarchy<T> languageHierarchy(Language<T> language) {
    return LexerApiPackageAccessor.get().languageHierarchy(language);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:LexerUtilsConstants.java

示例10: createLanguage

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public abstract <T extends TokenId> Language<T> createLanguage(
LanguageHierarchy<T> languageHierarchy);
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:LexerApiPackageAccessor.java

示例11: languageHierarchy

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public abstract <T extends TokenId> LanguageHierarchy<T> languageHierarchy(
Language<T> language);
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:LexerApiPackageAccessor.java

示例12: embedding

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public abstract <T extends TokenId> LanguageEmbedding<?> embedding(
LanguageHierarchy<T> languageHierarchy, Token<T> token,
LanguagePath languagePath, InputAttributes inputAttributes);
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:LexerSpiPackageAccessor.java

示例13: innerLanguageHierarchy

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
/**
 * Returns language hierarchy of the most embedded language in the given language path.
 * <br/>
 * The method casts the resulting language hierarchy to the generic type requested by the caller.
 */
public static <T extends TokenId> LanguageHierarchy<T> innerLanguageHierarchy(LanguagePath languagePath) {
    Language<T> language = innerLanguage(languagePath);
    return LexerApiPackageAccessor.get().languageHierarchy(language);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:LexerUtilsConstants.java

示例14: createTokenIds

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public abstract <T extends TokenId> Collection<T> createTokenIds(LanguageHierarchy<T> languageHierarchy); 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:2,代码来源:LexerSpiPackageAccessor.java

示例15: createTokenCategories

import org.netbeans.spi.lexer.LanguageHierarchy; //导入依赖的package包/类
public abstract <T extends TokenId> Map<String,Collection<T>> createTokenCategories(LanguageHierarchy<T> languageHierarchy); 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:2,代码来源:LexerSpiPackageAccessor.java


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