Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SequenceNode.cs
Go to the documentation of this file.
1
using
System.Collections.Generic
;
2
3
namespace
System.Xml.Schema
;
4
5
internal
sealed
class
SequenceNode
:
InteriorNode
6
{
7
private
struct
SequenceConstructPosContext
8
{
9
public
SequenceNode
this_
;
10
11
public
BitSet
firstpos
;
12
13
public
BitSet
lastpos
;
14
15
public
BitSet
lastposLeft
;
16
17
public
BitSet
firstposRight
;
18
19
public
SequenceConstructPosContext
(
SequenceNode
node
,
BitSet
firstpos
,
BitSet
lastpos
)
20
{
21
this_
=
node
;
22
this.firstpos
=
firstpos
;
23
this.lastpos
=
lastpos
;
24
lastposLeft
=
null
;
25
firstposRight
=
null
;
26
}
27
}
28
29
public
override
bool
IsNullable
30
{
31
get
32
{
33
SequenceNode
sequenceNode
=
this
;
34
SyntaxTreeNode
leftChild
;
35
do
36
{
37
if
(
sequenceNode
.RightChild.IsRangeNode && ((
LeafRangeNode
)
sequenceNode
.RightChild).Min == 0
m
)
38
{
39
return
true
;
40
}
41
if
(!
sequenceNode
.RightChild.IsNullable && !
sequenceNode
.RightChild.IsRangeNode)
42
{
43
return
false
;
44
}
45
leftChild
=
sequenceNode
.LeftChild;
46
sequenceNode
=
leftChild
as
SequenceNode
;
47
}
48
while
(
sequenceNode
!=
null
);
49
return
leftChild
.IsNullable;
50
}
51
}
52
53
public
override
void
ConstructPos
(
BitSet
firstpos,
BitSet
lastpos,
BitSet
[]
followpos
)
54
{
55
Stack<SequenceConstructPosContext>
stack =
new
Stack<SequenceConstructPosContext>
();
56
SequenceConstructPosContext
item
=
new
SequenceConstructPosContext
(
this
, firstpos, lastpos);
57
SequenceNode
this_;
58
while
(
true
)
59
{
60
this_ =
item
.this_;
61
item.lastposLeft
=
new
BitSet
(lastpos.
Count
);
62
if
(!(this_.
LeftChild
is
SequenceNode
))
63
{
64
break
;
65
}
66
stack.Push(
item
);
67
item
=
new
SequenceConstructPosContext
((
SequenceNode
)this_.
LeftChild
,
item
.firstpos,
item
.lastposLeft);
68
}
69
this_.
LeftChild
.
ConstructPos
(
item
.firstpos,
item
.lastposLeft,
followpos
);
70
while
(
true
)
71
{
72
item.firstposRight
=
new
BitSet
(firstpos.
Count
);
73
this_.
RightChild
.
ConstructPos
(
item
.firstposRight,
item
.lastpos,
followpos
);
74
if
(this_.
LeftChild
.
IsNullable
&& !this_.
RightChild
.
IsRangeNode
)
75
{
76
item
.firstpos.Or(
item
.firstposRight);
77
}
78
if
(this_.
RightChild
.
IsNullable
)
79
{
80
item
.lastpos.Or(
item
.lastposLeft);
81
}
82
for
(
int
num =
item
.lastposLeft.NextSet(-1); num != -1; num =
item
.lastposLeft.NextSet(num))
83
{
84
followpos
[num].Or(
item
.firstposRight);
85
}
86
if
(this_.
RightChild
.
IsRangeNode
)
87
{
88
((
LeafRangeNode
)this_.
RightChild
).NextIteration =
item
.firstpos.Clone();
89
}
90
if
(stack.
Count
!= 0)
91
{
92
item
= stack.Pop();
93
this_ =
item
.this_;
94
continue
;
95
}
96
break
;
97
}
98
}
99
100
public
override
void
ExpandTree
(
InteriorNode
parent,
SymbolsDictionary
symbols
,
Positions
positions
)
101
{
102
ExpandTreeNoRecursive
(parent,
symbols
,
positions
);
103
}
104
}
System.Collections.Generic.Dictionary.Count
int Count
Definition
Dictionary.cs:682
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Xml.Schema.BitSet.Count
int Count
Definition
BitSet.cs:11
System.Xml.Schema.BitSet
Definition
BitSet.cs:6
System.Xml.Schema.InteriorNode.ExpandTreeNoRecursive
void ExpandTreeNoRecursive(InteriorNode parent, SymbolsDictionary symbols, Positions positions)
Definition
InteriorNode.cs:35
System.Xml.Schema.InteriorNode.RightChild
SyntaxTreeNode RightChild
Definition
InteriorNode.cs:24
System.Xml.Schema.InteriorNode.LeftChild
SyntaxTreeNode LeftChild
Definition
InteriorNode.cs:12
System.Xml.Schema.InteriorNode
Definition
InteriorNode.cs:6
System.Xml.Schema.LeafRangeNode
Definition
LeafRangeNode.cs:4
System.Xml.Schema.Positions
Definition
Positions.cs:6
System.Xml.Schema.SequenceNode.ExpandTree
override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions)
Definition
SequenceNode.cs:100
System.Xml.Schema.SequenceNode.IsNullable
override bool IsNullable
Definition
SequenceNode.cs:30
System.Xml.Schema.SequenceNode.ConstructPos
override void ConstructPos(BitSet firstpos, BitSet lastpos, BitSet[] followpos)
Definition
SequenceNode.cs:53
System.Xml.Schema.SequenceNode
Definition
SequenceNode.cs:6
System.Xml.Schema.SymbolsDictionary
Definition
SymbolsDictionary.cs:6
System.Xml.Schema.SyntaxTreeNode.ConstructPos
void ConstructPos(BitSet firstpos, BitSet lastpos, BitSet[] followpos)
System.Xml.Schema.SyntaxTreeNode.IsRangeNode
virtual bool IsRangeNode
Definition
SyntaxTreeNode.cs:7
System.Xml.Schema.SyntaxTreeNode.IsNullable
bool IsNullable
Definition
SyntaxTreeNode.cs:5
System.Xml.Schema.SyntaxTreeNode
Definition
SyntaxTreeNode.cs:4
System.Collections.Generic
Definition
IHashKeyCollection.cs:1
System.Xml.Schema
Definition
Extensions.cs:3
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.ExceptionArgument.item
@ item
System.Xml.Schema.SequenceNode.SequenceConstructPosContext.lastpos
BitSet lastpos
Definition
SequenceNode.cs:13
System.Xml.Schema.SequenceNode.SequenceConstructPosContext.firstposRight
BitSet firstposRight
Definition
SequenceNode.cs:17
System.Xml.Schema.SequenceNode.SequenceConstructPosContext.firstpos
BitSet firstpos
Definition
SequenceNode.cs:11
System.Xml.Schema.SequenceNode.SequenceConstructPosContext.SequenceConstructPosContext
SequenceConstructPosContext(SequenceNode node, BitSet firstpos, BitSet lastpos)
Definition
SequenceNode.cs:19
System.Xml.Schema.SequenceNode.SequenceConstructPosContext.this_
SequenceNode this_
Definition
SequenceNode.cs:9
System.Xml.Schema.SequenceNode.SequenceConstructPosContext.lastposLeft
BitSet lastposLeft
Definition
SequenceNode.cs:15
System.Xml.Schema.SequenceNode.SequenceConstructPosContext
Definition
SequenceNode.cs:8
source
System.Private.Xml
System.Xml.Schema
SequenceNode.cs
Generated by
1.10.0