Exemple #1
0
        public INode Parse(IEnumerable<IToken> tokens)
        {
            _tokens = tokens.GetEnumerator();
            _states = new Stack<ParseState>();
            _currentState = new ParseState();
            while (_tokens.MoveNext())
            {
                _currentState.Handle(this);
            }

            while (_states.Count > 0)
            {
                EndState();
            }

            return _currentState.Close();
        }
Exemple #2
0
 public void ToState(ParseState state)
 {
     _states.Push(_currentState);
     _currentState = state;
 }
Exemple #3
0
 public void ToState(ParseState state)
 {
     _states.Push(_currentState);
     _currentState = state;
 }
Exemple #4
0
 public void EndState()
 {
     var toState = _states.Pop();
     toState.AddOperand(_currentState.Close());
     _currentState = toState;
 }