本文整理汇总了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;
}
示例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());
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例8: getOperatorRegistry
import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public IOperatorRegistry getOperatorRegistry(String domain) {
return operatorRegistries.get(domain);
}
示例9: internalAddOperatorRegistry
import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
final void internalAddOperatorRegistry(IOperatorRegistry or) {
operatorRegistries.put(or.getOperatorRegistryName(), or);
}
示例10: addOperatorRegistry
import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public void addOperatorRegistry(IOperatorRegistry or) {
internalAddOperatorRegistry(or);
}
示例11: addOperatorRegistry
import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public void addOperatorRegistry(IOperatorRegistry or) {
context.addOperatorRegistry(or);
}
示例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);
}
示例13: getOperatorRegistry
import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public IOperatorRegistry getOperatorRegistry(String domain);
示例14: addOperatorRegistry
import org.spoofax.interpreter.library.IOperatorRegistry; //导入依赖的package包/类
public void addOperatorRegistry(IOperatorRegistry or);