##// END OF EJS Templates
minor fixes and debug
minor fixes and debug

File last commit:

r176:0c3c69fe225b ref20160224
r181:b2b6a6640aa3 ref20160224
Show More
StringScanner.cs
26 lines | 651 B | text/x-csharp | CSharpLexer
cin
rewritten the text scanner
r176 using System;
namespace Implab.Formats {
public class StringScanner: TextScanner {
const int CHUNK_SIZE = 1024;
readonly string m_text;
int m_pos;
public StringScanner(string text) : base(text.Length, text.Length < CHUNK_SIZE ? text.Length : CHUNK_SIZE) {
m_text = text;
Feed();
}
protected override int Read(char[] buffer, int offset, int size) {
var actual = size + m_pos > m_text.Length ? m_text.Length - m_pos : size;
m_text.CopyTo(m_pos,buffer,offset, actual);
m_pos += actual;
return actual;
}
}
}