| 62 | } |
| 63 | |
| 64 | private String getNextToken(String token) throws ScannerException { |
| 65 | |
| 66 | int tokenIndex = 0; |
| 67 | int endTokenIndex = index + token.length(); |
| 68 | |
| 69 | while (index < endTokenIndex) { |
| 70 | |
| 71 | char currentChar = statement.charAt(index); |
| 72 | char currentTokenChar = token.charAt(tokenIndex); |
| 73 | |
| 74 | if (currentChar != currentTokenChar) { |
| 75 | throw new ScannerException(token); |
| 76 | } |
| 77 | |
| 78 | tokenIndex++; |
| 79 | index++; |
| 80 | } |
| 81 | |
| 82 | return token; |
| 83 | } |
| 84 | |
| 85 | private String getNextToken(Predicate<Character> tokenInclusionPredicate) { |
| 86 | |