Esempio n. 1
0
 public IEnumerable <ParenCapture> GetCaptures(int number)
 {
     return
         (new ReadOnlyCollection <ParenCapture>(
              _captures.ContainsKey(number)
                 ? _captures[number].ToList()
                 : (IList <ParenCapture>) new[] { ParenCapture.Fail(number) }));
 }
Esempio n. 2
0
            public void AddCapture(int number, int index, string value)
            {
                if (!_captures.ContainsKey(number))
                {
                    _captures.Add(number, new Stack <ParenCapture>());
                }

                var capture = ParenCapture.Pass(number, index, value);

                _captures[number].Push(capture);

                // In case there are any saved states, we need to associate the capture with all of them. That way, should
                // a saved state be backtracted away, it can clear any captures associated with it.
                foreach (var savedState in _savedStates)
                {
                    savedState.AddCapture(capture);
                }
            }
Esempio n. 3
0
 public void RemoveCapture(ParenCapture capture)
 {
     _captures.Remove(capture);
 }
Esempio n. 4
0
 public void AddCapture(ParenCapture capture)
 {
     _captures.Add(capture);
 }