Package railo.transformer.bytecode.expression

Examples of railo.transformer.bytecode.expression.Expression


    Position line = data.cfml.getPosition();
   
    // Init Parameter
    char quoter = data.cfml.getCurrentLower();
    StringBuffer str=new StringBuffer();
    Expression expr=null;
   
    while(data.cfml.hasNext()) {
      data.cfml.next();
      // check sharp
      if(data.cfml.isCurrent('#')) {
       
        // Ecaped sharp
        if(data.cfml.isNext('#')){
          data.cfml.next();
          str.append('#');
        }
        // get Content of sharp
        else {
          data.cfml.next();
                    comments(data);
          Expression inner=assignOp(data);
                    comments(data);
          if (!data.cfml.isCurrent('#'))
            throw new TemplateException(data.cfml,"Invalid Syntax Closing [#] not found");
         
          ExprString exprStr=null;
View Full Code Here


    Identifier id = identifier(data,false,true);
    if(id == null) {
        if (!data.cfml.forwardIfCurrent('(')) return null;
       
            comments(data);
      Expression expr = assignOp(data);

      if (!data.cfml.forwardIfCurrent(')'))
        throw new TemplateException(
          data.cfml,
          "Invalid Syntax Closing [)] not found");
View Full Code Here

     
      exprName=LitString.toExprString(fullName.toString());
    }
    else {
     
      Expression str=string(data);
      if(str!=null){
        exprName=CastString.toExprString(str);
      }
      else {
        data.cfml.setPos(start);
View Full Code Here

   * @throws TemplateException
  */
  private Expression sharp(ExprData data) throws TemplateException {
    if(!data.cfml.forwardIfCurrent('#'))
      return null;
    Expression expr;
        comments(data);
        boolean old=data.allowLowerThan;
        data.allowLowerThan=true;
    expr = assignOp(data);
    data.allowLowerThan=old;
View Full Code Here

     
   
    // Query query=pc.getQuery(@query);
    tag.setQuery(adapter.newLocal(Types.QUERY));
    adapter.loadArg(0);
    Expression val = tag.getAttribute("query").getValue();
    val.writeOut(bc, Expression.MODE_REF);
    if(val instanceof LitString)
      adapter.invokeVirtual(Types.PAGE_CONTEXT, TagLoop.GET_QUERY_STRING);
    else
      adapter.invokeVirtual(Types.PAGE_CONTEXT, TagLoop.GET_QUERY_OBJ);
   
View Full Code Here

        // required
        ExprBoolean _req = arg.getRequired();
        boolean useReq=!canHaveKey || toBoolean(_req,null)!=Boolean.FALSE;
       
        // default-type
        Expression _def = arg.getDefaultValueType();
        boolean useDef=!canHaveKey || toInt(_def,-1)!=FunctionArgument.DEFAULT_TYPE_NULL;
       
        // pass by reference
        ExprBoolean _pass = arg.isPassByReference();
        boolean usePass=!canHaveKey || toBoolean(_pass,null)!=Boolean.TRUE;
       
        // display-hint
        ExprString _dsp = arg.getDisplayName();
        boolean useDsp=!canHaveKey || !isLiteralEmptyString(_dsp);
       
        // hint
        ExprString _hint = arg.getHint();
        boolean useHint=!canHaveKey || !isLiteralEmptyString(_hint);
       
        // meta
        Map _meta = arg.getMetaData();
        boolean useMeta=!canHaveKey || (_meta!=null && !_meta.isEmpty());
        int functionIndex=7;
        if(!useMeta) {
          functionIndex--;
          if(!useHint) {
            functionIndex--;
            if(!useDsp){
                functionIndex--;
                if(!usePass) {
                  functionIndex--;
                  if(!useDef) {
                    functionIndex--;
                    if(!useReq) {
                      functionIndex--;
                      if(!useType){
                        functionIndex--;
                      }
                    }
                  }
                }
            }
          }
        }
      // write out arguments 
        ga.dup();
            ga.push(i);
             
            // new FunctionArgument(...)
            ga.newInstance(canHaveKey && functionIndex<INIT_FAI_KEY_LIGHT.length?FUNCTION_ARGUMENT_LIGHT:FUNCTION_ARGUMENT_IMPL);
        ga.dup();
        Variable.registerKey(bc,arg.getName(),false);
       
        // type
        if(functionIndex>=INIT_FAI_KEY.length-7) {
          _strType.writeOut(bc, Expression.MODE_REF);
          bc.getAdapter().push(_type);
        }
        // required
        if(functionIndex>=INIT_FAI_KEY.length-6)_req.writeOut(bc, Expression.MODE_VALUE);
        // default value
        if(functionIndex>=INIT_FAI_KEY.length-5)_def.writeOut(bc, Expression.MODE_VALUE);
        // pass by reference
        if(functionIndex>=INIT_FAI_KEY.length-4)_pass.writeOut(bc, Expression.MODE_VALUE);
        // display-name
        if(functionIndex>=INIT_FAI_KEY.length-3)_dsp.writeOut(bc, Expression.MODE_REF);
        // hint
View Full Code Here

    else if("description".equals(name))  this.description=toLitString(name,attr.getValue());
    else if("returnformat".equals(name))this.returnFormat=toLitString(name,attr.getValue());
    else if("securejson".equals(name))  this.secureJson=toLitBoolean(name,attr.getValue());
    else if("verifyclient".equals(name))  this.verifyClient=toLitBoolean(name,attr.getValue());
    else if("localmode".equals(name))  {
      Expression v = attr.getValue();
      if(v!=null) {
        String str = ASMUtil.toString(v,null);
        if(!StringUtil.isEmpty(str)){
          int mode = AppListenerUtil.toLocalMode(str, -1);
          if(mode!=-1) this.localMode=LitInteger.toExpr(mode);
          else throw new BytecodeException("Attribute localMode of the Tag Function, must be a literal value (modern, classic, true or false)",getStart());
        }
      }
    }
    else if("cachedwithin".equals(name))  {
      try {
        this.cachedWithin=ASMUtil.timeSpanToLong(attr.getValue());
      } catch (EvaluatorException e) {
        throw new TemplateException(e.getMessage());
      }
    }
    else if("modifier".equals(name))  {
      Expression val = attr.getValue();
      if(val instanceof Literal) {
        Literal l=(Literal) val;
        String str = StringUtil.emptyIfNull(l.getString()).trim();
        if("abstract".equalsIgnoreCase(str))_abstract=true;
        else if("final".equalsIgnoreCase(str))_final=true;
View Full Code Here

   * @see railo.transformer.bytecode.Body#addStatement(railo.transformer.bytecode.Statement)
   */
    public void addStatement(Statement statement) {
       
        if(statement instanceof PrintOut) {
          Expression expr = ((PrintOut)statement).getExpr();
          if(expr instanceof LitString && concatPrintouts(((LitString)expr).getString())) return;
        }
        statement.setParent(this);
        this.statements.add(statement);
        last=statement;
View Full Code Here

  }
 
  private boolean concatPrintouts(String str) {
    if(last instanceof PrintOut)  {
      PrintOut po=(PrintOut) last;
      Expression expr = po.getExpr();
      if(expr instanceof LitString) {
        LitString lit=(LitString)expr;
        if(lit.getString().length()<1024) {
          po.setExpr(LitString.toExprString(lit.getString().concat(str),lit.getStart(),lit.getEnd()));
          return true;
View Full Code Here

   *
   * @see railo.transformer.bytecode.statement.tag.TagBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter)
   */
  public void _writeOut(BytecodeContext bc) throws BytecodeException {
    Attribute attr = getAttribute("expr");
    Expression expr=null;
    if(attr!=null)expr=attr.getValue();
    new Return(expr,expr.getStart(),expr.getEnd()).writeOut(bc);
  }
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.expression.Expression

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.