Package org.rascalmpl.interpreter.staticErrors

Examples of org.rascalmpl.interpreter.staticErrors.UnsupportedSubscript


    Result<IValue> subsBase = (Result<IValue>)subscripts[0];
    if(subsBase == null)
      /*
       * Wild card not allowed as tuple subscript
       */
      throw new UnsupportedSubscript(type, null, ctx.getCurrentAST());
    if (!subsBase.getType().isInteger()){
      throw new UnsupportedSubscript(getTypeFactory().integerType(), subsBase.getType(), ctx.getCurrentAST());
    }
    IInteger index = (IInteger)subsBase.getValue();
    int idx = index.intValue();
    if(idx < 0){
      idx = idx + getValue().arity();
View Full Code Here


              rec.getType().getFieldType(0))) {
        ISet rel = (ISet) rec.getValue();
        IValue sub = subscript.getValue();

        if (rec.getType().getArity() != 2) {
          throw new UnsupportedSubscript(rec.getType(),
              subscript.getType(), this);
        }

        if (!__eval.__getValue().getType().isSubtypeOf(
            rec.getType().getFieldType(1))) {
          throw new UnexpectedType(
              rec.getType().getFieldType(1), __eval.__getValue()
                  .getType(), __eval.__getEval()
                  .getCurrentAST());
        }

        rel = rel.insert(__eval.__getEval().getValueFactory().tuple(
            sub, __eval.__getValue().getValue()));
        result = org.rascalmpl.interpreter.result.ResultFactory
            .makeResult(rec.getType(), rel, __eval.__getEval());
      } else {
        throw new UnsupportedSubscript(rec.getType(), subscript
            .getType(), this);
        // TODO implement other subscripts
      }

      return __eval.recur(this, result);
View Full Code Here

      Result<IValue> result;

      assert rec != null && rec.getValue() != null;
     
      if( !(first == null || first.getType().isInteger()) ){
        throw new UnsupportedSubscript(rec.getType(), first.getType(), this);
      }
         
      if( !(end == null || end.getType().isInteger()) ){
        throw new UnsupportedSubscript(rec.getType(), end.getType(), this);
      }
      int len =  rec.getType().isList() ? ((IList) rec.getValue()).length()
           : rec.getType().isString() ? ((IString) rec.getValue()).length()
           : rec.getType().isNode() ?((INode) rec.getValue()).arity()
           : 0 ;
View Full Code Here

      Result<IValue> result;

      assert rec != null && rec.getValue() != null;
     
      if( !(first == null || first.getType().isInteger()) ){
        throw new UnsupportedSubscript(rec.getType(), first.getType(), this);
      }
     
      if(!second.getType().isInteger()){
        throw new UnsupportedSubscript(rec.getType(), second.getType(), this);
      }
         
      if( !(end == null || end.getType().isInteger()) ){
        throw new UnsupportedSubscript(rec.getType(), end.getType(), this);
      }
     
      int len = rec.getType().isList() ? ((IList) rec.getValue()).length()
           : rec.getType().isString() ? ((IString) rec.getValue()).length()
           :  rec.getType().isNode() ?((INode) rec.getValue()).arity()
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.staticErrors.UnsupportedSubscript

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.