Package dk.brics.string.intermediate

Examples of dk.brics.string.intermediate.ArrayNew


      factory.addStatement(new StringInit(temp, auto));
     
      switch (resultType) {
      case ARRAY:
        result = factory.createVariable(resultType);
        factory.addStatement(new ArrayNew(result));
        factory.addStatement(new ArrayWriteElement(result, temp));
        break;
     
      case STRINGBUFFER:
        result = factory.createVariable(resultType);
View Full Code Here


            }
           
            // String.toCharArray()
            else if (methodName.equals("toCharArray") && numArgs == 0) {
                Variable result = factory.createVariable(VariableType.ARRAY);
                factory.addStatement(new ArrayNew(result));
                Variable charAt = factory.createVariable(VariableType.PRIMITIVE);
                factory.addStatement(new BasicUnaryOp(charAt, callee, new CharAt2()));
                factory.addStatement(new ArrayWriteElement(result, charAt));
                return result;
            }
View Full Code Here

      else if (methodName.equals("size")) {
        return factory.getNothing();
      }
      else if (methodName.equals("toArray") && numArgs == 0) {
        Variable result = factory.createVariable(VariableType.ARRAY);
        factory.addStatement(new ArrayNew(result));
        factory.addStatement(new ArrayAddAll(result, callee));
        return result;
      }
      else if (methodName.equals("toArray") && numArgs == 1) {
        Variable result = factory.createVariable(VariableType.ARRAY);
       
        // the elements MIGHT be stored into the argument
        factory.startBranch();
        // 1) not stored in argument
        {
          factory.addStatement(new ArrayNew(result));
          factory.useBranch();
        }
        // 2) stored in argument
        {
          // note: existing elements in the array may remain
View Full Code Here

      else if (methodName.equals("reverse")) {
        return factory.getNothing();
      }
      else if (methodName.equals("singleton") && numArgs == 1 && isString(expr.getArg(0).getType())) {
        Variable v = factory.createVariable(VariableType.ARRAY);
        factory.addStatement(new ArrayNew(v));
        factory.addStatement(new ArrayWriteElement(v, arguments.get(0)));
        return v;
      }
      else if (methodName.equals("singletonList") && numArgs == 1 && isString(expr.getArg(0).getType())) {
        Variable v = factory.createVariable(VariableType.ARRAY);
        factory.addStatement(new ArrayNew(v));
        factory.addStatement(new ArrayWriteElement(v, arguments.get(0)));
        return v;
      }
    }
   
View Full Code Here

      }
    }
    // known collection type
    else if (trustedCollections.contains(declaringClass.getName())) {
      if (expr.getArgCount() == 0) {
        factory.addStatement(new ArrayNew(callee));
        return true;
      }
      //TODO more constructors
    }
   
View Full Code Here

      addStatement(new StringBufferInit(to, temp));
      break;
     
    case ARRAY:
      // make an array with the empty language of possible strings, by not writing any strings to it
      addStatement(new ArrayNew(to));
      break;
     
    case PRIMITIVE:
        assert false;
        break;
View Full Code Here

      break;
    case STRINGBUFFER:
      addStatement(new StringBufferInit(v, makeAnyStringVariable()));
      break;
    case ARRAY:
      addStatement(new ArrayNew(v));
      addStatement(new ArrayWriteElement(v, makeAnyStringVariable()));
      break;
    case PRIMITIVE:
        addStatement(new PrimitiveInit(v, Automaton.makeAnyChar()));
        break;
View Full Code Here

TOP

Related Classes of dk.brics.string.intermediate.ArrayNew

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.