@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(); }
/** * @since 2.7 */ protected MutableTokenDefProvider createLexerTokensProvider(final String lexerBaseFileName, KeywordHelper helper, Charset encoding) { MutableTokenDefProvider provider = new MutableTokenDefProvider(helper, encoding); provider.setAntlrTokenFileProvider(new IAntlrTokenFileProvider() { @Override public InputStream getAntlrTokenFile() { try { return new FileInputStream(lexerBaseFileName + ".tokens"); } catch (FileNotFoundException e) { throw new RuntimeException(e); } } }); return provider; }
@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(); }
protected MutableTokenDefProvider createLexerTokensProvider(final AntlrGrammar lexerGrammar, final KeywordHelper helper, final IXtextGeneratorFileSystemAccess fsa) { Charset _forName = Charset.forName(this.codeConfig.getEncoding()); final MutableTokenDefProvider provider = new MutableTokenDefProvider(helper, _forName); final IAntlrTokenFileProvider _function = () -> { return fsa.readBinaryFile(lexerGrammar.getTokensFileName()); }; provider.setAntlrTokenFileProvider(_function); return provider; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return PkmntcgoAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return TypesAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return RegularExpressionAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return N4JSAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return N4MFAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return MyDslAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return BromiumAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return DSLPoliciesAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return LcDslAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return DslAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return RestauranteAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return OCCIAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return PureXbaseAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return InheritanceTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return XbaseWithAnnotationsAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return XtypeAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return RefactoringTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return InheritanceTest3LanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return ContentAssistTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return RefactoringTestLanguage2AntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return BuilderTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return Bug462047LangAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return XImportSectionTestLangAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return AbstractIgnoreCaseLinkingTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return Bug250313AntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return EnumRulesTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return MultiRuleEnumTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return EnumAndReferenceTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return IgnoreCaseLexerTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return XtextAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return PartialContentAssistTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return PartialSerializationTestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return Bug311337TestLanguageAntlrTokenFileProvider.class; }
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() { return TestLanguageAntlrTokenFileProvider.class; }
public JavaFileAccess generateAntlrTokenFileProvider() { GeneratedJavaFileAccess _xblockexpression = null; { @Extension final GrammarNaming naming = this.productionNaming; final GeneratedJavaFileAccess file = this.fileFactory.createGeneratedJavaFile(naming.getAntlrTokenFileProviderClass(this.getGrammar())); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("public class "); String _simpleName = naming.getAntlrTokenFileProviderClass(XtextAntlrGeneratorFragment2.this.getGrammar()).getSimpleName(); _builder.append(_simpleName); _builder.append(" implements "); _builder.append(IAntlrTokenFileProvider.class); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("\t"); _builder.append("@Override"); _builder.newLine(); _builder.append("\t"); _builder.append("public "); _builder.append(InputStream.class, "\t"); _builder.append(" getAntlrTokenFile() {"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append(ClassLoader.class, "\t\t"); _builder.append(" classLoader = getClass().getClassLoader();"); _builder.newLineIfNotEmpty(); _builder.append("\t\t"); _builder.append("return classLoader.getResourceAsStream(\""); String _tokensFileName = naming.getParserGrammar(XtextAntlrGeneratorFragment2.this.getGrammar()).getTokensFileName(); _builder.append(_tokensFileName, "\t\t"); _builder.append("\");"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("}"); _builder.newLine(); } }; file.setContent(_client); _xblockexpression = file; } return _xblockexpression; }