Esempio n. 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();
        }
Esempio n. 2
0
 public void ToState(ParseState state)
 {
     _states.Push(_currentState);
     _currentState = state;
 }
Esempio n. 3
0
 public void ToState(ParseState state)
 {
     _states.Push(_currentState);
     _currentState = state;
 }
Esempio n. 4
0
 public void EndState()
 {
     var toState = _states.Pop();
     toState.AddOperand(_currentState.Close());
     _currentState = toState;
 }