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 AmbigiousDeclException extends antlr.SemanticException {
16: String filename = "unknown";
17: String ambigious_symbol;
18: Token t;
19:
20: public AmbigiousDeclException(String cat, Token t) {
21: super ("Name already in use");
22: this .ambigious_symbol = t.getText();
23: this .filename = t.getFilename();
24: this .line = t.getLine();
25: this .column = t.getColumn();
26: }
27:
28: public AmbigiousDeclException(String ambigious_symbol,
29: String filename, int line, int column) {
30: super ("Name already in use");
31: this .filename = filename;
32: this .ambigious_symbol = ambigious_symbol;
33: this .line = line;
34: this .column = column;
35: }
36:
37: /**
38: * Returns a clean error message (no line number/column information)
39: */
40: public String getErrorMessage() {
41: return "The name \'" + ambigious_symbol
42: + "\' is already in use.";
43: }
44:
45: /**
46: * Returns a clean error message (no line number/column information)
47: */
48: public String getMessage() {
49: return getErrorMessage();
50: }
51:
52: /**
53: * Returns a string representation of this exception.
54: */
55: public String toString() {
56: return filename + "(" + this .getLine() + ", "
57: + this .getColumn() + "):\n" + getErrorMessage();
58: }
59: }
|