//if(!data.cfml.forwardIfCurrent("for",'('))
// return null;
Expression left=null;
Body body=new BodyBase();
Position line = data.cfml.getPosition();
comments(data);
if(!data.cfml.isCurrent(';')) {
// left
left=expression(data);
comments(data);
}
// middle for
if(data.cfml.forwardIfCurrent(';')) {
Expression cont=null;
Expression update=null;
// condition
comments(data);
if(!data.cfml.isCurrent(';')) {
cont=condition(data);
comments(data);
}
// middle
if(!data.cfml.forwardIfCurrent(';'))
throw new TemplateException(data.cfml,"invalid syntax in for statement");
// update
comments(data);
if(!data.cfml.isCurrent(')')) {
update=expression(data);
comments(data);
}
// start )
if(!data.cfml.forwardIfCurrent(')'))
throw new TemplateException(data.cfml,"invalid syntax in for statement, for statement must end with a [)]");
// ex block
statement(data,body,CTX_FOR);
return new For(left,cont,update,body,line,data.cfml.getPosition(),id);
}
// middle foreach
else if(data.cfml.forwardIfCurrent("in")) {
// condition
comments(data);
Expression value = expression(data);
comments(data);
if(!data.cfml.forwardIfCurrent(')'))
throw new TemplateException(data.cfml,"invalid syntax in for statement, for statement must end with a [)]");
// ex block