1:
9: package ;
10:
11: import ;
12:
13:
17: public class LocatorImpl implements Locator {
18:
19:
20: private static boolean W3CDebug;
21: static {
22: try {
23: W3CDebug = (Boolean.getBoolean("debug")
24: || Boolean.getBoolean("org.w3c.flute.parser.LocatorImpl.debug")
25: || Boolean.getBoolean("org.w3c.flute.parser.debug")
26: || Boolean.getBoolean("org.w3c.flute.debug")
27: || Boolean.getBoolean("org.w3c.debug")
28: || Boolean.getBoolean("org.debug"));
29: } catch (Exception e) {
30:
31: }
32: }
33:
34: String uri;
35: int line;
36: int column;
37:
38: public String getURI() {
39: return uri;
40: }
41:
42: public int getLineNumber() {
43: return line;
44: }
45:
46: public int getColumnNumber() {
47: return column;
48: }
49:
50:
53: public LocatorImpl(Parser p) {
54: if (W3CDebug) {
55: System.err.println( "LocatorImpl::newLocator(" + p + ");");
56: }
57: uri = p.source.getURI();
58: line = p.token.beginLine;
59: column = p.token.beginColumn;
60: }
61:
62:
65: public LocatorImpl(Parser p, Token tok) {
66: if (W3CDebug) {
67: System.err.println( "LocatorImpl::newLocator(" + p
68: + ", " + tok + ");");
69: }
70: uri = p.source.getURI();
71: line = tok.beginLine;
72: column = tok.beginColumn;
73: }
74:
75:
78: public LocatorImpl(Parser p, int line, int column) {
79: if (W3CDebug) {
80: System.err.println( "LocatorImpl::newLocator(" + p
81: + ", " + line
82: + ", " + column + ");");
83: }
84: uri = p.source.getURI();
85: this.line = line;
86: this.column = column;
87: }
88:
89:
92: public LocatorImpl reInit(Parser p) {
93: if (W3CDebug) {
94: System.err.println( "LocatorImpl::reInit(" + p + ");" );
95: }
96: uri = p.source.getURI();
97: line = p.token.beginLine;
98: column = p.token.beginColumn;
99: return this;
100: }
101:
102:
105: public LocatorImpl reInit(Parser p, Token tok) {
106: if (W3CDebug) {
107: System.err.println( "LocatorImpl::reInit(" + p
108: + ", " + tok + ");");
109: }
110: uri = p.source.getURI();
111: line = tok.beginLine;
112: column = tok.beginColumn;
113: return this;
114: }
115:
116:
119: public LocatorImpl reInit(Parser p, int line, int column) {
120: if (W3CDebug) {
121: System.err.println("LocatorImpl::reInit(" + p
122: + ", " + line
123: + ", " + column + ");");
124: }
125: uri = p.source.getURI();
126: this.line = line;
127: this.column = column;
128: return this;
129: }
130: }