Home > prsc > codepoints
Creates a Parser that skips code points while the given predicate returns true.
This counts in unicode characters (code points), not UTF-16 code units.
This acts like starConsumed(codepoint(isMatch, []))
if expected is not set, or as plusConsumed(codepoint(isMatch, expected))
if it is, but is much more efficient than either of those combinations.
Signature:
export declare function codepoints(isMatch: (codepoint: number) => boolean, expected?: string[]): Parser<void>;
Parameter | Type | Description |
---|---|---|
isMatch | (codepoint: number) => boolean | callback called for each codepoint, should return whether that matches |
expected | string[] | (Optional) expected strings to return if the first codepoint does not match |
Returns:
Parser<void>