@Override public Set<Binding> getGuiceBindingsRt(Grammar grammar) { BindFactory factory = new BindFactory() .addTypeToType(IParser.class.getName(),getParserClassName(grammar, getNaming())) .addTypeToType(ITokenToStringConverter.class.getName(),AntlrTokenToStringConverter.class.getName()) .addTypeToType(IAntlrTokenFileProvider.class.getName(),getAntlrTokenFileProviderClassName(grammar, getNaming())) .addTypeToType(Lexer.class.getName(), getLexerClassName(grammar, getNaming())) .addTypeToProviderInstance(getLexerClassName(grammar, getNaming()), "org.eclipse.xtext.parser.antlr.LexerProvider.create(" + getLexerClassName(grammar, getNaming()) + ".class)") .addConfiguredBinding("RuntimeLexer", "binder.bind(" + Lexer.class.getName() + ".class)"+ ".annotatedWith(com.google.inject.name.Names.named(" + "org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME" + ")).to(" + getLexerClassName(grammar, getNaming()) +".class)") .addTypeToType(ITokenDefProvider.class.getName(), AntlrTokenDefProvider.class.getName()); if (containsUnorderedGroup(grammar)) factory = factory.addTypeToType(IUnorderedGroupHelper.class.getName(), UnorderedGroupHelper.class.getName()); return factory.getBindings(); }
@Override public Set<Binding> getGuiceBindingsRt(Grammar grammar) { BindFactory factory = new BindFactory() .addTypeToType(IParser.class.getName(),getFragmentHelper().getParserClassName(grammar)) .addTypeToType(ITokenToStringConverter.class.getName(),AntlrTokenToStringConverter.class.getName()) .addTypeToType(IAntlrTokenFileProvider.class.getName(),getFragmentHelper().getAntlrTokenFileProviderClassName(grammar)) .addTypeToType(Lexer.class.getName(), getFragmentHelper().getLexerClassName(grammar)) .addTypeToProviderInstance(getFragmentHelper().getLexerClassName(grammar), "org.eclipse.xtext.parser.antlr.LexerProvider.create(" + getFragmentHelper().getLexerClassName(grammar) + ".class)") .addConfiguredBinding("RuntimeLexer", "binder.bind(" + Lexer.class.getName() + ".class)"+ ".annotatedWith(com.google.inject.name.Names.named(" + "org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME" + ")).to(" + getFragmentHelper().getLexerClassName(grammar) +".class)") .addTypeToType(ITokenDefProvider.class.getName(),AntlrTokenDefProvider.class.getName()); if (containsUnorderedGroup(grammar)) factory = factory.addTypeToType(IUnorderedGroupHelper.class.getName(), UnorderedGroupHelper.class.getName()); if (getOptions().isIgnoreCase()) { factory = factory .addTypeToType(ITokenSerializer.IKeywordSerializer.class.getName(), IgnoreCaseKeywordSerializer.class.getName()) .addTypeToType(AbstractIDValueConverter.class.getName(), IgnoreCaseIDValueConverter.class.getName()); } return factory.getBindings(); }
@Override public Set<Binding> getGuiceBindingsUi(Grammar grammar) { return new BindFactory() .addTypeToType("org.eclipse.xtext.ui.editor.contentassist.IProposalConflictHelper", "org.eclipse.xtext.ui.editor.contentassist.antlr.AntlrProposalConflictHelper") .addConfiguredBinding("HighlightingLexer", "binder.bind(" + Lexer.class.getName() + ".class)"+ ".annotatedWith(com.google.inject.name.Names.named(" + "org.eclipse.xtext.ui.LexerUIBindings.HIGHLIGHTING" + ")).to(" + getFragmentHelper().getLexerClassName(grammar) +".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)") .getBindings(); }
@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(); }
@Override public void setUp() throws Exception { super.setUp(); with(BacktrackingLexerTestLanguageStandaloneSetup.class); ITokenDefProvider tokenDefProvider = get(ITokenDefProvider.class); map = tokenDefProvider.getTokenDefMap(); }
public Class<? extends ITokenDefProvider> bindITokenDefProvider() { return AntlrTokenDefProvider.class; }
public void configureHighlightingTokenDefProvider(Binder binder) { binder.bind(ITokenDefProvider.class) .annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING)) .to(AntlrTokenDefProvider.class); }
/** * Create a new stream with the given source. */ public LazyTokenStream(TokenSource tokenSource, ITokenDefProvider tokenDefProvider) { super(tokenSource, tokenDefProvider); tokens = new JSTokenList(); }
public ObservableXtextTokenStream(TokenSource tokenSource, ITokenDefProvider tokenDefProvider) { super(tokenSource, tokenDefProvider); }
@Inject public void setTokenDefProvider(@Named(LexerIdeBindings.HIGHLIGHTING) final ITokenDefProvider tokenDefProvider) { this.initIds(tokenDefProvider.getTokenDefMap()); }