static PT_Tree restoreLiteral(PT_Symbol symbol) { PT_Tree result; result = PT_makeTreeLit(PT_getSymbolString(symbol)); return result; }
PT_Tree ASC_get_lex_term_anno(ATerm type, ATerm aterm, ATerm akey) { PT_Tree term = muASFToTree(aterm); PT_Tree key = muASFToTree(akey); PT_Tree value = NULL; value = get_lex_term_anno(term, key); if (value != NULL) { return value; } return PT_makeTreeLit("TODO: return a proper normal form"); }
static PT_Tree listToTree(PT_Production prod, ATermList elems) { PT_Tree layout = defaultLayout; PT_Tree sepTree = NULL; PT_Symbol rhs; PT_Args args = PT_makeArgsEmpty(); ATbool contextfree; int sepLength = 0; int i; rhs = PT_getProductionRhs(prod); if (PT_isSymbolCf(rhs)) { rhs = PT_getSymbolSymbol(rhs); contextfree = ATtrue; } else if (PT_isSymbolLex(rhs)) { rhs = PT_getSymbolSymbol(rhs); contextfree = ATfalse; } else { contextfree = ATfalse; } if (PT_hasSymbolSeparator(rhs)) { PT_Symbol sepSym = PT_getSymbolSeparator(rhs); assert(PT_isSymbolLit(sepSym)); sepTree = PT_makeTreeLit(PT_getSymbolString(sepSym)); sepLength = contextfree ? 3 : 1; } if (!ATisEmpty(elems)) { /* get a free part of the term store */ TERM_STORE_FRAME(ATgetLength(elems), for (i = 0; !ATisEmpty(elems); elems = ATgetNext(elems)) { PT_Tree newTree = termToTree(ATgetFirst(elems)); /* Note that TERM_STORE contains a reference to a global * that may be updated by termToTree, so do not remove the * newTree temporary variable and do not inline the call to termToTree * in the following assignment. */ TERM_STORE_CHECK(i); TERM_STORE[i] = (ATerm) newTree; i++; } while(--i >= 0) { args = PT_makeArgsMany((PT_Tree) TERM_STORE[i], args); if (i != 0) { if (sepTree) { if (!keep_layout && contextfree) { args = PT_makeArgsMany(layout, args); } if (!keep_layout) { args = PT_makeArgsMany(sepTree, args); } } if (!keep_layout && contextfree) { args = PT_makeArgsMany(layout, args); } } } ) }