Package railo.runtime.exp

Examples of railo.runtime.exp.TemplateException


        comments(data);
       
    try {
      return LitDouble.toExprDouble(Caster.toDoubleValue(rtn.toString()),line,data.cfml.getPosition());
    } catch (CasterException e) {
      throw new TemplateException(data.cfml,e.getMessage());
    }
   
  }
View Full Code Here


       
            comments(data);
      Expression expr = assignOp(data);

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

    }
    while (data.cfml.forwardIfCurrent(','));
    comments(data);
     
    if (!data.cfml.forwardIfCurrent(end))
      throw new TemplateException(data.cfml,"Invalid Syntax Closing ["+end+"] not found");
    comments(data);
    Variable var=new Variable(line,data.cfml.getPosition());
    var.addMember(bif);
    return var;
  }
View Full Code Here

        // Extract next Var String
                comments(data);
                Position line=data.cfml.getPosition();
                name = identifier(data,true);
        if(name==null)
          throw new TemplateException(data.cfml, "Invalid identifier");
                comments(data);
        nameProp=Identifier.toIdentifier(name,line,data.cfml.getPosition());
        namePropUC=Identifier.toIdentifier(name,data.settings.dotNotationUpper?Identifier.CASE_UPPER:Identifier.CASE_ORIGNAL,line,data.cfml.getPosition());
      }
      // []
      else if (data.cfml.forwardIfCurrent('[')) {
       
        // get Next Var
        nameProp = structElement(data);
        namePropUC=nameProp;
        // Valid Syntax ???
        if (!data.cfml.forwardIfCurrent(']'))
          throw new TemplateException(
            data.cfml,
            "Invalid Syntax Closing []] not found");
      }
      /* / :
      else if (data.cfml.forwardIfCurrent(':')) {
View Full Code Here

    // get Function Library
    checkLibrary=checkLibrary && data.flibs!=null;
    FunctionLibFunction flf = null;
    if (checkLibrary) {
      if(!(name instanceof Literal))
        throw new TemplateException(data.cfml,"syntax error"); // should never happen!
     
      for (int i = 0; i < data.flibs.length; i++) {
        flf = data.flibs[i].getFunction(((Literal)name).getString());
        if (flf != null)break;
      }
      if (flf == null) {
        checkLibrary = false;
      }
    }
    // Element Function
    FunctionMember fm;
    if(checkLibrary) {
      BIF bif=new BIF(name,flf);
      bif.setArgType(flf.getArgType());
      bif.setClass(flf.getClazz());
      bif.setReturnType(flf.getReturnTypeAsString());
      fm=bif;
     
      if(flf.getArgType()== FunctionLibFunction.ARG_DYNAMIC && flf.hasDefaultValues()){
            ArrayList<FunctionLibFunctionArg> args = flf.getArg();
        Iterator<FunctionLibFunctionArg> it = args.iterator();
            FunctionLibFunctionArg arg;
            while(it.hasNext()){
              arg=it.next();
              if(arg.getDefaultValue()!=null)
                bif.addArgument(
                    new NamedArgument(
                        LitString.toExprString(arg.getName()),
                        LitString.toExprString(arg.getDefaultValue()),
                        arg.getTypeAsString(),false
                        ));
            }
      }
    }
    else {
      fm = new UDF(name);
    }
   
   
   

    // Function Attributes
    ArrayList<FunctionLibFunctionArg> arrFuncLibAtt = null;
    int libLen = 0;
    if (checkLibrary) {
      arrFuncLibAtt = flf.getArg();
      libLen = arrFuncLibAtt.size();
    }
    int count = 0;
    do {
      data.cfml.next();
            comments(data);

      // finish
      if (count==0 && data.cfml.isCurrent(')'))
        break;

      // too many Attributes
      boolean isDynamic=false;
      int max=-1;
      if(checkLibrary) {
        isDynamic=flf.getArgType()==FunctionLibFunction.ARG_DYNAMIC;
        max=flf.getArgMax();
      // Dynamic
        if(isDynamic) {
          if(max!=-1 && max <= count)
            throw new TemplateException(
              data.cfml,
              "too many Attributes in function [" + ASMUtil.display(name) + "]");
        }
      // Fix
        else {
          if(libLen <= count){
           
            TemplateException te = new TemplateException(
              data.cfml,
              "too many Attributes in function call [" + ASMUtil.display(name) + "]");
            UDFUtil.addFunctionDoc(te, flf);
            throw te;
          }
        }
       
      }
     
      //Argument arg;
      if (checkLibrary && !isDynamic) {
        // current attribues from library
        FunctionLibFunctionArg funcLibAtt =arrFuncLibAtt.get(count);
        fm.addArgument(functionArgument(data,funcLibAtt.getTypeAsString(),false))
      }
      else {
        fm.addArgument(functionArgument(data,false));
      }

            comments(data);
      count++;
      if (data.cfml.isCurrent(')'))
        break;
    }
    while (data.cfml.isCurrent(','));

    // end with ) ??   
    if (!data.cfml.forwardIfCurrent(')'))
      throw new TemplateException(
        data.cfml,
        "Invalid Syntax Closing [)] for function ["
          + ASMUtil.display(name)
          + "] not found");

    // check min attributes
    if (checkLibrary && flf.getArgMin() > count){
      TemplateException te = new TemplateException(
        data.cfml,
        "too few attributes in function [" + ASMUtil.display(name) + "]");
      if(flf.getArgType()==FunctionLibFunction.ARG_FIX) UDFUtil.addFunctionDoc(te, flf);
      throw te;
    }
View Full Code Here

        data.allowLowerThan=true;
    expr = assignOp(data);
    data.allowLowerThan=old;
        comments(data);
    if (!data.cfml.forwardIfCurrent('#'))
      throw new TemplateException(
        data.cfml,
        "Syntax Error, Invalid Construct "+(data.cfml.length()<30?data.cfml.toString():""));
        comments(data);
    return expr;
  }
View Full Code Here

      }
     
      //if(data.cfml.isCurrent(' ') || data.cfml.isCurrent('>') || data.cfml.isCurrent("/>")) break;
     
      if(data.cfml.isCurrent('"') || data.cfml.isCurrent('#') || data.cfml.isCurrent('\'')) {
        throw new TemplateException(data.cfml,"simple attribute value can't contain ["+data.cfml.getCurrent()+"]");
      }
      sb.append(data.cfml.getCurrent());
      data.cfml.next();
    }
        comments(data);
View Full Code Here

            if(cfml.isCurrent("*/")) break;
            cfml.next();
        }
        if(!cfml.forwardIfCurrent("*/")){
            cfml.setPos(pos);
            throw new TemplateException(cfml,"comment is not closed");
        }
        if(isDocComment) {
          String comment = cfml.substring(pos-2,cfml.getPos()-pos);
          data.docComment=docCommentTransformer.transform(comment);
        }
View Full Code Here

      // this is already loaded, oherwise we where not here
      tl = TagLibFactory.loadFromSystem();
      return tl.getTag(name);
    }
    catch (TagLibException e) {
      throw new TemplateException(cfml,e);
    }
  }
View Full Code Here

              if(tlt==null) {
                data.cfml.setPos(pos);
                page.addPrintOut("</", null,null);
              }
            }
            else throw new TemplateException(cfml,"no matching start tag for end tag ["+tagLib.getNameSpaceAndSeparator()+name+"]");
     
          }
        }
        else
          throw new TemplateException(cfml,"Error while transforming CFML File");
      }while(true);
     
      // call-back of evaluators
      data.ep.run();
     
View Full Code Here

TOP

Related Classes of railo.runtime.exp.TemplateException

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.