A CFML Parser written in CFML
file = new cfmlparser.File("/path/to/file.cfm");
statements = file.getStatements();
info = [];
for (s in statements) {
if (s.isTag()) {
arrayAppend(info, {type:"tag", name:s.getName(), attributes:s.getAttributes(), start:s.getStartPosition(), end:s.getEndPosition()});
} else if (s.isComment()) {
arrayAppend(info, {type:"comment", comment:s.getComment(), start:s.getStartPosition(), end:s.getEndPosition()});
}
}
writeDump(info);
Parses the file into an array of Statement
objects, the statements may be a CFML tag, a CFML comment or a cfscript statement (todo).
If the statement is a CFML tag, then you will have an instance of the Tag
component, with methods such as getAttributes()
hasAttributes()
getInnerContent()
hasInnerContent()
etc.
- Currently does not parse cfscript or or script based CFCs (todo)