Package railo.transformer.bytecode.statement

Examples of railo.transformer.bytecode.statement.TryCatchFinally$Catch


    if(!data.cfml.forwardIfCurrent("try",'{') && !data.cfml.forwardIfCurrent("try ") && !data.cfml.forwardIfCurrent("try",'/'))
      return null;
    data.cfml.previous();

    Body body=new BodyBase();
    TryCatchFinally tryCatchFinally=new TryCatchFinally(body,data.cfml.getPosition(),null);
   
    statement(data,body,CTX_TRY);
    comments(data);
   
    // catches
    short catchCount=0;
    while(data.cfml.forwardIfCurrent("catch",'(')) {
      catchCount++;
      comments(data);
     
      // type
      int pos=data.cfml.getPos();
      Position line=data.cfml.getPosition();
      Expression name = null,type = null;
     
      StringBuffer sbType=new StringBuffer();
            String id;
            while(true) {
              id=identifier(data,false);
                if(id==null)break;
                sbType.append(id);
                data.cfml.removeSpace();
                if(!data.cfml.forwardIfCurrent('.'))break;
                sbType.append('.');
                data.cfml.removeSpace();
            }
       
           
      if(sbType.length()==0) {
          type=string(data);
          if(type==null)         
              throw new TemplateException(data.cfml,"a catch statement must begin with the throwing type (query, application ...).");
      }
      else {
        type=LitString.toExprString(sbType.toString());
      }
           
           
      //name = expression();
      comments(data);
     
      // name
      if(!data.cfml.isCurrent(')')) {
        name=expression(data);
      }
      else {
        data.cfml.setPos(pos);
        name=expression(data);
        type = LitString.toExprString( "any" );
      }
      comments(data);

            Body b=new BodyBase();
      try {
        tryCatchFinally.addCatch(type,name,b,line);
      }
      catch (BytecodeException e) {
        throw new TemplateException(data.cfml,e.getMessage());
      }
      comments(data);
     
      if(!data.cfml.forwardIfCurrent(')')) throw new TemplateException(data.cfml,"invalid catch statement, missing closing )");
     
            statement(data,b,CTX_CATCH);
      comments(data)
    }
       
   
// finally
     if(finallyStatement(data,tryCatchFinally)) {
      comments(data);
     }
     else if(catchCount==0)
      throw new TemplateException(data.cfml,"a try statement must have at least one catch statement");
   
        //if(body.isEmpty()) return null;
    tryCatchFinally.setEnd(data.cfml.getPosition());
    return tryCatchFinally;
  }
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.statement.TryCatchFinally$Catch

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.