Package jfun.util.dict

Examples of jfun.util.dict.Dict


    final Stmt[] deps = new Stmt[dependencies.length];
   
    for(int i=0; i<dependencies.length; i++){
      deps[i] = new Bound(dependencies[i], loc);
    }
    Dict ctxt = interpreter.getInitialCompileContext()
      .puts(dependencies, deps);
    ctxt = seedImports(ctxt, imports);
    return compileBody(module_id, nuts, tag, idchecker,
        ctxt);
  }
View Full Code Here


    final Object[] keys = imported.keySet().toArray();
    final Object[] vals = new Object[keys.length];
    for(int i=0; i<keys.length; i++){
      vals[i] = imported.get(keys[i]);
    }
    final Dict with_deps = withDependencies(initial_frame);
    Dict myframe = with_deps.puts(keys, vals);
    final Body body = BodyCompiler.evaluate(
        stmts.getKeys(), stmts.getStmts(),
        runtime, //new FilteringRegistry(exported, reg),
        myframe);
    return new SimpleModule(module_id, name, description,
View Full Code Here

      return ctxt.puts(names, stmts);
    }
    private Stmt compile(){
      current_location.setLocation(getLocation());
      final List subnodes = tag.getSubNodes();
      Dict ctxt = this.ctxt;
      if(BINDER.equals(tag.getName())){
        final String varname = getMandatoryVar(this.tag);
        ctxt = declareName(ctxt, varname, getLocation());
      }
      else if(FUNCTION.equals(tag.getName())){
View Full Code Here

        final Node node = (Node)subnodes.get(0);
        if(node instanceof Tag){
          final Tag t = (Tag)node;
          if(LOCAL.equals(t.getName())){
            final LocalScope scope = compileLocalScope(ctxt, t);
            final Dict nctxt = scope.getScope();
            return withScope(scope, compileNut(nutname, desc, nctxt,
                subnodes.subList(1, subnodes.size()), is_subnut), getLocation());
          }
        }
        return compileNut(nutname, desc, ctxt, subnodes, is_subnut);
View Full Code Here

      if(id!=null && id.equals(varname)){
        throw raise(ID+" and "+VAR+" cannot share the same value");
      }
      final HashMap local_names = new HashMap();
      local_names.put(varname, varname);
      final Dict nctxt = ctxt;//declareName(ctxt, varname, getLocation());
      final Definition[] stmt = compileDefinitions(nctxt, subnodes, local_names);
      return compileBinder(varname, stmt, 0, stmt.length);
    }
View Full Code Here

    return nframe[0];
  }
  static Body evaluate(Object[] keys, Stmt[] stmts,
      Runtime runtime,
      Dict initial_frame){
    final Dict frame = newFrame(keys,
        stmts, initial_frame, runtime);
    final Closure[] closures = new Closure[keys.length];
    final Location[] locations = new Location[keys.length];
    for(int i=0; i<keys.length; i++){
      final Object key = keys[i];
      //final Location iloc = stmts[i].getLocation();
      closures[i] = (Closure)frame.get(key);
      locations[i] = stmts[i].getLocation();
    }
    return new Body(keys, closures, locations);
  }
View Full Code Here

      else{
        throw new ConfigurationException("only elements are allowed within "+tagname,
            loc);
      }
    }
    final Dict nctxt = ctxt.puts(keys, bounds);
    final Stmt[] stmts = new Stmt[keys.length];
    for(int i=0; i<keys.length; i++){
      final Tag tag = (Tag)decs.get(i);
      stmts[i] = compileTag(i, nctxt, tag, false, is_global, singleton_mode);
    }
View Full Code Here

      public String toString(){
        return "\\"+varname+"->"+stmt;
      }
      public Creator bind(Object v){
        //final Var var = new Var(v);
        Dict nframe = frame.put(varname, v);
        final Object retval = evalStmt(stmt, runtime, nframe);
        return NutsUtils.asComponent(retval);
      }

      public Class bindType(Class type) {
View Full Code Here

TOP

Related Classes of jfun.util.dict.Dict

Copyright © 2018 www.massapicom. 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.