01: package 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: import java.io.Reader;
09: import java.io.InputStream;
10:
11: /** This object contains the data associated with an
12: * input stream of characters. Multiple lexers
13: * share a single LexerSharedInputState to lex
14: * the same input stream.
15: */
16: public class LexerSharedInputState {
17: protected int column = 1;
18: protected int line = 1;
19: protected int tokenStartColumn = 1;
20: protected int tokenStartLine = 1;
21: protected InputBuffer input;
22:
23: /** What file (if known) caused the problem? */
24: protected String filename;
25:
26: public int guessing = 0;
27:
28: public LexerSharedInputState(InputBuffer inbuf) {
29: input = inbuf;
30: }
31:
32: public LexerSharedInputState(InputStream in) {
33: this (new ByteBuffer(in));
34: }
35:
36: public LexerSharedInputState(Reader in) {
37: this (new CharBuffer(in));
38: }
39:
40: public String getFilename() {
41: return filename;
42: }
43:
44: public InputBuffer getInput() {
45: return input;
46: }
47:
48: public int getLine() {
49: return line;
50: }
51:
52: public int getTokenStartColumn() {
53: return tokenStartColumn;
54: }
55:
56: public int getTokenStartLine() {
57: return tokenStartLine;
58: }
59:
60: public int getColumn() {
61: return column;
62: }
63:
64: /*public void reset() {
65: column = 1;
66: line = 1;
67: tokenStartColumn = 1;
68: tokenStartLine = 1;
69: guessing = 0;
70: filename = null;
71: input.reset();
72: }*/
73: }
|