KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > RecognitionException


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 public class RecognitionException extends ANTLRException {
10     public String JavaDoc fileName; // not used by treeparsers
11
public int line;
12     public int column;
13
14     public RecognitionException() {
15         super("parsing error");
16         fileName = null;
17         line = -1;
18         column = -1;
19     }
20
21     /**
22      * RecognitionException constructor comment.
23      * @param s java.lang.String
24      */

25     public RecognitionException(String JavaDoc s) {
26         super(s);
27         fileName = null;
28         line = -1;
29         column = -1;
30     }
31
32     /** @deprecated As of ANTLR 2.7.2 use {@see #RecognitionException(char, String, int, int) } */
33     public RecognitionException(String JavaDoc s, String JavaDoc fileName_, int line_) {
34         this(s, fileName_, line_, -1);
35     }
36     
37     /**
38      * RecognitionException constructor comment.
39      * @param s java.lang.String
40      */

41     public RecognitionException(String JavaDoc s, String JavaDoc fileName_, int line_, int column_) {
42         super(s);
43         fileName = fileName_;
44         line = line_;
45         column = column_;
46     }
47
48     public String JavaDoc 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 JavaDoc getErrorMessage() {
62         return getMessage();
63     }
64
65     public String JavaDoc toString() {
66         return FileLineFormatter.getFormatter().
67             getFormatString(fileName, line, column) + getMessage();
68     }
69 }
70
Popular Tags