Package org.rascalmpl.interpreter.matching

Examples of org.rascalmpl.interpreter.matching.IBooleanResult


      __eval.setCurrentAST(this);
      __eval.notifyAboutSuspension(this);
     
      org.rascalmpl.ast.Statement body = this.getBody();
      org.rascalmpl.ast.Expression generator = this.getCondition();
      IBooleanResult gen;
      Environment old = __eval.getCurrentEnvt();
      String label = null;
      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 {
              body.interpret(__eval);
            }
            catch (BreakException e) {
              value = __eval.__getAccumulators().pop().done();
              return org.rascalmpl.interpreter.result.ResultFactory
                  .makeResult(value.getType(), value, __eval);
            }
            catch (ContinueException e) {
              // just continue;
            }
 
            gen = generator.getBacktracker(__eval);
            gen.init();
            if (__eval.isInterrupted()) {
              throw new InterruptException(__eval.getStackTrace(), __eval.getCurrentAST().getLocation());
            }
            if (!(gen.hasNext() && gen.next())) {
              value = __eval.__getAccumulators().pop().done();
              return org.rascalmpl.interpreter.result.ResultFactory
                  .makeResult(value.getType(), value, __eval);
            }
          } finally {
View Full Code Here


   
    return args;
  }
 
  private static Result<IValue> evalBooleanExpression(org.rascalmpl.ast.Expression x, IEvaluatorContext ctx) {
    IBooleanResult mp = x.getBacktracker(ctx);
    mp.init();
//    while (mp.hasNext()) {
//      if (ctx.isInterrupted())
//        throw new InterruptException(ctx.getStackTrace());
//      if (mp.next()) {
//        return ResultFactory.bool(true, ctx);
//      }
//    }
    return makeResult(TypeFactory.getInstance().boolType(), ctx.getValueFactory().bool(mp.hasNext() && mp.next()), ctx);
  }
View Full Code Here

        hasMatched = true;
       
        if (repl.getType().isString()){
          int start;
          int end;
          IBooleanResult lastPattern = e.getMatchPattern();
          if (lastPattern == null) {
            throw new ImplementationError("No last pattern known");
          }
          if (lastPattern instanceof RegExpPatternValue){
            start = ((RegExpPatternValue)lastPattern).getStart();
View Full Code Here

      __eval.notifyAboutSuspension(this);     
     
      Environment old = __eval.getCurrentEnvt();
      try {
        __eval.pushEnv();
        IBooleanResult gen = this.getBacktracker(__eval);
        gen.init();
        if (gen.hasNext() && gen.next()) {
          return org.rascalmpl.interpreter.result.ResultFactory.makeResult(TF.boolType(),
              VF.bool(true), __eval);
        }
        return org.rascalmpl.interpreter.result.ResultFactory.makeResult(TF.boolType(),
            VF.bool(false), __eval);
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.matching.IBooleanResult

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.