コード例 #1
0
        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);
        }
コード例 #2
0
 public ParseTreeEnumerator(
     IInternalForestNode forestRoot)
 {
     _forestRoot = forestRoot;
     _status     = ParseTreeEnumeratorState.New;
     _visitor    = new ForestNodeVisitorImpl();
 }
コード例 #3
0
 public ParseTreeEnumerator(
     IInternalForestNode forestRoot)
 {
     _forestRoot = forestRoot;
     _status = ParseTreeEnumeratorState.New;
     _visitor = new ForestNodeVisitorImpl();
 }
コード例 #4
0
 public void Reset()
 {
     _status = ParseTreeEnumeratorState.New;
     _visitor.Reset();
 }
コード例 #5
0
 public void Reset()
 {
     _status = ParseTreeEnumeratorState.New;
     _visitor.Reset();
 }
コード例 #6
0
        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;
        }