Java 类org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider 实例源码

项目:xtext-extras    文件:XtextAntlrGeneratorFragment.java   
@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();
}
项目:xtext-extras    文件:AntlrGeneratorFragment.java   
/**
 * @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;
}
项目:xtext-extras    文件:AntlrGeneratorFragment.java   
@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();
}
项目:xtext-core    文件:AbstractAntlrGeneratorFragment2.java   
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;
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return PkmntcgoAntlrTokenFileProvider.class;
}
项目:n4js    文件:AbstractTypesRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return TypesAntlrTokenFileProvider.class;
}
项目:n4js    文件:AbstractRegularExpressionRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return RegularExpressionAntlrTokenFileProvider.class;
}
项目:n4js    文件:AbstractN4JSRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return N4JSAntlrTokenFileProvider.class;
}
项目:n4js    文件:AbstractN4MFRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return N4MFAntlrTokenFileProvider.class;
}
项目:Xtext_Xtend_HTML_Generator    文件:AbstractMyDslRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return MyDslAntlrTokenFileProvider.class;
}
项目:bromium    文件:AbstractBromiumRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return BromiumAntlrTokenFileProvider.class;
}
项目:gw4e.project    文件:AbstractDSLPoliciesRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return DSLPoliciesAntlrTokenFileProvider.class;
}
项目:lcdsl    文件:AbstractLcDslRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return LcDslAntlrTokenFileProvider.class;
}
项目:gemoc-studio    文件:AbstractDslRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return DslAntlrTokenFileProvider.class;
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return RestauranteAntlrTokenFileProvider.class;
}
项目:OCCI-Studio    文件:AbstractOCCIRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return OCCIAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractPureXbaseRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return PureXbaseAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractInheritanceTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return InheritanceTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractXbaseWithAnnotationsRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return XbaseWithAnnotationsAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractXtypeRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return XtypeAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractRefactoringTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return RefactoringTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractInheritanceTest3LanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return InheritanceTest3LanguageAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractContentAssistTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return ContentAssistTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractRefactoringTestLanguage2RuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return RefactoringTestLanguage2AntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractBuilderTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return BuilderTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractBug462047LangRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return Bug462047LangAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractXImportSectionTestLangRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return XImportSectionTestLangAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractAbstractIgnoreCaseLinkingTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return AbstractIgnoreCaseLinkingTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractBug250313RuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return Bug250313AntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractEnumRulesTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return EnumRulesTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractMultiRuleEnumTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return MultiRuleEnumTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-extras    文件:AbstractEnumAndReferenceTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return EnumAndReferenceTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractEnumRulesTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return EnumRulesTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractIgnoreCaseLexerTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return IgnoreCaseLexerTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractXtextRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return XtextAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractPartialContentAssistTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return PartialContentAssistTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractPartialSerializationTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return PartialSerializationTestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractBug311337TestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return Bug311337TestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:AbstractTestLanguageRuntimeModule.java   
public Class<? extends IAntlrTokenFileProvider> bindIAntlrTokenFileProvider() {
    return TestLanguageAntlrTokenFileProvider.class;
}
项目:xtext-core    文件:XtextAntlrGeneratorFragment2.java   
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;
}