01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10:
11: package de.uka.ilkd.key.parser;
12:
13: import antlr.Token;
14:
15: public class KeYSemanticException extends antlr.SemanticException {
16: String cat;
17: String filename;
18: Token t;
19:
20: public KeYSemanticException(String cat, Token t, String filename) {
21: super ("Semantic Error", filename, t.getLine(), t.getColumn());
22: this .cat = cat;
23: this .filename = filename;
24: this .t = t;
25: this .line = t.getLine();
26: this .column = t.getColumn();
27: }
28:
29: public KeYSemanticException(String cat, String filename, int line,
30: int column) {
31: super ("Semantic Error", filename, line, column);
32: this .cat = cat;
33: this .filename = filename;
34: this .line = line;
35: this .column = column;
36: }
37:
38: public KeYSemanticException(String cat, int line, int column,
39: String file) {
40: this (cat, file, line, column);
41: }
42:
43: public KeYSemanticException(String message) {
44: super (message);
45: }
46:
47: public String getFilename() {
48: return filename;
49: }
50:
51: public int getLine() {
52: return line;
53: }
54:
55: public int getColumn() {
56: return column;
57: }
58:
59: /**
60: * Returns a clean error message (no line number/column information)
61: */
62: public String getErrorMessage() {
63: return cat;
64: }
65:
66: /**
67: * Returns a clean error message (no line number/column information)
68: */
69: public String getMessage() {
70: return getErrorMessage();
71: }
72:
73: /**
74: * Returns a string representation of this exception.
75: */
76: public String toString() {
77: return filename + "(" + this .getLine() + ", "
78: + this .getColumn() + "): " + getErrorMessage();
79: }
80: }
|