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: import de.uka.ilkd.key.logic.sort.Sort;
15:
16: public class GenericSortException extends antlr.SemanticException {
17: String cat;
18: String filename;
19: Sort sort;
20: String reason;
21:
22: public GenericSortException(String cat, String reason, Sort sort,
23: Token t, String filename) {
24: super ("GenericSort");
25: this .cat = cat;
26: this .reason = reason;
27: this .filename = filename;
28: this .sort = sort;
29: this .line = t.getLine();
30: this .column = t.getColumn();
31: }
32:
33: public GenericSortException(String cat, String reason, Sort sort,
34: String filename, int line, int column) {
35: super ("GenericSort");
36: this .cat = cat;
37: this .reason = reason;
38: this .filename = filename;
39: this .sort = sort;
40: this .line = line;
41: this .column = column;
42: }
43:
44: /**
45: * Returns a clean error message (no line number/column information)
46: */
47: public String getErrorMessage() {
48: String errmsg = cat + "\n " + sort + "\n";
49: return errmsg + reason;
50: }
51:
52: /**
53: * Returns a clean error message (no line number/column information)
54: */
55: public String getMessage() {
56: return getErrorMessage();
57: }
58:
59: /**
60: * Returns a string representation of this exception.
61: */
62: public String toString() {
63: return filename + "(" + this .getLine() + ", "
64: + this .getColumn() + "): " + getErrorMessage();
65: }
66: }
|