/** Place expressions around an Op */
  private static Op buildFilter(ExprList exprs, Op op) {
    if (exprs.isEmpty()) return op;

    for (Iterator<Expr> iter = exprs.iterator(); iter.hasNext(); ) {
      Expr expr = iter.next();
      if (op == null) op = OpTable.unit();
      op = OpFilter.filter(expr, op);
      iter.remove();
    }
    return op;
  }
 /** For any expression now in scope, wrap the op with a filter */
 private static Op insertAnyFilter(ExprList exprs, Set<Var> patternVarsScope, Op op) {
   for (Iterator<Expr> iter = exprs.iterator(); iter.hasNext(); ) {
     Expr expr = iter.next();
     // Cache
     Set<Var> exprVars = expr.getVarsMentioned();
     if (patternVarsScope.containsAll(exprVars)) {
       if (op == null) op = OpTable.unit();
       op = OpFilter.filter(expr, op);
       iter.remove();
     }
   }
   return op;
 }
Exemple #3
0
 public void visit(OpTable table) {
   System.out.println(table.toString());
 }
 public void visit(OpTable opTable) {
   push(opTable.getTable());
 }
 @Test
 public void testOp_04() {
   opSame("(label 'ABC' (table unit))", OpLabel.create("ABC", OpTable.unit()));
 }