// 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;
if(tag.getTagLibTag().getTagClassName().equals(className)) count++;
}
}
if(count>1)
throw new EvaluatorException("inside one cfc file only one tag "+tlt.getFullName()+" is allowed, now we have "+count);
boolean isComponent="railo.runtime.tag.Component".equals(tlt.getTagClassName());
boolean isInterface="railo.runtime.tag.Interface".equals(tlt.getTagClassName());
if(isComponent)page.setIsComponent(true);
if(isInterface)page.setIsInterface(true);
// Attributes
// output
// "output=true" wird in "railo.transformer.cfml.attributes.impl.Function" geh�ndelt
Attribute attr = tag.getAttribute("output");
if(attr!=null) {
Expression expr = CastBoolean.toExprBoolean(attr.getValue());
if(!(expr instanceof LitBoolean))
throw new EvaluatorException("Attribute output of the Tag "+tlt.getFullName()+", must contain a static boolean value (true or false, yes or no)");
//boolean output = ((LitBoolean)expr).getBooleanValue();
//if(!output) ASMUtil.removeLiterlChildren(tag, true);
}
// extends
attr = tag.getAttribute("extends");
if(attr!=null) {
Expression expr = CastString.toExprString(attr.getValue());
if(!(expr instanceof LitString)) throw new EvaluatorException("Attribute extends of the Tag "+tlt.getFullName()+", must contain a literal string value");
}
// implements
if(isComponent){
attr = tag.getAttribute("implements");
if(attr!=null) {
Expression expr = CastString.toExprString(attr.getValue());
if(!(expr instanceof LitString)) throw new EvaluatorException("Attribute implements of the Tag "+tlt.getFullName()+", must contain a literal string value");
}
}
}