[1] | 1 | using System; |
---|
| 2 | |
---|
| 3 | namespace antlr |
---|
| 4 | { |
---|
| 5 | /*ANTLR Translator Generator |
---|
| 6 | * Project led by Terence Parr at http://www.jGuru.com |
---|
| 7 | * Software rights: http://www.antlr.org/license.html |
---|
| 8 | * |
---|
| 9 | * $Id:$ |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | // |
---|
| 13 | // ANTLR C# Code Generator by Micheal Jordan |
---|
| 14 | // Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com |
---|
| 15 | // Anthony Oguntimehin |
---|
| 16 | // |
---|
| 17 | // With many thanks to Eric V. Smith from the ANTLR list. |
---|
| 18 | // |
---|
| 19 | |
---|
| 20 | [Serializable] |
---|
| 21 | public class RecognitionException : ANTLRException |
---|
| 22 | { |
---|
| 23 | public string fileName; // not used by treeparsers |
---|
| 24 | public int line; // not used by treeparsers |
---|
| 25 | public int column; // not used by treeparsers |
---|
| 26 | |
---|
| 27 | public RecognitionException() : base("parsing error") |
---|
| 28 | { |
---|
| 29 | fileName = null; |
---|
| 30 | line = - 1; |
---|
| 31 | column = - 1; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | /* |
---|
| 35 | * RecognitionException constructor comment. |
---|
| 36 | * @param s java.lang.String |
---|
| 37 | */ |
---|
| 38 | public RecognitionException(string s) : base(s) |
---|
| 39 | { |
---|
| 40 | fileName = null; |
---|
| 41 | line = - 1; |
---|
| 42 | column = - 1; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | /* |
---|
| 46 | * RecognitionException constructor comment. |
---|
| 47 | * @param s java.lang.String |
---|
| 48 | */ |
---|
| 49 | public RecognitionException(string s, string fileName_, int line_, int column_) : base(s) |
---|
| 50 | { |
---|
| 51 | fileName = fileName_; |
---|
| 52 | line = line_; |
---|
| 53 | column = column_; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | public virtual string getFilename() |
---|
| 57 | { |
---|
| 58 | return fileName; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | public virtual int getLine() |
---|
| 62 | { |
---|
| 63 | return line; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | public virtual int getColumn() |
---|
| 67 | { |
---|
| 68 | return column; |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | [Obsolete("Replaced by Message property since version 2.7.0", true)] |
---|
| 72 | public virtual string getErrorMessage() |
---|
| 73 | { |
---|
| 74 | return Message; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | override public string ToString() |
---|
| 78 | { |
---|
| 79 | return FileLineFormatter.getFormatter().getFormatString(fileName, line, column) + Message; |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | } |
---|