Operator version of and
Create a new matcher by forming a chain with this matcher at the front, and the next
matcher at the back.
Create a new matcher by forming a chain with this matcher at the front, and the next
matcher at the back.
In other words, a matcher for a context within another context.
To satisfy covariance on A
The next
matcher's context type
The "reduced" content type, derived from the tuple type (A, B)
based on the reduce
rule.
A matcher which will be used to match the "inner" context
The TypeReduce
rule to help omit Unit
from the resulting context type
A matcher which delegates to this
matcher first, then the next
matcher for the remaining stack.
Creates a new single-element matcher which combines the results of both this
matcher and that
matcher.
Creates a new single-element matcher which combines the results of both this
matcher and that
matcher.
Both this
and that
will operate on the first element of the stack (as opposed to Chained matchers).
To satisfy covariance on A
The other matcher's result type
The combined result type
The matcher to combine
The TypeReduce
rule for combining the two match results
A new matcher which combines the results of this
and that
The main context match method.
The main context match method.
Inspects the elements in the XML "tag stack", which is essentially a List[StartElement]
, but for
performance reasons is represented as an array with an "offset" index and a number of available
elements from that offset. If the elements correspond to a context value of A
, the implementation
must then pass the remaining elements of the stack to the next
matcher, i.e. by calling
next(stack, offset + numConsumed, avail - numConsumed)
.
The difference between this method and applyChained
is the lack of the next
parameter; in this
method, the current matcher is assumed to be the end of the chain.
A reference to the complete XML "tag stack". Note that the responsibility of this method
is limited to a *slice* of this value, as defined by offset
and avail
.
The index of the first element to be considered by the matching logic. From this method's
point of view, the "first" element in the stack is actually at stack(offset)
The number of elements available in the stack
starting from the offset
.
An option containing the successfully-matched context, or None
.
The underlying context match method.
The underlying context match method.
Inspects the elements in the XML "tag stack", which is essentially a List[StartElement]
, but for
performance reasons is represented as an array with an "offset" index and a number of available
elements from that offset. If the elements correspond to a context value of A
, the implementation
must then pass the remaining elements of the stack to the next
matcher, i.e. by calling
next(stack, offset + numConsumed, avail - numConsumed)
.
The next
matcher is necessary in order to support non-greedy matchers, e.g. ContextMatcher.variableLength
,
a.k.a. **
. Without a reference to the next
matcher in the chain, matcher implementations would be
forced to pick a fixed number of elements for matching, never knowing that the overall match could have
succeeded if they had consumed some additional elements.
The next
matcher's context type
A reference to the complete XML "tag stack". Note that the responsibility of this method
is limited to a *slice* of this value, as defined by offset
and avail
.
The index of the first element to be considered by the matching logic. From this method's
point of view, the "first" element in the stack is actually at stack(offset)
The number of elements available in the stack
starting from the offset
.
The next matcher in the chain.
If the match succeeded, and the next
match succeded, an Option containing a tuple of both match results.
If the match failed, or if the next
match failed, None
.
Create a new ContextMatcher which takes the match result of this matcher and passes it through the
validation function f
.
Create a new ContextMatcher which takes the match result of this matcher and passes it through the
validation function f
. If f
returns false
, the match is unsuccessful.
The filter predicate, i.e. the validation function
A new matcher with validated results
Create a new ContextMatcher which takes the match result of this matcher and passes it through the
combined transformation/validation function f
.
Create a new ContextMatcher which takes the match result of this matcher and passes it through the
combined transformation/validation function f
. If f
returns None
, the match is unsuccessful;
if f
returns a Some
, the value inside is the result of the match.
The transformed context type
The transformation/validation function
A new matcher with transformed and validated results
Create a new ContextMatcher which takes the match result of this matcher and passes it through the
transformation function f
.
Create a new ContextMatcher which takes the match result of this matcher and passes it through the
transformation function f
.
The transformed context type
The transformation function
A new matcher with transformed results
Specialization of the default or
method, specifically for SingleElementContextMatchers
Create a new ContextMatcher which will fall back to a second matcher in the event that this matcher fails to match a context.
Create a new ContextMatcher which will fall back to a second matcher in the event that this matcher fails to match a context.
The resulting context type (common supertype between this matcher and that
)
The matcher which will be used as the fallback
A matcher that falls back to another matcher in case of failure
Operator version of or
, specialized for SingleElementContextMatchers
Operator version of or
Operator version of or
Specialization of ContextMatcher which only checks the first element in the stack for matching operations. Transformation operations on single-element matchers will yield other single-element matchers (rather than the base ContextMatcher type). Combination operations involving other single-element matchers will also yield single-element matchers. SingleElementContextMatchers form the building blocks of more complex matchers.
The type of the matched context.