01: package antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.cs.usfca.edu
05: * Software rights: http://www.antlr.org/license.html
06: */
07:
08: public class RecognitionException extends ANTLRException {
09: public String fileName; // not used by treeparsers
10: public int line;
11: public int column;
12:
13: public RecognitionException() {
14: super ("parsing error");
15: fileName = null;
16: line = -1;
17: column = -1;
18: }
19:
20: /**
21: * RecognitionException constructor comment.
22: * @param s java.lang.String
23: */
24: public RecognitionException(String s) {
25: super (s);
26: fileName = null;
27: line = -1;
28: column = -1;
29: }
30:
31: /** @deprecated As of ANTLR 2.7.2 use {@see #RecognitionException(char, String, int, int) } */
32: public RecognitionException(String s, String fileName_, int line_) {
33: this (s, fileName_, line_, -1);
34: }
35:
36: /**
37: * RecognitionException constructor comment.
38: * @param s java.lang.String
39: */
40: public RecognitionException(String s, String fileName_, int line_,
41: int column_) {
42: super (s);
43: fileName = fileName_;
44: line = line_;
45: column = column_;
46: }
47:
48: public String getFilename() {
49: return fileName;
50: }
51:
52: public int getLine() {
53: return line;
54: }
55:
56: public int getColumn() {
57: return column;
58: }
59:
60: /** @deprecated As of ANTLR 2.7.0 */
61: public String getErrorMessage() {
62: return getMessage();
63: }
64:
65: public String toString() {
66: return FileLineFormatter.getFormatter().getFormatString(
67: fileName, line, column)
68: + getMessage();
69: }
70: }
|