A SeqParser
is a parser for sequences. It wraps a function which takes a
sequence and optionally returns a value successfully-parsed from the start of
the sequence along with the rest of the sequence. If parsing fails it returns
None.
You can construct a SeqParser
using the seqParser
computation expression.
The bind operation of the computation expression will return the value parsed
from the sequence and advance the sequence to the position where the next value
can be parsed from. For example, given a parser parseValue, you can construct a
parser which parses three values like this:
1: 2: 3: 4: 5: 6: |
|
You can also call SeqParser.next
and SeqParser.abort
from within a
seqParser to pop the next element of the sequence or to abort parsing
respectively.
The function SeqParser.parseToCompletion
takes a sequence and a SeqParser
and will attempt to parse the sequence to completion.
Type | Description |
Function or value | Description |
|
|