Examples of ESmall


Examples of erjang.ESmall

  }
  public EAtom module() {return  mod;}
  public EAtom name()   {return  fun;}

  public ETuple toSymbolic() {
    return ETuple.make(EXTFUNC_ATOM, mod, fun, new ESmall(arity));
  }
View Full Code Here

Examples of erjang.ESmall

    this.self = self;
  }

  @Override
  public ESeq cons(EObject h) {
    ESmall s;
    if ((s = h.testSmall()) != null) {
      if ((s.value & 0xff) == s.value) {
        return new EStringList((byte) s.value, this);
      }
    }
View Full Code Here

Examples of erjang.ESmall

          result = result.cons(l);
        } else if ((list = o2.capture_spec.testSeq()) != null) {
          ESeq l = ERT.NIL;
          while (!list.isNil()) {
            EObject group = list.head();
            ESmall num;
            EAtom nam;
            EString nam2;
            if ((num=group.testSmall()) != null)
            {
              l = l.cons( capture (subject, mr, num.value, o2 ));
            } else if ((nam=group.testAtom()) != null) {
              Integer groupNo = o2.named_groups.get(nam.getName());
              if (groupNo != null) {
                l = l.cons( capture (subject, mr, groupNo.intValue(), o2 ));
              }
            } else if ((nam2=group.testString()) != null) {
              Integer groupNo = o2.named_groups.get(nam2.stringValue());
              if (groupNo != null) {
                l = l.cons( capture (subject, mr, groupNo.intValue(), o2 ));
              }
            } else {
              throw new NotImplemented("named capture groups");
            }
            list = list.tail();
          }
          result = result.cons(l);

        } else {
          throw new NotImplemented("global and not all");
        }
      }
     
      if (result == ERT.NIL) {
        return am_nomatch;
      } else {
         return new ETuple2(am_match, result.reverse());
      }
     
    } else {
     
      if (matcher.find()) {
       
        if (o2.capture_spec  == am_none) {
          return am_match;
        }
       
        MatchResult mr = matcher.toMatchResult();
     
        int max = mr.groupCount();
        while( mr.start(max) == -1)
          max -= 1;
       
        ESeq il;
        if (o2.capture_spec == am_all) {
          ESeq l = ERT.NIL;
          for (int i = max; i >= 0; i--) {
            l = l.cons( capture (subject, mr, i, o2) );
          }
          return new ETuple2(am_match, l);
         
        } else if (o2.capture_spec == am_all_but_first) {
          ESeq l = ERT.NIL;
          for (int i = max; i > 0; i--) {
            l = l.cons( capture (subject, mr, i, o2) );
          }
          return new ETuple2(am_match, l);
         
        } else if (o2.capture_spec == am_first) {
          EObject l = capture (subject, mr, 0, o2);
          return new ETuple2(am_match, l);
         
        } else if ((il = o2.capture_spec.testSeq()) != null) {
         
          ESeq out = ERT.NIL;
         
           for (; !il.isNil(); il = il.tail()) {
             EObject what = il.head();
            ESmall idx = what.testSmall();
             EAtom nam;
            if (idx != null && mr.start(idx.value) != -1) {
               EObject val = capture (subject, mr, idx.value, o2);
               out = out.cons(val);
             } else if ((nam=what.testAtom())!=null) {
View Full Code Here

Examples of erjang.ESmall

    public AllocList asAllocList() {return this;}
    public EObject toSymbolic() {
      int len = list.length/2;

      if (len==1 && list[0] == WORDS)
        return new ESmall(list[1]); // Just words.

      EObject[] elems = new EObject[len];
      for (int i=0; i<len; i++) {
        elems[i] = ETuple.make(kindToSymbolic(list[2*i]),
                     new ESmall(list[2*i+1]));
      }
      return ETuple.make(ALLOC_ATOM, ESeq.fromArray(elems));
    }
View Full Code Here

Examples of erjang.ESmall

    public Label(int nr) {this.nr=nr;}
    @Override
    public Label asLabel() {return this;}

    public EObject toSymbolic() {
      return ETuple.make(F_ATOM, new ESmall(nr));
    }
View Full Code Here

Examples of erjang.ESmall

      }
      return cache.get(nr);
    }

    public EObject toSymbolic() {
      return ETuple.make(X_ATOM, new ESmall(nr));
    }
View Full Code Here

Examples of erjang.ESmall

      }
      return cache.get(nr);
    }

    public EObject toSymbolic() {
      return ETuple.make(Y_ATOM, new ESmall(nr));
    }
View Full Code Here

Examples of erjang.ESmall

      }
      return cache.get(nr);
    }

    public EObject toSymbolic() {
      return ETuple.make(FR_ATOM, new ESmall(nr));
    }
View Full Code Here

Examples of erjang.ESmall

      symBody[i++] = insn.toSymbolic();
    }

    ETuple fun = ETuple.make(CodeAtoms.FUNCTION_ATOM,
                 sig.fun,
                 new ESmall(sig.arity),
                 new ESmall(sig.label),
                 ESeq.fromArray(symBody));
    return fun;
  }
View Full Code Here

Examples of erjang.ESmall

    public ESeq symbolicExportList() {
    ArrayList<EObject> symExports = new ArrayList<EObject>(exports.length);
    int i=0;
    for (FunctionInfo f : exports) {
      symExports.add(ETuple.make(f.fun,
                     new ESmall(f.arity),
                     new ESmall(f.label)));
    }
    Collections.sort(symExports, EObject.ERLANG_ORDERING);
    return ESeq.fromList(symExports);
    }
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.