Package railo.transformer.bytecode.statement.tag

Examples of railo.transformer.bytecode.statement.tag.TagOther


    if(data.context!=CTX_CFC || !data.cfml.forwardIfCurrent("property "))
      return null;
    Position line = data.cfml.getPosition();
   
    TagLibTag tlt = CFMLTransformer.getTLT(data.cfml,"property");
    Tag property=new TagOther(line,null);
    addMetaData(data, property,IGNORE_LIST_PROPERTY);
   

    boolean hasName=false,hasType=false;

    // TODO allow the following pattern property "a.b.C" d;
    //Expression t = string(data);
    // print.o("name:"+t.getClass().getName());
   
    int pos = data.cfml.getPos();
    String tmp=variableDec(data, true);
    if(!StringUtil.isEmpty(tmp)) {
      if(tmp.indexOf('.')!=-1) {
        property.addAttribute(new Attribute(false,"type",LitString.toExprString(tmp),"string"));
        hasType=true;
      }
      else {
        data.cfml.setPos(pos);
      }
    }
    else data.cfml.setPos(pos);
   
   
   
    // folgend wird tlt extra nicht uebergeben, sonst findet pruefung statt
    Attribute[] attrs = attributes(property,tlt,data,SEMI,  NULL,Boolean.FALSE,"name",true);
   
    checkSemiColonLineFeed(data,true,true);

    property.setTagLibTag(tlt);
    property.setScriptBase(true);
   
   
    Attribute attr;
   
    // first fill all regular attribute -> name="value"
    for(int i=attrs.length-1;i>=0;i--){
      attr=attrs[i];
      if(!attr.getValue().equals(NULL)){
        if(attr.getName().equalsIgnoreCase("name")){
          hasName=true;
          //attr=new Attribute(attr.isDynamicType(),attr.getName(),CastString.toExprString(attr.getValue()),"string");
        }
        else if(attr.getName().equalsIgnoreCase("type")){
          hasType=true;
          //attr=new Attribute(attr.isDynamicType(),attr.getName(),CastString.toExprString(attr.getValue()),"string");
        }
        property.addAttribute(attr);
      }
    }
   
    // now fill name named attributes -> attr1 attr2
   
    String first=null,second=null;
    for(int i=0;i<attrs.length;i++){
      attr=attrs[i];
     
      if(attr.getValue().equals(NULL)){
        // type
        if(first==null && (!hasName || !hasType)){
          first=attr.getName();
          //type=new Attribute(false,"type",LitString.toExprString(attr.getName()),"string");
          //property.addAttribute(type);
        }
        // name
        else if(second==null && !hasName && !hasType){
          second=attr.getName();
          //name=new Attribute(false,"name",LitString.toExprString(attr.getName()),"string");
          //property.addAttribute(name);
        }
        // attr with no value
        else {
          attr=new Attribute(true,attr.getName(),LitString.EMPTY,"string");
          property.addAttribute(attr);
        }
      }
    }

   
   
    if(first!=null) {
        hasName=true;
      if(second!=null){
        hasType=true;
        property.addAttribute(new Attribute(false,"name",LitString.toExprString(second),"string"));
        property.addAttribute(new Attribute(false,"type",LitString.toExprString(first),"string"));
      }
      else {
        property.addAttribute(new Attribute(false,"name",LitString.toExprString(first),"string"));
      }
    }
   
    if(!hasType)
      property.addAttribute(ANY);
   
    if(!hasName)
      throw new TemplateException(data.cfml,"missing name declaration for property");

    /*Tag property=new TagBase(line);
    property.setTagLibTag(tlt);
    property.addAttribute(new Attribute(false,"name",LitString.toExprString(name),"string"));
    property.addAttribute(new Attribute(false,"type",LitString.toExprString(type),"string"));
    */
    property.setEnd(data.cfml.getPosition());
   
    return property;
  }
View Full Code Here


   * @param line
   * @return

   */
  public Tag getTag(Position start,Position end) throws TagLibException {
    if(StringUtil.isEmpty(tttClass)) return new TagOther(start,end);
    try {
      return _getTag(start,end);
    }
    catch (ClassException e) {
      throw new TagLibException(e.getMessage());
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.statement.tag.TagOther

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.