KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > LexerSharedInputState


1 package persistence.antlr;
2
3 /* ANTLR Translator Generator
4  * Project led by Terence Parr at http://www.jGuru.com
5  * Software rights: http://www.antlr.org/license.html
6  *
7  */

8
9 import java.io.Reader JavaDoc;
10 import java.io.InputStream JavaDoc;
11
12 /** This object contains the data associated with an
13  * input stream of characters. Multiple lexers
14  * share a single LexerSharedInputState to lex
15  * the same input stream.
16  */

17 public class LexerSharedInputState {
18     protected int column = 1;
19     protected int line = 1;
20     protected int tokenStartColumn = 1;
21     protected int tokenStartLine = 1;
22     protected InputBuffer input;
23
24     /** What file (if known) caused the problem? */
25     protected String JavaDoc filename;
26
27     public int guessing = 0;
28
29     public LexerSharedInputState(InputBuffer inbuf) {
30         input = inbuf;
31     }
32
33     public LexerSharedInputState(InputStream JavaDoc in) {
34         this(new ByteBuffer(in));
35     }
36
37     public LexerSharedInputState(Reader JavaDoc in) {
38         this(new CharBuffer(in));
39     }
40
41     public void reset() {
42         column = 1;
43         line = 1;
44         tokenStartColumn = 1;
45         tokenStartLine = 1;
46         guessing = 0;
47         filename = null;
48         input.reset();
49     }
50 }
51
Popular Tags