Package railo.transformer.bytecode.expression

Examples of railo.transformer.bytecode.expression.Expression


      isCFC = ASMUtil.getAncestorPage(tag).isComponent();
    } catch (BytecodeException e) {}

    Attribute attrName = tag.getAttribute("name");
    if(attrName!=null) {
      Expression expr = attrName.getValue();
      if(expr instanceof LitString && !isCFC){
        checkFunctionName(((LitString)expr).getString(),flibs);
      }
       
    }
    // attribute modifier
    Attribute attrModifier = tag.getAttribute("modifier");
    if(attrModifier!=null) {
      ExprString expr = CastString.toExprString(attrModifier.getValue());
      if(!(expr instanceof Literal))
        throw new EvaluatorException("Attribute modifier of the Tag Function, must be one of the following literal string values: [abstract] or [final]");
      String modifier=StringUtil.emptyIfNull(((Literal)expr).getString()).trim();
      if(!StringUtil.isEmpty(modifier) && !"abstract".equalsIgnoreCase(modifier) && !"final".equalsIgnoreCase(modifier))
        throw new EvaluatorException("Attribute modifier of the Tag Function, must be one of the following literal string values: [abstract] or [final]");
     
     
      boolean abstr = "abstract".equalsIgnoreCase(modifier);
      if(abstr)throwIfNotEmpty(tag);
    }
   
    // cachedWithin
    Attribute attrCachedWithin = tag.getAttribute("cachedwithin");
    if(attrCachedWithin!=null) {
      Expression val = attrCachedWithin.getValue();
      tag.addAttribute(new Attribute(attrCachedWithin.isDynamicType(), attrCachedWithin.getName(), LitLong.toExpr(ASMUtil.timeSpanToLong(val), null, null), "numeric"));
    }
   
    // Attribute localMode
    Attribute attrLocalMode = tag.getAttribute("localmode");
    if(attrLocalMode!=null) {
      Expression expr = attrLocalMode.getValue();
      String str = ASMUtil.toString(expr,null);
      if(!StringUtil.isEmpty(str) && AppListenerUtil.toLocalMode(str, -1)==-1)
        throw new EvaluatorException("Attribute localMode of the Tag Function, must be a literal value (modern, classic, true or false)");
      //boolean output = ((LitBoolean)expr).getBooleanValue();
      //if(!output) ASMUtil.removeLiterlChildren(tag, true);
    }
   
   
    // Attribute Output
    // "output=true" wird in "railo.transformer.cfml.attributes.impl.Function" geh�ndelt
    Attribute attrOutput = tag.getAttribute("output");
    if(attrOutput!=null) {
      Expression expr = CastBoolean.toExprBoolean(attrOutput.getValue());
      if(!(expr instanceof LitBoolean))
        throw new EvaluatorException("Attribute output of the Tag Function, must be a literal boolean value (true or false, yes or no)");
      //boolean output = ((LitBoolean)expr).getBooleanValue();
      //if(!output) ASMUtil.removeLiterlChildren(tag, true);
    }
   
    Attribute attrBufferOutput = tag.getAttribute("bufferoutput");
    if(attrBufferOutput!=null) {
      Expression expr = CastBoolean.toExprBoolean(attrBufferOutput.getValue());
      if(!(expr instanceof LitBoolean))
        throw new EvaluatorException("Attribute bufferOutput of the Tag Function, must be a literal boolean value (true or false, yes or no)");
      //boolean output = ((LitBoolean)expr).getBooleanValue();
      //if(!output) ASMUtil.removeLiterlChildren(tag, true);
    }
View Full Code Here


      String text=ASMUtil.getAttributeString(tag, "condition");

      try {
        ConfigImpl config=(ConfigImpl) ThreadLocalPageContext.getConfig();
        transformer = tagLib.getExprTransfomer();
        Expression expr=transformer.transform(ASMUtil.getAncestorPage(tag),null,flibs,config.getCoreTagLib().getScriptTags(),new CFMLString(text,"UTF-8"),TransfomerSettings.toSetting(ThreadLocalPageContext.getConfig(),null));
        tag.addAttribute(new Attribute(false,"condition",CastBoolean.toExprBoolean(expr),"boolean"));
      }
      catch (Exception e) {
        throw new EvaluatorException(e.getMessage());
      }
View Full Code Here

      ExprString typeValue = CastString.toExprString(_type.getValue());
      if(typeValue instanceof LitString) {
        String strType=((LitString)typeValue).getString();
        Attribute _default = tag.getAttribute("default");
        if(_default!=null) {
          Expression defaultValue = _default.getValue();
          if(defaultValue instanceof LitString) {
            String strDefault=((LitString)defaultValue).getString();
           
           
           
View Full Code Here

    
    while(it.hasNext()) {
      stat=(Statement) it.next();
      if(stat instanceof PrintOut) {
        PrintOut printOut = ((PrintOut)stat);
        Expression e = printOut.getExpr();
        if(!(e instanceof Literal)) {
          Expression expr=removeCastString(e);
         
          if(expr instanceof Variable) {
            // do not preserve BIF PreserveSingleQuotes return value
            Member member = ((Variable)expr).getFirstMember();
            if(member instanceof BIF) {
View Full Code Here

          adapter.invokeStatic(Types.CASTER, TO_PAGE_EXCEPTION);
      adapter.storeLocal(pe);
     
      Iterator<Tag> it = catches.iterator();
      Attribute attrType;
      Expression type;
      Label endAllIfs=new Label();
      Tag tagElse=null;
      while(it.hasNext()) {
        tag=it.next();
        Label endIf=new Label();
        attrType = tag.getAttribute("type");
        type=ANY;
        if(attrType!=null)type=attrType.getValue();

        if(type instanceof LitString && ((LitString)type).getString().equalsIgnoreCase("any")){
          tagElse=tag;
          continue;
        }
       
        ExpressionUtil.visitLine(bc, tag.getStart());
       
        // if(pe.typeEqual(@type)
        adapter.loadLocal(pe);
        type.writeOut(bc, Expression.MODE_REF);
        adapter.invokeVirtual(Types.PAGE_EXCEPTION, TYPE_EQUAL);
       
        adapter.ifZCmp(Opcodes.IFEQ, endIf);
          catchBody(bc,adapter,tag,pe,true,true);
         
View Full Code Here

          stat = it.next();
          if(stat==last) break;
         
          if(stat instanceof PrintOut){
            PrintOut po=(PrintOut) stat;
            Expression expr = po.getExpr();
            if(!(expr instanceof LitString) || !StringUtil.isWhiteSpace(((LitString)expr).getString())) {
              last=null;
              break;
            }
          }
        }
      }
    }
   
   
   
    Iterator<Statement> it = statements.iterator();
    boolean beforeLastArgument=last!=null;
    while (it.hasNext()) {
      stat = it.next();
      if(beforeLastArgument) {
        if(stat==last) {
          beforeLastArgument=false;
        }
        else if(stat instanceof PrintOut){
          PrintOut po=(PrintOut) stat;
          Expression expr = po.getExpr();
          if(expr instanceof LitString) {
            LitString ls=(LitString) expr;
            if(StringUtil.isWhiteSpace(ls.getString())) continue;
          }
        }
View Full Code Here

  }

  private void addArgument(Function func, Tag tag) {
    Attribute attr;
    // name
    Expression name = tag.removeAttribute("name").getValue();
   
    // type
    attr = tag.removeAttribute("type");
    Expression type = (attr == null) ? ANY : attr.getValue();

    // required
    attr = tag.removeAttribute("required");
    Expression required = (attr == null) ? LitBoolean.FALSE : attr
        .getValue();

    // default
    attr = tag.removeAttribute("default");
    Expression defaultValue = (attr == null) ? null : attr.getValue();
   
    // passby
    attr = tag.removeAttribute("passby");
    LitBoolean passByReference = LitBoolean.TRUE;
    if(attr!=null) {
      // i can cast irt to LitString because he evulator check this before
       String str = ((LitString)attr.getValue()).getString();
       if(str.trim().equalsIgnoreCase("value"))
         passByReference=LitBoolean.FALSE;
    }
   
   
    // displayname
    attr = tag.removeAttribute("displayname");
    Expression displayName = (attr == null) ? EMPTY : attr.getValue();

    // hint
    attr = tag.removeAttribute("hint");
    if (attr == null)
      attr = tag.removeAttribute("description");
   
    Expression hint;
    if(attr == null)hint=EMPTY;
    else hint=attr.getValue();
   
    func.addArgument(name, type, required, defaultValue, passByReference,displayName, hint,tag.getAttributes());
View Full Code Here

  private Function createFunction(Page page, Body body) throws BytecodeException {
    Attribute attr;

    // name
    Expression name = removeAttribute("name").getValue();
    /*if(name instanceof LitString) {
      ((LitString)name).upperCase();
    }*/
    // return
    attr = removeAttribute("returntype");
    // if(attr==null) attr = getAttribute("return");
    // if(attr==null) attr = getAttribute("type");
    Expression returnType = (attr == null) ? ANY : attr.getValue();

    // output
    attr = removeAttribute("output");
    Expression output = (attr == null) ? LitBoolean.TRUE : attr.getValue();
   
    // bufferOutput
    attr = removeAttribute("bufferoutput");
    Expression bufferOutput = (attr == null) ? null : attr.getValue();

    // modifier
    boolean _abstract=false,_final=false;
    attr = removeAttribute("modifier");
    if(attr!=null) {
      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;
      }
    }

    // access
    attr = removeAttribute("access");
    Expression access = (attr == null) ? PUBLIC : attr.getValue();

    // dspLabel
    attr = removeAttribute("displayname");
    Expression displayname = (attr == null) ? EMPTY : attr.getValue();

    // hint
    attr = removeAttribute("hint");
    Expression hint = (attr == null) ? EMPTY : attr.getValue();

    // description
    attr = removeAttribute("description");
    Expression description = (attr == null) ? EMPTY : attr.getValue();

    // returnformat
    attr = removeAttribute("returnformat");
    Expression returnFormat = (attr == null) ? null : attr.getValue();

    // secureJson
    attr = removeAttribute("securejson");
    Expression secureJson = (attr == null) ? null : attr.getValue();

    // verifyClient
    attr = removeAttribute("verifyclient");
    Expression verifyClient = (attr == null) ? null : attr.getValue();

    // localMode
    attr = removeAttribute("localmode");
    Expression localMode = (attr == null) ? null : attr.getValue();
   
   
   
    // cachedWithin
    long cachedWithin=0;
    attr = removeAttribute("cachedwithin");
    if(attr!=null) {
      Expression val = attr.getValue();
      if(val instanceof LitLong)
        cachedWithin=((LitLong)val).getLongValue();
    }
   
    String strAccess = ((LitString)access).getString();
View Full Code Here

      this.allowLowerThan=allowLowerThan;
    }
  }
 
  protected Expression transformAsString(ExprData data,String[] breakConditions) throws TemplateException {
    Expression el=null;
   
    // parse the houle Page String
        comments(data);   
       
    // String
View Full Code Here

  private Argument functionArgument(ExprData data, boolean varKeyUpperCase) throws TemplateException {
    return functionArgument(data,null,varKeyUpperCase);
  }
 
  private Argument functionArgument(ExprData data,String type, boolean varKeyUpperCase) throws TemplateException {
    Expression expr = assignOp(data);
    try{
      if (data.cfml.forwardIfCurrent(":")) {
        comments(data);
        return new NamedArgument(expr,assignOp(data),type,varKeyUpperCase);
      }
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.