本文整理汇总了Java中org.netbeans.spi.lexer.LexerRestartInfo类的典型用法代码示例。如果您正苦于以下问题:Java LexerRestartInfo类的具体用法?Java LexerRestartInfo怎么用?Java LexerRestartInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LexerRestartInfo类属于org.netbeans.spi.lexer包,在下文中一共展示了LexerRestartInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
SLexer (
Language language,
Map<Integer,STokenId> tokenIDToType,
LexerRestartInfo<STokenId> info
) {
this.language = language;
this.tokenFactory = info.tokenFactory ();
this.tokenIDToType = tokenIDToType;
this.state = info.state ();
parser = language.getParser ();
String outerMimeType = info.languagePath ().language (0).mimeType ();
try {
Language outerLanguage = LanguagesManager.getDefault ().
getLanguage (outerMimeType);
this.input = createInputBridge (info.input (), outerLanguage);
} catch (ParseException ex) {
this.input = createInputBridge (info.input (), Language.create (outerMimeType));
}
}
示例2: HtmlLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
public HtmlLexer(LexerRestartInfo<HTMLTokenId> info) {
this.input = info.input();
this.tokenFactory = info.tokenFactory();
if (info.state() == null) {
this.lexerSubState = INIT;
this.lexerState = INIT;
this.lexerEmbeddingState = INIT;
this.customELIndex = INIT;
this.quoteType = false;
} else {
CompoundState cs = (CompoundState) info.state();
lexerState = cs.lexerState;
lexerSubState = cs.lexerSubState;
lexerEmbeddingState = cs.lexerEmbeddingState;
attribute = cs.attribute;
tag = cs.tag;
customELIndex = cs.customELIndex;
quoteType = cs.quoteType;
}
InputAttributes inputAttributes = info.inputAttributes();
if (inputAttributes != null) {
cssClassTagAttrMap = (Map<String, Collection<String>>)inputAttributes.getValue(
LanguagePath.get(HTMLTokenId.language()), CSS_CLASS_MAP_PROPERTY_KEY); //NOI18N
}
}
示例3: NO_LANG
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的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;
}
示例4: ProtobufEditorLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
/**
* @requires info != null
* @effects Makes this be a new Protobuf editor lexer with 'info'.
*/
ProtobufEditorLexer(LexerRestartInfo<ProtobufTokenId> info) {
Assert.notNull(info);
this.info = info;
this.lexer =
new ProtobufLexer(
new AntlrCharStream(info.input(), SOURCE_NAME));
this.lexer.setChannel(ProtobufLexer.HIDDEN);
AntlrLexerState state = (AntlrLexerState) info.state();
if (state != null) {
state.apply(lexer);
}
}
示例5: FTLLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
public FTLLexer(LexerRestartInfo<FTLTokenId> info) {
this.info = info;
final LexerInput input = info.input();
InputStream istream = new InputStream() {
@Override
public int read() throws IOException {
int result = input.read();
//debug("read " + result);
//if (result == LexerInput.EOF) {
// throw new IOException("LexerInput EOF");
//}
return result;
}
};
SimpleCharStream stream = new SimpleCharStream(istream);
fmParserTokenManager = new FMParserWSTokenManager(stream);
}
示例6: JPQLLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
JPQLLexer(LexerRestartInfo<JPQLTokenId> info) {
this.info = info;
this.input = info.input();
this.tokenFactory = info.tokenFactory();
//JavaCharStream stream = new JavaCharStream(info.input());
//javaParserTokenManager = new JavaParserTokenManager(stream);
}
示例7: createLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
protected Lexer<STokenId> createLexer (LexerRestartInfo<STokenId> info) {
if (tokenIDs == null) createTokenIds ();
return new SLexer (
language,
tokenIDToType,
info
);
}
示例8: DockerfileLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
DockerfileLexer(@NonNull final LexerRestartInfo<DockerfileTokenId> info) {
this.input = info.input();
this.tokenFactory = info.tokenFactory();
Object restoredState = info.state();
if (restoredState instanceof Integer) {
state = (Integer) restoredState;
}
}
示例9: JavaLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
public JavaLexer(LexerRestartInfo<JavaTokenId> info) {
this.input = info.input();
this.tokenFactory = info.tokenFactory();
this.state = (Integer) info.state();
if (state == null) {
Supplier<String> fileName = (Supplier<String>)info.getAttributeValue("fileName"); //NOI18N
if (fileName != null && "module-info.java".equals(fileName.get())) { //NOI18N
state = 1; // parsing module info
}
}
Integer ver = (Integer)info.getAttributeValue("version"); //NOI18N
this.version = (ver != null) ? ver.intValue() : 9; // TODO: Java 1.8 used by default
}
示例10: JShellLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
public JShellLexer(LexerRestartInfo<JShellToken> info) {
this.input = info.input();
this.tokenFactory = info.tokenFactory();
Object s = info.state();
if (s != null) {
LexState ls = (LexState)s;
this.state = ls.s;
this.prevState = ls.prev;
}
}
示例11: YamlLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
/**
* A Lexer for ruby strings
*
* @param substituting If true, handle substitution rules for double quoted
* strings, otherwise single quoted strings.
*/
public YamlLexer(LexerRestartInfo<YamlTokenId> info) {
this.input = info.input();
this.tokenFactory = info.tokenFactory();
if (info.state() == null) {
this.state = ISI_WHITESPACE;
} else {
state = ((Integer) info.state()).intValue();
}
}
示例12: DTDLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
public DTDLexer(LexerRestartInfo<DTDTokenId> info) {
this.input = info.input();
if (info.state() == null) {
state = ISI_INIT;
substate = 0;
} else {
int s = (Integer)info.state();
this.state = s & 0x0f;
this.substate = (s >> 4) & 0x0f;
this.intrSubstate = (s >> 16) & 0xff;
}
this.tokenFactory = info.tokenFactory();
}
示例13: XhtmlElLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
public XhtmlElLexer(LexerRestartInfo<XhtmlElTokenId> info) {
this.input = info.input();
this.inputAttributes = info.inputAttributes();
this.tokenFactory = info.tokenFactory();
if (info.state() == null) {
lexerState = INIT;
lexerCurlyNestedLevel = 0;
} else {
CompoundState cs = (CompoundState) info.state();
lexerState = cs.lexerState;
lexerCurlyNestedLevel = cs.lexerCurlyNestedLevel;
}
}
示例14: LexerInputOperation
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的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
}
}
示例15: TestLexer
import org.netbeans.spi.lexer.LexerRestartInfo; //导入依赖的package包/类
TestLexer(LexerRestartInfo<TestTokenId> info) {
this.input = info.input();
this.tokenFactory = info.tokenFactory();
assert (info.state() == null); // never set to non-null value in state()
Integer ver = (Integer)info.getAttributeValue("version");
this.version = (ver != null) ? ver.intValue() : 2;
}