Skip to content

foundeo/cfmlparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

fbb468c · Jan 14, 2025

History

47 Commits
Jan 14, 2025
Mar 9, 2016
Jul 29, 2021
Mar 9, 2016
Apr 5, 2024
Mar 9, 2016
Mar 9, 2016
Mar 20, 2024
Mar 20, 2024
Jan 27, 2023
Jul 29, 2021
Jan 14, 2025
Jan 14, 2025
Apr 27, 2017

Repository files navigation

cfmlparser

A CFML Parser written in CFML

Build Status

Basic Usage

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);

How it works

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.

Known Issues / Limitations

  • Currently does not parse cfscript or or script based CFCs (todo)