Основы объектно-ориентированного программирования на языке C# book | Page 185

8.5 Комплексна вправа до роздiлу 7 return new StringInput(s); } public StringInput(string s) { if (s == null) throw new ArgumentNullException(); this.s = s; this.position = -1; } public bool IsEmpty() { return (position >= s.Length); } object IEnumerator.Current { get { return s[Math.Max(0, position)]; } } public bool MoveNext() { if (position + 1 >= s.Length) { position = s.Length; return false; } else { position++; return true; } } void IEnumerator.Reset() { } public char Current { get { return s[Math.Max(0, position)]; } } public void Dispose() { } } public class ExpressionSyntaxError : Exception { public enum ErrorReason { MissingSymbol, UnexpectedToken, EmptyParentheses } private static Dictionary messages = new Dictionary(); private ErrorReason reason; private readonly int where; static ExpressionSyntaxError() { 185