@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 void setUp() throws Exception { super.setUp(); with(XtextStandaloneSetup.class); idConverter = get(IgnoreCaseIDValueConverter.class); idConverter.setRule(GrammarUtil.findRuleForName(getGrammarAccess().getGrammar(), "ID")); }
@Override public Set<Binding> getGuiceBindingsRt(final 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(); }
public Class<? extends AbstractIDValueConverter> bindAbstractIDValueConverter() { return IgnoreCaseIDValueConverter.class; }