当前位置: 首页>>代码示例>>Java>>正文


Java ISpoofaxTransformUnit类代码示例

本文整理汇总了Java中org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit的典型用法代码示例。如果您正苦于以下问题:Java ISpoofaxTransformUnit类的具体用法?Java ISpoofaxTransformUnit怎么用?Java ISpoofaxTransformUnit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ISpoofaxTransformUnit类属于org.metaborg.spoofax.core.unit包,在下文中一共展示了ISpoofaxTransformUnit类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transformAllAnalyzed

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
@Override public Collection<ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>> transformAllAnalyzed(
    Iterable<ISpoofaxAnalyzeUnit> inputs, IContext context, TransformActionContrib action, ITransformConfig config)
    throws TransformException {
    final int size = Iterables.size(inputs);
    final Collection<ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>> transformUnits =
        Lists.newArrayListWithCapacity(size);
    for(ISpoofaxAnalyzeUnit input : inputs) {
        if(!input.valid()) {
            throw new TransformException("Cannot transform analyze unit " + input + ", it is not valid");
        }
        if(!input.hasAst()) {
            throw new TransformException("Cannot transform analyze unit " + input + ", it has no AST");
        }
        transformUnits.add(transform(input, context, action, input.source(), input.ast(), config));
    }
    return transformUnits;
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:18,代码来源:StrategoTransformer.java

示例2: bindTransformer

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
protected void bindTransformer() {
    // Analysis service
    bind(SpoofaxTransformService.class).in(Singleton.class);
    bind(ISpoofaxTransformService.class).to(SpoofaxTransformService.class);
    bind(
        new TypeLiteral<ITransformService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>>>() {})
            .to(SpoofaxTransformService.class);
    bind(new TypeLiteral<ITransformService<?, ?, ?, ?>>() {}).to(SpoofaxTransformService.class);
    bind(ITransformService.class).to(SpoofaxTransformService.class);

    // Analyzers
    bind(StrategoTransformer.class).in(Singleton.class);
    bind(IStrategoTransformer.class).to(StrategoTransformer.class);
    bind(
        new TypeLiteral<ITransformer<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>>>() {})
            .to(StrategoTransformer.class);
    bind(new TypeLiteral<ITransformer<?, ?, ?, ?>>() {}).to(StrategoTransformer.class);
    bind(ITransformer.class).to(StrategoTransformer.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:20,代码来源:SpoofaxModule.java

示例3: bindTracing

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
protected void bindTracing() {
    bind(TracingService.class).in(Singleton.class);
    bind(ISpoofaxTracingService.class).to(TracingService.class);
    bind(
        new TypeLiteral<ITracingService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<?>, IStrategoTerm>>() {})
            .to(TracingService.class);
    bind(new TypeLiteral<ITracingService<?, ?, ?, ?>>() {}).to(TracingService.class);
    bind(ITracingService.class).to(TracingService.class);

    bind(TracingCommon.class).in(Singleton.class);

    bind(ResolverService.class).in(Singleton.class);
    bind(ISpoofaxResolverService.class).to(ResolverService.class);
    bind(new TypeLiteral<IResolverService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>>() {}).to(ResolverService.class);
    bind(new TypeLiteral<IResolverService<?, ?>>() {}).to(ResolverService.class);
    bind(IResolverService.class).to(ResolverService.class);

    bind(HoverService.class).in(Singleton.class);
    bind(ISpoofaxHoverService.class).to(HoverService.class);
    bind(new TypeLiteral<IHoverService<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>>() {}).to(HoverService.class);
    bind(new TypeLiteral<IHoverService<?, ?>>() {}).to(HoverService.class);
    bind(IHoverService.class).to(HoverService.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:24,代码来源:SpoofaxModule.java

示例4: bindTransformations

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
/**
 * Binds transformations.
 */
protected void bindTransformations() {
    bind(IResourceTransformer.class)
        .to(new TypeLiteral<ResourceTransformer<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxTransformUnit<?>, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>>>() {})
        .in(Singleton.class);

    install(new FactoryModuleBuilder().implement(TransformationAction.class, TransformationAction.class)
        .build(ITransformIdeaActionFactory.class));
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:12,代码来源:IdeaSpoofaxModule.java

示例5: transform

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
@Override public ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit> transform(ISpoofaxAnalyzeUnit input, IContext context,
    TransformActionContrib action, ITransformConfig config) throws TransformException {
    if(!input.valid()) {
        throw new TransformException("Cannot transform analyze unit " + input + ", it is not valid");
    }
    if(!input.hasAst()) {
        throw new TransformException("Cannot transform analyze unit " + input + ", it has no AST");
    }
    return transform(input, context, action, input.source(), input.ast(), config);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:11,代码来源:StrategoTransformer.java

示例6: transformAllParsed

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
@Override public Collection<ISpoofaxTransformUnit<ISpoofaxParseUnit>> transformAllParsed(
    Iterable<ISpoofaxParseUnit> inputs, IContext context, TransformActionContrib action, ITransformConfig config)
    throws TransformException {
    final int size = Iterables.size(inputs);
    final Collection<ISpoofaxTransformUnit<ISpoofaxParseUnit>> transformUnits =
        Lists.newArrayListWithCapacity(size);
    for(ISpoofaxParseUnit input : inputs) {
        transformUnits.add(transform(input, context, action, input.source(), input.ast(), config));
    }
    return transformUnits;
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:12,代码来源:StrategoTransformer.java

示例7: Spoofax

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
/**
 * Instantiate the MetaBorg API with a Spoofax implementation.
 * 
 * @param loader
 *            Module plugin loader to use.
 * @param module
 *            Spoofax module to use.
 * @param additionalModules
 *            Additional modules to use.
 * 
 * @throws MetaborgException
 *             When loading plugins or dependency injection fails.
 */
public Spoofax(IModulePluginLoader loader, SpoofaxModule module, Module... additionalModules)
    throws MetaborgException {
    super(ISpoofaxInputUnit.class, ISpoofaxParseUnit.class, ISpoofaxAnalyzeUnit.class,
        ISpoofaxAnalyzeUnitUpdate.class,
        Types.newParameterizedType(ISpoofaxTransformUnit.class, Types.subtypeOf(Object.class)),
        Types.newParameterizedType(ISpoofaxTransformUnit.class, ISpoofaxParseUnit.class),
        Types.newParameterizedType(ISpoofaxTransformUnit.class, ISpoofaxAnalyzeUnit.class), IStrategoTerm.class,
        loader, module, additionalModules);
    
    this.unitService = injector.getInstance(ISpoofaxUnitService.class);
    
    this.syntaxService = injector.getInstance(ISpoofaxSyntaxService.class);
    this.analysisService = injector.getInstance(ISpoofaxAnalysisService.class);
    this.transformService = injector.getInstance(ISpoofaxTransformService.class);
    
    this.builder = injector.getInstance(ISpoofaxBuilder.class);
    this.processorRunner = injector.getInstance(ISpoofaxProcessorRunner.class);

    this.parseResultProcessor = injector.getInstance(ISpoofaxParseResultProcessor.class);
    this.analysisResultProcessor = injector.getInstance(ISpoofaxAnalysisResultProcessor.class);
    
    this.tracingService = injector.getInstance(ISpoofaxTracingService.class);
    
    this.categorizerService = injector.getInstance(ISpoofaxCategorizerService.class);
    this.stylerService = injector.getInstance(ISpoofaxStylerService.class);
    this.hoverService = injector.getInstance(ISpoofaxHoverService.class);
    this.resolverService = injector.getInstance(ISpoofaxResolverService.class);
    this.outlineService = injector.getInstance(ISpoofaxOutlineService.class);
    this.completionService = injector.getInstance(ISpoofaxCompletionService.class);
    
    this.termFactoryService = injector.getInstance(ITermFactoryService.class);
    this.strategoRuntimeService = injector.getInstance(IStrategoRuntimeService.class);
    this.strategoCommon = injector.getInstance(IStrategoCommon.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:48,代码来源:Spoofax.java

示例8: bindUnit

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
protected void bindUnit() {
    bind(UnitService.class).in(Singleton.class);
    bind(ISpoofaxUnitService.class).to(UnitService.class);
    bind(
        new TypeLiteral<IUnitService<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<ISpoofaxParseUnit>, ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>>>() {})
            .to(UnitService.class);
    bind(new TypeLiteral<IUnitService<?, ?, ?, ?, ?, ?>>() {}).to(UnitService.class);
    bind(IUnitService.class).to(UnitService.class);

    bind(ISpoofaxInputUnitService.class).to(UnitService.class);
    bind(new TypeLiteral<IInputUnitService<ISpoofaxInputUnit>>() {}).to(UnitService.class);
    bind(new TypeLiteral<IInputUnitService<?>>() {}).to(UnitService.class);
    bind(IInputUnitService.class).to(UnitService.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:15,代码来源:SpoofaxModule.java

示例9: bindProcessorRunner

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
/**
 * Overrides {@link MetaborgModule#bindProcessorRunner()} to provide Spoofax-specific bindings with generics filled
 * in as {@link IStrategoTerm}.
 */
@Override protected void bindProcessorRunner() {
    bind(SpoofaxProcessorRunner.class).in(Singleton.class);
    bind(ISpoofaxProcessorRunner.class).to(SpoofaxProcessorRunner.class);
    bind(
        new TypeLiteral<IProcessorRunner<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>>() {})
            .to(SpoofaxProcessorRunner.class);
    bind(new TypeLiteral<IProcessorRunner<?, ?, ?, ?>>() {}).to(SpoofaxProcessorRunner.class);
    bind(IProcessorRunner.class).to(SpoofaxProcessorRunner.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:14,代码来源:SpoofaxModule.java

示例10: bindProcessor

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
/**
 * Overrides {@link MetaborgModule#bindProcessor()} to provide Spoofax-specific bindings with generics filled in as
 * {@link IStrategoTerm}.
 */
@Override protected void bindProcessor() {
    bind(SpoofaxBlockingProcessor.class).in(Singleton.class);
    bind(ISpoofaxProcessor.class).to(SpoofaxBlockingProcessor.class);
    bind(
        new TypeLiteral<IProcessor<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>>() {})
            .to(SpoofaxBlockingProcessor.class);
    bind(new TypeLiteral<IProcessor<?, ?, ?, ?>>() {}).to(SpoofaxBlockingProcessor.class);
    bind(IProcessor.class).to(SpoofaxBlockingProcessor.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:14,代码来源:SpoofaxModule.java

示例11: fragments

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
@Override public Iterable<IStrategoTerm> fragments(ISpoofaxTransformUnit<?> result, ISourceRegion region) {
    if(!result.valid()) {
        throw new MetaborgRuntimeException(
            "Cannot get fragments for transform unit " + result + " because it is invalid");
    }

    return toTerms(result.ast(), region);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:9,代码来源:TracingService.java

示例12: fragmentsWithin

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
@Override public Iterable<IStrategoTerm> fragmentsWithin(ISpoofaxTransformUnit<?> result, ISourceRegion region) {
    if(!result.valid()) {
        throw new MetaborgRuntimeException(
            "Cannot get fragments for transform unit " + result + " because it is invalid");
    }

    return toTermsWithin(result.ast(), region);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:9,代码来源:TracingService.java

示例13: SpoofaxBuilder

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
@Inject public SpoofaxBuilder(IResourceService resourceService, ILanguageIdentifierService languageIdentifier,
    ILanguagePathService languagePathService, ISpoofaxUnitService unitService, ISourceTextService sourceTextService,
    ISpoofaxSyntaxService syntaxService, IContextService contextService, ISpoofaxAnalysisService analysisService,
    ISpoofaxTransformService transformService, ISpoofaxParseResultUpdater parseResultUpdater,
    ISpoofaxAnalysisResultUpdater analysisResultUpdater,
    Provider<IBuildOutputInternal<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>> buildOutputProvider) {
    super(resourceService, languageIdentifier, languagePathService, unitService, sourceTextService, syntaxService,
        contextService, analysisService, transformService, parseResultUpdater, analysisResultUpdater,
        buildOutputProvider);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:11,代码来源:SpoofaxBuilder.java

示例14: bindBuilder

import org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit; //导入依赖的package包/类
/**
 * Overrides {@link MetaborgModule#bindBuilder()} to provide Spoofax-specific bindings with generics filled in as
 * {@link IStrategoTerm}.
 */
@Override protected void bindBuilder() {
    bind(SpoofaxParseResultProcessor.class).in(Singleton.class);

    bind(ISpoofaxParseResultRequester.class).to(SpoofaxParseResultProcessor.class);
    bind(new TypeLiteral<IParseResultRequester<ISpoofaxInputUnit, ISpoofaxParseUnit>>() {})
        .to(SpoofaxParseResultProcessor.class);
    bind(new TypeLiteral<IParseResultRequester<?, ?>>() {}).to(SpoofaxParseResultProcessor.class);
    bind(IParseResultRequester.class).to(SpoofaxParseResultProcessor.class);

    bind(ISpoofaxParseResultUpdater.class).to(SpoofaxParseResultProcessor.class);
    bind(new TypeLiteral<IParseResultUpdater<ISpoofaxParseUnit>>() {}).to(SpoofaxParseResultProcessor.class);
    bind(new TypeLiteral<IParseResultUpdater<?>>() {}).to(SpoofaxParseResultProcessor.class);
    bind(IParseResultUpdater.class).to(SpoofaxParseResultProcessor.class);

    bind(ISpoofaxParseResultProcessor.class).to(SpoofaxParseResultProcessor.class);
    bind(new TypeLiteral<IParseResultProcessor<ISpoofaxInputUnit, ISpoofaxParseUnit>>() {})
        .to(SpoofaxParseResultProcessor.class);
    bind(new TypeLiteral<IParseResultProcessor<?, ?>>() {}).to(SpoofaxParseResultProcessor.class);
    bind(IParseResultProcessor.class).to(SpoofaxParseResultProcessor.class);


    bind(SpoofaxAnalysisResultProcessor.class).in(Singleton.class);

    bind(ISpoofaxAnalysisResultRequester.class).to(SpoofaxAnalysisResultProcessor.class);
    bind(new TypeLiteral<IAnalysisResultRequester<ISpoofaxInputUnit, ISpoofaxAnalyzeUnit>>() {})
        .to(SpoofaxAnalysisResultProcessor.class);
    bind(new TypeLiteral<IAnalysisResultRequester<?, ?>>() {}).to(SpoofaxAnalysisResultProcessor.class);
    bind(IAnalysisResultRequester.class).to(SpoofaxAnalysisResultProcessor.class);

    bind(ISpoofaxAnalysisResultUpdater.class).to(SpoofaxAnalysisResultProcessor.class);
    bind(new TypeLiteral<IAnalysisResultUpdater<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>>() {})
        .to(SpoofaxAnalysisResultProcessor.class);
    bind(new TypeLiteral<IAnalysisResultUpdater<?, ?>>() {}).to(SpoofaxAnalysisResultProcessor.class);
    bind(IAnalysisResultUpdater.class).to(SpoofaxAnalysisResultProcessor.class);

    bind(ISpoofaxAnalysisResultProcessor.class).to(SpoofaxAnalysisResultProcessor.class);
    bind(new TypeLiteral<IAnalysisResultProcessor<ISpoofaxInputUnit, ISpoofaxParseUnit, ISpoofaxAnalyzeUnit>>() {})
        .to(SpoofaxAnalysisResultProcessor.class);
    bind(new TypeLiteral<IAnalysisResultProcessor<?, ?, ?>>() {}).to(SpoofaxAnalysisResultProcessor.class);
    bind(IAnalysisResultProcessor.class).to(SpoofaxAnalysisResultProcessor.class);


    bind(SpoofaxBuilder.class).in(Singleton.class);
    bind(ISpoofaxBuilder.class).to(SpoofaxBuilder.class);
    bind(
        new TypeLiteral<IBuilder<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>>() {})
            .to(SpoofaxBuilder.class);
    bind(new TypeLiteral<IBuilder<?, ?, ?, ?>>() {}).to(SpoofaxBuilder.class);
    bind(IBuilder.class).to(SpoofaxBuilder.class);

    // No scope for build output, new instance for every request.
    bind(
        new TypeLiteral<IBuildOutputInternal<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate, ISpoofaxTransformUnit<?>>>() {})
            .to(SpoofaxBuildOutput.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:60,代码来源:SpoofaxModule.java


注:本文中的org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。