Chained

case class Chained[Elem, H, T, F](headM: ContextMatcher[Elem, H], tailM: ContextMatcher[Elem, T])(implicit reduce: Aux[H, T, F]) extends ContextMatcher[Elem, F]

Matcher implementation for headM \ tailM

Type parameters:
F

The combined result type

H

The head result type

T

The tail result type

Value parameters:
headM

The first matcher in the chain

reduce

The TypeReduce rule to combine the head and tail result types

tailM

The next matcher in the chain

trait Serializable
trait Product
trait Equals
trait ContextMatcher[Elem, F]
class Object
trait Matchable
class Any

Value members

Concrete methods

override def apply(stack: IndexedSeq[Elem], offset: Int, avail: Int): Option[F]
Definition Classes
def applyChained[N](stack: IndexedSeq[Elem], offset: Int, avail: Int, next: ContextMatcher[Elem, N]): Option[(F, N)]
override def toString: String
Definition Classes
Any

Inherited methods

def \[A1 >: F, B, R](next: ContextMatcher[Elem, B])(implicit reduce: Aux[A1, B, R]): ContextMatcher[Elem, R]

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.

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.

Type parameters:
A1

To satisfy covariance on A

B

The next matcher's context type

R

The "reduced" content type, derived from the tuple type (A, B) based on the reduce rule.

Value parameters:
next

A matcher which will be used to match the "inner" context

reduce

The TypeReduce rule to help omit Unit from the resulting context type

Returns:

A matcher which delegates to this matcher first, then the next matcher for the remaining stack.

Inherited from:
ContextMatcher
def filter(p: F => Boolean): ContextMatcher[Elem, 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.

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.

Value parameters:
p

The filter predicate, i.e. the validation function

Returns:

A new matcher with validated results

Inherited from:
ContextMatcher
def flatMap[B](f: F => Option[B]): ContextMatcher[Elem, B]

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.

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.

Type parameters:
B

The transformed context type

Value parameters:
f

The transformation/validation function

Returns:

A new matcher with transformed and validated results

Inherited from:
ContextMatcher
def map[B](f: F => B): ContextMatcher[Elem, B]

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.

Type parameters:
B

The transformed context type

Value parameters:
f

The transformation function

Returns:

A new matcher with transformed results

Inherited from:
ContextMatcher
def or[A2 >: F](that: ContextMatcher[Elem, A2]): ContextMatcher[Elem, A2]

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.

Type parameters:
A2

The resulting context type (common supertype between this matcher and that)

Value parameters:
that

The matcher which will be used as the fallback

Returns:

A matcher that falls back to another matcher in case of failure

Inherited from:
ContextMatcher
def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product
def |[A2 >: F](that: ContextMatcher[Elem, A2]): ContextMatcher[Elem, A2]

Operator version of or

Operator version of or

Inherited from:
ContextMatcher