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