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


Java IOperatorRegistry类代码示例

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


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

示例1: clone

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
private HybridInterpreter clone(HybridInterpreter prototype, FileObject workingLocation,
    ILanguageComponent component, @Nullable IProject project, boolean typesmart) {
    // TODO: this seems to copy operator registries, but they should be recreated to isolate interpreters?
    final HybridInterpreter runtime = new HybridInterpreter(prototype);

    final ResourceAgent agent = new ResourceAgent(resourceService);
    agent.setAbsoluteWorkingDir(workingLocation);
    agent.setAbsoluteDefinitionDir(component.location());
    runtime.setIOAgent(agent);

    runtime.getCompiledContext().getExceptionHandler().setEnabled(false);

    // Add primitive libraries again, to make sure that our libraries override any default ones.
    for(IOperatorRegistry library : strategoLibraries) {
        runtime.getCompiledContext().addOperatorRegistry(library);
    }

    final ITermFactory termFactory = termFactoryService.get(component, project, typesmart);
    runtime.getContext().setFactory(termFactory);
    runtime.getCompiledContext().setFactory(termFactory);

    runtime.init();

    return runtime;
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:26,代码来源:StrategoRuntimeService.java

示例2: Context

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public Context(ITermFactory factory, ITermFactory programFactory, boolean skipStandardLibraries) {
    this.programFactory =  programFactory;
    this.factory = factory;
    stackTracer = new StackTracer();
    opdecls = new HashMap<String, OpDecl>();
    varScope = new VarScope(null);
    strategoSignature = new StrategoSignature(programFactory);
    operatorRegistries = new LinkedHashMap<String, IOperatorRegistry>();
    operatorCache = new PrimitiveCache(2, 16);

    if (!skipStandardLibraries) {
       addOperatorRegistry(new SSLLibrary());
       stackTracer.setIOAgent(getIOAgent());
    }
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:16,代码来源:Context.java

示例3: lookupOperator

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public AbstractPrimitive lookupOperator(String name) {
    if (asyncCancelled) cancel();
    AbstractPrimitive p = null;
    if((p = operatorCache.get(name)) != null) {
        return p;
    }
    for(IOperatorRegistry or : operatorRegistries.values()) {
        if((p = or.get(name)) != null) {
            break;
        }
    }
    operatorCache.put(name, p);
    return p;
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:15,代码来源:Context.java

示例4: loadLibraries

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
private static void loadLibraries(Interpreter itp, List<String> libraryArgs, ITermFactory factory) {
    for(String s : libraryArgs) {
        final IOperatorRegistry ior = findOperatorRegistry(s, factory);
        if(ior == null) {
            System.err.println("Unable to load '" + s + "'");
        } else {
            itp.addOperatorRegistry(ior);
        }
    }
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:11,代码来源:Main.java

示例5: StrategoRuntimeService

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
@Inject public StrategoRuntimeService(IResourceService resourceService, ITermFactoryService termFactoryService,
    Set<IOperatorRegistry> strategoLibraries, ParseStrategoFileStrategy parseStrategoFileStrategy,
    IProjectService projectService, Set<ClassLoader> additionalClassLoaders) {
    this.resourceService = resourceService;
    this.termFactoryService = termFactoryService;
    this.strategoLibraries = strategoLibraries;
    this.parseStrategoFileStrategy = parseStrategoFileStrategy;
    this.projectService = projectService;
    this.additionalClassLoaders = additionalClassLoaders;
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:11,代码来源:StrategoRuntimeService.java

示例6: createNew

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
private HybridInterpreter createNew(ITermFactory termFactory) {
    final HybridInterpreter interpreter = new HybridInterpreter(termFactory);

    interpreter.getCompiledContext().registerComponent("stratego_lib");
    interpreter.getCompiledContext().registerComponent("stratego_sglr");

    for(IOperatorRegistry library : strategoLibraries) {
        interpreter.getCompiledContext().addOperatorRegistry(library);
    }

    // Override parse Stratego file strategy with one that works with Spoofax core.
    parse_stratego_file_0_0.instance = parseStrategoFileStrategy;

    return interpreter;
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:16,代码来源:StrategoRuntimeService.java

示例7: call

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
@Override
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars) {
	IOperatorRegistry or = getLibrary(env);
	STRSGLR_parse_string_pt parser = (STRSGLR_parse_string_pt) or.get(STRSGLR_parse_string_pt.NAME);
	parser.clearLastException();
	return true;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:8,代码来源:STRSGLR_clear_parse_error.java

示例8: getOperatorRegistry

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public IOperatorRegistry getOperatorRegistry(String domain) {
    return operatorRegistries.get(domain);
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Context.java

示例9: internalAddOperatorRegistry

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
final void internalAddOperatorRegistry(IOperatorRegistry or) {
    operatorRegistries.put(or.getOperatorRegistryName(), or);
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Context.java

示例10: addOperatorRegistry

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public void addOperatorRegistry(IOperatorRegistry or) {
    internalAddOperatorRegistry(or);
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Context.java

示例11: addOperatorRegistry

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public void addOperatorRegistry(IOperatorRegistry or) {
    context.addOperatorRegistry(or);
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Interpreter.java

示例12: bindPrimitiveLibrary

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
protected static void bindPrimitiveLibrary(Multibinder<IOperatorRegistry> binder,
    Class<? extends IOperatorRegistry> primitiveLibrary) {
    binder.addBinding().to(primitiveLibrary).in(Singleton.class);
}
 
开发者ID:metaborg,项目名称:spoofax,代码行数:5,代码来源:SpoofaxModule.java

示例13: getOperatorRegistry

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public IOperatorRegistry getOperatorRegistry(String domain); 
开发者ID:metaborg,项目名称:mb-exec,代码行数:2,代码来源:IContext.java

示例14: addOperatorRegistry

import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public void addOperatorRegistry(IOperatorRegistry or); 
开发者ID:metaborg,项目名称:mb-exec,代码行数:2,代码来源:IContext.java


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