Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
KeyMatchBuilder.cs
Go to the documentation of this file.
4
5namespace System.Xml.Xsl.Xslt;
6
7internal sealed class KeyMatchBuilder : XPathBuilder, XPathPatternParser.IPatternBuilder, IXPathBuilder<QilNode>
8{
9 internal sealed class PathConvertor : QilReplaceVisitor
10 {
11 private new readonly XPathQilFactory f;
12
13 private QilNode _fixup;
14
16 : base(f.BaseFactory)
17 {
18 this.f = f;
19 }
20
27
28 protected override QilNode Visit(QilNode n)
29 {
30 if (n.NodeType == QilNodeType.Union || n.NodeType == QilNodeType.DocOrderDistinct || n.NodeType == QilNodeType.Filter || n.NodeType == QilNodeType.Loop)
31 {
32 return base.Visit(n);
33 }
34 return n;
35 }
36
37 protected override QilNode VisitLoop(QilLoop n)
38 {
39 if (n.Variable.Binding.NodeType == QilNodeType.Root || n.Variable.Binding.NodeType == QilNodeType.Deref)
40 {
41 return n;
42 }
43 if (n.Variable.Binding.NodeType == QilNodeType.Content)
44 {
45 QilUnary qilUnary = (QilUnary)n.Variable.Binding;
48 return n;
49 }
50 n.Variable.Binding = Visit(n.Variable.Binding);
51 return n;
52 }
53
54 protected override QilNode VisitFilter(QilLoop n)
55 {
56 return VisitLoop(n);
57 }
58 }
59
60 private int _depth;
61
62 private readonly PathConvertor _convertor;
63
65 : base(env)
66 {
67 _convertor = new PathConvertor(env.Factory);
68 }
69
70 public override void StartBuild()
71 {
72 if (_depth == 0)
73 {
74 base.StartBuild();
75 }
76 _depth++;
77 }
78
79 [return: NotNullIfNotNull("result")]
80 public override QilNode EndBuild(QilNode result)
81 {
82 _depth--;
83 if (result == null)
84 {
85 return base.EndBuild(result);
86 }
87 if (_depth == 0)
88 {
90 result = base.EndBuild(result);
91 }
92 return result;
93 }
94
96 {
97 return this;
98 }
99}
static void Check(QilNode input)
QilIterator For(QilNode binding)
QilNode Loop(QilIterator variable, QilNode body)
QilNode DescendantOrSelf(QilNode context)
QilNode ConvertReletive2Absolute(QilNode node, QilNode fixup)
KeyMatchBuilder(IXPathEnvironment env)
IXPathBuilder< QilNode > GetPredicateBuilder(QilNode ctx)
override QilNode EndBuild(QilNode result)