Package railo.runtime.interpreter.ref.literal

Examples of railo.runtime.interpreter.ref.literal.LStringBuffer


    protected Ref string() throws PageException {
       
        // Init Parameter
        char quoter = cfml.getCurrentLower();
        //String str="";
        LStringBuffer str=new LStringBuffer();
       
        while(cfml.hasNext()) {
            cfml.next();
            // check sharp
            if(cfml.isCurrent('\\')) {
              if(cfml.isNext(quoter)){
                    cfml.next();
                    str.append(quoter);
                }
              else if(cfml.isNext('\\')){
                    cfml.next();
                    str.append('\\');
                }
              else if(cfml.isNext('"')){
                    cfml.next();
                    str.append('"');
                }
              else if(cfml.isNext('\'')){
                    cfml.next();
                    str.append('\'');
                }
              else if(cfml.isNext('t')){
                    cfml.next();
                    str.append('\t');
                }
              else if(cfml.isNext('n')){
                    cfml.next();
                    str.append('\n');
                }
              else if(cfml.isNext('b')){
                    cfml.next();
                    str.append('\b');
                }
              else if(cfml.isNext('f')){
                    cfml.next();
                    str.append('\f');
                }
              else if(cfml.isNext('r')){
                    cfml.next();
                    str.append('\r');
                }
              else if(cfml.isNext('u')){
                    cfml.next();
                    StringBuffer sb=new StringBuffer();
                    int i=0;
                   
                    for(;i<4 && cfml.hasNext();i++){
                      cfml.next();
                      sb.append(cfml.getCurrent());
                    }
                    if(i<4){
                      str.append("\\u");
                      str.append(sb.toString());
                    }
                    else{
                      int asc = NumberUtil.hexToInt(sb.toString(),-1);
                      if(asc!=-1)str.append((char)asc);
                      else {
                        str.append("\\u");
                          str.append(sb.toString());
                      }
                    }  
                   
                }
              else if(cfml.isNext('/')){
                    cfml.next();
                    str.append('/');
                }
                else {
                  str.append('\\');
                }    
            }
            else if(cfml.isCurrent(quoter)) {
                break;         
            }
            // all other character
            else {
                str.append(cfml.getCurrent());
            }
        }
        if(!cfml.forwardIfCurrent(quoter))
            throw new InterpreterException("Invalid String Literal Syntax Closing ["+quoter+"] not found");
       
View Full Code Here


    protected Ref string() throws PageException {
                       
        // Init Parameter
        char quoter = cfml.getCurrentLower();
        //String str="";
        LStringBuffer str=new LStringBuffer();
        Ref value=null;
       
        while(cfml.hasNext()) {
            cfml.next();
            // check sharp
            if(cfml.isCurrent('#')) {
                if(cfml.isNext('#')){
                    cfml.next();
                    str.append('#');
                }
                else {
                    cfml.next();
                    cfml.removeSpace();
                    if(!str.isEmpty() || value!=null) str.append(assignOp());
                    else value=assignOp();
                    cfml.removeSpace();
                    if (!cfml.isCurrent('#')) throw new InterpreterException("Invalid Syntax Closing [#] not found");
                }
            }
            else if(cfml.isCurrent(quoter)) {
                if(cfml.isNext(quoter)){
                    cfml.next();
                    str.append(quoter);
                }
                else {
                    break;
                }              
            }
            // all other character
            else {
                str.append(cfml.getCurrent());
            }
        }
        if(!cfml.forwardIfCurrent(quoter))
            throw new InterpreterException("Invalid String Literal Syntax Closing ["+quoter+"] not found");
       
        cfml.removeSpace();
        mode=STATIC;
        if(value!=null) {
            if(str.isEmpty()) return value;
            return new Concat(value,str);
        }
        return str;
    }
View Full Code Here

TOP

Related Classes of railo.runtime.interpreter.ref.literal.LStringBuffer

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.