Search in sources :

Example 21 with ExprString

use of lucee.transformer.expression.ExprString in project Lucee by lucee.

the class AbstrCFMLExprTransformer method structElement.

/**
 * Transfomiert ein Collection Element das in eckigen Klammern aufgerufen wird.
 * <br />
 * EBNF:<br />
 * <code>"[" impOp "]"</code>
 * @return CFXD Element
 * @throws TemplateException
 */
private ExprString structElement(ExprData data) throws TemplateException {
    comments(data);
    ExprString name = data.factory.toExprString(assignOp(data));
    if (name instanceof LitString)
        ((LitString) name).fromBracket(true);
    comments(data);
    return name;
}
Also used : LitString(lucee.transformer.expression.literal.LitString) ExprString(lucee.transformer.expression.ExprString)

Example 22 with ExprString

use of lucee.transformer.expression.ExprString in project Lucee by lucee.

the class AbstrCFMLExprTransformer method getFunctionMemberAttrs.

private int getFunctionMemberAttrs(ExprData data, ExprString name, boolean checkLibrary, Func fm, FunctionLibFunction flf) throws TemplateException {
    // Function Attributes
    ArrayList<FunctionLibFunctionArg> arrFuncLibAtt = null;
    // int libLen = 0;
    if (checkLibrary) {
        arrFuncLibAtt = flf.getArg();
    // libLen = arrFuncLibAtt.size();
    }
    int count = 0;
    do {
        data.srcCode.next();
        comments(data);
        // finish
        if (count == 0 && data.srcCode.isCurrent(')'))
            break;
        // Argument arg;
        if (checkLibrary && flf.getArgType() != FunctionLibFunction.ARG_DYNAMIC) {
            // current attribues from library
            String _type;
            try {
                _type = arrFuncLibAtt.get(count).getTypeAsString();
            } catch (IndexOutOfBoundsException e) {
                _type = null;
            }
            fm.addArgument(functionArgument(data, _type, false));
        } else {
            fm.addArgument(functionArgument(data, false));
        }
        comments(data);
        count++;
        if (data.srcCode.isCurrent(')'))
            break;
    } while (data.srcCode.isCurrent(','));
    if (!data.srcCode.forwardIfCurrent(')')) {
        if (name != null) {
            throw new TemplateException(data.srcCode, "Invalid Syntax Closing [)] for function [" + (flf != null ? flf.getName() : ASMUtil.display(name)) + "] not found");
        }
        throw new TemplateException(data.srcCode, "Invalid Syntax Closing [)] not found");
    }
    return count;
}
Also used : TemplateException(lucee.runtime.exp.TemplateException) LitString(lucee.transformer.expression.literal.LitString) ExprString(lucee.transformer.expression.ExprString) FunctionLibFunctionArg(lucee.transformer.library.function.FunctionLibFunctionArg)

Aggregations

ExprString (lucee.transformer.expression.ExprString)22 LitString (lucee.transformer.expression.literal.LitString)15 Expression (lucee.transformer.expression.Expression)9 GeneratorAdapter (org.objectweb.asm.commons.GeneratorAdapter)8 Type (org.objectweb.asm.Type)6 TemplateException (lucee.runtime.exp.TemplateException)4 FunctionAsExpression (lucee.transformer.bytecode.expression.FunctionAsExpression)4 Attribute (lucee.transformer.bytecode.statement.tag.Attribute)4 Variable (lucee.transformer.expression.var.Variable)4 Method (org.objectweb.asm.commons.Method)4 OpVariable (lucee.transformer.bytecode.op.OpVariable)3 EvaluatorException (lucee.transformer.cfml.evaluator.EvaluatorException)3 ExprBoolean (lucee.transformer.expression.ExprBoolean)3 ExprDouble (lucee.transformer.expression.ExprDouble)3 DataMember (lucee.transformer.expression.var.DataMember)3 Member (lucee.transformer.expression.var.Member)3 Position (lucee.transformer.Position)2 TransformerException (lucee.transformer.TransformerException)2 Body (lucee.transformer.bytecode.Body)2 Argument (lucee.transformer.bytecode.expression.var.Argument)2