| Matching Statements |
| File1 Line# |
File2 Line# |
Statement |
| 11 | 19 | public class TokenMgrError extends Error |
| 20 | 28 | static final int LEXICAL_ERROR = 0 |
| 25 | 33 | static final int STATIC_LEXER_ERROR = 1 |
| 30 | 38 | static final int INVALID_LEXICAL_STATE = 2 |
| 35 | 43 | static final int LOOP_DETECTED = 3 |
| 41 | 49 | int errorCode |
| 47 | 55 | protected static final String addEscapes(String str) { |
| 48 | 56 | StringBuffer retval = new StringBuffer() |
| 49 | 57 | char ch |
| 50 | 58 | for (int i = 0 |
| 50 | 58 | i < str.length() |
| 50 | 58 | i++) { |
| 51 | 59 | switch (str.charAt(i)) |
| 53 | 61 | case 0 : |
56 59 62 65 68 71 74 77 | 64 67 70 73 76 79 82 85 | retval.append( ) |
| 80 | 88 | if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { |
| 81 | 89 | String s = + Integer.toString(ch, 16) |
| 82 | 90 | retval.append( + s.substring(s.length() - 4, s.length())) |
| 84 | 92 | retval.append(ch) |
| 89 | 97 | return retval.toString() |
| 106 | 114 | errorLine + + |
| 107 | 115 | errorColumn + + |
| 108 | 116 | (EOFSeen ? : ( + addEscapes(String.valueOf(curChar)) + ) + + (int)curChar + ) + |
| 109 | 117 | + addEscapes(errorAfter) + ) |
| 121 | 129 | public String getMessage() { |
| 122 | 130 | return super.getMessage() |
| 129 | 137 | public TokenMgrError() { |
| 132 | 140 | public TokenMgrError(String message, int reason) { |
| 133 | 141 | super(message) |
| 134 | 142 | errorCode = reason |
| 137 | 145 | public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { |
| 138 | 146 | this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason) |
| Matching Comments and Strings |
| File1 Line# |
File2 Line# |
Comment/String |
| 14 | 22 | * Ordinals for various reasons why an Error of this type can be thrown. |
| 18 | 26 | * Lexical error occured. |
| 23 | 31 | * An attempt wass made to create a second instance of a static token manager. |
| 28 | 36 | * Tried to change to an invalid lexical state. |
| 33 | 41 | * Detected (and bailed out of) an infinite loop in the token manager. |
| 38 | 46 | * Indicates the reason why the exception is thrown. It will have |
| 39 | 47 | * one of the above 4 values. |
| 44 | 52 | * Replaces unprintable characters by their espaced (or unicode escaped) |
| 45 | 53 | * equivalents in the given string |
| 56 | 64 | \\b |
| 59 | 67 | \\t |
| 62 | 70 | \\n |
| 65 | 73 | \\f |
| 68 | 76 | \\r |
| 71 | 79 | \\\" |
| 74 | 82 | \\\' |
| 77 | 85 | \\\\ |
| 81 | 89 | 0000 |
| 82 | 90 | \\u |
| 93 | 101 | * Returns a detailed message for the Error when it is thrown by the |
| 94 | 102 | * token manager to indicate a lexical error. |
| 95 | 103 | * Parameters : |
| 96 | 104 | * EOFSeen : indicates if EOF caused the lexicl error |
| 97 | 105 | * curLexState : lexical state in which this error occured |
| 98 | 106 | * errorLine : line number when the error occured |
| 99 | 107 | * errorColumn : column number when the error occured |
| 100 | 108 | * errorAfter : prefix that was seen before this error occured |
| 101 | 109 | * curchar : the offending character |
| 102 | 110 | * Note: You can customize the lexical error message by modifying this method. |
| 105 | 113 | Lexical error at line |
| 106 | 114 | , column |
| 107 | 115 | . Encountered: |
| 108 | 116 | <EOF> |
| 109 | 117 | after : \" |
| 113 | 121 | * You can also modify the body of this method to customize your error messages. |
| 114 | 122 | * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not |
| 115 | 123 | * of end-users concern, so you can return something like : |
| 117 | 125 | * "Internal Error : Please file a bug report .... " |
| 119 | 127 | * from this method for such cases in the release version of your parser. |
| 126 | 134 | * Constructors of various flavors follow. |