Package org.rascalmpl.ast

Examples of org.rascalmpl.ast.QualifiedName


    }

    @Override
    public Type typeOf(Environment env, boolean instantiateTypeParameters, IEvaluator<Result<IValue>> eval) {
      Type adt;
      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
View Full Code Here


    }

    @Override
    public Result<IValue> assignment(AssignableEvaluator __eval) {

      QualifiedName qname = this.getQualifiedName();
      Result<IValue> previous = __eval.__getEnv().getVariable(qname);

      if (previous != null && previous.getValue() != null) {
        __eval.__setValue(__eval.newResult(previous, __eval
            .__getValue()));
View Full Code Here

      setCurrentEnvt(oldEnv);
    }
  }
 
  private IValue call(String name, Map<String,IValue> kwArgs, IValue... args) {
    QualifiedName qualifiedName = Names.toQualifiedName(name, getCurrentEnvt().getLocation());
    setCurrentAST(qualifiedName);
    return call(qualifiedName, kwArgs, args);
  }
View Full Code Here

      __eval.setCurrentAST(this);
      __eval.notifyAboutSuspension(this);
     
      int size = this.getVariables().size();
      QualifiedName vars[] = new QualifiedName[size];
      IValue currentValue[] = new IValue[size];

      Environment old = __eval.getCurrentEnvt();

      try {
        List<QualifiedName> varList = this.getVariables();

        for (int i = 0; i < size; i++) {
          QualifiedName var = varList.get(i);
          vars[i] = var;
          Result<IValue> tmp = __eval.getCurrentEnvt().getSimpleVariable(var);
         
          if (tmp == null) {
            throw new UndeclaredVariable(Names.fullName(var), var);
          }
          if (tmp.getValue() == null) {
            throw new UninitializedVariable(Names.fullName(var),
                var);
          }
          currentValue[i] = tmp.getValue();
        }

        __eval.pushEnv();
        org.rascalmpl.ast.Statement body = this.getBody();

        int max = -1;

        Bound bound = this.getBound();
        if (bound.isDefault()) {
          Result<IValue> res = bound.getExpression()
              .interpret(__eval);
          if (!res.getType().isInteger()) {
            throw new UnexpectedType(
                org.rascalmpl.interpreter.Evaluator.__getTf()
                    .integerType(), res.getType(), this);
          }
          max = ((IInteger) res.getValue()).intValue();
          if (max <= 0) {
            throw org.rascalmpl.interpreter.utils.RuntimeExceptionFactory
                .indexOutOfBounds((IInteger) res.getValue(),
                    __eval.getCurrentAST(), __eval
                        .getStackTrace());
          }
        }

        Result<IValue> bodyResult = null;

        boolean change = true;
        int iterations = 0;

        while (change && (max == -1 || iterations < max)) {
          change = false;
          iterations++;
          if (__eval.isInterrupted()) {
            throw new InterruptException(__eval.getStackTrace(), __eval.getCurrentAST().getLocation());
          }
          bodyResult = body.interpret(__eval);
          for (int i = 0; i < size; i++) {
            QualifiedName var = vars[i];
            Result<IValue> v = __eval.getCurrentEnvt().getVariable(
                var);
            if (currentValue[i] == null
                || !v.getValue().isEqual(currentValue[i])) {
              change = true;
View Full Code Here

    try {
      Type base = x.getBase().typeOf(env, true, eval);

      assert base != null;
     
      QualifiedName name = x.getUser().getName();
      if (Names.isQualified(name)) {
        throw new IllegalQualifiedDeclaration(name);
      }

      env.aliasType(Names.typeName(name), base,
View Full Code Here

      }
    }
  }

  public Type declareAbstractDataType(UserType decl, Environment env) {
    QualifiedName name = decl.getName();
    if (Names.isQualified(name)) {
      throw new IllegalQualifiedDeclaration(name);
    }
    return env.abstractDataType(Names.typeName(name), computeTypeParameters(decl, env));
  }
View Full Code Here

    if (tr.changed) {
      IConstructor rcons;
     
      try {
        QualifiedName n = Names.toQualifiedName(cons.getType().getName(), cons.getName(), null);
        rcons = (IConstructor) eval.call(n, kwParams != null ? kwParams : Collections.<String,IValue>emptyMap(), args);
      }
      catch (UndeclaredFunction | UndeclaredModule | ArgumentsMismatch e) {
        // This may happen when visiting data constructors dynamically which are not
        // defined in the current scope. For example, when data was serialized and the format
View Full Code Here

TOP

Related Classes of org.rascalmpl.ast.QualifiedName

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.