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


Java IStrategoAppl.getConstructor方法代码示例

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


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

示例1: isList

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public boolean isList(IStrategoAppl rhs, IStrategoAppl attrs) {
	IStrategoAppl details = rhs;
	
	if (details.getConstructor() == varsymFun)
		details = termAt(details, 0);
	
	if (details.getConstructor() == cfFun)
		details = termAt(details, 0);
	              	
  	if (details.getConstructor() == optFun)
  		details = termAt(details, 0);
  	
	IStrategoConstructor fun = details.getConstructor();
	
	 // FIXME: Spoofax/159: AsfixImploder creates tuples instead of lists for seqs
	if (isIterFun(fun) || seqFun == fun)
	  return true;
	
  return isFlatten(rhs, attrs);
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:21,代码来源:ProductionAttributeReader.java

示例2: tryGetSort

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
/** 
 * Get the RTG sort name of a pattern.
 */
public String tryGetSort(IStrategoAppl currentAppl) {
	IStrategoConstructor cons = currentAppl.getConstructor();
	if (cons == cfFun)
		return tryGetSort(applAt(currentAppl, 0));
	if (cons == lexFun)
		return tryGetSort(applAt(currentAppl, 0));
	if (cons == sortFun)
		return javaString(termAt(currentAppl, 0));
	if (cons == parameterizedSortFun)
		return getParameterizedSortName(currentAppl);
	if (cons == charClassFun)
		return null;
	if (cons == altFun)
		return getAltSortName(currentAppl);
	return null;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:20,代码来源:ProductionAttributeReader.java

示例3: isOptional

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public boolean isOptional(IStrategoAppl rhs) {
	if (rhs.getConstructor() == optFun)
		return true;
	IStrategoTerm contents = termAt(rhs, 0);
	return contents.getSubtermCount() == 1
		&& isTermAppl(contents)
		&& ((IStrategoAppl) contents).getConstructor() == optFun;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:9,代码来源:ProductionAttributeReader.java

示例4: fromTerm

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public final T fromTerm(IStrategoAppl term) {
	if (term.getConstructor() == constructor) {
		return fromSubterms(term.getAllSubterms());
	} else {
		return null;
	}
}
 
开发者ID:metaborg,项目名称:mb-rep,代码行数:8,代码来源:TermAttachmentType.java

示例5: buildTerm

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public IStrategoTerm buildTerm(IContext env, IStrategoAppl t) throws InterpreterException {

        ITermFactory factory = env.getFactory();

        if (Tools.isAnno(t, env)) {
            return buildAnno(env, t);
        }
        else if (Tools.isOp(t, env)) {
            return buildOp(env, t, factory);
        }
        else if (Tools.isInt(t, env)) {
            return buildInt(t, factory);
        }
        else if (Tools.isReal(t, env)) {
            return buildReal(t, factory);
        }
        else if (Tools.isStr(t, env)) {
            return buildStr(t);
        }
        else if (Tools.isVar(t, env)) {
            return buildVar(env, t);
        }
        else if (Tools.isExplode(t, env)) {
            return buildExplode(env, t);
        }

        throw new InterpreterException("Unknown build constituent '" + t.getConstructor() + "'");
    }
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:29,代码来源:Build.java

示例6: getMetaVarConstructor

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public String getMetaVarConstructor(IStrategoAppl rhs, IStrategoAppl attrs) {
	if (varSymFun == rhs.getConstructor()) {
		rhs = termAt(rhs, 0);
		return isList(rhs, attrs)
				? "meta-listvar"
				: "meta-var";
	}
	return null;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:10,代码来源:ProductionAttributeReader.java

示例7: getIterConstructor

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
private static IStrategoConstructor getIterConstructor(IStrategoAppl lhs) {
    IStrategoAppl details = lhs;

    if("varsym".equals(details.getConstructor().getName()))
        details = termAt(details, 0);

    if("cf".equals(details.getConstructor().getName()))
        details = termAt(details, 0);

    if("opt".equals(details.getConstructor().getName()))
        details = termAt(details, 0);

    return details.getConstructor();
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:15,代码来源:ProductionReader.java

示例8: parseStrategy

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
private Strategy parseStrategy(IStrategoAppl appl) throws InterpreterException {

        IStrategoConstructor ctor = appl.getConstructor();
        StrategoSignature sign = context.getStrategoSignature();

        if (ctor.equals(sign.getBuild())) {
            return parseBuild(appl);
        } else if (ctor.equals(sign.getScope())) {
            return parseScope(appl);
        } else if (ctor.equals(sign.getSeq())) {
            return parseSeq(appl);
        } else if (ctor.equals(sign.getGuardedLChoice())) {
            return parseGuardedLChoice(appl);
        } else if (ctor.equals(sign.getMatch())) {
            return parseMatch(appl);
        } else if (ctor.equals(sign.getId())) {
            return parseId(appl);
        } else if (ctor.equals(sign.getCallT())) {
            return parseCallT(appl);
        } else if (ctor.equals(sign.getPrimT())) {
            return parsePrimT(appl);
        } else if (ctor.equals(sign.getLet())) {
            return parseLet(appl);
        } else if (ctor.equals(sign.getFail())) {
            return makeFail(appl);
        } else if (ctor.equals(sign.getId())) {
            return makeId(appl);
        } else if (ctor.equals(sign.getAll())) {
            return makeAll(appl);
        } else if (ctor.equals(sign.getOne())) {
            return makeOne(appl);
        } else if (ctor.equals(sign.getSome())) {
            return makeSome(appl);
        } else if (ctor.equals(sign.getImportTerm())) {
        	return makeImportTerm(appl);
        } else if (ctor.equals(sign.getCallDynamic())){
        	return parseCallDynamic(appl);
        }

        throw new InterpreterException("Unknown op '" + ctor + "'");
    }
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:42,代码来源:StrategoCoreLoader.java

示例9: isLexical

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public boolean isLexical(IStrategoAppl rhs) {
	return lexFun == rhs.getConstructor();
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:4,代码来源:ProductionAttributeReader.java

示例10: isLiteral

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public boolean isLiteral(IStrategoAppl rhs) {
	IStrategoConstructor fun = rhs.getConstructor();
	return litFun == fun || cilitFun == fun;
}
 
开发者ID:metaborg,项目名称:jsglr,代码行数:5,代码来源:ProductionAttributeReader.java

示例11: isStr

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isStr(IStrategoAppl t, IContext env) {
	return t.getConstructor() == env.getStrategoSignature().getStr();
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Tools.java

示例12: isVar

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isVar(IStrategoAppl t, IContext env) {
	return t.getConstructor() == env.getStrategoSignature().getVar();
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Tools.java

示例13: isWld

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isWld(IStrategoAppl t, IContext env) {
	return t.getConstructor() == env.getStrategoSignature().getWld();
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Tools.java

示例14: isAs

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isAs(IStrategoAppl t, IContext env) {
	return t.getConstructor() == env.getStrategoSignature().getAs();
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Tools.java

示例15: isReal

import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isReal(IStrategoAppl t, IContext env) {
	return t.getConstructor() == env.getStrategoSignature().getReal();
}
 
开发者ID:metaborg,项目名称:mb-exec,代码行数:4,代码来源:Tools.java


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