public override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { SyntaxTreeNode node = null; foreach (int num in this.GetResolvedSymbols(symbols)) { if (symbols.GetParticle(num) != this.particle) { symbols.IsUpaEnforced = false; } LeafNode node2 = new LeafNode(positions.Add(num, this.particle)); if (node == null) { node = node2; } else { InteriorNode node3 = new ChoiceNode { LeftChild = node, RightChild = node2 }; node = node3; } } if (parent.LeftChild == this) { parent.LeftChild = node; } else { parent.RightChild = node; } }
public override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { this.leftChild.ExpandTree(this, symbols, positions); if (this.rightChild != null) { this.rightChild.ExpandTree(this, symbols, positions); } }
internal NfaContentValidator(BitSet firstpos, BitSet[] followpos, SymbolsDictionary symbols, Positions positions, int endMarkerPos, XmlSchemaContentType contentType, bool isOpen, bool isEmptiable) : base(contentType, isOpen, isEmptiable) { this.firstpos = firstpos; this.followpos = followpos; this.symbols = symbols; this.positions = positions; this.endMarkerPos = endMarkerPos; }
public override SyntaxTreeNode Clone(Positions positions) { InteriorNode node = (InteriorNode) base.MemberwiseClone(); node.LeftChild = this.leftChild.Clone(positions); if (this.rightChild != null) { node.RightChild = this.rightChild.Clone(positions); } return node; }
public override void Dump(StringBuilder bb, SymbolsDictionary symbols, Positions positions) { LeftChild.Dump(bb, symbols, positions); bb.Append("{" + Convert.ToString(min, NumberFormatInfo.InvariantInfo) + ", " + Convert.ToString(max, NumberFormatInfo.InvariantInfo) + "}"); }
public override SyntaxTreeNode Clone(Positions positions) { // range nodes have to be removed prior to that throw new InvalidOperationException(); }
public override void Dump(StringBuilder bb, SymbolsDictionary symbols, Positions positions) { Stack<ChoiceNode> nodeStack = new Stack<ChoiceNode>(); ChoiceNode this_ = this; while (true) { bb.Append("("); if (this_.LeftChild is ChoiceNode) { nodeStack.Push(this_); this_ = (ChoiceNode)this_.LeftChild; continue; } this_.LeftChild.Dump(bb, symbols, positions); ProcessRight: bb.Append(" | "); this_.RightChild.Dump(bb, symbols, positions); bb.Append(")"); if (nodeStack.Count == 0) break; this_ = nodeStack.Pop(); goto ProcessRight; } }
//no recursive version of expand tree for Sequence and Choice node protected void ExpandTreeNoRecursive(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { Stack<InteriorNode> nodeStack = new Stack<InteriorNode>(); InteriorNode this_ = this; while (true) { if (this_.leftChild is ChoiceNode || this_.leftChild is SequenceNode) { nodeStack.Push(this_); this_ = (InteriorNode)this_.leftChild; continue; } this_.leftChild.ExpandTree(this_, symbols, positions); ProcessRight: if (this_.rightChild != null) { this_.rightChild.ExpandTree(this_, symbols, positions); } if (nodeStack.Count == 0) break; this_ = nodeStack.Pop(); goto ProcessRight; } }
public override void Dump(StringBuilder bb, SymbolsDictionary symbols, Positions positions) { bb.Append("[" + namespaceList.ToString() + "]"); }
public override void Dump(StringBuilder bb, SymbolsDictionary symbols, Positions positions) { bb.Append("\"" + symbols.NameOf(positions[pos].symbol) + "\""); }
public override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { // do nothing }
public void Start() { this.symbols = new SymbolsDictionary(); this.positions = new Positions(); this.stack = new Stack(); }
public override SyntaxTreeNode Clone(Positions positions) { throw new InvalidOperationException(); }
public override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { Debug.Assert(parent is SequenceNode); Debug.Assert(this == parent.RightChild); //change the range node min to zero if left is nullable if (parent.LeftChild.IsNullable) { min = 0; } }
public abstract SyntaxTreeNode Clone(Positions positions);
public override SyntaxTreeNode Clone(Positions positions) { return new LeafNode(positions.Add(positions[pos].symbol, positions[pos].particle)); }
public abstract void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions);
public override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { SyntaxTreeNode replacementNode = null; foreach(int symbol in GetResolvedSymbols(symbols)) { if (symbols.GetParticle(symbol) != particle) { symbols.IsUpaEnforced = false; } LeafNode node = new LeafNode(positions.Add(symbol, particle)); if (replacementNode == null) { replacementNode = node; } else { InteriorNode choice = new ChoiceNode(); choice.LeftChild = replacementNode; choice.RightChild = node; replacementNode = choice; } } if (parent.LeftChild == this) { parent.LeftChild = replacementNode; } else { parent.RightChild = replacementNode; } }
internal RangeContentValidator(BitSet firstpos, BitSet[] followpos, SymbolsDictionary symbols, Positions positions, int endMarkerPos, XmlSchemaContentType contentType, bool isEmptiable, BitSet positionsWithRangeTerminals, int minmaxNodesCount) : base(contentType, false, isEmptiable) { this.firstpos = firstpos; this.followpos = followpos; this.symbols = symbols; this.positions = positions; this.positionsWithRangeTerminals = positionsWithRangeTerminals; this.minMaxNodesCount = minmaxNodesCount; this.endMarkerPos = endMarkerPos; }
public override SyntaxTreeNode Clone(Positions positions) { InteriorNode other = (InteriorNode)this.MemberwiseClone(); other.LeftChild = leftChild.Clone(positions); if (rightChild != null) { other.RightChild = rightChild.Clone(positions); } return other; }
public override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { ExpandTreeNoRecursive(parent, symbols, positions); }
internal RangeContentValidator( BitSet firstpos, BitSet[] followpos, SymbolsDictionary symbols, Positions positions, int endMarkerPos, XmlSchemaContentType contentType, bool isEmptiable, BitSet positionsWithRangeTerminals, int minmaxNodesCount) : base(contentType, false, isEmptiable) { this.firstpos = firstpos; this.followpos = followpos; this.symbols = symbols; this.positions = positions; this.positionsWithRangeTerminals = positionsWithRangeTerminals; this.minMaxNodesCount = minmaxNodesCount; this.endMarkerPos = endMarkerPos; }
public override void Dump(StringBuilder bb, SymbolsDictionary symbols, Positions positions) { LeftChild.Dump(bb, symbols, positions); bb.Append("*"); }
/// <summary> /// Expand NamesapceListNode and RangeNode nodes. All other nodes /// </summary> public abstract void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions);
/// <summary> /// Expand tree will replace a{min, max} using following algorithm. Bare in mind that this sequence will have at least two leaves /// if min == 0 (max cannot be unbounded) /// a?, ... a? /// \__ __/ /// max /// else /// if max == unbounded /// a, ... a, a* /// \__ __/ /// min /// else /// a, ... a, a?, ... a? /// \__ __/ \__ __/ /// min max - min /// </summary> public override void ExpandTree(InteriorNode parent, SymbolsDictionary symbols, Positions positions) { LeftChild.ExpandTree(this, symbols, positions); SyntaxTreeNode replacementNode = null; if (min == 0) { Debug.Assert(max != int.MaxValue); replacementNode = NewQmark(LeftChild); for (int i = 0; i < max - 1; i ++) { replacementNode = NewSequence(replacementNode, NewQmark(LeftChild.Clone(positions))); } } else { replacementNode = LeftChild; for (int i = 0; i < min - 1; i ++) { replacementNode = NewSequence(replacementNode, LeftChild.Clone(positions)); } if (max == int.MaxValue) { replacementNode = NewSequence(replacementNode, NewStar(LeftChild.Clone(positions))); } else { for (int i = 0; i < max - min; i ++) { replacementNode = NewSequence(replacementNode, NewQmark(LeftChild.Clone(positions))); } } } if (parent.LeftChild == this) { parent.LeftChild = replacementNode; } else { parent.RightChild = replacementNode; } }
/// <summary> /// Clone the syntaxTree. We need to pass symbolsByPosition because leaf nodes have to add themselves to it. /// </summary> public abstract SyntaxTreeNode Clone(Positions positions);
public override SyntaxTreeNode Clone(Positions positions) { return new LeafRangeNode(this.Pos, this.min, this.max); }
/// <summary> /// Print syntax tree /// </summary> #if DEBUG public abstract void Dump(StringBuilder bb, SymbolsDictionary symbols, Positions positions);
public void Start() { symbols = new SymbolsDictionary(); positions = new Positions(); stack = new Stack(); }
public override SyntaxTreeNode Clone(Positions positions) { return(new LeafRangeNode(base.Pos, this.min, this.max)); }