本文整理汇总了Java中org.spoofax.interpreter.terms.IStrategoTerm.PLACEHOLDER属性的典型用法代码示例。如果您正苦于以下问题:Java IStrategoTerm.PLACEHOLDER属性的具体用法?Java IStrategoTerm.PLACEHOLDER怎么用?Java IStrategoTerm.PLACEHOLDER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.spoofax.interpreter.terms.IStrategoTerm
的用法示例。
在下文中一共展示了IStrategoTerm.PLACEHOLDER属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatch
private static boolean dispatch(IStrategoTermVisitor visitor, IStrategoTerm term) {
switch(term.getTermType()) {
case IStrategoTerm.APPL:
return visitor.visit((IStrategoAppl) term);
case IStrategoTerm.LIST:
return visitor.visit((IStrategoList) term);
case IStrategoTerm.TUPLE:
return visitor.visit((IStrategoTuple) term);
case IStrategoTerm.INT:
visitor.visit((IStrategoInt) term);
return false;
case IStrategoTerm.REAL:
visitor.visit((IStrategoReal) term);
return false;
case IStrategoTerm.STRING:
visitor.visit((IStrategoString) term);
return false;
case IStrategoTerm.REF:
visitor.visit((IStrategoRef) term);
return false;
case IStrategoTerm.PLACEHOLDER:
return visitor.visit((IStrategoPlaceholder) term);
default:
return visitor.visit(term);
}
}
示例2: call
@Override
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)
throws InterpreterException {
ITermFactory factory = env.getFactory();
switch(tvars[0].getTermType()) {
case IStrategoTerm.APPL:
IStrategoAppl a = (IStrategoAppl) tvars[0];
env.setCurrent(factory.makeString(a.getConstructor().getName()));
return true;
case IStrategoTerm.INT:
env.setCurrent(factory.makeInt(((IStrategoInt) tvars[0]).intValue()));
return true;
case IStrategoTerm.REAL:
env.setCurrent(factory.makeReal(((IStrategoReal) tvars[0]).realValue()));
return true;
case IStrategoTerm.BLOB:
env.setCurrent(factory.makeString("BLOB_" + tvars[0].toString()));
return true;
case IStrategoTerm.LIST:
env.setCurrent(factory.makeList());
return true;
case IStrategoTerm.STRING:
IStrategoString current = (IStrategoString) factory.annotateTerm(tvars[0], factory.makeList());
env.setCurrent(factory.makeString(current.toString()));
return true;
case IStrategoTerm.TUPLE:
env.setCurrent(factory.makeString(""));
return true;
case IStrategoTerm.PLACEHOLDER:
env.setCurrent(factory.makePlaceholder(factory.makeList()));
return true;
default:
throw new IllegalStateException("SSL_get_constructor failed for " + tvars[0]);
}
}
示例3: call
@Override
public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars)
throws InterpreterException {
switch(tvars[0].getTermType()) {
case IStrategoTerm.APPL:
IStrategoAppl a = (IStrategoAppl) tvars[0];
env.setCurrent(env.getFactory().makeList(a.getAllSubterms()));
return true;
case IStrategoTerm.INT:
case IStrategoTerm.STRING:
case IStrategoTerm.REAL:
case IStrategoTerm.BLOB:
env.setCurrent(env.getFactory().makeList());
return true;
case IStrategoTerm.LIST:
env.setCurrent(tvars[0]);
return true;
case IStrategoTerm.TUPLE:
IStrategoTuple tuple = (IStrategoTuple) tvars[0];
env.setCurrent(env.getFactory().makeList(tuple.getAllSubterms()));
return true;
case IStrategoTerm.PLACEHOLDER:
IStrategoPlaceholder placeholder = (IStrategoPlaceholder) tvars[0];
env.setCurrent(env.getFactory().makeList(placeholder.getTemplate()));
return true;
default:
throw new IllegalStateException("SSL_get_arguments failed for " + tvars[0]);
}
}