Beispiel #1
0
        void IParserNodeVisitor.VisitNumber(ParserNode.Number number)
        {
            if (_currState.PrevNode == number.Parent)
            {
                _currState = _currState.EnterNode(number.Child);
            }
            else if (_currState.PrevNode == number.Child)
            {
                // var handledChildIndex = _currState.Stack.ChildsCount;
                // var handledChildIndex = _currState.TreeNode.ChildsCount;
                var handledChildIndex = _currState.ChildsCount;

                if (_currState.LastTerminalFailed.Value)
                {
                    // _currState.PopChildIndex();
                    if (handledChildIndex < number.CountFrom)
                    {
                        _currState = _currState.ExitNode(true);
                    }
                    else
                    {
                        _currState = _currState.ExitNode(false);
                    }
                }
                else
                {
                    if (handledChildIndex + 1 < number.CountTo)
                    {
                        // _currState.IncChildIndex();
                        _currState = _currState.EnterNode(number.Child);
                    }
                    else
                    {
                        // _currState.PopChildIndex();
                        _currState = _currState.ExitNode(false);
                    }
                }
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Beispiel #2
0
 public void VisitNumber(ParserNode.Number number)
 {
     this.LogLine("{0}", number); _v.VisitNumber(number);
 }
Beispiel #3
0
 void IParserNodeVisitor.VisitNumber(ParserNode.Number number)
 {
     this.PrintNode(number);
 }