Package org.rascalmpl.interpreter.env

Examples of org.rascalmpl.interpreter.env.ModuleEnvironment


      QualifiedName sort = this.getSort();
      String name = org.rascalmpl.interpreter.utils.Names.typeName(sort);

      if (org.rascalmpl.interpreter.utils.Names.isQualified(sort)) {
        GlobalEnvironment heap = env.getHeap();
        ModuleEnvironment mod = heap
            .getModule(org.rascalmpl.interpreter.utils.Names
                .moduleName(sort));

        if (mod == null) {
          throw new UndeclaredModule(
              org.rascalmpl.interpreter.utils.Names
                  .moduleName(sort), sort);
        }

        adt = mod.lookupAbstractDataType(name);
      } else {
        adt = env.lookupAbstractDataType(name);
      }

      if (adt == null) {
View Full Code Here


  public IValue call(IRascalMonitor monitor, String module, String name, IValue... args) {
    IRascalMonitor old = setMonitor(monitor);
    Environment oldEnv = getCurrentEnvt();
   
    try {
      ModuleEnvironment modEnv = getHeap().getModule(module);
      setCurrentEnvt(modEnv);
      return call(name, (Map<String,IValue>) null, args);
    }
    finally {
      setMonitor(old);
View Full Code Here

  public IValue main(IRascalMonitor monitor, String module, String function, String[] commandline) {
    IRascalMonitor old = setMonitor(monitor);
    Environment oldEnv = getCurrentEnvt();
   
    try {
      ModuleEnvironment modEnv = getHeap().getModule(module);
      setCurrentEnvt(modEnv);
     
      Name name = Names.toName(function, modEnv.getLocation());
      OverloadedFunction func = (OverloadedFunction) getCurrentEnvt().getVariable(name);
     
      if (func == null) {
        throw new UndeclaredVariable(function, name);
      }
View Full Code Here

  public IValue call(String name, String module, Map<String, IValue> kwArgs, IValue... args) {
    IRascalMonitor old = setMonitor(monitor);
    Environment oldEnv = getCurrentEnvt();
   
    try {
      ModuleEnvironment modEnv = getHeap().getModule(module);
      setCurrentEnvt(modEnv);
      return call(name, kwArgs, args);
    }
    finally {
      setMonitor(old);
View Full Code Here

    return org.rascalmpl.semantics.dynamic.Import.getParser(this, (ModuleEnvironment) getCurrentEnvt().getRoot(), loc, false);
  }

  @Override
  public IConstructor getGrammar(Environment env) {
    ModuleEnvironment root = (ModuleEnvironment) env.getRoot();
    return getParserGenerator().getGrammar(monitor, root.getName(), root.getSyntaxDefinition());
  }
View Full Code Here

  public IConstructor getGrammar(IRascalMonitor monitor, URI uri) {
    IRascalMonitor old = setMonitor(monitor);
    try {
      ParserGenerator pgen = getParserGenerator();
      String main = uri.getAuthority();
      ModuleEnvironment env = getHeap().getModule(main);
      return pgen.getGrammar(monitor, main, env.getSyntaxDefinition());
    }
    finally {
      setMonitor(old);
    }
  }
View Full Code Here

  public IConstructor getExpandedGrammar(IRascalMonitor monitor, URI uri) {
    IRascalMonitor old = setMonitor(monitor);
    try {
      ParserGenerator pgen = getParserGenerator();
      String main = uri.getAuthority();
      ModuleEnvironment env = getHeap().getModule(main);
      monitor.startJob("Expanding Grammar");
      return pgen.getExpandedGrammar(monitor, main, env.getSyntaxDefinition());
    }
    finally {
      monitor.endJob(true);
      setMonitor(old);
    }
View Full Code Here

      dependingImports.addAll(getImportingModules(names));
      dependingExtends.addAll(getExtendingModules(names));

      monitor.startJob("Reconnecting importers of affected modules");
      for (String mod : dependingImports) {
        ModuleEnvironment env = heap.getModule(mod);
        Set<String> todo = new HashSet<String>(env.getImports());
        for (String imp : todo) {
          if (names.contains(imp)) {
            env.unImport(imp);
            ModuleEnvironment imported = heap.getModule(imp);
            if (imported != null) {
              env.addImport(imp, imported);
            }
          }

        }
        monitor.event("Reconnected " + mod, 1);
      }

      monitor.event("Reconnecting extenders of affected modules");
      for (String mod : dependingExtends) {
        ModuleEnvironment env = heap.getModule(mod);
        Set<String> todo = new HashSet<String>(env.getExtends());
        for (String ext : todo) {
          if (names.contains(ext)) {
            env.unExtend(ext);
            ModuleEnvironment extended = heap.getModule(ext);
            if (extended != null) {
              env.addExtend(ext);
            }
          }
        }
View Full Code Here

      setMonitor(old);
    }
  }

  private void reloadModule(String name, URI errorLocation) { 
    ModuleEnvironment env = new ModuleEnvironment(name, getHeap());
    heap.addModule(env);

    try {
      ISourceLocation loc = getValueFactory().sourceLocation(errorLocation);
      org.rascalmpl.semantics.dynamic.Import.loadModule(loc, name, this);
View Full Code Here

    });
  }

  private static TypeStore constructCompleteTypeStore(Environment env) {
      TypeStore complete = new TypeStore();
      ModuleEnvironment mod = (ModuleEnvironment) env.getRoot();
    constructCompleteTypeStoreRec(complete, mod, new HashSet<java.lang.String>());
    return complete;
  }
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.env.ModuleEnvironment

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.