-
Notifications
You must be signed in to change notification settings - Fork 9
/
ScriptStatement.cfc
81 lines (66 loc) · 1.93 KB
/
ScriptStatement.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
component extends="Statement" accessors="false" {
variables.bodyOpen = 0;
variables.bodyClose = 0;
public function setBodyOpen(position) {
variables.bodyOpen = arguments.position;
}
public function setBodyClose(position) {
variables.bodyClose = arguments.position;
}
public numeric function getBodyOpen() {
return variables.bodyOpen;
}
public numeric function getBodyClose() {
return variables.bodyClose;
}
public boolean function isFunction() {
return getName() == "function";
}
public string function getTagName() {
if (!structKeyExists(variables, "tagName")) {
variables.tagName = "";
if (left(trim(getText()), 2) == "cf") {
if (reFindNoCase("^\s*cf[a-z]{4,26}\s*\(", getText())) {
variables.tagName = reReplaceNoCase(getText(),"\s*(cf[a-z]{4,16})\s*\(.+" , "\1");
}
}
}
return variables.tagName;
}
public boolean function isScriptModeTag() {
if (left(getTagName(), 2) == "cf") {
return true;
}
return false;
}
public string function getAttributeContent() {
if (!structKeyExists(variables, "attributeContent")) {
variables.attributeContent = "";
local.endPos = reFind("\)\s*;?\s*$", getText());
if (local.endPos != 0) {
variables.attributeContent = reReplaceNoCase(getText(), "\s*cf[a-z]{4,16}\s*\((.+)\)\s*;?\s*$", "\1");
} else if (reFind("}\s*$", getText())) {
local.endPos = reFind("\s*cf[a-z]{4,16}\s*\([^\{]+\)\s*{", getText());
if (local.endPos != 0) {
variables.attributeContent = reReplaceNoCase(getText(), "\s*cf[a-z]{4,16}\s*\(([^\{]+)\)\s*{.*", "\1");
}
}
}
return variables.attributeContent;
}
public boolean function hasAttributes() {
if (isScriptModeTag()) {
if (reFindNoCase("^\s*cf[a-z]{4,26}\s*\(\s*[^\)]", getText())) {
return true;
}
}
return false;
}
public array function getExpressions() {
if (hasAttributes()) {
return variables.attributeExpressions;
} else {
return super.getExpressions();
}
}
}