示例#1
0
 /// <summary>
 /// 使用指定的起始位置和 Tab 宽度初始化 <see cref="SourceReader"/> 类的新实例。
 /// </summary>
 /// <param name="initPosition">起始位置。</param>
 /// <param name="tabSize">Tab 的宽度。</param>
 private SourceReader(SourcePosition initPosition, int tabSize)
 {
     locator            = new SourceLocator(initPosition, tabSize);
     current            = first = last = new SourceBuffer();
     firstIndex         = lastLength = 0;
     current.Next       = current;
     current.StartIndex = 0;
 }
示例#2
0
 /// <summary>
 /// 使用指定的字符读取器和 Tab 宽度初始化 <see cref="SourceReader"/> 类的新实例。
 /// </summary>
 /// <param name="reader">用于读取源文件的字符读取器。</param>
 /// <param name="tabSize">Tab 的宽度。</param>
 public SourceReader(TextReader reader, int tabSize)
 {
     ExceptionHelper.CheckArgumentNull(reader, "reader");
     locator        = new SourceLocator(tabSize);
     this.reader    = reader;
     current        = first = last = new SourceBuffer();
     firstIndex     = lastLength = 0;
     current.Buffer = new char[BufferSize];
     current.Next   = current;
 }