~ubuntu-branches/ubuntu/breezy/antlr/breezy

« back to all changes in this revision

Viewing changes to lib/csharp/src/antlr.debug/DebuggingInputBuffer.cs

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2005-06-29 16:11:22 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050629161122-g81crc3z92p5xhsg
Tags: 2.7.5-6ubuntu4
Build depend on java-gcj-compat-dev, depend on java-gcj-compat.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
namespace antlr.debug
2
 
{
3
 
        using System;
4
 
        using ArrayList = System.Collections.ArrayList;
5
 
        
6
 
        public class DebuggingInputBuffer : InputBuffer
7
 
        {
8
 
                public virtual ArrayList InputBufferListeners
9
 
                {
10
 
                        get { return inputBufferEventSupport.InputBufferListeners; }
11
 
                }
12
 
                public virtual bool DebugMode
13
 
                {
14
 
                        set     { debugMode = value;    }
15
 
                }
16
 
 
17
 
                private InputBuffer buffer;
18
 
                private InputBufferEventSupport inputBufferEventSupport;
19
 
                private bool debugMode = true;
20
 
                
21
 
                
22
 
                public DebuggingInputBuffer(InputBuffer buffer)
23
 
                {
24
 
                        this.buffer = buffer;
25
 
                        inputBufferEventSupport = new InputBufferEventSupport(this);
26
 
                }
27
 
                public virtual void  addInputBufferListener(InputBufferListener l)
28
 
                {
29
 
                        inputBufferEventSupport.addInputBufferListener(l);
30
 
                }
31
 
                public override void  consume()
32
 
                {
33
 
                        char la = ' ';
34
 
                        try
35
 
                        {
36
 
                                la = buffer.LA(1);
37
 
                        }
38
 
                        catch (CharStreamException)
39
 
                        {
40
 
                        } // vaporize it...
41
 
                        buffer.consume();
42
 
                        if (debugMode)
43
 
                                inputBufferEventSupport.fireConsume(la);
44
 
                }
45
 
                public override void  fill(int a)
46
 
                {
47
 
                        buffer.fill(a);
48
 
                }
49
 
                public virtual bool isDebugMode()
50
 
                {
51
 
                        return debugMode;
52
 
                }
53
 
                public override bool isMarked()
54
 
                {
55
 
                        return buffer.isMarked();
56
 
                }
57
 
                public override char LA(int i)
58
 
                {
59
 
                        char la = buffer.LA(i);
60
 
                        if (debugMode)
61
 
                                inputBufferEventSupport.fireLA(la, i);
62
 
                        return la;
63
 
                }
64
 
                public override int mark()
65
 
                {
66
 
                        int m = buffer.mark();
67
 
                        inputBufferEventSupport.fireMark(m);
68
 
                        return m;
69
 
                }
70
 
                public virtual void  removeInputBufferListener(InputBufferListener l)
71
 
                {
72
 
                        if (inputBufferEventSupport != null)
73
 
                                inputBufferEventSupport.removeInputBufferListener(l);
74
 
                }
75
 
                public override void  rewind(int mark)
76
 
                {
77
 
                        buffer.rewind(mark);
78
 
                        inputBufferEventSupport.fireRewind(mark);
79
 
                }
80
 
        }
 
1
namespace antlr.debug
 
2
{
 
3
        using System;
 
4
        using ArrayList = System.Collections.ArrayList;
 
5
        
 
6
        public class DebuggingInputBuffer : InputBuffer
 
7
        {
 
8
                public virtual ArrayList InputBufferListeners
 
9
                {
 
10
                        get { return inputBufferEventSupport.InputBufferListeners; }
 
11
                }
 
12
                public virtual bool DebugMode
 
13
                {
 
14
                        set     { debugMode = value;    }
 
15
                }
 
16
 
 
17
                private InputBuffer buffer;
 
18
                private InputBufferEventSupport inputBufferEventSupport;
 
19
                private bool debugMode = true;
 
20
                
 
21
                
 
22
                public DebuggingInputBuffer(InputBuffer buffer)
 
23
                {
 
24
                        this.buffer = buffer;
 
25
                        inputBufferEventSupport = new InputBufferEventSupport(this);
 
26
                }
 
27
                public virtual void  addInputBufferListener(InputBufferListener l)
 
28
                {
 
29
                        inputBufferEventSupport.addInputBufferListener(l);
 
30
                }
 
31
                public override char  consume()
 
32
                {
 
33
                        char la = ' ';
 
34
                        try
 
35
                        {
 
36
                                la = buffer.LA(1);
 
37
                        }
 
38
                        catch (CharStreamException)
 
39
                        {
 
40
                        } // vaporize it...
 
41
                        buffer.consume();
 
42
                        if (debugMode)
 
43
                                inputBufferEventSupport.fireConsume(la);
 
44
                        return la;
 
45
                }
 
46
                public override void  fill(int a)
 
47
                {
 
48
                        buffer.fill(a);
 
49
                }
 
50
                public virtual bool isDebugMode()
 
51
                {
 
52
                        return debugMode;
 
53
                }
 
54
                public override bool isMarked()
 
55
                {
 
56
                        return buffer.isMarked();
 
57
                }
 
58
                public override char LA(int i)
 
59
                {
 
60
                        char la = buffer.LA(i);
 
61
                        if (debugMode)
 
62
                                inputBufferEventSupport.fireLA(la, i);
 
63
                        return la;
 
64
                }
 
65
                public override int mark()
 
66
                {
 
67
                        int m = buffer.mark();
 
68
                        inputBufferEventSupport.fireMark(m);
 
69
                        return m;
 
70
                }
 
71
                public virtual void  removeInputBufferListener(InputBufferListener l)
 
72
                {
 
73
                        if (inputBufferEventSupport != null)
 
74
                                inputBufferEventSupport.removeInputBufferListener(l);
 
75
                }
 
76
                public override void  rewind(int mark)
 
77
                {
 
78
                        buffer.rewind(mark);
 
79
                        inputBufferEventSupport.fireRewind(mark);
 
80
                }
 
81
        }
81
82
}
 
 
b'\\ No newline at end of file'