equal
deleted
inserted
replaced
61 protected char ch; |
61 protected char ch; |
62 |
62 |
63 /** The buffer index of the last converted unicode character |
63 /** The buffer index of the last converted unicode character |
64 */ |
64 */ |
65 protected int unicodeConversionBp = -1; |
65 protected int unicodeConversionBp = -1; |
66 |
|
67 /** Control conversion of unicode characters |
|
68 */ |
|
69 protected boolean unicodeConversion = true; |
|
70 |
66 |
71 protected Log log; |
67 protected Log log; |
72 protected Names names; |
68 protected Names names; |
73 |
69 |
74 /** A character buffer for saved chars. |
70 /** A character buffer for saved chars. |
156 |
152 |
157 String chars() { |
153 String chars() { |
158 return new String(sbuf, 0, sp); |
154 return new String(sbuf, 0, sp); |
159 } |
155 } |
160 |
156 |
161 protected boolean setUnicodeConversion(boolean newState) { |
|
162 boolean oldState = unicodeConversion; |
|
163 unicodeConversion = newState; |
|
164 return oldState; |
|
165 } |
|
166 |
|
167 /** Convert unicode escape; bp points to initial '\' character |
157 /** Convert unicode escape; bp points to initial '\' character |
168 * (Spec 3.3). |
158 * (Spec 3.3). |
169 */ |
159 */ |
170 protected void convertUnicode() { |
160 protected void convertUnicode() { |
171 if (ch == '\\' && unicodeConversion && unicodeConversionBp != bp ) { |
161 if (ch == '\\' && unicodeConversionBp != bp ) { |
172 bp++; ch = buf[bp]; |
162 bp++; ch = buf[bp]; |
173 if (ch == 'u') { |
163 if (ch == 'u') { |
174 do { |
164 do { |
175 bp++; ch = buf[bp]; |
165 bp++; ch = buf[bp]; |
176 } while (ch == 'u'); |
166 } while (ch == 'u'); |
262 |
252 |
263 protected char peekChar() { |
253 protected char peekChar() { |
264 return buf[bp + 1]; |
254 return buf[bp + 1]; |
265 } |
255 } |
266 |
256 |
267 protected char peekBack() { |
|
268 return buf[bp]; |
|
269 } |
|
270 |
|
271 /** |
|
272 * Skips consecutive occurrences of the current character, leaving bp positioned |
|
273 * at the last occurrence. Returns the occurrence count. |
|
274 */ |
|
275 protected int skipRepeats() { |
|
276 int start = bp; |
|
277 while (bp < buflen) { |
|
278 if (buf[bp] != buf[bp + 1]) |
|
279 break; |
|
280 bp++; |
|
281 } |
|
282 return bp - start; |
|
283 } |
|
284 |
|
285 /** |
257 /** |
286 * Returns a copy of the input buffer, up to its inputLength. |
258 * Returns a copy of the input buffer, up to its inputLength. |
287 * Unicode escape sequences are not translated. |
259 * Unicode escape sequences are not translated. |
288 */ |
260 */ |
289 public char[] getRawCharacters() { |
261 public char[] getRawCharacters() { |