Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
QilPatternFactory.cs
Go to the documentation of this file.
3
4namespace System.Xml.Xsl.Qil;
5
6internal class QilPatternFactory
7{
8 private readonly bool _debug;
9
10 private readonly QilFactory _f;
11
13
15 {
16 _f = f;
17 _debug = debug;
18 }
19
20 public QilLiteral String(string val)
21 {
22 return _f.LiteralString(val);
23 }
24
25 public QilLiteral Int32(int val)
26 {
27 return _f.LiteralInt32(val);
28 }
29
30 public QilLiteral Double(double val)
31 {
32 return _f.LiteralDouble(val);
33 }
34
35 public QilName QName(string local, string uri, string prefix)
36 {
37 return _f.LiteralQName(local, uri, prefix);
38 }
39
40 public QilName QName(string local, string uri)
41 {
42 return _f.LiteralQName(local, uri, string.Empty);
43 }
44
45 public QilName QName(string local)
46 {
47 return _f.LiteralQName(local, string.Empty, string.Empty);
48 }
49
51 {
52 return _f.Unknown(t);
53 }
54
56 {
57 return _f.QilExpression(root, factory);
58 }
59
61 {
62 return _f.FunctionList();
63 }
64
66 {
67 return _f.GlobalVariableList();
68 }
69
71 {
72 return _f.GlobalParameterList();
73 }
74
76 {
77 return _f.ActualParameterList();
78 }
79
87
92
94 {
95 return _f.FormalParameterList();
96 }
97
105
110
112 {
113 return _f.BranchList(args);
114 }
115
117 {
118 return _f.OptimizeBarrier(child);
119 }
120
121 public QilNode DataSource(QilNode name, QilNode baseUri)
122 {
123 return _f.DataSource(name, baseUri);
124 }
125
126 public QilNode Nop(QilNode child)
127 {
128 return _f.Nop(child);
129 }
130
132 {
133 return _f.Error(text);
134 }
135
137 {
138 return _f.Warning(text);
139 }
140
142 {
143 return _f.For(binding);
144 }
145
147 {
148 return _f.Let(binding);
149 }
150
152 {
153 return _f.Parameter(t);
154 }
155
157 {
158 return _f.Parameter(defaultValue, name, t);
159 }
160
162 {
163 return _f.PositionOf(expr);
164 }
165
166 public QilNode True()
167 {
168 return _f.True();
169 }
170
171 public QilNode False()
172 {
173 return _f.False();
174 }
175
176 public QilNode Boolean(bool b)
177 {
178 if (!b)
179 {
180 return False();
181 }
182 return True();
183 }
184
185 private static void CheckLogicArg(QilNode arg)
186 {
187 }
188
189 public QilNode And(QilNode left, QilNode right)
190 {
191 CheckLogicArg(left);
192 CheckLogicArg(right);
193 if (!_debug)
194 {
195 if (left.NodeType == QilNodeType.True || right.NodeType == QilNodeType.False)
196 {
197 return right;
198 }
199 if (left.NodeType == QilNodeType.False || right.NodeType == QilNodeType.True)
200 {
201 return left;
202 }
203 }
204 return _f.And(left, right);
205 }
206
207 public QilNode Or(QilNode left, QilNode right)
208 {
209 CheckLogicArg(left);
210 CheckLogicArg(right);
211 if (!_debug)
212 {
213 if (left.NodeType == QilNodeType.True || right.NodeType == QilNodeType.False)
214 {
215 return left;
216 }
217 if (left.NodeType == QilNodeType.False || right.NodeType == QilNodeType.True)
218 {
219 return right;
220 }
221 }
222 return _f.Or(left, right);
223 }
224
225 public QilNode Not(QilNode child)
226 {
227 if (!_debug)
228 {
229 switch (child.NodeType)
230 {
231 case QilNodeType.True:
232 return _f.False();
233 case QilNodeType.False:
234 return _f.True();
235 case QilNodeType.Not:
236 return ((QilUnary)child).Child;
237 }
238 }
239 return _f.Not(child);
240 }
241
243 {
244 if (!_debug)
245 {
246 switch (condition.NodeType)
247 {
248 case QilNodeType.True:
249 return trueBranch;
250 case QilNodeType.False:
251 return falseBranch;
252 case QilNodeType.Not:
253 return Conditional(((QilUnary)condition).Child, falseBranch, trueBranch);
254 }
255 }
256 return _f.Conditional(condition, trueBranch, falseBranch);
257 }
258
260 {
261 if (!_debug)
262 {
263 switch (branches.Count)
264 {
265 case 1:
266 return _f.Loop(_f.Let(expr), branches[0]);
267 case 2:
268 return _f.Conditional(_f.Eq(expr, _f.LiteralInt32(0)), branches[0], branches[1]);
269 }
270 }
271 return _f.Choice(expr, branches);
272 }
273
274 public QilNode Length(QilNode child)
275 {
276 return _f.Length(child);
277 }
278
280 {
281 return _f.Sequence();
282 }
283
285 {
286 if (!_debug)
287 {
288 return child;
289 }
291 qilList.Add(child);
292 return qilList;
293 }
294
296 {
300 return qilList;
301 }
302
304 {
305 if (!_debug)
306 {
307 switch (args.Length)
308 {
309 case 0:
310 return _f.Sequence();
311 case 1:
312 return args[0];
313 }
314 }
316 foreach (QilNode node in args)
317 {
319 }
320 return qilList;
321 }
322
323 public QilNode Union(QilNode left, QilNode right)
324 {
325 return _f.Union(left, right);
326 }
327
329 {
330 return _f.Sum(collection);
331 }
332
333 public QilNode Negate(QilNode child)
334 {
335 return _f.Negate(child);
336 }
337
338 public QilNode Add(QilNode left, QilNode right)
339 {
340 return _f.Add(left, right);
341 }
342
343 public QilNode Subtract(QilNode left, QilNode right)
344 {
345 return _f.Subtract(left, right);
346 }
347
348 public QilNode Multiply(QilNode left, QilNode right)
349 {
350 return _f.Multiply(left, right);
351 }
352
353 public QilNode Divide(QilNode left, QilNode right)
354 {
355 return _f.Divide(left, right);
356 }
357
358 public QilNode Modulo(QilNode left, QilNode right)
359 {
360 return _f.Modulo(left, right);
361 }
362
364 {
365 return _f.StrLength(str);
366 }
367
369 {
370 if (!_debug && values.XmlType.IsSingleton)
371 {
372 return values;
373 }
374 return _f.StrConcat(values);
375 }
376
378 {
380 }
381
383 {
384 if (!_debug)
385 {
386 switch (args.Count)
387 {
388 case 0:
389 return _f.LiteralString(string.Empty);
390 case 1:
391 return StrConcat(args[0]);
392 }
393 }
394 return StrConcat(_f.Sequence(args));
395 }
396
398 {
399 return _f.StrParseQName(str, ns);
400 }
401
402 public QilNode Ne(QilNode left, QilNode right)
403 {
404 return _f.Ne(left, right);
405 }
406
407 public QilNode Eq(QilNode left, QilNode right)
408 {
409 return _f.Eq(left, right);
410 }
411
412 public QilNode Gt(QilNode left, QilNode right)
413 {
414 return _f.Gt(left, right);
415 }
416
417 public QilNode Ge(QilNode left, QilNode right)
418 {
419 return _f.Ge(left, right);
420 }
421
422 public QilNode Lt(QilNode left, QilNode right)
423 {
424 return _f.Lt(left, right);
425 }
426
427 public QilNode Le(QilNode left, QilNode right)
428 {
429 return _f.Le(left, right);
430 }
431
432 public QilNode Is(QilNode left, QilNode right)
433 {
434 return _f.Is(left, right);
435 }
436
437 public QilNode Before(QilNode left, QilNode right)
438 {
439 return _f.Before(left, right);
440 }
441
443 {
444 if (!_debug && body == variable.Binding)
445 {
446 return body;
447 }
448 return _f.Loop(variable, body);
449 }
450
452 {
453 if (!_debug && expr.NodeType == QilNodeType.True)
454 {
455 return variable.Binding;
456 }
457 return _f.Filter(variable, expr);
458 }
459
461 {
462 return _f.Sort(iter, keys);
463 }
464
466 {
467 return _f.SortKey(key, collation);
468 }
469
471 {
472 if (collection.NodeType == QilNodeType.DocOrderDistinct)
473 {
474 return collection;
475 }
477 }
478
483
488
490 {
491 return _f.Invoke(func, args);
492 }
493
494 public QilNode Content(QilNode context)
495 {
496 return _f.Content(context);
497 }
498
499 public QilNode Parent(QilNode context)
500 {
501 return _f.Parent(context);
502 }
503
504 public QilNode Root(QilNode context)
505 {
506 return _f.Root(context);
507 }
508
510 {
511 return _f.XmlContext();
512 }
513
515 {
516 return _f.Descendant(expr);
517 }
518
520 {
521 return _f.DescendantOrSelf(context);
522 }
523
525 {
526 return _f.Ancestor(expr);
527 }
528
530 {
531 return _f.AncestorOrSelf(expr);
532 }
533
535 {
536 return _f.Preceding(expr);
537 }
538
540 {
541 return _f.FollowingSibling(expr);
542 }
543
545 {
546 return _f.PrecedingSibling(expr);
547 }
548
549 public QilNode NodeRange(QilNode left, QilNode right)
550 {
551 return _f.NodeRange(left, right);
552 }
553
554 public QilBinary Deref(QilNode context, QilNode id)
555 {
556 return _f.Deref(context, id);
557 }
558
559 public QilNode ElementCtor(QilNode name, QilNode content)
560 {
561 return _f.ElementCtor(name, content);
562 }
563
565 {
566 return _f.AttributeCtor(name, val);
567 }
568
570 {
571 return _f.CommentCtor(content);
572 }
573
574 public QilNode PICtor(QilNode name, QilNode content)
575 {
576 return _f.PICtor(name, content);
577 }
578
579 public QilNode TextCtor(QilNode content)
580 {
581 return _f.TextCtor(content);
582 }
583
585 {
586 return _f.RawTextCtor(content);
587 }
588
590 {
591 return _f.DocumentCtor(child);
592 }
593
595 {
596 return _f.NamespaceDecl(prefix, uri);
597 }
598
599 public QilNode RtfCtor(QilNode content, QilNode baseUri)
600 {
601 return _f.RtfCtor(content, baseUri);
602 }
603
604 public QilNode NameOf(QilNode expr)
605 {
606 return _f.NameOf(expr);
607 }
608
610 {
611 return _f.LocalNameOf(expr);
612 }
613
615 {
616 return _f.NamespaceUriOf(expr);
617 }
618
620 {
621 return _f.PrefixOf(expr);
622 }
623
625 {
626 return _f.TypeAssert(expr, t);
627 }
628
630 {
631 return _f.IsType(expr, t);
632 }
633
635 {
636 return _f.IsEmpty(set);
637 }
638
640 {
641 return _f.XPathNodeValue(expr);
642 }
643
645 {
646 return _f.XPathFollowing(expr);
647 }
648
650 {
651 return _f.XPathNamespace(expr);
652 }
653
655 {
656 return _f.XPathPreceding(expr);
657 }
658
660 {
661 return _f.XsltGenerateId(expr);
662 }
663
670
677
678 public QilNode XsltCopy(QilNode expr, QilNode content)
679 {
680 return _f.XsltCopy(expr, content);
681 }
682
684 {
685 return _f.XsltCopyOf(expr);
686 }
687
689 {
690 return _f.XsltConvert(expr, t);
691 }
692}
void Add(TKey key, TValue value)
QilBinary Union(QilNode left, QilNode right)
QilBinary Gt(QilNode left, QilNode right)
QilIterator Let(QilNode binding)
QilUnary FollowingSibling(QilNode child)
QilBinary Ne(QilNode left, QilNode right)
QilUnary AncestorOrSelf(QilNode child)
QilUnary Warning(QilNode child)
QilLoop Sort(QilNode variable, QilNode body)
QilList Sequence(IList< QilNode > values)
Definition QilFactory.cs:44
QilUnary IsEmpty(QilNode child)
QilNode Unknown(XmlQueryType xmlType)
QilTargetType TypeAssert(QilNode expr, XmlQueryType xmlType)
Definition QilFactory.cs:66
QilUnary CommentCtor(QilNode child)
QilInvoke Invoke(QilNode function, QilNode arguments)
QilBinary Subtract(QilNode left, QilNode right)
QilUnary Ancestor(QilNode child)
QilBinary StrParseQName(QilNode left, QilNode right)
QilUnary XPathFollowing(QilNode child)
QilExpression QilExpression(QilNode root, QilFactory factory)
Definition QilFactory.cs:16
QilUnary Length(QilNode child)
QilLiteral LiteralString(string value)
QilBinary Divide(QilNode left, QilNode right)
QilBinary NamespaceDecl(QilNode left, QilNode right)
QilUnary Parent(QilNode child)
QilBinary ElementCtor(QilNode left, QilNode right)
QilBinary Deref(QilNode left, QilNode right)
QilTernary Conditional(QilNode left, QilNode center, QilNode right)
QilUnary XPathNodeValue(QilNode child)
QilChoice Choice(QilNode expression, QilNode branches)
QilUnary PrecedingSibling(QilNode child)
QilUnary Descendant(QilNode child)
QilFunction Function(QilNode arguments, QilNode sideEffects, XmlQueryType xmlType)
Definition QilFactory.cs:81
QilUnary XPathNamespace(QilNode child)
QilDataSource DataSource(QilNode name, QilNode baseUri)
QilUnary Preceding(QilNode child)
QilUnary Negate(QilNode child)
QilBinary PICtor(QilNode left, QilNode right)
QilUnary PrefixOf(QilNode child)
QilUnary NamespaceUriOf(QilNode child)
QilLiteral LiteralInt32(int value)
QilUnary RawTextCtor(QilNode child)
QilUnary TextCtor(QilNode child)
QilBinary Add(QilNode left, QilNode right)
QilUnary DocumentCtor(QilNode child)
QilBinary Ge(QilNode left, QilNode right)
QilInvokeEarlyBound XsltInvokeEarlyBound(QilNode name, QilNode clrMethod, QilNode arguments, XmlQueryType xmlType)
QilLiteral LiteralDouble(double value)
QilUnary Nop(QilNode child)
QilBinary Le(QilNode left, QilNode right)
QilUnary NameOf(QilNode child)
QilUnary DocOrderDistinct(QilNode child)
QilUnary DescendantOrSelf(QilNode child)
QilTargetType IsType(QilNode expr, XmlQueryType xmlType)
Definition QilFactory.cs:71
QilUnary LocalNameOf(QilNode child)
QilParameter Parameter(XmlQueryType xmlType)
Definition QilFactory.cs:51
QilList BranchList(IList< QilNode > values)
Definition QilFactory.cs:37
QilUnary Not(QilNode child)
QilUnary XPathPreceding(QilNode child)
QilBinary RtfCtor(QilNode left, QilNode right)
QilBinary And(QilNode left, QilNode right)
QilBinary Modulo(QilNode left, QilNode right)
QilUnary OptimizeBarrier(QilNode child)
QilList FormalParameterList(IList< QilNode > values)
Definition QilFactory.cs:30
QilList ActualParameterList(IList< QilNode > values)
Definition QilFactory.cs:23
QilBinary Is(QilNode left, QilNode right)
QilLoop Filter(QilNode variable, QilNode body)
QilUnary XsltCopyOf(QilNode child)
QilLoop Loop(QilNode variable, QilNode body)
QilBinary NodeRange(QilNode left, QilNode right)
QilUnary PositionOf(QilNode child)
QilUnary Content(QilNode child)
QilBinary XsltCopy(QilNode left, QilNode right)
QilIterator For(QilNode binding)
QilBinary Eq(QilNode left, QilNode right)
QilUnary Sum(QilNode child)
QilLiteral LiteralObject(object value)
QilName LiteralQName(string local)
Definition QilFactory.cs:61
QilStrConcat StrConcat(QilNode values)
Definition QilFactory.cs:56
QilUnary Error(QilNode child)
QilBinary Before(QilNode left, QilNode right)
QilBinary Multiply(QilNode left, QilNode right)
QilUnary Root(QilNode child)
QilBinary Lt(QilNode left, QilNode right)
QilTargetType XsltConvert(QilNode expr, XmlQueryType xmlType)
Definition QilFactory.cs:76
QilBinary Or(QilNode left, QilNode right)
QilBinary AttributeCtor(QilNode left, QilNode right)
QilUnary StrLength(QilNode child)
QilSortKey SortKey(QilNode key, QilNode collation)
QilUnary XsltGenerateId(QilNode child)
QilInvokeLateBound XsltInvokeLateBound(QilNode name, QilNode arguments)
QilList ActualParameterList(params QilNode[] args)
QilIterator For(QilNode binding)
QilNode Filter(QilIterator variable, QilNode expr)
QilNode IsType(QilNode expr, XmlQueryType t)
QilNode Sequence(QilNode child1, QilNode child2)
QilSortKey SortKey(QilNode key, QilNode collation)
QilNode Union(QilNode left, QilNode right)
QilNode Invoke(QilFunction func, QilList args)
QilNode XsltInvokeLateBound(QilNode name, IList< QilNode > args)
QilNode Modulo(QilNode left, QilNode right)
QilList FormalParameterList(QilNode arg1, QilNode arg2)
QilNode AttributeCtor(QilNode name, QilNode val)
QilNode Before(QilNode left, QilNode right)
QilNode Multiply(QilNode left, QilNode right)
QilNode Loop(QilIterator variable, QilNode body)
QilNode Ge(QilNode left, QilNode right)
QilNode StrConcat(IList< QilNode > args)
QilNode Is(QilNode left, QilNode right)
QilNode Conditional(QilNode condition, QilNode trueBranch, QilNode falseBranch)
QilNode Sequence(params QilNode[] args)
QilIterator Let(QilNode binding)
QilNode NodeRange(QilNode left, QilNode right)
QilNode XsltConvert(QilNode expr, XmlQueryType t)
QilNode Le(QilNode left, QilNode right)
QilNode Divide(QilNode left, QilNode right)
QilParameter Parameter(QilNode defaultValue, QilName name, XmlQueryType t)
QilNode XsltInvokeEarlyBound(QilNode name, MethodInfo d, XmlQueryType t, IList< QilNode > args)
QilNode And(QilNode left, QilNode right)
QilNode Or(QilNode left, QilNode right)
QilList BranchList(params QilNode[] args)
QilNode Ne(QilNode left, QilNode right)
QilFunction Function(QilList args, QilNode defn, QilNode sideEffects)
QilName QName(string local, string uri, string prefix)
QilNode ElementCtor(QilNode name, QilNode content)
QilList ActualParameterList(QilNode arg1, QilNode arg2)
QilNode Sort(QilIterator iter, QilNode keys)
QilNode DocOrderDistinct(QilNode collection)
QilNode Choice(QilNode expr, QilList branches)
QilNode Eq(QilNode left, QilNode right)
QilBinary Deref(QilNode context, QilNode id)
QilNode Gt(QilNode left, QilNode right)
QilList FormalParameterList(params QilNode[] args)
QilNode StrParseQName(QilNode str, QilNode ns)
QilNode Subtract(QilNode left, QilNode right)
QilNode XsltCopy(QilNode expr, QilNode content)
QilNode Lt(QilNode left, QilNode right)
QilNode Add(QilNode left, QilNode right)
QilNode DataSource(QilNode name, QilNode baseUri)
QilPatternFactory(QilFactory f, bool debug)
QilNode PICtor(QilNode name, QilNode content)
QilName QName(string local, string uri)
QilParameter Parameter(XmlQueryType t)
QilExpression QilExpression(QilNode root, QilFactory factory)
QilNode DescendantOrSelf(QilNode context)
QilNode RtfCtor(QilNode content, QilNode baseUri)
QilFunction Function(QilList args, QilNode sideEffects, XmlQueryType resultType)
QilNode TypeAssert(QilNode expr, XmlQueryType t)
QilNode NamespaceDecl(QilNode prefix, QilNode uri)
QilNode StrConcat(params QilNode[] args)