Package railo.transformer.bytecode

Examples of railo.transformer.bytecode.Statement


  }
  private boolean statement(ExprData data,Body parent,short context) throws TemplateException {
    short prior=data.context;
    data.context=context;
    comments(data);
    Statement child=null;
    if(data.cfml.forwardIfCurrent(';')){return true;}
    else if((child=ifStatement(data))!=null)         parent.addStatement(child);
    else if((child=propertyStatement(data,parent))!=nullparent.addStatement(child);
    else if((child=paramStatement(data,parent))!=nullparent.addStatement(child);
    else if((child=funcStatement(data,parent))!=null)    parent.addStatement(child);
View Full Code Here


  }
 

 
  private Statement tagStatement(ExprData data, Body parent) throws TemplateException {
    Statement child;
   
    //TagLibTag[] tags = getScriptTags(data);
    for(int i=0;i<data.scriptTags.length;i++){
      // single
      if(data.scriptTags[i].getScript().getType()==TagLibTagScript.TYPE_SINGLE) {
View Full Code Here

   * @see railo.transformer.cfml.evaluator.EvaluatorSupport#evaluate(org.w3c.dom.Element, railo.transformer.library.tag.TagLibTag)
   */

  public void evaluate(Tag tag,TagLibTag tlt) throws EvaluatorException {

    Statement pPage = tag.getParent();
    String className=tag.getTagLibTag().getTagClassName();
   
    // is direct in document
    if(!(pPage instanceof Page)){
     
      // is script Component
      Tag p = ASMUtil.getParentTag(tag);
      if(p.getTagLibTag().getName().equals("script") && (pPage = p.getParent()) instanceof Page){
       
        // move imports from script to component body
        List children = p.getBody().getStatements();
        Iterator it = children.iterator();
        Statement stat;
        Tag t;
        while(it.hasNext()){
          stat=(Statement) it.next();
          if(!(stat instanceof Tag)) continue;
          t=(Tag) stat;
          if(t.getTagLibTag().getName().equals("import")){
            tag.getBody().addStatement(t);
          }
        }
       
        // replace script with component 
        ASMUtil.replace(p, tag, false);
      }
      else
        throw new EvaluatorException("Wrong Context, tag "+tlt.getFullName()+" can't be inside other tags, tag is inside tag "+p.getFullname());
    }

    Page page=(Page) pPage;
   
    // is inside a file named cfc
    String src=page.getSource();
    int pos=src.lastIndexOf(".");
    if(!(pos!=-1 && pos<src.length() && src.substring(pos+1).equals("cfc")))
      throw new EvaluatorException("Wrong Context, "+tlt.getFullName()+" tag must be inside a file with extension cfc");
   
    // check if more than one component in document and remove any other data
    List stats = page.getStatements();
    Iterator it = stats.iterator();
    Statement stat;
    int count=0;
    while(it.hasNext()) {
      stat=(Statement) it.next();
      if(stat instanceof Tag) {
        tag=(Tag) stat;
View Full Code Here

   */
  public void evaluate(Tag tag,TagLibTag libTag) throws EvaluatorException {
    super.evaluate(tag,libTag);
    Body body = tag.getBody();
    List statments = body.getStatements();
    Statement stat;
    Iterator it = statments.iterator();
    Tag t;
    while(it.hasNext()) {
      stat=(Statement) it.next();
     
View Full Code Here

  }
 
  public static Statement getAncestorCatch(TagLib tagLib, Statement stat) {
    String name=tagLib.getNameSpaceAndSeparator()+"catch";
    Tag tag;
    Statement parent=stat;
    while(true)  {
      parent=parent.getParent();
      if(parent==null)return null;
      if(parent instanceof Tag)  {
        tag=(Tag) parent;
        if(tag.getFullname().equalsIgnoreCase(name))
          return tag;
View Full Code Here

       
       
  }
 
  public static TagOutput getParentTagOutput(TagOutput stat) {
    Statement parent = stat;
   
   
    while(true)  {
      parent=parent.getParent();
      if(parent==null)return null;
      if(parent instanceof TagOutputreturn (TagOutput) parent;
    }
  }
View Full Code Here

   * Gibt das uebergeordnete CFXD Tag Element zurueck, falls dies nicht existiert wird null zurueckgegeben.
   * @param el Element von dem das parent Element zurueckgegeben werden soll.
   * @return uebergeordnete CFXD Tag Element
   */
  public static Tag getParentTag(Tag tag)  {
    Statement p=tag.getParent();
    if(p==null)return null;
    p=p.getParent();
    if(p instanceof Tag) return (Tag) p;
    return null;
  }
View Full Code Here

  public static FlowControlContinue getAncestorContinueFCStatement(Statement stat, List<FlowControlFinal> finallyLabels, String label) {
    return (FlowControlContinue) getAncestorFCStatement(stat, finallyLabels, FlowControl.CONTINUE,label);
  }

  private static FlowControl getAncestorFCStatement(Statement stat, List<FlowControlFinal> finallyLabels, int flowType, String label) {
    Statement parent = stat;
    FlowControlFinal fcf;
    while(true)  {
      parent=parent.getParent();
      if(parent==null)return null;
      if(
         ((flowType==FlowControl.RETRY && parent instanceof FlowControlRetry) ||
         (flowType==FlowControl.CONTINUE && parent instanceof FlowControlContinue) ||
         (flowType==FlowControl.BREAK && parent instanceof FlowControlBreak))
         &&
        labelMatch((FlowControl)parent,label))  {
        if(parent instanceof ScriptBody){
          List<FlowControlFinal> _finallyLabels=finallyLabels==null?null:new ArrayList<FlowControlFinal>();
         
          FlowControl scriptBodyParent = getAncestorFCStatement(parent,_finallyLabels,flowType,label);
          if(scriptBodyParent!=null) {
            if(finallyLabels!=null){
              Iterator<FlowControlFinal> it = _finallyLabels.iterator();
              while(it.hasNext()){
                finallyLabels.add(it.next());
              }
            }
            return scriptBodyParent;
          }
          return (FlowControl)parent;
        }
        return (FlowControl) parent;
      }
     
      // only if not last
      if(finallyLabels!=null){
        fcf = parent.getFlowControlFinal();
        if(fcf!=null){
          finallyLabels.add(fcf);
        }
      }
     
View Full Code Here

  public static boolean hasAncestorTryStatement(Statement stat) {
    return getAncestorTryStatement(stat)!=null;
  }
 
  public static Statement getAncestorTryStatement(Statement stat) {
    Statement parent = stat;
    while(true)  {
      parent=parent.getParent();
      if(parent==null)return null;
     
      if(parent instanceof TagTry)  {
        return parent;
      }
View Full Code Here

   * @param el Startelement, von wo aus gesucht werden soll.
   * @param fullName Name des gesuchten Tags.
   * @return  �bergeornetes Element oder null.
   */
  public static Tag getAncestorTag(Tag tag, String fullName) {
    Statement parent=tag;
    while(true)  {
      parent=parent.getParent();
      if(parent==null)return null;
      if(parent instanceof Tag)  {
        tag=(Tag) parent;
        if(tag.getFullname().equalsIgnoreCase(fullName))
          return tag;
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.Statement

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.