eof package:megaparsec
This parser only succeeds at the end of input.
As the dual of
oneOf,
noneOf ts succeeds if the
current token
not in the supplied list of tokens
ts.
Returns the parsed character. Note that this parser cannot
automatically generate the “expected” component of error message, so
usually you should label it manually with
label or
(
<?>).
noneOf cs = satisfy (`notElem` cs)
See also:
satisfy.
Performance note: prefer
satisfy and
anySingleBut
when you can because it's faster.
oneOf ts succeeds if the current token is in the
supplied collection of tokens
ts. Returns the parsed token.
Note that this parser cannot automatically generate the “expected”
component of error message, so usually you should label it manually
with
label or (
<?>).
oneOf cs = satisfy (`elem` cs)
See also:
satisfy.
digit = oneOf ['0'..'9'] <?> "digit"
Performance note: prefer
satisfy when you can because
it's faster when you have only a couple of tokens to compare to:
quoteFast = satisfy (\x -> x == '\'' || x == '\"')
quoteSlow = oneOf "'\""
Number of processed tokens so far
Construct an “expected end of input” error component.
Construct an “unexpected end of input” error component.