BoxLang 🚀 A New JVM Dynamic Language Learn More...
function-linenums is a utility module for use with CFML exception TagContext
arrays. Given a template and a line number it computes CFML function names - as tag context items do not include original CFML function names in them.
Install this module via CommandBox:
$ install funclinenums
Alternatively the git repository can be cloned into the desired directory.
You can leverage the module via the injection DSL: functionLineNums@funclinenums
:
property name="functionLineNums" inject="functionLineNums@funclinenums";
Alternatively, the functionLineNumbers
component can be instantiated directly:
functionLineNums = new funclinenums.functionLineNums();
The following methods are available:
// pass in a TagContext item directly
functionName = functionLineNums.findTagContextFunction( tagContextItem );
// pass in a full path to a CFML source file and a line number
functionName = functionLineNums.findFunction( fullPath, lineNum );
// pass in a full path to a CFML source file
functionArray = functionLineNums.getFunctionRanges( fullPath );
/*
returns an array of structs:
[
{
"name": "funcName",
"start": 1,
"end": 104,
"startline": 1,
"endline": 9
}
]
*/
// pass in source code directly
functionArray = functionLineNums.walk( srcCode );
/*
returns an array of structs:
[
{
"name": "funcName",
"start": 1,
"end": 104,
"startline": 1,
"endline": 9
}
]
*/
$
box install funclinenums