-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathE4X.qll
More file actions
137 lines (122 loc) · 3.17 KB
/
E4X.qll
File metadata and controls
137 lines (122 loc) · 3.17 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
* Provides classes for working with E4X.
*/
overlay[local?]
module;
import javascript
module E4X {
/**
* An E4X wildcard pseudo-identifier.
*
* Example:
*
* ```
* *
* ```
*/
class XmlAnyName extends Expr, @e4x_xml_anyname { }
/**
* An E4X qualified identifier.
*
* Examples:
*
* ```
* soap::encodingStyle
* soap::["encodingStyle"]
* ```
*
* Note that qualified identifiers are not currently supported by the parser, so snapshots
* will not usually contain any.
*/
class XmlQualifiedIdentifier extends Expr, @e4x_xml_qualident {
/**
* Gets the left operand of this qualified identifier, which is either
* an identifier or a wildcard.
*/
Expr getLeft() { result = this.getChildExpr(0) }
/**
* Gets the right operand of this qualified identifer, which is either
* an identifier, or an arbitrary expression for computed qualified
* identifiers.
*/
Expr getRight() { result = this.getChildExpr(1) }
/**
* Holds if this is a qualified identifier with a computed name, as in
* `q::[expr]`.
*/
predicate isComputed() { this instanceof @e4x_xml_dynamic_qualident }
override ControlFlowNode getFirstControlFlowNode() {
result = this.getLeft().getFirstControlFlowNode()
}
}
/**
* An E4X attribute selector.
*
* Examples:
*
* ```
* @border
* @[p]
* ```
*/
class XmlAttributeSelector extends Expr, @e4x_xml_attribute_selector {
/**
* Gets the selected attribute, which is either a static name (that is, a
* wildcard identifier or a possibly qualified name), or an arbitrary
* expression for computed attribute selectors.
*/
Expr getAttribute() { result = this.getChildExpr(0) }
/**
* Holds if this is an attribute selector with a computed name, as in
* `@[expr]`.
*/
predicate isComputed() { this instanceof @e4x_xml_dynamic_attribute_selector }
override ControlFlowNode getFirstControlFlowNode() {
result = this.getAttribute().getFirstControlFlowNode()
}
}
/**
* An E4X filter expression.
*
* Example:
*
* ```
* employees.(@id == 0 || @id == 1)
* ```
*/
class XmlFilterExpression extends Expr, @e4x_xml_filter_expression {
/**
* Gets the left operand of this filter expression.
*/
Expr getLeft() { result = this.getChildExpr(0) }
/**
* Gets the right operand of this filter expression.
*/
Expr getRight() { result = this.getChildExpr(1) }
override ControlFlowNode getFirstControlFlowNode() {
result = this.getLeft().getFirstControlFlowNode()
}
}
/**
* An E4X "dot-dot" expression.
*
* Example:
*
* ```
* e..name
* ```
*/
class XmlDotDotExpression extends Expr, @e4x_xml_dotdotexpr {
/**
* Gets the base expression of this dot-dot expression.
*/
Expr getBase() { result = this.getChildExpr(0) }
/**
* Gets the index expression of this dot-dot expression.
*/
Expr getIndex() { result = this.getChildExpr(1) }
override ControlFlowNode getFirstControlFlowNode() {
result = this.getBase().getFirstControlFlowNode()
}
}
}