Search in sources :

Example 6 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class TagHelper method writeOut.

/**
 * writes out the tag
 * @param tag
 * @param bc
 * @param doReuse
 * @throws TransformerException
 * @throws BundleException
 * @throws ClassException
 */
public static void writeOut(Tag tag, BytecodeContext bc, boolean doReuse, final FlowControlFinal fcf) throws TransformerException {
    final GeneratorAdapter adapter = bc.getAdapter();
    final TagLibTag tlt = tag.getTagLibTag();
    final ClassDefinition cd = tlt.getTagClassDefinition();
    final boolean fromBundle = cd.getName() != null;
    final Type currType;
    if (fromBundle) {
        try {
            if (Reflector.isInstaneOf(cd.getClazz(), BodyTag.class))
                currType = BODY_TAG;
            else
                currType = TAG;
        } catch (Exception e) {
            if (e instanceof TransformerException)
                throw (TransformerException) e;
            throw new TransformerException(e, tag.getStart());
        }
    } else
        currType = getTagType(tag);
    final int currLocal = adapter.newLocal(currType);
    Label tagBegin = new Label();
    Label tagEnd = new Label();
    ExpressionUtil.visitLine(bc, tag.getStart());
    // TODO adapter.visitLocalVariable("tag", "L"+currType.getInternalName()+";", null, tagBegin, tagEnd, currLocal);
    adapter.visitLabel(tagBegin);
    // tag=pc.use(String tagClassName,String tagBundleName, String tagBundleVersion, String fullname,int attrType) throws PageException {
    adapter.loadArg(0);
    adapter.checkCast(Types.PAGE_CONTEXT_IMPL);
    adapter.push(cd.getClassName());
    // has bundle info/version
    if (fromBundle) {
        // name
        adapter.push(cd.getName());
        // version
        if (cd.getVersion() != null)
            adapter.push(cd.getVersionAsString());
        else
            ASMConstants.NULL(adapter);
    }
    adapter.push(tlt.getFullName());
    adapter.push(tlt.getAttributeType());
    adapter.invokeVirtual(Types.PAGE_CONTEXT_IMPL, fromBundle ? USE5 : USE3);
    if (currType != TAG)
        adapter.checkCast(currType);
    adapter.storeLocal(currLocal);
    TryFinallyVisitor outerTcfv = new TryFinallyVisitor(new OnFinally() {

        @Override
        public void _writeOut(BytecodeContext bc) {
            adapter.loadArg(0);
            adapter.checkCast(Types.PAGE_CONTEXT_IMPL);
            adapter.loadLocal(currLocal);
            if (cd.getName() != null) {
                adapter.push(cd.getName());
                if (cd.getVersion() != null)
                    adapter.push(cd.getVersionAsString());
                else
                    ASMConstants.NULL(adapter);
            }
            adapter.invokeVirtual(Types.PAGE_CONTEXT_IMPL, fromBundle ? RE_USE3 : RE_USE1);
        }
    }, null);
    if (doReuse)
        outerTcfv.visitTryBegin(bc);
    // appendix
    if (tlt.hasAppendix()) {
        adapter.loadLocal(currLocal);
        adapter.push(tag.getAppendix());
        if (// PageContextUtil.setAppendix(tag,appendix)
        fromBundle)
            ASMUtil.invoke(ASMUtil.STATIC, adapter, Types.TAG_UTIL, SET_APPENDIX2);
        else
            // tag.setAppendix(appendix)
            ASMUtil.invoke(ASMUtil.VIRTUAL, adapter, currType, SET_APPENDIX1);
    }
    // hasBody
    boolean hasBody = tag.getBody() != null;
    if (tlt.isBodyFree() && tlt.hasBodyMethodExists()) {
        adapter.loadLocal(currLocal);
        adapter.push(hasBody);
        if (// PageContextUtil.setAppendix(tag,appendix)
        fromBundle)
            ASMUtil.invoke(ASMUtil.STATIC, adapter, Types.TAG_UTIL, HAS_BODY2);
        else
            // tag.setAppendix(appendix)
            ASMUtil.invoke(ASMUtil.VIRTUAL, adapter, currType, HAS_BODY1);
    }
    // default attributes (get overwritten by attributeCollection because of that set before)
    setAttributes(bc, tag, currLocal, currType, true, fromBundle);
    // attributeCollection
    Attribute attrColl = tag.getAttribute("attributecollection");
    if (attrColl != null) {
        int attrType = tag.getTagLibTag().getAttributeType();
        if (TagLibTag.ATTRIBUTE_TYPE_NONAME != attrType) {
            tag.removeAttribute("attributecollection");
            // TagUtil.setAttributeCollection(Tag, Struct)
            adapter.loadArg(0);
            adapter.loadLocal(currLocal);
            if (currType != TAG)
                adapter.cast(currType, TAG);
            // /
            TagLibTagAttr[] missings = tag.getMissingAttributes();
            if (!ArrayUtil.isEmpty(missings)) {
                ArrayVisitor av = new ArrayVisitor();
                av.visitBegin(adapter, MISSING_ATTRIBUTE, missings.length);
                int count = 0;
                TagLibTagAttr miss;
                for (int i = 0; i < missings.length; i++) {
                    miss = missings[i];
                    av.visitBeginItem(adapter, count++);
                    bc.getFactory().registerKey(bc, bc.getFactory().createLitString(miss.getName()), false);
                    adapter.push(miss.getType());
                    if (ArrayUtil.isEmpty(miss.getAlias()))
                        adapter.invokeStatic(MISSING_ATTRIBUTE, NEW_INSTANCE_MAX2);
                    else {
                        new LiteralStringArray(bc.getFactory(), miss.getAlias()).writeOut(bc, Expression.MODE_REF);
                        adapter.invokeStatic(MISSING_ATTRIBUTE, NEW_INSTANCE_MAX3);
                    }
                    av.visitEndItem(bc.getAdapter());
                }
                av.visitEnd();
            } else {
                ASMConstants.NULL(adapter);
            }
            // /
            attrColl.getValue().writeOut(bc, Expression.MODE_REF);
            adapter.push(attrType);
            adapter.invokeStatic(TAG_UTIL, SET_ATTRIBUTE_COLLECTION);
        }
    }
    // metadata
    Attribute attr;
    Map<String, Attribute> metadata = tag.getMetaData();
    if (metadata != null) {
        Iterator<Attribute> it = metadata.values().iterator();
        while (it.hasNext()) {
            attr = it.next();
            adapter.loadLocal(currLocal);
            adapter.push(attr.getName());
            attr.getValue().writeOut(bc, Expression.MODE_REF);
            if (fromBundle)
                ASMUtil.invoke(ASMUtil.STATIC, adapter, Types.TAG_UTIL, SET_META_DATA3);
            else
                ASMUtil.invoke(ASMUtil.VIRTUAL, adapter, currType, SET_META_DATA2);
        }
    }
    // set attributes
    setAttributes(bc, tag, currLocal, currType, false, fromBundle);
    // Body
    if (hasBody) {
        final int state = adapter.newLocal(Types.INT_VALUE);
        // int state=tag.doStartTag();
        adapter.loadLocal(currLocal);
        ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_START_TAG);
        // adapter.invokeVirtual(currType, DO_START_TAG);
        adapter.storeLocal(state);
        // if (state!=Tag.SKIP_BODY)
        Label endBody = new Label();
        adapter.loadLocal(state);
        adapter.push(javax.servlet.jsp.tagext.Tag.SKIP_BODY);
        adapter.visitJumpInsn(Opcodes.IF_ICMPEQ, endBody);
        // pc.initBody(tag, state);
        adapter.loadArg(0);
        adapter.loadLocal(currLocal);
        adapter.loadLocal(state);
        adapter.invokeVirtual(Types.PAGE_CONTEXT, INIT_BODY);
        OnFinally onFinally = new OnFinally() {

            @Override
            public void _writeOut(BytecodeContext bc) {
                Label endIf = new Label();
                /*if(tlt.handleException() && fcf!=null && fcf.getAfterFinalGOTOLabel()!=null){
							ASMUtil.visitLabel(adapter, fcf.getFinalEntryLabel());
						}*/
                adapter.loadLocal(state);
                adapter.push(javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE);
                adapter.visitJumpInsn(Opcodes.IF_ICMPEQ, endIf);
                // ... pc.popBody();
                adapter.loadArg(0);
                adapter.invokeVirtual(Types.PAGE_CONTEXT, POP_BODY);
                adapter.pop();
                adapter.visitLabel(endIf);
                // tag.doFinally();
                if (tlt.handleException()) {
                    adapter.loadLocal(currLocal);
                    ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_FINALLY);
                // adapter.invokeVirtual(currType, DO_FINALLY);
                }
            // GOTO after execution body, used when a continue/break was called before
            /*if(fcf!=null) {
							Label l = fcf.getAfterFinalGOTOLabel();
							if(l!=null)adapter.visitJumpInsn(Opcodes.GOTO, l);
						}*/
            }
        };
        if (tlt.handleException()) {
            TryCatchFinallyVisitor tcfv = new TryCatchFinallyVisitor(onFinally, fcf);
            tcfv.visitTryBegin(bc);
            doTry(bc, adapter, tag, currLocal, currType, fromBundle);
            int t = tcfv.visitTryEndCatchBeging(bc);
            // tag.doCatch(t);
            adapter.loadLocal(currLocal);
            adapter.loadLocal(t);
            // adapter.visitVarInsn(Opcodes.ALOAD,t);
            ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_CATCH);
            // adapter.invokeVirtual(currType, DO_CATCH);
            tcfv.visitCatchEnd(bc);
        } else {
            TryFinallyVisitor tfv = new TryFinallyVisitor(onFinally, fcf);
            tfv.visitTryBegin(bc);
            doTry(bc, adapter, tag, currLocal, currType, fromBundle);
            tfv.visitTryEnd(bc);
        }
        adapter.visitLabel(endBody);
    } else {
        // tag.doStartTag();
        adapter.loadLocal(currLocal);
        ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_START_TAG);
        // adapter.invokeVirtual(currType, DO_START_TAG);
        adapter.pop();
    }
    // if (tag.doEndTag()==Tag.SKIP_PAGE) throw new Abort(0<!-- SCOPE_PAGE -->);
    Label endDoEndTag = new Label();
    adapter.loadLocal(currLocal);
    ASMUtil.invoke(fromBundle ? ASMUtil.INTERFACE : ASMUtil.VIRTUAL, adapter, currType, DO_END_TAG);
    // adapter.invokeVirtual(currType, DO_END_TAG);
    adapter.push(javax.servlet.jsp.tagext.Tag.SKIP_PAGE);
    adapter.visitJumpInsn(Opcodes.IF_ICMPNE, endDoEndTag);
    adapter.push(Abort.SCOPE_PAGE);
    adapter.invokeStatic(ABORT, NEW_INSTANCE);
    adapter.throwException();
    adapter.visitLabel(endDoEndTag);
    if (doReuse) {
        // } finally{pc.reuse(tag);}
        outerTcfv.visitTryEnd(bc);
    }
    adapter.visitLabel(tagEnd);
    ExpressionUtil.visitLine(bc, tag.getEnd());
}
Also used : TagLibTagAttr(lucee.transformer.library.tag.TagLibTagAttr) TagLibTag(lucee.transformer.library.tag.TagLibTag) LiteralStringArray(lucee.transformer.bytecode.expression.type.LiteralStringArray) MissingAttribute(lucee.runtime.tag.MissingAttribute) Label(org.objectweb.asm.Label) ClassDefinition(lucee.runtime.db.ClassDefinition) ClassException(lucee.commons.lang.ClassException) TransformerException(lucee.transformer.TransformerException) BundleException(org.osgi.framework.BundleException) Type(org.objectweb.asm.Type) OnFinally(lucee.transformer.bytecode.visitor.OnFinally) GeneratorAdapter(org.objectweb.asm.commons.GeneratorAdapter) TryCatchFinallyVisitor(lucee.transformer.bytecode.visitor.TryCatchFinallyVisitor) ArrayVisitor(lucee.transformer.bytecode.visitor.ArrayVisitor) TryFinallyVisitor(lucee.transformer.bytecode.visitor.TryFinallyVisitor) TransformerException(lucee.transformer.TransformerException) BytecodeContext(lucee.transformer.bytecode.BytecodeContext)

Example 7 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class AbstrCFMLScriptTransformer method _paramStatement.

private Tag _paramStatement(ExprData data, Body parent) throws TemplateException {
    if (!data.srcCode.forwardIfCurrent("param "))
        return null;
    Position line = data.srcCode.getPosition();
    TagLibTag tlt = CFMLTransformer.getTLT(data.srcCode, "param", data.config.getIdentification());
    TagParam param = new TagParam(data.factory, line, null);
    // type
    boolean hasType = false;
    boolean hasName = false;
    int pos = data.srcCode.getPos();
    // first 2 arguments can be type/name directly
    String tmp = variableDec(data, true);
    do {
        if (!StringUtil.isEmpty(tmp)) {
            TagLibTagAttr attr = tlt.getAttribute(tmp.toLowerCase(), true);
            // name is not a defined attribute
            if (attr == null) {
                comments(data);
                // it could be a name followed by default value
                if (data.srcCode.forwardIfCurrent('=')) {
                    comments(data);
                    Expression v = attributeValue(data, true);
                    param.addAttribute(new Attribute(false, "name", data.factory.createLitString(tmp), "string"));
                    param.addAttribute(new Attribute(false, "default", v, "string"));
                    hasName = true;
                    // if we had a value this was already name
                    break;
                }
                // can be type or name
                int pos2 = data.srcCode.getPos();
                // first could be type, followed by name
                comments(data);
                String tmp2 = variableDec(data, true);
                if (!StringUtil.isEmpty(tmp2)) {
                    attr = tlt.getAttribute(tmp2.toLowerCase(), true);
                    if (attr == null) {
                        param.addAttribute(new Attribute(false, "name", data.factory.createLitString(tmp2), "string"));
                        param.addAttribute(new Attribute(false, "type", data.factory.createLitString(tmp), "string"));
                        if (data.srcCode.forwardIfCurrent('=')) {
                            Expression v = attributeValue(data, true);
                            param.addAttribute(new Attribute(false, "default", v, "string"));
                        }
                        hasName = true;
                        hasType = true;
                        break;
                    }
                }
                param.addAttribute(new Attribute(false, "name", data.factory.createLitString(tmp), "string"));
                data.srcCode.setPos(pos2);
                hasName = true;
            } else
                data.srcCode.setPos(pos);
        } else
            data.srcCode.setPos(pos);
    } while (false);
    // folgend wird tlt extra nicht uebergeben, sonst findet pruefung statt
    Attribute[] attrs = attributes(param, tlt, data, SEMI, data.factory.NULL(), Boolean.TRUE, "name", true, ',', false);
    checkSemiColonLineFeed(data, true, true, true);
    param.setTagLibTag(tlt);
    param.setScriptBase(true);
    Attribute attr;
    // first fill all regular attribute -> name="value"
    boolean hasDynamic = false;
    for (int i = attrs.length - 1; i >= 0; i--) {
        attr = attrs[i];
        if (!attr.getValue().equals(data.factory.NULL())) {
            if (attr.getName().equalsIgnoreCase("name")) {
                hasName = true;
                param.addAttribute(attr);
            } else if (attr.getName().equalsIgnoreCase("type")) {
                hasType = true;
                param.addAttribute(attr);
            } else if (attr.isDynamicType()) {
                hasName = true;
                if (hasDynamic)
                    throw attrNotSupported(data.srcCode, tlt, attr.getName());
                hasDynamic = true;
                param.addAttribute(new Attribute(false, "name", data.factory.createLitString(attr.getName()), "string"));
                param.addAttribute(new Attribute(false, "default", attr.getValue(), "any"));
            } else
                param.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(data.factory.NULL())) {
            // type
            if (first == null && (!hasName || !hasType)) {
                first = attr.getName();
            } else // name
            if (second == null && !hasName && !hasType) {
                second = attr.getName();
            } else // attr with no value
            {
                attr = new Attribute(true, attr.getName(), data.factory.EMPTY(), "string");
                param.addAttribute(attr);
            }
        }
    }
    if (first != null) {
        if (second != null) {
            hasName = true;
            hasType = true;
            if (hasDynamic)
                throw attrNotSupported(data.srcCode, tlt, first);
            hasDynamic = true;
            param.addAttribute(new Attribute(false, "name", data.factory.createLitString(second), "string"));
            param.addAttribute(new Attribute(false, "type", data.factory.createLitString(first), "string"));
        } else {
            param.addAttribute(new Attribute(false, hasName ? "type" : "name", data.factory.createLitString(first), "string"));
            hasName = true;
        }
    }
    if (!hasName)
        throw new TemplateException(data.srcCode, "missing name declaration for param");
    param.setEnd(data.srcCode.getPosition());
    return param;
}
Also used : TagLibTagAttr(lucee.transformer.library.tag.TagLibTagAttr) TagLibTag(lucee.transformer.library.tag.TagLibTag) TagParam(lucee.transformer.bytecode.statement.tag.TagParam) Position(lucee.transformer.Position) FunctionAsExpression(lucee.transformer.bytecode.expression.FunctionAsExpression) Expression(lucee.transformer.expression.Expression) Attribute(lucee.transformer.bytecode.statement.tag.Attribute) TemplateException(lucee.runtime.exp.TemplateException)

Example 8 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class AbstrCFMLScriptTransformer method _propertyStatement.

private final Tag _propertyStatement(ExprData data, Body parent) throws TemplateException {
    if (data.context != CTX_CFC || !data.srcCode.forwardIfCurrent("property "))
        return null;
    Position line = data.srcCode.getPosition();
    TagLibTag tlt = CFMLTransformer.getTLT(data.srcCode, "property", data.config.getIdentification());
    Tag property = new TagOther(data.factory, line, null);
    addMetaData(data, property, IGNORE_LIST_PROPERTY);
    boolean hasName = false, hasType = false;
    int pos = data.srcCode.getPos();
    String tmp = variableDec(data, true);
    if (!StringUtil.isEmpty(tmp)) {
        if (tmp.indexOf('.') != -1) {
            property.addAttribute(new Attribute(false, "type", data.factory.createLitString(tmp), "string"));
            hasType = true;
        } else {
            data.srcCode.setPos(pos);
        }
    } else
        data.srcCode.setPos(pos);
    // folgend wird tlt extra nicht uebergeben, sonst findet pruefung statt
    Attribute[] attrs = attributes(property, tlt, data, SEMI, data.factory.NULL(), Boolean.FALSE, "name", true, NO_ATTR_SEP, false);
    checkSemiColonLineFeed(data, true, true, false);
    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(data.factory.NULL())) {
            if (attr.getName().equalsIgnoreCase("name")) {
                hasName = true;
            } else if (attr.getName().equalsIgnoreCase("type")) {
                hasType = true;
            }
            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(data.factory.NULL())) {
            // type
            if (first == null && ((!hasName && !hasType) || !hasName)) {
                first = attr.getNameOC();
            } else // name
            if (second == null && !hasName && !hasType) {
                second = attr.getNameOC();
            } else // attr with no value
            {
                attr = new Attribute(true, attr.getName(), data.factory.EMPTY(), "string");
                property.addAttribute(attr);
            }
        }
    }
    if (first != null) {
        hasName = true;
        if (second != null) {
            hasType = true;
            property.addAttribute(new Attribute(false, "name", data.factory.createLitString(second), "string"));
            property.addAttribute(new Attribute(false, "type", data.factory.createLitString(first), "string"));
        } else {
            property.addAttribute(new Attribute(false, "name", data.factory.createLitString(first), "string"));
        }
    }
    if (!hasType) {
        property.addAttribute(new Attribute(false, "type", data.factory.createLitString("any"), "string"));
    }
    if (!hasName)
        throw new TemplateException(data.srcCode, "missing name declaration for property");
    /*Tag property=new TagBase(line);
		property.setTagLibTag(tlt);
		property.addAttribute(new Attribute(false,"name",data.factory.createLitString(name),"string"));
		property.addAttribute(new Attribute(false,"type",data.factory.createLitString(type),"string"));
		*/
    property.setEnd(data.srcCode.getPosition());
    return property;
}
Also used : TagLibTag(lucee.transformer.library.tag.TagLibTag) Position(lucee.transformer.Position) Attribute(lucee.transformer.bytecode.statement.tag.Attribute) TemplateException(lucee.runtime.exp.TemplateException) TagOther(lucee.transformer.bytecode.statement.tag.TagOther) TagLibTag(lucee.transformer.library.tag.TagLibTag) Tag(lucee.transformer.bytecode.statement.tag.Tag)

Example 9 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class AbstrCFMLScriptTransformer method createStaticTag.

public static TagOther createStaticTag(ExprData data, Position start) throws TemplateException {
    TagLibTag tlt = CFMLTransformer.getTLT(data.srcCode, "static", data.config.getIdentification());
    BodyBase body = new BodyBase(data.factory);
    TagOther tag = new TagOther(data.factory, start, data.srcCode.getPosition());
    tag.setTagLibTag(tlt);
    tag.setBody(body);
    data.ep.add(tlt, tag, data.flibs, data.srcCode);
    return tag;
}
Also used : TagLibTag(lucee.transformer.library.tag.TagLibTag) TagOther(lucee.transformer.bytecode.statement.tag.TagOther) BodyBase(lucee.transformer.bytecode.BodyBase)

Example 10 with TagLibTag

use of lucee.transformer.library.tag.TagLibTag in project Lucee by lucee.

the class CFMLTransformer method transform.

/**
 * Startmethode zum transfomieren einer CFMLString.
 * <br />
 * EBNF:<br />
 * <code>{body}</code>
 * @param config
 * @param sc CFMLString
 * @param tlibs Tag Library Deskriptoren, nach denen innerhalb der CFML Datei geprueft werden soll.
 * @param flibs Function Library Deskriptoren, nach denen innerhalb der Expressions der CFML Datei geprueft werden soll.
 * @param sourceLastModified
 * @param dotNotationUpperCase
 * @param returnValue if true the method returns the value of the last expression executed inside when you call the method "call"
 * @return uebersetztes CFXD Dokument Element.
 * @throws TemplateException
 */
public Page transform(Factory factory, ConfigImpl config, SourceCode sc, TagLib[] tlibs, FunctionLib[] flibs, long sourceLastModified, Boolean dotNotationUpperCase, boolean returnValue, boolean ignoreScope) throws TemplateException {
    boolean dnuc;
    if (dotNotationUpperCase == null) {
        if (sc instanceof PageSourceCode)
            dnuc = sc.getDialect() == CFMLEngine.DIALECT_CFML && ((MappingImpl) ((PageSourceCode) sc).getPageSource().getMapping()).getDotNotationUpperCase();
        else
            dnuc = sc.getDialect() == CFMLEngine.DIALECT_CFML && config.getDotNotationUpperCase();
    } else
        dnuc = dotNotationUpperCase;
    TagLib[][] _tlibs = new TagLib[][] { null, new TagLib[0] };
    _tlibs[TAG_LIB_GLOBAL] = tlibs;
    // reset page tlds
    if (_tlibs[TAG_LIB_PAGE].length > 0) {
        _tlibs[TAG_LIB_PAGE] = new TagLib[0];
    }
    Page page = new Page(factory, config, sc, null, ConfigWebUtil.getEngine(config).getInfo().getFullVersionInfo(), sourceLastModified, sc.getWriteLog(), sc.getDialect() == CFMLEngine.DIALECT_LUCEE || config.getSuppressWSBeforeArg(), config.getDefaultFunctionOutput(), returnValue, ignoreScope);
    TagData data = new TagData(factory, _tlibs, flibs, config.getCoreTagLib(sc.getDialect()).getScriptTags(), sc, page, dnuc, ignoreScope);
    // Body body=page;
    try {
        do {
            body(data, page, false, null);
            if (data.srcCode.isAfterLast())
                break;
            if (data.srcCode.forwardIfCurrent("</")) {
                int pos = data.srcCode.getPos();
                TagLib tagLib = nameSpace(data);
                if (tagLib == null) {
                    page.addPrintOut(data.factory, "</", null, null);
                } else {
                    String name = identifier(data.srcCode, true, true);
                    if (tagLib.getIgnoreUnknowTags()) {
                        TagLibTag tlt = tagLib.getTag(name);
                        if (tlt == null) {
                            data.srcCode.setPos(pos);
                            page.addPrintOut(data.factory, "</", null, null);
                        }
                    } else
                        throw new TemplateException(sc, "no matching start tag for end tag [" + tagLib.getNameSpaceAndSeparator() + name + "]");
                }
            } else
                throw new TemplateException(sc, "Error while transforming CFML File");
        } while (true);
        // call-back of evaluators
        data.ep.run();
        return page;
    } catch (TemplateException e) {
        data.ep.clear();
        throw e;
    }
}
Also used : TagLibTag(lucee.transformer.library.tag.TagLibTag) PageSourceCode(lucee.transformer.util.PageSourceCode) ComponentTemplateException(lucee.transformer.cfml.script.AbstrCFMLScriptTransformer.ComponentTemplateException) TemplateException(lucee.runtime.exp.TemplateException) TagLib(lucee.transformer.library.tag.TagLib) CustomTagLib(lucee.transformer.library.tag.CustomTagLib) Page(lucee.transformer.bytecode.Page) LitString(lucee.transformer.expression.literal.LitString)

Aggregations

TagLibTag (lucee.transformer.library.tag.TagLibTag)28 Tag (lucee.transformer.bytecode.statement.tag.Tag)12 Attribute (lucee.transformer.bytecode.statement.tag.Attribute)11 TagLib (lucee.transformer.library.tag.TagLib)9 TagLibTagAttr (lucee.transformer.library.tag.TagLibTagAttr)8 Body (lucee.transformer.bytecode.Body)7 TemplateException (lucee.runtime.exp.TemplateException)6 Position (lucee.transformer.Position)6 BodyBase (lucee.transformer.bytecode.BodyBase)6 EvaluatorException (lucee.transformer.cfml.evaluator.EvaluatorException)6 LitString (lucee.transformer.expression.literal.LitString)6 Statement (lucee.transformer.bytecode.Statement)5 Entry (java.util.Map.Entry)3 Key (lucee.runtime.type.Collection.Key)3 Struct (lucee.runtime.type.Struct)3 FunctionBody (lucee.transformer.bytecode.FunctionBody)3 Page (lucee.transformer.bytecode.Page)3 ScriptBody (lucee.transformer.bytecode.ScriptBody)3 Expression (lucee.transformer.expression.Expression)3 ArrayList (java.util.ArrayList)2