本文整理汇总了Java中org.spoofax.interpreter.terms.IStrategoTerm.putAttachment方法的典型用法代码示例。如果您正苦于以下问题:Java IStrategoTerm.putAttachment方法的具体用法?Java IStrategoTerm.putAttachment怎么用?Java IStrategoTerm.putAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spoofax.interpreter.terms.IStrategoTerm
的用法示例。
在下文中一共展示了IStrategoTerm.putAttachment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyAttachments
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public IStrategoTerm copyAttachments(IStrategoTerm from, IStrategoTerm to) {
if (to.getStorageType() != MUTABLE)
throw new IllegalArgumentException("Target term is not mutable and does not support attachments");
ITermAttachment attach = from.getAttachment(null);
while (attach != null) {
try {
to.putAttachment(attach.clone());
} catch (CloneNotSupportedException e) {
throw new IllegalArgumentException("Copying attachments of this type is not supported: " + attach.getAttachmentType(), e);
}
attach = attach.getNext();
}
return to;
}
示例2: setDesugaredOrigin
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public static void setDesugaredOrigin(IStrategoTerm term, IStrategoTerm desugared) {
/*
assert(
DesugaredOriginAttachment.getDesugaredOrigin(term) == null ||
DesugaredOriginAttachment.getDesugaredOrigin(term) == desugared
) : "Desugared origin is set only once";
assert(OriginAttachment.getOrigin(desugared) != null) :
"desugared origin term must have an origin term";
if(DesugaredOriginAttachment.getDesugaredOrigin(term) == null)
*/
term.putAttachment(new DesugaredOriginAttachment(desugared));
}
示例3: tryMatchTerms
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
/**
* Accomplishes a match between term1 in AST1 and term2 in AST2 if and only if
* term1 and term2 are not already matched.
* @param term1 Term in AST1
* @param term2 Term in AST2
* @return True iff term1 and term2 are matched after this function returns
*/
public static boolean tryMatchTerms(IStrategoTerm term1, IStrategoTerm term2) {
assert(term1 != term2);
assert(ParentAttachment.getRoot(term1) != ParentAttachment.getRoot(term2) || ParentAttachment.getRoot(term2) == null);
if(TermMatchAttachment.getMatchedTerm(term1) == term2){
return true;
}
if(!hasMatchedTerm(term1) && !hasMatchedTerm(term2)){
term1.putAttachment(new TermMatchAttachment(term2));
term2.putAttachment(new TermMatchAttachment(term1));
return true;
}
return false;
}
示例4: apply
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
@Override
public void apply(IStrategoTerm term) {
term.putAttachment(attachment);
}
示例5: put
import org.spoofax.interpreter.terms.IStrategoTerm; //导入方法依赖的package包/类
public void put(IStrategoTerm term) {
term.putAttachment(getImploderAttachment());
}