public bool MoveNext() { if (_status == ParseTreeEnumeratorState.Done) { return(false); } if (_forestRoot.NodeType == ForestNodeType.Intermediate) { _visitor.Visit(_forestRoot as IIntermediateForestNode); } else if (_forestRoot.NodeType == ForestNodeType.Symbol) { _visitor.Visit(_forestRoot as ISymbolForestNode); } if (_visitor.Root is null) { _status = ParseTreeEnumeratorState.Done; return(false); } _status = ParseTreeEnumeratorState.Current; return(true); }
public ParseTreeEnumerator( IInternalForestNode forestRoot) { _forestRoot = forestRoot; _status = ParseTreeEnumeratorState.New; _visitor = new ForestNodeVisitorImpl(); }
public void Reset() { _status = ParseTreeEnumeratorState.New; _visitor.Reset(); }
public bool MoveNext() { if (_status == ParseTreeEnumeratorState.Done) return false; if (_forestRoot.NodeType == ForestNodeType.Intermediate) _visitor.Visit(_forestRoot as IIntermediateForestNode); else if (_forestRoot.NodeType == ForestNodeType.Symbol) _visitor.Visit(_forestRoot as ISymbolForestNode); if (_visitor.Root == null) { _status = ParseTreeEnumeratorState.Done; return false; } _status = ParseTreeEnumeratorState.Current; return true; }