01: package ro.infoiasi.donald.compiler.lexer.exceptions;
02:
03: public class ExpParseError extends Exception {
04: public Integer startPos;
05: public Integer endPos;
06:
07: public ExpParseError() {
08: super ();
09: }
10:
11: public ExpParseError(String s, int startPos) {
12: super (s);
13: this .startPos = new Integer(startPos);
14: }
15:
16: public ExpParseError(String s, int startPos, int endPos) {
17: super (s);
18: this .startPos = new Integer(startPos);
19: this .endPos = new Integer(endPos);
20: }
21:
22: public String emphasize() {
23: StringBuffer sb = new StringBuffer();
24: if (startPos != null) {
25: for (int i = 0; i < startPos.intValue(); i++) {
26: sb.append(" ");
27: }
28: if (endPos != null) {
29: for (int i = startPos.intValue(); i < endPos.intValue(); i++) {
30: sb.append("^");
31: }
32: } else {
33: sb.append("^");
34: }
35: }
36: return new String(sb);
37: }
38: }
|