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