package encore
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Encore.Syntax
Source
fail msg
creates a combinator that will always fail with the message msg
.
commit
prevents backtracking beyong the current position of the input, allowing the manager of the input buffer to reuse the preceding bytes for other purposes when the combinator is used as a parser.
As a serializer, commit
forces to flush the internal buffer to the manager of the output buffer (if the current state is not into an alteration - see choice
).
peek p q
accepts/computes p
and returns it. Otherwise, it accepts/computes q
and returns it. It does not advance the input as a parser or produce something into the output as a serializer.
any
accepts/produces any character. As a parser, it returns it. As a serializer, it writes it.
rep1 t
runs t
one or more times and accepts/produces a list of results from the runs of t
.
rep0 t
runs t
zero of more times and accepts/produces a list of results from the runs of t
.
while0 p
accepts/produces a string
which respects the predicate p
. For example, this description:
NUMBER = *DIGIT
can be translated to:
let number = while0 is_digit
while1 p
accepts/produces a string
which respects the predicate p
. The string
must be not empty. This description:
NUMBER = 1*DIGIT
can be translated to:
let number = while1 is_digit
lower
accepts/produces any US-ASCII lowercase letter 'a'
.. 'z'
, that is a byte in the range [0x61
;0x7A
].
upper
accepts/produces any US-ASCII uppercase letter 'A'
.. 'Z'
, that is a byte in the range [0x41
;0x5A
].
digit
accepts/produces any US-ASCII digit '0'
.. '9'
, that is a byte in the range [0x30
;0x39
].