class

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

INSTANCE = new

This class is stateless, so to save memory, you can use this singleton INSTANCE instead of allocating a new one every time.

Class methods

utf8_at(source, offset) : Tuple(UInt32, Int32, Bool)

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

Source

Instance methods

_match(source, offset, state) : MatchResult
Source
description
Source
dsl_name
Source
inspect(io)
Source