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


Java Tools.asJavaInt方法代码示例

本文整理汇总了Java中org.spoofax.interpreter.core.Tools.asJavaInt方法的典型用法代码示例。如果您正苦于以下问题:Java Tools.asJavaInt方法的具体用法?Java Tools.asJavaInt怎么用?Java Tools.asJavaInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spoofax.interpreter.core.Tools的用法示例。


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

示例1: call

import org.spoofax.interpreter.core.Tools; //导入方法依赖的package包/类
@Override
public final boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars) {
	final IStrategoTerm location = tvars[0];
	if(!Tools.isTermTuple(location) && location.getSubtermCount() != 4)
		return false;

	final String filename = Tools.asJavaString(location.getSubterm(0));
	final int line = Tools.asJavaInt(location.getSubterm(1));
	final int column = Tools.asJavaInt(location.getSubterm(2));
	final int startOffset = Tools.asJavaInt(location.getSubterm(3));
	final int endOffset = Tools.asJavaInt(location.getSubterm(4));

	final ImploderAttachment attachment =
		ImploderAttachment.createCompactPositionAttachment(filename, line, column, startOffset, endOffset);
	env.current().putAttachment(attachment);

	return true;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:19,代码来源:OriginSetLocationOffsetPrimitive.java

示例2: fromStrategoTerm

import org.spoofax.interpreter.core.Tools; //导入方法依赖的package包/类
public static L_Int fromStrategoTerm(IStrategoTerm alist) {
	L_Int list = new L_Int(SourceSectionUtil.fromStrategoTerm(alist));
	for (IStrategoTerm elem : alist) {
		final SourceSection src = SourceSectionUtil.fromStrategoTerm(elem);
		list = new L_Int(src, Tools.asJavaInt(elem), list);
	}
	return list;
}
 
开发者ID:metaborg,项目名称:dynsem,代码行数:9,代码来源:L_Int.java

示例3: call

import org.spoofax.interpreter.core.Tools; //导入方法依赖的package包/类
@Override
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)
        throws InterpreterException {
    
    if(!Tools.isTermInt(tvars[0]))
        return false;
    
    SSLLibrary op = (SSLLibrary) env.getOperatorRegistry(SSLLibrary.REGISTRY_NAME);
    int fd = Tools.asJavaInt(tvars[0]);
    return op.getIOAgent().closeRandomAccessFile(fd);
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:12,代码来源:SSL_close.java

示例4: call

import org.spoofax.interpreter.core.Tools; //导入方法依赖的package包/类
@Override
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)
        throws InterpreterException {
    
    if(!Tools.isTermInt(tvars[0]))
        return false;
    
    SSLLibrary.instance(env).getIOAgent().closeAllFiles();
    
    int exitCode = Tools.asJavaInt(tvars[0]);
    env.getStackTracer().popOnExit(exitCode == 0);
    
    throw new InterpreterExit(exitCode);
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:15,代码来源:SSL_exit.java

示例5: call

import org.spoofax.interpreter.core.Tools; //导入方法依赖的package包/类
@Override
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars) {
	ITermFactory factory = env.getFactory();
	boolean enable = Tools.asJavaInt(tvars[0]) != 0;
	if (factory instanceof OriginTermFactory){
   		((OriginTermFactory)env.getFactory()).setAssignDesugaredOrigins(enable);    		
	}
	else if (enable){
		OriginTermFactory originFactory = new ImploderOriginTermFactory(factory);
		originFactory.setAssignDesugaredOrigins(enable);
		env.setFactory(originFactory);
	}
	return true;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:15,代码来源:SSL_EXT_enable_desugared_origins.java

示例6: intFromTerm

import org.spoofax.interpreter.core.Tools; //导入方法依赖的package包/类
public static int intFromTerm(IStrategoTerm term) {
	if (Tools.isTermInt(term)) {
		return Tools.asJavaInt(term);
	}
	throw new MalformedASTException("Malformed int: " + term);
}
 
开发者ID:metaborg,项目名称:dynsem,代码行数:7,代码来源:TermUtils.java


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