using CanonSharp.Common.Abstractions; namespace CanonSharp.Common.Reader; public class StringReader(string source) : ISourceReader { private int _pos; public char Read() { if (_pos >= source.Length) { throw new InvalidOperationException(); } char result = source[_pos]; _pos += 1; return result; } public bool TryPeek(out char c) { if (_pos < source.Length) { c = source[_pos]; return true; } c = char.MinValue; return false; } }