本文整理汇总了Java中org.spoofax.interpreter.terms.IStrategoTerm.isList方法的典型用法代码示例。如果您正苦于以下问题:Java IStrategoTerm.isList方法的具体用法?Java IStrategoTerm.isList怎么用?Java IStrategoTerm.isList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spoofax.interpreter.terms.IStrategoTerm
的用法示例。
在下文中一共展示了IStrategoTerm.isList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceTerm
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
@Override
public IStrategoTerm replaceTerm(IStrategoTerm term, IStrategoTerm origin) {
if (term == null) {
return term;
} else if (term == origin) {
return term;
} else if (term.isList()) {
if (term.getSubtermCount() == origin.getSubtermCount()
&& origin.isList()) {
return makeListLink((IStrategoList) term, (IStrategoList) origin);
} else {
return term;
}
} else if (haveSameSignature(term, origin)) {
ensureChildLinks(term.getAllSubterms(), origin);
return ensureLink(term, origin, false);
} else {
return ensureLink(term, origin, false);
}
}
示例2: constructMinimalCostRecovery
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
private RecoverInterpretation constructMinimalCostRecovery(IStrategoTerm term, IStrategoTerm parent) {
//candidates can be null
RecoverInterpretation discardRecovery = constructDiscardRecovery(term, parent);
RecoverInterpretation childTermsRecovery = null;
if(!term.isList())
childTermsRecovery = constructRepairSubtermsRecovery(term, parent);
else {
childTermsRecovery = sublistRecovery(0, term, parent);
if(childTermsRecovery != null)
return childTermsRecovery;
return discardRecovery;
}
RecoverInterpretation subTermsRecovery = constructReplaceBySubtermsRecovery(term, parent);
ArrayList<RecoverInterpretation> candidates = new ArrayList<RecoverInterpretation>();
candidates.add(childTermsRecovery);
candidates.add(subTermsRecovery);
candidates.add(discardRecovery);
return getMinimumCostRecovery(candidates);
}
示例3: makeLinkDesugared
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
/**
* @param origin
* The origin term. For lists, this must be the exact
* corresponding term with the same offset and length.
*/
public IStrategoTerm makeLinkDesugared(IStrategoTerm term, IStrategoTerm desugared) {
if (!term.isList() && DesugaredOriginAttachment.get(term) == null) {
if (term.getStorageType() == MUTABLE)
DesugaredOriginAttachment.setDesugaredOrigin(term, desugared);
} else if (REASSIGN_ORIGINS) {
throw new NotImplementedException("Not implemented: unwrapping of possibly already wrapped term");
}
return term;
}
示例4: isList
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public static boolean isList(STermCursor c) {
IStrategoTerm term = c.getData();
return term.isList();
}
示例5: constructDiscardRecovery
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
private RecoverInterpretation constructDiscardRecovery(IStrategoTerm term, IStrategoTerm parent) {
if(HelperFunctions.isSomeNode(term) || term.isList()){ //|| (parent != null && parent.isList())
return RecoverInterpretation.createDiscardInterpretation(term, parent);
}
return null;
}
示例6: isIncrementalNode
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public boolean isIncrementalNode(ISimpleTerm term) {
IStrategoTerm parent = getParent(term);
return parent != null && parent.isList() && incrementalSorts.contains(getSort(term));
}