Matcher implementation for headM \ tailM
Matcher implementation for headM \ tailM
The head result type
The tail result type
The combined result type
The first matcher in the chain
The next matcher in the chain
The TypeReduce
rule to combine the head and tail result types
Matcher implementation for the map
, flatMap
, and filter
operations.
Matcher implementation for the map
, flatMap
, and filter
operations.
The type of the matched context.
The transformed context type
The transformed mapper
The name of the operation, used by toString
The transform operation
Matcher implementation for left | right
.
Matcher implementation for left | right
.
The type of the matched context.
The left matcher (i.e. the first choice)
The right matcher (i.e. the fallback)
A matcher that uses a custom function f
to consume the first N
elements
from the input before passing the remainder to the next matcher in the chain.
A matcher that uses a custom function f
to consume the first N
elements
from the input before passing the remainder to the next matcher in the chain.
For example:
Matcher.greedy { (stack, offset, avail) => if(avail >= 2 && stack(offset) == "foo" && stack(offset + 1) == "bar"){ Some("yes!" -> 2) } else { None } }
The matcher function's result type
The matching function. Given a reference to the stack elements, an offset position, and
the number of elements available starting from the offset, f
should return
an option containing a pair of the matched value and the unconsumed portion of the stack.
A new matcher which uses f
to determine how (and how much of) the stack is matched
A matcher that quickly rejects any input
A matcher that quickly matches any input as ()
without consuming any stack.
A matcher that matches any input as long as the next matcher in the chain will match some segment of that input.