protected Expression parseNewInstanceExpression(long p,Expression outerArg,Expression type) throws SyntaxError, IOException {
  int i=argIndex;
  expect(LPAREN);
  if (token != RPAREN) {
    addArgument(parseExpression());
    while (token == COMMA) {
      scan();
      addArgument(parseExpression());
    }
  }
  expect(RPAREN);
  ClassDefinition body=null;
  if (token == LBRACE && !(type instanceof TypeExpression)) {
    long tp=pos;
    Identifier superName=FieldExpression.toIdentifier(type);
    if (superName == null) {
      env.error(type.getWhere(),"type.expected");
    }
    Vector ext=new Vector(1);
    Vector impl=new Vector(0);
    ext.addElement(new IdentifierToken(idNull));
    if (token == IMPLEMENTS || token == EXTENDS) {
      env.error(pos,"anonymous.extends");
      parseInheritance(ext,impl);
    }
    body=parseClassBody(new IdentifierToken(tp,idNull),M_ANONYMOUS | M_LOCAL,EXPR,null,ext,impl,type.getWhere());
  }
  if (outerArg == null && body == null) {
    return new NewInstanceExpression(p,type,exprArgs(i));
  }
  return new NewInstanceExpression(p,type,exprArgs(i),outerArg,body);
}

protected Expression parseNewInstanceExpression ( long p , Expression outerArg , Expression type ) throws SyntaxError , IOException { int i = argIndex ; expect ( LPAREN ) ; if ( token != RPAREN ) { addArgument ( parseExpression ( ) ) ; while ( token == COMMA ) { scan ( ) ; addArgument ( parseExpression ( ) ) ; } } expect ( RPAREN ) ; ClassDefinition body = null ; if ( token == LBRACE && ! ( type instanceof TypeExpression ) ) { long tp = pos ; Identifier superName = FieldExpression . toIdentifier ( type ) ; if ( superName == null ) { env . error ( type . getWhere ( ) , "type.expected" ) ; } Vector ext = new Vector ( 1 ) ; Vector impl = new Vector ( 0 ) ; ext . addElement ( new IdentifierToken ( idNull ) ) ; if ( token == IMPLEMENTS || token == EXTENDS ) { env . error ( pos , "anonymous.extends" ) ; parseInheritance ( ext , impl ) ; } body = parseClassBody ( new IdentifierToken ( tp , idNull ) , M_ANONYMOUS | M_LOCAL , EXPR , null , ext , impl , type . getWhere ( ) ) ; } if ( outerArg == null && body == null ) { return new NewInstanceExpression ( p , type , exprArgs ( i ) ) ; } return new NewInstanceExpression ( p , type , exprArgs ( i ) , outerArg , body ) ; }
parse a new instance expression . should be called when the current token is the ' ( ' of the argument list .
