class Pegmatite::Pattern::UnicodeAny
- Pegmatite::Pattern::UnicodeAny
- Pegmatite::Pattern
- Reference
- Object
Overview
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.
Defined in:
pegmatite/pattern/unicode_any.crConstant Summary
-
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 Method Summary
-
.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.
Instance Method Summary
Instance methods inherited from class Pegmatite::Pattern
_match(source, offset, state) : MatchResult
_match,
match(source, offset, state) : MatchResult
match
Instance methods inherited from module Pegmatite::DSL::Methods
>>(other)
>>,
^(other)
^,
|(other)
|,
~
~,
dynamic_pop(label)
dynamic_pop,
dynamic_push(label)
dynamic_push,
maybe
maybe,
named(label, tokenize = true)
named,
repeat(min = 0, max = nil)
repeat,
repeat_exactly(times)
repeat_exactly,
then_eof
then_eof
Class Method Detail
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