Pegmatite::Pattern::UnicodeAny
Inherits Pegmatite::Pattern < Pegmatite::DSL::Methods < Reference < Object
Pattern::UnicodeAny is used to consume any single arbitrary character.
Parsing will fail if a valid UTF-8 codepoint couldn't be parsed. Otherwise, the pattern succeeds, consuming the matched bytes.
Constants
This class is stateless, so to save memory, you can use this singleton INSTANCE instead of allocating a new one every time.
Class methods
This helper method is used to extract a UTF-8 codepoint from the given byte offset of the given source string, returning the codepoint itself along with the number of bytes that were consumed by its representation.
TODO: Use Crystal's Char::Reader abstraction for Pegmatite, which would potentially obviate the need for this logic to be here. ameba:disable Metrics/CyclomaticComplexity