本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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() + "'");
}
示例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;
}
示例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();
}
示例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 + "'");
}
示例9: isLexical
import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public boolean isLexical(IStrategoAppl rhs) {
return lexFun == rhs.getConstructor();
}
示例10: isLiteral
import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public boolean isLiteral(IStrategoAppl rhs) {
IStrategoConstructor fun = rhs.getConstructor();
return litFun == fun || cilitFun == fun;
}
示例11: isStr
import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isStr(IStrategoAppl t, IContext env) {
return t.getConstructor() == env.getStrategoSignature().getStr();
}
示例12: isVar
import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isVar(IStrategoAppl t, IContext env) {
return t.getConstructor() == env.getStrategoSignature().getVar();
}
示例13: isWld
import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isWld(IStrategoAppl t, IContext env) {
return t.getConstructor() == env.getStrategoSignature().getWld();
}
示例14: isAs
import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isAs(IStrategoAppl t, IContext env) {
return t.getConstructor() == env.getStrategoSignature().getAs();
}
示例15: isReal
import org.spoofax.interpreter.terms.IStrategoAppl; //导入方法依赖的package包/类
public static boolean isReal(IStrategoAppl t, IContext env) {
return t.getConstructor() == env.getStrategoSignature().getReal();
}