1.0.0-alpha.14 • Published 1 year ago
rudus v1.0.0-alpha.14
API
Parsers
number
- Tries to match a given number
string
- Tries to match a given string
regex
- Tries to match a given regex
whitespace
- Tries to match one or more whitespaces (regex:
/[\r\n\t\f\v ]+/
)
- Tries to match one or more whitespaces (regex:
word
- Tries to match one or more words (regex:
/[a-zA-Z0-9_]+/
)
- Tries to match one or more words (regex:
endOfInput
- Checks if there is nothing left to parse otherwise it fails
endOfLine
- Tries to match an end of line (either
\r\n
,\r
or\n
)
- Tries to match an end of line (either
lazy
- Takes a function that just returns a parser (a thunk). This defers the evaluation of the given parser. Useful for writing recursive parsers.
failure
- Always returns a failing parser with the given
errorMessage
. Typically used inside a contextual parser.
- Always returns a failing parser with the given
Combinators
sequenceOf
- Accepts multiple parsers, which must all match successfully in the given order otherwise it fails.
many
- Accepts a single parser, which may match zero or infinite times.
many1
- Accepts a single parser, which must match at least once or infinite times otherwise it fails.
separatedBy
- Tries to match a given
value
separated by a givenseparator
- Only captures the
value
- Tries to match a given
anyOf
- Tries to match all
parsers
and returns the first successful one.
- Tries to match all
optional
- The given
parser
may or may not match. This combinator can not fail.
- The given
between
- Tries to match a given
inner
surrounded by a givenouterLeft
andouterRight
. TheouterRight
parser is optional and defaults toouterLeft
.
- Tries to match a given
everythingUntil
- Tries to match everything until (
value
) the separator.
- Tries to match everything until (
1.0.0-alpha.14
1 year ago
1.0.0-alpha.13
1 year ago
1.0.0-alpha.12
2 years ago
1.0.0-alpha.9
3 years ago
1.0.0-alpha.8
3 years ago
1.0.0-alpha.7
3 years ago
1.0.0-alpha.6
3 years ago
1.0.0-alpha.10
3 years ago
1.0.0-alpha.5
3 years ago
1.0.0-alpha.4
3 years ago
1.0.0-alpha.3
3 years ago
1.0.0-alpha.11
3 years ago
1.0.0-alpha.2
3 years ago
1.0.0-alpha.1
4 years ago