當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。