1 package polyglot.types; 2 3 import polyglot.util.Position; 4 import polyglot.main.Report; 5 import java.util.*; 6 7 11 public class SemanticException extends Exception { 12 protected Position position; 13 14 public SemanticException() { 15 super(); 16 trace(this, 5); 17 } 18 19 public SemanticException(Throwable cause) { 20 super(cause); 21 trace(this, 5); 22 } 23 24 public SemanticException(Position position) { 25 super(); 26 this.position = position; 27 trace(this, 5); 28 } 29 30 public SemanticException(String m) { 31 super(m); 32 trace(this, 5); 33 } 34 35 public SemanticException(String m, Throwable cause) { 36 super(m, cause); 37 trace(this, 5); 38 } 39 40 public SemanticException(String m, Position position) { 41 super(m); 42 this.position = position; 43 trace(this, 5); 44 } 45 46 public Position position() { 47 return position; 48 } 49 50 static void trace(Exception e, int level) { 51 if (Report.should_report(Report.errors, level)) { 52 e.printStackTrace(); 53 } 54 } 55 } 56 | Popular Tags |