01: package persistence.antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.jGuru.com
05: * Software rights: http://www.antlr.org/license.html
06: *
07: */
08:
09: import java.io.Reader;
10: import java.io.InputStream;
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 filename;
26:
27: public int guessing = 0;
28:
29: public LexerSharedInputState(InputBuffer inbuf) {
30: input = inbuf;
31: }
32:
33: public LexerSharedInputState(InputStream in) {
34: this (new ByteBuffer(in));
35: }
36:
37: public LexerSharedInputState(Reader 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: }
|