(char[] arr)
| 392 | } |
| 393 | |
| 394 | protected boolean matchBareWord(char[] arr) throws IOException { |
| 395 | for (int i = 1; i < arr.length; i++) { |
| 396 | int ch = getChar(); |
| 397 | if (ch != arr[i]) { |
| 398 | if ((flags & ALLOW_UNQUOTED_STRING_VALUES) == 0) { |
| 399 | throw err("Expected " + new String(arr)); |
| 400 | } else { |
| 401 | stringTerm = 0; |
| 402 | out.reset(); |
| 403 | out.write(arr, 0, i); |
| 404 | if (!eof) { |
| 405 | start--; |
| 406 | } |
| 407 | return false; |
| 408 | } |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | // if we don't allow bare strings, we don't need to check that the string actually terminates... |
| 413 | // just let things fail as the parser tries to continue |
| 414 | if ((flags & ALLOW_UNQUOTED_STRING_VALUES) == 0) { |
| 415 | return true; |
| 416 | } |
| 417 | |
| 418 | // check that the string actually terminates... for example trueX should return false |
| 419 | int ch = getChar(); |
| 420 | if (eof) { |
| 421 | return true; |
| 422 | } else if (!isUnquotedStringChar(ch)) { |
| 423 | start--; |
| 424 | return true; |
| 425 | } |
| 426 | |
| 427 | // we encountered something like "trueX" when matching "true" |
| 428 | stringTerm = 0; |
| 429 | out.reset(); |
| 430 | out.unsafeWrite(arr, 0, arr.length); |
| 431 | out.unsafeWrite(ch); |
| 432 | return false; |
| 433 | } |
| 434 | |
| 435 | protected ParseException err(String msg) { |
| 436 | // We can't tell if EOF was hit by comparing start<=end |
no test coverage detected