~ubuntu-branches/ubuntu/feisty/monodevelop/feisty

« back to all changes in this revision

Viewing changes to Extras/VBNetBinding/SharpRefactoryVB/src/Lexer/Reader/FileReader.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-08-18 00:51:23 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060818005123-5iit07y0j7wjg55f
Tags: 0.11+svn20060818-0ubuntu1
* New SVN snapshot
  + Works with Gtk# 2.9.0
* debian/control:
  + Updated Build-Depends
* debian/patches/use_nunit2.2.dpatch,
  debian/patches/use_real_libs.dpatch:
  + Updated
* debian/patches/versioncontrol_buildfix.dpatch:
  + Fix build failure in the version control addin

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// <file>
2
 
//     <copyright see="prj:///doc/copyright.txt"/>
3
 
//     <license see="prj:///doc/license.txt"/>
4
 
//     <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
5
 
//     <version value="$version"/>
6
 
// </file>
7
 
 
8
 
using System;
9
 
using System.IO;
10
 
 
11
 
namespace ICSharpCode.SharpRefactory.Parser.VB
12
 
{
13
 
        public class FileReader : IReader
14
 
        {
15
 
                string file = null;
16
 
                int    ptr  = 0;
17
 
                
18
 
                public FileReader(string filename)
19
 
                {
20
 
                        StreamReader sreader = File.OpenText(filename);
21
 
                        file = sreader.ReadToEnd();
22
 
                        sreader.Close();
23
 
                }
24
 
                
25
 
                public char GetNext()
26
 
                {
27
 
                        if (Eos()) {
28
 
                                return '\0';
29
 
//                              throw new ParserException("warning : FileReader.GetNext : Read char over eos.", 0, 0);
30
 
                        }
31
 
                        return file[ptr++];
32
 
                }
33
 
                
34
 
                public char Peek()
35
 
                {
36
 
                        if (Eos()) {
37
 
                                return '\0';
38
 
//                              throw new ParserException("warning : FileReader.Peek : Read char over eos.", 0, 0);
39
 
                        }
40
 
                        return file[ptr];
41
 
                }
42
 
                
43
 
                public void UnGet()
44
 
                {
45
 
                        ptr = Math.Max(0, ptr -1);
46
 
                }
47
 
                
48
 
                public bool Eos()
49
 
                {
50
 
                        return ptr >= file.Length;
51
 
                }
52
 
        }
53
 
}