1+ /**
2+ * Provides classes for working with E4X.
3+ */
4+
5+ import javascript
6+
7+ module E4X {
8+ /**
9+ * An E4X wildcard pseudo-identifier.
10+ */
11+ class XMLAnyName extends Expr , @e4x_xml_anyname {
12+ }
13+
14+ /**
15+ * An E4X qualified identifier of the form `q::n` or `q::[expr]`.
16+ */
17+ class XMLQualifiedIdentifier extends Expr , @e4x_xml_qualident {
18+ /**
19+ * Gets the left operand of this qualified identifier, which is either
20+ * an identifier or a wildcard.
21+ */
22+ Expr getLeft ( ) { result = getChildExpr ( 0 ) }
23+
24+ /**
25+ * Gets the right operand of this qualified identifer, which is either
26+ * an identifier, or an arbitrary expression for computed qualified
27+ * identifiers.
28+ */
29+ Expr getRight ( ) { result = getChildExpr ( 1 ) }
30+
31+ /**
32+ * Holds if this is a qualified identifier with a computed name, as in
33+ * `q::[expr]`.
34+ */
35+ predicate isComputed ( ) { this instanceof @e4x_xml_dynamic_qualident }
36+
37+ override ControlFlowNode getFirstControlFlowNode ( ) {
38+ result = getLeft ( ) .getFirstControlFlowNode ( )
39+ }
40+ }
41+
42+ /**
43+ * An E4X attribute selector of the form `@name` or `@[expr]`.
44+ */
45+ class XMLAttributeSelector extends Expr , @e4x_xml_attribute_selector {
46+ /**
47+ * Gets the selected attribute, which is either a static name (that is, a
48+ * wildcard identifier or a possibly qualified name), or an arbitrary
49+ * expression for computed attribute selectors.
50+ */
51+ Expr getAttribute ( ) { result = getChildExpr ( 0 ) }
52+
53+ /**
54+ * Holds if this is an attribute selector with a computed name, as in
55+ * `@[expr]`.
56+ */
57+ predicate isComputed ( ) { this instanceof @e4x_xml_dynamic_attribute_selector }
58+
59+ override ControlFlowNode getFirstControlFlowNode ( ) {
60+ result = getAttribute ( ) .getFirstControlFlowNode ( )
61+ }
62+ }
63+
64+ /**
65+ * An E4X filter expression of the form `left.(right)`.
66+ */
67+ class XMLFilterExpression extends Expr , @e4x_xml_filter_expression {
68+ /**
69+ * Gets the left operand of this filter expression.
70+ */
71+ Expr getLeft ( ) { result = getChildExpr ( 0 ) }
72+
73+ /**
74+ * Gets the right operand of this filter expression.
75+ */
76+ Expr getRight ( ) { result = getChildExpr ( 1 ) }
77+
78+ override ControlFlowNode getFirstControlFlowNode ( ) {
79+ result = getLeft ( ) .getFirstControlFlowNode ( )
80+ }
81+ }
82+
83+ /**
84+ * An E4X "dot-dot" expression of the form `e..id`.
85+ */
86+ class XMLDotDotExpression extends Expr , @e4x_xml_dotdotexpr {
87+ /**
88+ * Gets the base expression of this dot-dot expression.
89+ */
90+ Expr getBase ( ) { result = getChildExpr ( 0 ) }
91+
92+ /**
93+ * Gets the index expression of this dot-dot expression.
94+ */
95+ Expr getIndex ( ) { result = getChildExpr ( 1 ) }
96+
97+ override ControlFlowNode getFirstControlFlowNode ( ) {
98+ result = getBase ( ) .getFirstControlFlowNode ( )
99+ }
100+ }
101+ }
0 commit comments