| 1 |
|
|
| 2 |
|
package org.apache.lucene.analysis.standard; |
| 3 |
|
|
|
|
|
| 0% |
Uncovered Elements: 54 (54) |
Complexity: 18 |
Complexity Density: 0.43 |
|
| 4 |
|
public class TokenMgrError extends Error |
| 5 |
|
{ |
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
static final int LEXICAL_ERROR = 0; |
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
static final int STATIC_LEXER_ERROR = 1; |
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
static final int INVALID_LEXICAL_STATE = 2; |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
static final int LOOP_DETECTED = 3; |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
int errorCode; |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 13 |
Complexity Density: 0.35 |
|
| 40 |
0
|
protected static final String addEscapes(String str) {... |
| 41 |
0
|
StringBuffer retval = new StringBuffer(); |
| 42 |
0
|
char ch; |
| 43 |
0
|
for (int i = 0; i < str.length(); i++) { |
| 44 |
0
|
switch (str.charAt(i)) |
| 45 |
|
{ |
| 46 |
0
|
case 0 : |
| 47 |
0
|
continue; |
| 48 |
0
|
case '\b': |
| 49 |
0
|
retval.append("\\b"); |
| 50 |
0
|
continue; |
| 51 |
0
|
case '\t': |
| 52 |
0
|
retval.append("\\t"); |
| 53 |
0
|
continue; |
| 54 |
0
|
case '\n': |
| 55 |
0
|
retval.append("\\n"); |
| 56 |
0
|
continue; |
| 57 |
0
|
case '\f': |
| 58 |
0
|
retval.append("\\f"); |
| 59 |
0
|
continue; |
| 60 |
0
|
case '\r': |
| 61 |
0
|
retval.append("\\r"); |
| 62 |
0
|
continue; |
| 63 |
0
|
case '\"': |
| 64 |
0
|
retval.append("\\\""); |
| 65 |
0
|
continue; |
| 66 |
0
|
case '\'': |
| 67 |
0
|
retval.append("\\\'"); |
| 68 |
0
|
continue; |
| 69 |
0
|
case '\\': |
| 70 |
0
|
retval.append("\\\\"); |
| 71 |
0
|
continue; |
| 72 |
0
|
default: |
| 73 |
0
|
if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { |
| 74 |
0
|
String s = "0000" + Integer.toString(ch, 16); |
| 75 |
0
|
retval.append("\\u" + s.substring(s.length() - 4, s.length())); |
| 76 |
|
} else { |
| 77 |
0
|
retval.append(ch); |
| 78 |
|
} |
| 79 |
0
|
continue; |
| 80 |
|
} |
| 81 |
|
} |
| 82 |
0
|
return retval.toString(); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
|
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 97 |
0
|
protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {... |
| 98 |
0
|
return("Lexical error at line " + |
| 99 |
|
errorLine + ", column " + |
| 100 |
|
errorColumn + ". Encountered: " + |
| 101 |
0
|
(EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + |
| 102 |
|
"after : \"" + addEscapes(errorAfter) + "\""); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 114 |
0
|
public String getMessage() {... |
| 115 |
0
|
return super.getMessage(); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 122 |
0
|
public TokenMgrError() {... |
| 123 |
|
} |
| 124 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 125 |
0
|
public TokenMgrError(String message, int reason) {... |
| 126 |
0
|
super(message); |
| 127 |
0
|
errorCode = reason; |
| 128 |
|
} |
| 129 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 130 |
0
|
public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {... |
| 131 |
0
|
this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); |
| 132 |
|
} |
| 133 |
|
} |