| | * @return The next token in the sequence. |
| | */ |
| | - Lexeme parse( final CharacterIterator i ) { |
| | + private Lexeme parse( final CharacterIterator i ) { |
| | int began = i.getIndex(); |
| | boolean isWord = false; |
 |
| | isWord = true; |
| | |
| | - final var next = peek(i); |
| | + final var next = peek( i ); |
| | |
| | if( !isLetter( next ) && !isDigit( next ) ) { |
 |
| | } |
| | |
| | + /** |
| | + * @param i The {@link CharacterIterator} used to scan through the text, one |
| | + * character at a time. |
| | + * @return {@code true} if any characters were skipped. |
| | + */ |
| | boolean skip( final CharacterIterator i ) { |
| | return false; |
 |
| | return Character.isDigit( curr ) || |
| | "¼½¾⅐⅑⅒⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞".indexOf( curr ) > -1; |
| | + } |
| | + |
| | + /** |
| | + * Answers whether the given character may be part of an en- or em-dash. |
| | + * This must be called after it is known that the character isn't a lone |
| | + * hyphen. |
| | + * |
| | + * @param curr The character to check as being a dash. |
| | + * @return {@code true} if the given character is part of a dash. |
| | + */ |
| | + private static boolean isDash( final char curr ) { |
| | + return curr == '-' || curr == '–' || curr == '—' || curr == '―'; |
| | } |
| | |
 |
| | curr == '.' || curr == ',' || curr == '-' || curr == '+' || |
| | curr == '^' || curr == '⅟' || curr == '⁄'; |
| | - } |
| | - |
| | - /** |
| | - * Answers whether the given character may be part of an en- or em-dash. |
| | - * This must be called after it is known that the character isn't a lone |
| | - * hyphen. |
| | - * |
| | - * @param curr The character to check as being a dash. |
| | - * @return {@code true} if the given character is part of a dash. |
| | - */ |
| | - private boolean isDash( final char curr ) { |
| | - return curr == '-' || curr == '–' || curr == '—' || curr == '―'; |
| | } |
| | |
| | - static char peek( final CharacterIterator ci ) { |
| | + private static char peek( final CharacterIterator ci ) { |
| | final var ch = ci.next(); |
| | ci.previous(); |
 |
| | * @return The number of characters parsed. |
| | */ |
| | - static int slurp( |
| | + protected static int slurp( |
| | final CharacterIterator ci, |
| | final BiFunction<Character, CharacterIterator, Boolean> f ) { |
 |
| | while( f.apply( next, ci ) ); |
| | |
| | - // The loop above will overshoot the tally by one character. |
| | + // The loop will have overshot the tally by one character. |
| | ci.previous(); |
| | |