Mercurial > pub > ImplabNet
comparison Implab/Formats/StringScanner.cs @ 182:76e8f2ba12b8 ref20160224
pretty print DFA, the minimization is still buggy
author | cin |
---|---|
date | Thu, 24 Mar 2016 18:52:10 +0300 |
parents | 0c3c69fe225b |
children |
comparison
equal
deleted
inserted
replaced
181:b2b6a6640aa3 | 182:76e8f2ba12b8 |
---|---|
2 | 2 |
3 namespace Implab.Formats { | 3 namespace Implab.Formats { |
4 public class StringScanner: TextScanner { | 4 public class StringScanner: TextScanner { |
5 const int CHUNK_SIZE = 1024; | 5 const int CHUNK_SIZE = 1024; |
6 | 6 |
7 readonly string m_text; | 7 public StringScanner(string text) : base(null) { |
8 int m_pos; | 8 Safe.ArgumentNotNull(text, "text"); |
9 | 9 var data = text.ToCharArray(); |
10 public StringScanner(string text) : base(text.Length, text.Length < CHUNK_SIZE ? text.Length : CHUNK_SIZE) { | 10 Feed(data, 0, data.Length); |
11 m_text = text; | |
12 Feed(); | |
13 } | 11 } |
14 | 12 |
15 protected override int Read(char[] buffer, int offset, int size) { | 13 protected override int Read(char[] buffer, int offset, int size) { |
16 var actual = size + m_pos > m_text.Length ? m_text.Length - m_pos : size; | 14 return 0; |
17 | |
18 m_text.CopyTo(m_pos,buffer,offset, actual); | |
19 | |
20 m_pos += actual; | |
21 | |
22 return actual; | |
23 } | 15 } |
24 } | 16 } |
25 } | 17 } |
26 | 18 |