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.proof;
12:
13: public class SVInstantiationParserException extends
14: SVInstantiationExceptionWithPosition {
15:
16: private String instantiation;
17: private String detail;
18:
19: public SVInstantiationParserException(String instantiation,
20: int row, int column, String detail, boolean inIfSequent) {
21: super ("Parser Error", row, column, inIfSequent);
22: this .instantiation = instantiation;
23: this .detail = (detail == null) ? "" : detail;
24: }
25:
26: private String space(int i) {
27: StringBuffer res = new StringBuffer();
28: for (int j = 0; j < i; j++) {
29: res.append(" ");
30: }
31: return res.toString();
32: }
33:
34: public String getMessage() {
35:
36: int column = getColumn();
37:
38: String errmsg = super .getMessage();
39: //needs non-prop font: errmsg +="\n"+inst;
40: if (column > 0) {
41: //needs non-prop font: errmsg +="\n"+space(column-1)+"^";
42: StringBuffer sb = new StringBuffer(instantiation);
43: sb.insert(column - 1, "~~>" + space(column - 1));
44: errmsg += "\noccured at: " + sb.toString();
45: } else {
46: errmsg += "\noccured in:" + instantiation;
47: }
48:
49: errmsg += "\nDetail:\n" + detail;
50:
51: return errmsg;
52: }
53:
54: /**
55: * Returns a string representation of this exception.
56: */
57: public String toString() {
58: return getMessage();
59: }
60: }
|