Matcher

io.github.edadma.pattern_matcher.Matchers.Matcher
abstract class Matcher[+R] extends Input => MatcherResult[R]

Abstract matcher. A matcher is a function that maps character input to a result value.

Type parameters

R

type of result value

Attributes

Graph
Supertypes
trait Input => MatcherResult[R]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def *: Matcher[List[R]]
def +: Matcher[List[R]]
def <~[S](m: => Matcher[S]): Matcher[R]

Returns a matcher that applies this matcher and another one sequentially and whose result value is that of this matcher.

Returns a matcher that applies this matcher and another one sequentially and whose result value is that of this matcher.

Type parameters

S

the type of the result value of the second matcher

Value parameters

m

the second matcher

Attributes

Returns

the new matcher

def ?: Matcher[Option[R]]
def ^^[S](f: R => S): Matcher[S]

Returns a matcher whose result value is transformed by a function.

Returns a matcher whose result value is transformed by a function.

Type parameters

S

the type of the transformed result value

Value parameters

f

the function applied to the result value

Attributes

def ^^^[S](v: => S): Matcher[S]
def map[S](f: R => S): Matcher[S]

Returns a new matcher whose result value is transformed by a function.

Returns a new matcher whose result value is transformed by a function.

Type parameters

S

type of the result value of the matcher being returned

Value parameters

f

function applied to the result value of this matcher

Attributes

Returns

a new matcher with a mapped result value

def withMessage(msg: String): Matcher[R]
def |[S >: R](m: => Matcher[S]): Matcher[S]

Returns a matcher that applies this matcher or alternatively another matcher if this matcher fails.

Returns a matcher that applies this matcher or alternatively another matcher if this matcher fails.

Type parameters

S

the type of the result value of the alternate

Value parameters

m

the alternate matcher

Attributes

Returns

the new matcher

def ~[S](m: => Matcher[S]): Matcher[R ~ S]

Returns a matcher that applies this matcher and another one sequentially and whose result value is a tuple containing the result values of the two matchers.

Returns a matcher that applies this matcher and another one sequentially and whose result value is a tuple containing the result values of the two matchers.

Type parameters

S

the type of the result value of the second matcher

Value parameters

m

the second matcher to be applied only if this matcher succeeds

Attributes

Returns

the new sequential matcher

def ~>[S](m: => Matcher[S]): Matcher[S]

Returns a matcher that applies this matcher and another one sequentially and whose result value is that of the second matcher.

Returns a matcher that applies this matcher and another one sequentially and whose result value is that of the second matcher.

Type parameters

S

the type of the result value of the second matcher

Value parameters

m

the second matcher

Attributes

Returns

the new matcher

Inherited methods

def andThen[A](g: MatcherResult[R] => A): Input => A

Attributes

Inherited from:
Function1
def compose[A](g: A => Input): A => MatcherResult[R]

Attributes

Inherited from:
Function1
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1

Inherited and Abstract methods

def apply(v1: Input): MatcherResult[R]

Attributes

Inherited from:
Function1