Package org.rascalmpl.interpreter

Examples of org.rascalmpl.interpreter.Accumulator


      if (__eval.__getAccumulators().empty()) {
        throw new UnguardedAppend(this);
      }
      if (!this.getDataTarget().isEmpty()) {
        String label = org.rascalmpl.interpreter.utils.Names.name(this.getDataTarget().getLabel());
        Accumulator accu = findDataTarget(__eval, label);
        if (accu == null) {
          throw new UnguardedAppend(this); // TODO: better error
        }
        return accu;
      }
View Full Code Here


        String label) {
      Stack<Accumulator> accus = __eval.__getAccumulators();
     
      // Search backwards, to allow nested fors with same label.
      for (int i = accus.size() - 1; i >= 0; i--) {
        Accumulator accu = accus.get(i);
        if (accu.hasLabel(label)) {
          return accu;
        }
      }
      return null;
    }
View Full Code Here

    public Result<IValue> interpret(IEvaluator<Result<IValue>> __eval) {

      __eval.setCurrentAST(this);
      __eval.notifyAboutSuspension(this);
     
      Accumulator target = null;
      if (__eval.__getAccumulators().empty()) {
        throw new UnguardedAppend(this);
      }
      if (!this.getDataTarget().isEmpty()) {
        String label = org.rascalmpl.interpreter.utils.Names.name(this
            .getDataTarget().getLabel());
        target = findDataTarget(__eval, label);
        if (target == null) {
          throw new UnguardedAppend(this); // TODO: better error
          // message
        }
      } else {
        target = __eval.__getAccumulators().peek();
      }
      Result<IValue> result = this.getStatement().interpret(__eval);
      target.append(result);
      return result;

    }
View Full Code Here

      if (!this.getLabel().isEmpty()) {
        label = org.rascalmpl.interpreter.utils.Names.name(this
            .getLabel().getName());
      }
      __eval.__getAccumulators().push(
          new Accumulator(__eval.__getVf(), label));
      IValue value = null;
      try {
        while (true) {
          try {
            try {
View Full Code Here

      if (!this.getLabel().isEmpty()) {
        label = org.rascalmpl.interpreter.utils.Names.name(this
            .getLabel().getName());
      }
      __eval.__getAccumulators().push(
          new Accumulator(__eval.__getVf(), label));

      // TODO: does this prohibit that the body influences the behavior
      // of the generators??

      int i = 0;
View Full Code Here

      if (!this.getLabel().isEmpty()) {
        label = org.rascalmpl.interpreter.utils.Names.name(this
            .getLabel().getName());
      }
      __eval.__getAccumulators().push(
          new Accumulator(__eval.__getVf(), label));
      try {
        // a while statement is different from a for statement, the body of
        // the while can influence the
        // variables that are used to test the condition of the loop
        // while does not iterate over all possible matches, rather it
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.Accumulator

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.