1 package ro.infoiasi.donald.compiler.lexer.exceptions; 2 3 public class ExpParseError extends Exception { 4 public Integer startPos; 5 public Integer endPos; 6 public ExpParseError() { super(); } 7 public ExpParseError(String s, int startPos) { 8 super(s); 9 this.startPos = new Integer (startPos); 10 } 11 12 public ExpParseError(String s, int startPos, int endPos) { 13 super(s); 14 this.startPos = new Integer (startPos); 15 this.endPos = new Integer (endPos); 16 } 17 18 public String emphasize() { 19 StringBuffer sb = new StringBuffer (); 20 if (startPos != null) { 21 for (int i = 0; i<startPos.intValue(); i++) { 22 sb.append(" "); 23 } 24 if (endPos != null) { 25 for (int i = startPos.intValue(); i<endPos.intValue(); i++) { 26 sb.append("^"); 27 } 28 } else { 29 sb.append("^"); 30 } 31 } 32 return new String (sb); 33 } 34 } 35 | Popular Tags |