Skip to content

Commit 1ce742f

Browse files
committed
Add isComponentFile to file function
1 parent 9933060 commit 1ce742f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

File.cfc

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ component {
44
variables.parser = "";
55
variables.isScript = false;
66
variables.fileLength = 0;
7+
variables.isComponentFile = false;
78

89
function init(string filePath="", string fileContent="", string parser="detect") {
910
if (len(arguments.fileContent) == 0 && len(arguments.filePath) > 0) {
@@ -25,6 +26,7 @@ component {
2526
if (local.hasScriptComponentPattern && !local.hasTagComponentPattern) {
2627
//script cfc
2728
variables.isScript = true;
29+
variables.isComponentFile = true;
2830

2931
} else if (local.hasTagComponentPattern && local.hasScriptComponentPattern) {
3032

@@ -39,17 +41,25 @@ component {
3941
} else {
4042
variables.isScript=false;
4143
}
42-
44+
variables.isComponentFile = true;
4345
} else {
4446
//tag based file
4547
variables.isScript = false;
48+
if (local.hasTagComponentPattern) {
49+
variables.isComponentFile = true;
50+
}
4651
}
4752
} else if (parser == "script") {
4853
variables.isScript = true;
54+
4955
} else {
5056
variables.isScript = false;
57+
5158
}
5259

60+
if (!variables.isComponentFile && right(arguments.filePath, 4) == ".cfc") {
61+
variables.isComponentFile = true;
62+
}
5363

5464

5565
if (variables.isScript) {
@@ -86,6 +96,10 @@ component {
8696
return variables.isScript;
8797
}
8898

99+
boolean function isComponentFile() {
100+
return variables.isComponentFile;
101+
}
102+
89103
numeric function getLineNumber(numeric position) {
90104
return listLen(left(variables.fileContent, arguments.position), chr(10), true);
91105
}

box.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"cfmlparser",
3-
"version":"1.1.6",
3+
"version":"1.1.7",
44
"author":"Pete Freitag / Foundeo Inc.",
55
"location":"",
66
"directory":"",

0 commit comments

Comments
 (0)