Examples of EObject


Examples of erjang.EObject

    }

    List<Expr> terms = new ArrayList<Expr>(actionTerms.length());
    for (ESeq actions = actionTerms; !actions.isNil(); actions = actions
        .tail()) {
      EObject action = actions.head();
      terms.add(parse_ActionTerm(action, ctx));
    }

    return terms.toArray(new Expr[terms.size()]);
  }
View Full Code Here

Examples of erjang.EObject

    return match(candidate) == ERT.TRUE;
  }

  public EObject match(EObject candidate) {
    for (int i = 0; i < funs.length; i++) {
      EObject val = funs[i].match(candidate);
      if (val != null) {
        return val;
      }
    }
View Full Code Here

Examples of erjang.EObject

  }

  public ESeq matching_values_coll(ESeq vals, ISeq seq) {
 
    for (; seq != null && !seq.equals(seq.empty()); seq = seq.next()) {
      EObject val = (EObject) seq.first();
      if (matches(val)) {
        vals = vals.cons(val);
      }
    }
    return vals;
View Full Code Here

Examples of erjang.EObject

      tail_expr = parse_ConditionExpression(seq.tail(), ctx);
    }

    @Override
    public EObject eval(EMatchContext ctx) {
      EObject head = head_expr.eval(ctx);
      EObject tail = tail_expr.eval(ctx);
      return tail.cons(head);
    }
View Full Code Here

Examples of erjang.EObject

      if (var_name == EXPR_ENTIRE_MATCH) {
        return ctx.value;
      } else if (var_name == EXPR_ALL_VARS) {
        return ctx.makeList();
      } else {
        EObject value = ctx.vars.get(var_name);
        if (value == null)
          throw new InternalError("Unbound $"+var_name);
        return value;       
      }
    }
View Full Code Here

Examples of erjang.EObject

        }
      } catch (Exception e) {
        return null;
      }

      EObject out = value;
      try {
        for (int i = 0; i < body.length; i++) {
          out = body[i].eval(ctx);
        }
      } catch (Exception e) {
View Full Code Here

Examples of erjang.EObject

     
      if (opts == null) return true;

      for (; !opts.isNil(); opts = opts.tail()) {

        EObject opt = opts.head();

        // unicode | anchored | caseless | dollar_endonly | dotall |
        // extended
        // | firstline | multiline | no_auto_capture | dupnames |
        // ungreedy
        // | {newline, NLSpec}| bsr_anycrlf | bsr_unicode

        ETuple tup;
        ESmall off;
        if (opt == am_unicode) {
          unicode = true;
        } else if (opt == am_anchored) {
          anchored = true;
        } else if (opt == am_global) {
          global = true;
        } else if (opt == am_caseless) {
          flags |= Pattern.CASE_INSENSITIVE;
        } else if (opt == am_dollar_endonly) {
          throw new NotImplemented("regex option "+opt);
        } else if (opt == am_dotall) {
          flags |= Pattern.DOTALL;
        } else if (opt == am_extended) {
          flags |= Pattern.COMMENTS;
        } else if (opt == am_firstline) {
          throw new NotImplemented("regex option "+opt);
        } else if (opt == am_multiline) {
          flags |= Pattern.MULTILINE;
        } else if (opt == am_no_auto_capture) {
          throw new NotImplemented("regex option "+opt);
        } else if (opt == am_dupnames) {
          throw new NotImplemented("regex option "+opt);
        } else if (opt == am_ungreedy) {
          throw new NotImplemented("regex option "+opt);
        } else if (opt == am_bsr_anycrlf) {
          newline_cr = true;
          newline_crlf = true;
          newline_lf = true;
          newline_any = false;

        } else if (opt == am_bsr_unicode) {
          newline_any = true;

        } else if ((tup = opt.testTuple()) != null && tup.arity() == 2
            && tup.elm(1) == am_newline) {

          newline_cr = false;
          newline_crlf = false;
          newline_lf = false;
          newline_any = false;

          EObject val = tup.elm(2);
          if (val == am_cr) {
            newline_cr = true;
          } else if (val == am_lf) {
            newline_lf = true;
          } else if (val == am_crlf) {
            newline_crlf = true;
          } else if (val == am_anycrlf) {
            newline_cr = true;
            newline_lf = true;
            newline_crlf = true;
          } else if (val == am_any) {
            newline_any = true;
          } else {
            return false;
          }
         
        } else if (tup != null && tup.arity() == 2 && tup.elm(1) == am_capture) {
          this.capture_spec = tup.elm(2);
          this.capture_type = am_index;

        } else if (tup != null && tup.arity() == 3 && tup.elm(1) == am_capture) {
          this.capture_spec = tup.elm(2);
          this.capture_type = tup.elm(3);

        } else if (tup != null && tup.arity() == 2
            && tup.elm(1) == am_offset
            && (off=tup.elm(2).testSmall()) != null) {
          this.offset = off.value;

        } else {
          return false;
        }

      }
     
      ESeq spec;
      if (capture_spec == am_all
        || capture_spec == am_all_but_first
        || capture_spec == am_first
        || capture_spec == am_none
        ) {
        // ok
      } else if ((spec=capture_spec.testSeq()) != null) {
       
        // if it is a sequence, make sure elements are integers
        while (!spec.isNil()) {
          EObject val = spec.head();
          if (val.testSmall() == null && val.testString() == null && val.testAtom() == null)
            return false;
          spec = spec.tail();
        }
       
        // ok
View Full Code Here

Examples of erjang.EObject

    boolean link = false;
    boolean monitor = false;
    EAtom priority = null;
   
    for (; !o.isNil(); o = o.tail() ) {
      EObject val = o.head();
     
      ETuple2 t2;
      if (val == am_link) {
        link = true;
      } else if (val == am_monitor) {
View Full Code Here

Examples of erjang.EObject

    if (r==null||o==null)
      throw ERT.badarg(ref, options);

    boolean flush = (!o.isNil() && o.head()==am_flush);

    EObject found = self.demonitor(r);

    if (found == null) {
      return ERT.FALSE;
    }
   
    EHandle h;
    ETuple tup;
    EAtom name;
    EAtom node;
    if ((h=found.testHandle()) != null) {
      h.remove_monitor(self.self_handle(), r, flush);
    } else if ((tup=found.testTuple()) != null
          && tup.arity()==2
          && (name=tup.elm(1).testAtom()) != null
          && (node=tup.elm(2).testAtom()) != null) {
     
      EAbstractNode n = EAbstractNode.get_or_connect(self, node);
View Full Code Here

Examples of erjang.EObject

  {
    if (mbox instanceof MBox) {
      MBox embox = (MBox) mbox;
     
      try {
        EObject res = ErlBif.apply(self, m, f, args);
        embox.put(ETuple.make(ERT.am_ok, res));       
        return res;
      } catch (ErlangException e) {
        embox.put(ETuple.make(ERT.am_error, e.getCatchValue()))
        return ERT.am_undefined;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.