Generates a rule which matches any single char in the char sequence. @param string candidate chars. @return rule
(CharSequence string)
| 680 | * @return rule |
| 681 | */ |
| 682 | public CharTerminal<V> anyOf(CharSequence string) { |
| 683 | return new CharTerminal<>((ignoreCase) -> { |
| 684 | get().pushFrame("anyOf(" + string + ")"); |
| 685 | int n = get().nextChar(); |
| 686 | if (n < 0) { return get().ruleReturn(false, false); } |
| 687 | for (int i = 0; i < string.length(); i++) { |
| 688 | if (isCharMatch(ignoreCase, string.charAt(i), (char) n)) { return get().ruleReturn(true, true); } |
| 689 | } |
| 690 | return get().ruleReturn(false, false); |
| 691 | }); |
| 692 | } |
| 693 | |
| 694 | /** |
| 695 | * Dictionary lookup, optimized. |