本文整理汇总了Java中org.eclipse.xtext.parser.antlr.Lexer类的典型用法代码示例。如果您正苦于以下问题:Java Lexer类的具体用法?Java Lexer怎么用?Java Lexer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Lexer类属于org.eclipse.xtext.parser.antlr包,在下文中一共展示了Lexer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String toString(int start, int stop) {
if (start < 0 || stop < 0) {
return null;
}
CommonToken startToken = (CommonToken) tokens.get(start);
CommonToken stopToken = (CommonToken) tokens.get(stop);
CharStream charStream = ((Lexer) tokenSource).getCharStream();
String result = charStream.toString().substring(startToken.getStartIndex(), stopToken.getStopIndex());
return result;
}
示例2: isSameTokenSequence
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
protected boolean isSameTokenSequence(String originalText, String newText, int expectedLength) {
Lexer originalLexer = lexerProvider.get();
Lexer newLexer = lexerProvider.get();
originalLexer.setCharStream(new ANTLRStringStream(originalText));
newLexer.setCharStream(new ANTLRStringStream(newText));
return isSameTokenSequence(originalLexer, newLexer, expectedLength);
}
示例3: getGuiceBindingsUi
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
@Override
public Set<Binding> getGuiceBindingsUi(Grammar grammar) {
BindFactory binder = new BindFactory();
binder.addTypeToType("org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper", "org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper");
if(getNaming().hasIde()){
binder.addConfiguredBinding("HighlightingLexer",
"binder.bind(" + Lexer.class.getName() + ".class)"+
".annotatedWith(com.google.inject.name.Names.named(" +
"org.eclipse.xtext.ide.LexerIdeBindings.HIGHLIGHTING" +
")).to(" + getLexerClassName(grammar, getNaming()) +".class)")
.addConfiguredBinding("HighlightingTokenDefProvider",
"binder.bind(" + ITokenDefProvider.class.getName() + ".class)"+
".annotatedWith(com.google.inject.name.Names.named(" +
"org.eclipse.xtext.ide.LexerIdeBindings.HIGHLIGHTING" +
")).to(" + AntlrTokenDefProvider.class.getName() +".class)");
} else {
binder.addConfiguredBinding("HighlightingLexer",
"binder.bind(" + Lexer.class.getName() + ".class)"+
".annotatedWith(com.google.inject.name.Names.named(" +
"org.eclipse.xtext.ui.LexerUIBindings.HIGHLIGHTING" +
")).to(" + getLexerClassName(grammar, getNaming()) +".class)")
.addConfiguredBinding("HighlightingTokenDefProvider",
"binder.bind(" + ITokenDefProvider.class.getName() + ".class)"+
".annotatedWith(com.google.inject.name.Names.named(" +
"org.eclipse.xtext.ui.LexerUIBindings.HIGHLIGHTING" +
")).to(" + AntlrTokenDefProvider.class.getName() +".class)");
}
return binder.getBindings();
}
示例4: bindLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public Class<? extends Lexer> bindLexer() {
return InternalPkmntcgoLexer.class;
}
示例5: configureRuntimeLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public void configureRuntimeLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerBindings.RUNTIME))
.to(InternalPkmntcgoLexer.class);
}
示例6: bindLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public Class<? extends Lexer> bindLexer() {
return InternalTypesLexer.class;
}
示例7: configureRuntimeLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public void configureRuntimeLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerBindings.RUNTIME))
.to(InternalTypesLexer.class);
}
示例8: bindLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public Class<? extends Lexer> bindLexer() {
return InternalRegularExpressionLexer.class;
}
示例9: configureRuntimeLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public void configureRuntimeLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerBindings.RUNTIME))
.to(InternalRegularExpressionLexer.class);
}
示例10: createLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
/**
* Create a new lexer for the given input.
*/
protected TokenSource createLexer(CharStream stream) {
Lexer lexer = lexerProvider.get();
lexer.setCharStream(stream);
return lexer;
}
示例11: bindLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public Class<? extends Lexer> bindLexer() {
return InternalN4JSLexer.class;
}
示例12: configureRuntimeLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public void configureRuntimeLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerBindings.RUNTIME))
.to(InternalN4JSLexer.class);
}
示例13: bindLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public Class<? extends Lexer> bindLexer() {
return InternalN4MFLexer.class;
}
示例14: configureRuntimeLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public void configureRuntimeLexer(Binder binder) {
binder.bind(Lexer.class)
.annotatedWith(Names.named(LexerBindings.RUNTIME))
.to(InternalN4MFLexer.class);
}
示例15: bindLexer
import org.eclipse.xtext.parser.antlr.Lexer; //导入依赖的package包/类
public Class<? extends Lexer> bindLexer() {
return InternalMyDslLexer.class;
}