private void AddLeafNode(SyntaxTreeNode node) { if (this.stack.Count > 0) { InteriorNode node2 = (InteriorNode) this.stack.Pop(); if (node2 != null) { node2.RightChild = node; node = node2; } } this.stack.Push(node); this.isPartial = true; }
private SyntaxTreeNode NewQmark(SyntaxTreeNode leftChild) { InteriorNode qmark = new QmarkNode(); qmark.LeftChild = leftChild; return qmark; }
private SyntaxTreeNode NewStar(SyntaxTreeNode leftChild) { InteriorNode star = new StarNode(); star.LeftChild = leftChild; return star; }
private SyntaxTreeNode NewSequence(SyntaxTreeNode leftChild, SyntaxTreeNode rightChild) { InteriorNode sequence = new SequenceNode(); sequence.LeftChild = leftChild; sequence.RightChild = rightChild; return sequence; }
private static void ConstructChildPos(SyntaxTreeNode child, BitSet firstpos, BitSet lastpos, BitSet[] followpos) { BitSet firstPosTemp = new BitSet(firstpos.Count); BitSet lastPosTemp = new BitSet(lastpos.Count); child.ConstructPos(firstPosTemp, lastPosTemp, followpos); firstpos.Or(firstPosTemp); lastpos.Or(lastPosTemp); }
private void Closure(InteriorNode node) { if (stack.Count > 0) { SyntaxTreeNode topNode = (SyntaxTreeNode)stack.Pop(); InteriorNode inNode = topNode as InteriorNode; if (isPartial && inNode != null) { // need to reach in and wrap right hand side of element. // and n remains the same. node.LeftChild = inNode.RightChild; inNode.RightChild = node; } else { // wrap terminal or any node node.LeftChild = topNode; topNode = node; } stack.Push(topNode); } else if (contentNode != null) { //If there is content to wrap // wrap whole content node.LeftChild = contentNode; contentNode = node; } }
private void AddLeafNode(SyntaxTreeNode node) { if (stack.Count > 0) { InteriorNode inNode = (InteriorNode)stack.Pop(); if (inNode != null) { inNode.RightChild = node; node = inNode; } } stack.Push( node ); isPartial = true; }
public void CloseGroup() { SyntaxTreeNode node = (SyntaxTreeNode)stack.Pop(); if (node == null) { return; } if (stack.Count == 0) { contentNode = node; isPartial = false; } else { // some collapsing to do... InteriorNode inNode = (InteriorNode)stack.Pop(); if (inNode != null) { inNode.RightChild = node; node = inNode; isPartial = true; } else { isPartial = false; } stack.Push(node); } }
private void Closure(InteriorNode node) { if (this.stack.Count > 0) { SyntaxTreeNode node2 = (SyntaxTreeNode) this.stack.Pop(); InteriorNode node3 = node2 as InteriorNode; if (this.isPartial && (node3 != null)) { node.LeftChild = node3.RightChild; node3.RightChild = node; } else { node.LeftChild = node2; node2 = node; } this.stack.Push(node2); } else if (this.contentNode != null) { node.LeftChild = this.contentNode; this.contentNode = node; } }
public void CloseGroup() { SyntaxTreeNode node = (SyntaxTreeNode) this.stack.Pop(); if (node != null) { if (this.stack.Count == 0) { this.contentNode = node; this.isPartial = false; } else { InteriorNode node2 = (InteriorNode) this.stack.Pop(); if (node2 != null) { node2.RightChild = node; node = node2; this.isPartial = true; } else { this.isPartial = false; } this.stack.Push(node); } } }