1 package persistence.antlr; 2 3 8 9 public class RecognitionException extends ANTLRException { 10 public String fileName; public int line; 12 public int column; 13 14 public RecognitionException() { 15 super("parsing error"); 16 fileName = null; 17 line = -1; 18 column = -1; 19 } 20 21 25 public RecognitionException(String s) { 26 super(s); 27 fileName = null; 28 line = -1; 29 column = -1; 30 } 31 32 33 public RecognitionException(String s, String fileName_, int line_) { 34 this(s, fileName_, line_, -1); 35 } 36 37 41 public RecognitionException(String s, String fileName_, int line_, int column_) { 42 super(s); 43 fileName = fileName_; 44 line = line_; 45 column = column_; 46 } 47 48 public String getFilename() { 49 return fileName; 50 } 51 52 public int getLine() { 53 return line; 54 } 55 56 public int getColumn() { 57 return column; 58 } 59 60 61 public String getErrorMessage() { 62 return getMessage(); 63 } 64 65 public String toString() { 66 return FileLineFormatter.getFormatter(). 67 getFormatString(fileName, line, column) + getMessage(); 68 } 69 } 70 | Popular Tags |