MatchersExtras

com.phasmidsoftware.number.expression.matchers.MatchersExtras
trait MatchersExtras extends Matchers

This trait extends a set of Matchers which operate in a parallel fashion to the Parsers of the Scala Parser Combinator library.

CONSIDER why to we need this trait?

Attributes

Graph
Supertypes
trait Matchers
class Object
trait Matchable
class Any
Known subtypes

Members list

Type members

Inherited classlikes

case class Error[+R](e: Throwable) extends Unsuccessful[R, Throwable]

Error when matching.

Error when matching.

Type parameters

R

the result-type of this.

Value parameters

e

the exception that was thrown.

Attributes

Inherited from:
Matchers
Supertypes
trait Serializable
trait Product
trait Equals
class Matchers.this.Unsuccessful[R, Throwable]
trait Matchers.this.MatchResult[R]
class Object
trait Matchable
class Any
Show all
class LoggingMatcher[T, R](f: T => Matchers.this.MatchResult[R], matcherName: String = ...)(logger: MatchLogger) extends Matcher[T, R]

Class to add logging to a Matcher.

Class to add logging to a Matcher.

Type parameters

R

the underlying type of the result of the matcher.

T

the underlying type of the input to the matcher.

Value parameters

f

a function T => MatchResult[R].

logger

interpreted as follows: If logger is LogOff, the Matcher instance will simply invoke function f. If logger is LogInfo, then in addition to evaluating function f, a successful match will be logged. If logger is LogDebug, then in addition to evaluating function f, the attempted match and its result will be logged.

matcherName

the name to be used for this matcher.

Attributes

Inherited from:
Matchers
Supertypes
trait Matchers.this.Matcher[T, R]
trait T => Matchers.this.MatchResult[R]
class Object
trait Matchable
class Any
case class Match[+R](r: R) extends MatchResult[R]

Successful match.

Successful match.

Type parameters

R

the type of the result.

Value parameters

r

the result.

Attributes

Inherited from:
Matchers
Supertypes
trait Serializable
trait Product
trait Equals
trait Matchers.this.MatchResult[R]
class Object
trait Matchable
class Any
Show all
object Match

Companion object for the Match class providing factory methods.

Companion object for the Match class providing factory methods.

This object allows the creation of MatchResult instances by comparing two values of type R. If the two values are equal, a Match is constructed, and a message indicating the match result is printed to the standard error stream.

Attributes

Inherited from:
Matchers
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
object MatchResult

Companion object for the MatchResult type. Provides utility methods for constructing and aggregating MatchResult values.

Companion object for the MatchResult type. Provides utility methods for constructing and aggregating MatchResult values.

Attributes

Inherited from:
Matchers
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
sealed trait MatchResult[+R]

Trait to define the behavior of the result of a Match.

Trait to define the behavior of the result of a Match.

Type parameters

R

the type of the result.

Attributes

Inherited from:
Matchers
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Matchers.this.Match[R]
class Matchers.this.Unsuccessful[R, X]
class Matchers.this.Error[R]
class Matchers.this.Miss[T, R]
implicit class MatchResultOps[R](rr: Matchers.this.MatchResult[R])

Implicit class MatchResultOps, which allows us to use the method tee on a MatchResult[R].

Implicit class MatchResultOps, which allows us to use the method tee on a MatchResult[R].

Type parameters

R

the result type of m.

Value parameters

rr

a MatchResult[R].

Attributes

Inherited from:
Matchers
Supertypes
class Object
trait Matchable
class Any
trait Matcher[-T, +R] extends T => MatchResult[R]

Trait that defines the behavior of a Matcher as a function of type T => MatchResult[R] together with other filter-monadic methods, etc...

Trait that defines the behavior of a Matcher as a function of type T => MatchResult[R] together with other filter-monadic methods, etc...

Type parameters

R

the result type.

T

the input type.

Attributes

Inherited from:
Matchers
Supertypes
trait T => Matchers.this.MatchResult[R]
class Object
trait Matchable
class Any
Known subtypes
class Matchers.this.LoggingMatcher[T, R]
implicit class MatcherOps[T, R](p: Matchers.this.Matcher[T, R])

Implicit class MatcherOps, which allows us to use the method :| on a Matcher[T,R].

Implicit class MatcherOps, which allows us to use the method :| on a Matcher[T,R].

Type parameters

R

the result type of p.

T

the input type of p.

Value parameters

p

a Matcher[T,R].

Attributes

Inherited from:
Matchers
Supertypes
class Object
trait Matchable
class Any
case class Miss[T, +R](msg: String, t: T) extends Unsuccessful[R, String]

Unsuccessful match (Miss).

Unsuccessful match (Miss).

Type parameters

R

the result-type of this.

T

the underlying type of t.

Value parameters

t

the value that was not matched.

Attributes

Inherited from:
Matchers
Supertypes
trait Serializable
trait Product
trait Equals
class Matchers.this.Unsuccessful[R, String]
trait Matchers.this.MatchResult[R]
class Object
trait Matchable
class Any
Show all
implicit class ParserOps(s: String)

Implicit class ParserOps, which allows us to use the method m on a String.

Implicit class ParserOps, which allows us to use the method m on a String.

Value parameters

s

a String.

Attributes

Inherited from:
Matchers
Supertypes
class Object
trait Matchable
class Any
object Unsuccessful

Extractor object for matching unsuccessful MatchResult values.

Extractor object for matching unsuccessful MatchResult values.

The Unsuccessful object serves as a pattern to extract information from instances of MatchResult that represent an unsuccessful match. It matches error cases and provides access to the underlying details (either an exception or a message) wrapped in a Left or Right.

Attributes

Inherited from:
Matchers
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any

Inherited and Abstract classlikes

sealed abstract class Unsuccessful[+R, X](x: X) extends MatchResult[R]

Unsuccessful match of type dependent on X.

Unsuccessful match of type dependent on X.

TODO eliminate X (or R?) from the type signature.

Type parameters

R

the result-type of this.

X

the type of x.

Value parameters

x

either a String or a Throwable.

Attributes

Inherited from:
Matchers
Supertypes
trait Matchers.this.MatchResult[R]
class Object
trait Matchable
class Any
Known subtypes
class Matchers.this.Error[R]
class Matchers.this.Miss[T, R]

Inherited types

type AutoMatcher[T] = Matcher[T, T]

Represents a type alias AutoMatcher[T] which defines a Matcher[T, T] that matches an input value of type T to a MatchResult of the same type T.

Represents a type alias AutoMatcher[T] which defines a Matcher[T, T] that matches an input value of type T to a MatchResult of the same type T.

This type alias can be used to simplify and make the code more readable where such a transformation operation is utilized.

T is the type of both the input and MatchResult values.

Attributes

Inherited from:
Matchers
type Parser[R] = Matcher[String, R]

Type alias such that Parser[R] = Matcher[String, R].

Type alias such that Parser[R] = Matcher[String, R].

R is the type of the result.

Attributes

See also

Matcher

Parser

MatcherException

Match

Miss

Error

Success

Inherited from:
Matchers

Value members

Concrete methods

def matchOptionFunc2[T, R](f: T => Option[R])(t: T): MatchResult[R]

Creates a MatchResult by applying a given function f to an input value of type T, and matching the result if the function yields a defined Option. Matches and processes a given input using a function that returns an Option. TODO promote this into Matchers (where matchOptionFunc is already defined but could be based on this method).

Creates a MatchResult by applying a given function f to an input value of type T, and matching the result if the function yields a defined Option. Matches and processes a given input using a function that returns an Option. TODO promote this into Matchers (where matchOptionFunc is already defined but could be based on this method).

Type parameters

R

the result type contained in the Option.

T

the input type.

Value parameters

f

a function that transforms an input of type T into an Option[R].

t

the input value of type T to be transformed and matched.

Attributes

Returns

a MatchResult[R] constructed from the result of the function if the Option is defined.

Inherited methods

def *[T, R](m: Matcher[T ~ T, R], commutes: Boolean = ...): Matcher[T ~ T, R]

Matcher that tries m on the given (~) input. If m is unsuccessful, it then tries m on the swapped (inverted) ~.

Matcher that tries m on the given (~) input. If m is unsuccessful, it then tries m on the swapped (inverted) ~.

Type parameters

R

the result type.

T

the input type.

Value parameters

commutes

if true (the default), the order of the incoming ~ elements is immaterial, thus we can try flipping their order. If false then we do not try.

m

a Matcher[T ~ T, R].

Attributes

Returns

a Matcher[T ~ T, R].

Inherited from:
Matchers
def **[T, R](m: Matcher[T ~ T ~ T, R], commutes: Boolean = ...): Matcher[T ~ T ~ T, R]

Matcher that tries m on the given (~~) input. If m is unsuccessful, it then tries m on the rotated ~~. If that's unsuccessful, it then tries m on the inverted ~~.

Matcher that tries m on the given (~~) input. If m is unsuccessful, it then tries m on the rotated ~~. If that's unsuccessful, it then tries m on the inverted ~~.

Type parameters

R

the result type.

T

the input type.

Value parameters

commutes

if true (the default), the order of the incoming ~ elements is immaterial, thus we can try rotating their order. If false then we do not try.

m

a Matcher[T ~ T ~ T, R].

Attributes

Returns

a Matcher[T ~ T ~ T, R].

Inherited from:
Matchers
def Matcher[T, R](name: String)(f: T => MatchResult[R]): Matcher[T, R]

Method to create a named Matcher, based on the given function f of form T => MatchResult[R]. Unusually, this method's identifier has a capital first letter. This is done to mimic the Parser method in the parser-combinators. It has the advantage of looking somewhat like a constructor of a Matcher.

Method to create a named Matcher, based on the given function f of form T => MatchResult[R]. Unusually, this method's identifier has a capital first letter. This is done to mimic the Parser method in the parser-combinators. It has the advantage of looking somewhat like a constructor of a Matcher.

NOTE: if you are looking for a method which takes a function f of form T => R, then you need to use the lift method.

TODO: rename Matcher as UnnamedMatcher and this as Matcher.

If f is a partial function, it may result in a MatchError. In such a case, this is simply treated as a Miss. However, if f throws some other non-fatal exception, then that will result in an Error.

Type parameters

R

the result type.

T

the input type.

Value parameters

f

a T => MatchResult[R].

name

the name to be used when debugging this Matcher

Attributes

Returns

a Matcher[T, R] based on f.

Inherited from:
Matchers
def UnnamedMatcher[T, R](f: T => MatchResult[R]): Matcher[T, R]

Method to create a Matcher, based on the given function f of form T => MatchResult[R]. Unusually, this method's identifier has a capital first letter. This is done to mimic the Parser method in the parser-combinators. It has the advantage of looking somewhat like a constructor of a Matcher.

Method to create a Matcher, based on the given function f of form T => MatchResult[R]. Unusually, this method's identifier has a capital first letter. This is done to mimic the Parser method in the parser-combinators. It has the advantage of looking somewhat like a constructor of a Matcher.

NOTE: if you are looking for a method which takes a function f of form T => R, then you need to use the lift method.

If f is a partial function, it may result in a MatchError. In such a case, this is simply treated as a Miss. However, if f throws some other non-fatal exception, then that will result in an Error.

Type parameters

R

the result type.

T

the input type.

Value parameters

f

a T => MatchResult[R].

Attributes

Returns

a Matcher[T, R] based on f.

Inherited from:
Matchers
def alt[T](m: AutoMatcher[T]): AutoMatcher[T]

The alt method returns a Matcher that behaves as follows: It first tries to match the input t according to the given matcher m, in which case the match is returned. If m returns a miss, then a successful match with the value of t will be returned. Therefore, this matcher always succeeds, unless there's an error.

The alt method returns a Matcher that behaves as follows: It first tries to match the input t according to the given matcher m, in which case the match is returned. If m returns a miss, then a successful match with the value of t will be returned. Therefore, this matcher always succeeds, unless there's an error.

Type parameters

T

both the type of the input and the underlying type of the output.

Value parameters

m

an AutoMatcher[T]

Attributes

Returns

an AutoMatcher[T]

Inherited from:
Matchers
def always[R]: AutoMatcher[R]

Defines a Matcher which always succeeds and whose input type and result type are the same.

Defines a Matcher which always succeeds and whose input type and result type are the same.

Type parameters

R

both the input type and the result type.

Attributes

Returns

an AutoMatcher[R] which always succeeds.

Inherited from:
Matchers
def eitherOr[R](m1: AutoMatcher[R], m2: AutoMatcher[R]): AutoMatcher[R]

Combines two AutoMatcher instances, attempting to apply the first matcher, and if it results in a match, passing the result to the second matcher. If the first matcher fails, the second matcher is applied directly to the input.

Combines two AutoMatcher instances, attempting to apply the first matcher, and if it results in a match, passing the result to the second matcher. If the first matcher fails, the second matcher is applied directly to the input.

The logic is essentially m1 & m2 | m1 | m2 but that results in over-evaluation.

Value parameters

m1

The first AutoMatcher to be applied to the input.

m2

The second AutoMatcher to be applied if the first succeeds or fails.

Attributes

Returns

A new AutoMatcher that represents the combination of the two input matchers.

Inherited from:
Matchers
def error[R](e: Throwable): Matcher[Any, R]

Defines a Matcher which always errs and creates an Error with the given exception.

Defines a Matcher which always errs and creates an Error with the given exception.

Type parameters

R

the result type.

Value parameters

e

a Throwable.

Attributes

Returns

a Matcher[Any, R]

Inherited from:
Matchers
def fail[T, R](msg: String): Matcher[T, R]

Defines a Matcher which always fails and creates a Miss with the value tried.

Defines a Matcher which always fails and creates a Miss with the value tried.

Type parameters

R

the result type.

T

the input type.

Value parameters

msg

the message to describe this failure.

Attributes

Returns

a Matcher[T, R]

Inherited from:
Matchers
def filter[R](p: R => Boolean): AutoMatcher[R]

Defines a Matcher which succeeds only if the predicate p evaluates to true. The result will be named "filter."

Defines a Matcher which succeeds only if the predicate p evaluates to true. The result will be named "filter."

Type parameters

R

both the input type and the result type.

Value parameters

p

a predicate on type R.

Attributes

Returns

an AutoMatcher[R] which succeeds only if p(r) is true.

Inherited from:
Matchers
def filter2_0[T0, T1, R0](m: Matcher[T0, R0]): Matcher[T0 ~ T1, R0 ~ T1]

Method to create a Matcher of a Tilde, which succeeds if the first member matches the given Matcher.

Method to create a Matcher of a Tilde, which succeeds if the first member matches the given Matcher.

Type parameters

R0

type of result's first member.

T0

first of the member types.

T1

second of the member types.

Attributes

Returns

a Matcher[T0 ~ T1, R0 ~ T1].

Inherited from:
Matchers
def filter2_1[T0, T1, R1](m: Matcher[T1, R1]): Matcher[T0 ~ T1, T0 ~ R1]

Method to create a Matcher of ~, which succeeds if the first member matches the given Matcher.

Method to create a Matcher of ~, which succeeds if the first member matches the given Matcher.

Type parameters

R1

type of result's second member.

T0

first of the input member types.

T1

second of the input member types.

Attributes

Returns

a Matcher[T0 ~ T1, T0 ~ R1].

Inherited from:
Matchers
def filter3_0[T0, T1, T2, R0](m: Matcher[T0, R0]): Matcher[T0 ~ T1 ~ T2, R0 ~ T1 ~ T2]

Method to create a Matcher of ~~, which succeeds if the first member matches the given Matcher.

Method to create a Matcher of ~~, which succeeds if the first member matches the given Matcher.

Type parameters

R0

type of result's first member.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Attributes

Returns

a Matcher[T0 ~ T1 ~ T2, R0 ~ T1 ~ T2].

Inherited from:
Matchers
def filter3_1[T0, T1, T2, R1](m: Matcher[T1, R1]): Matcher[T0 ~ T1 ~ T2, T0 ~ R1 ~ T2]

Method to create a Matcher of ~~, which succeeds if the second member matches the given Matcher.

Method to create a Matcher of ~~, which succeeds if the second member matches the given Matcher.

Type parameters

R1

type of result's second member.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Attributes

Returns

a Matcher[T0 ~ T1 ~ T2, T0 ~ R1 ~ T2].

Inherited from:
Matchers
def filter3_2[T0, T1, T2, R2](m: Matcher[T2, R2]): Matcher[T0 ~ T1 ~ T2, T0 ~ T1 ~ R2]

Method to create a Matcher of ~~, which succeeds if the third member matches the given Matcher.

Method to create a Matcher of ~~, which succeeds if the third member matches the given Matcher.

Type parameters

R2

type of result's third member.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Attributes

Returns

a Matcher[T0 ~ T1 ~ T2, T0 ~ T1 ~ R2].

Inherited from:
Matchers
def filterNot[R](p: R => Boolean): AutoMatcher[R]

Defines a Matcher which succeeds only if the predicate p evaluates to false. The result will be named "filterNot."

Defines a Matcher which succeeds only if the predicate p evaluates to false. The result will be named "filterNot."

Type parameters

R

both the input type and the result type.

Value parameters

p

a predicate on type R.

Attributes

Returns

an AutoMatcher[R] which succeeds only if p(r) is false.

Inherited from:
Matchers
def flip[T0, T1, R](m: Matcher[T0 ~ T1, R]): Matcher[T1 ~ T0, R]

Method to create a Matcher which operates on a similar, but inverted, ~ as m.

Method to create a Matcher which operates on a similar, but inverted, ~ as m.

Type parameters

R

the result type.

T0

one of the input types.

T1

the other input type.

Value parameters

m

a Matcher[T0 ~ T1, R].

Attributes

Returns

a Matcher[T1 ~ T0, R].

Inherited from:
Matchers
def having[T, U, R](m: Matcher[U, R])(lens: T => U): Matcher[T, R]

Method to match a T, resulting in an R, where the match is indirectly determined by the given lens function.

Method to match a T, resulting in an R, where the match is indirectly determined by the given lens function.

Type parameters

U

the type of the property that is matched by m.

Value parameters

lens

a function T => U.

m

a Matcher[U, R].

Attributes

Returns

a Matcher[T, R]

Inherited from:
Matchers
def invert3[T0, T1, T2]: Matcher[T0 ~ T1 ~ T2, T2 ~ T1 ~ T0]

Method to invert the order of elements in a ~~.

Method to invert the order of elements in a ~~.

Type parameters

T0

the first element type.

T1

the second element type.

T2

the third element type.

Attributes

Returns

a Matcher[T0 ~ T1 ~ T2, T2 ~ T1 ~ T0].

Inherited from:
Matchers
def isEqual[R](q: R, r: R): Boolean

Convenience predicate for use with create and similar methods that require a (Q, R) => Boolean argument.

Convenience predicate for use with create and similar methods that require a (Q, R) => Boolean argument.

Example:

 MatchResult.create(isEqual)(expectedValue, inputValue, resultValue)

This is equivalent to _ == _ but can be passed by name where a named function reference is cleaner than a lambda.

Type parameters

R

the common type.

Value parameters

q

a control value.

r

a result value.

Attributes

Returns

true if q == r.

Inherited from:
Matchers
def lens[R](f: R => Boolean)(r: R): MatchResult[R]

Evaluates a predicate function on a value of type R and returns a result indicating whether the predicate was satisfied.

Evaluates a predicate function on a value of type R and returns a result indicating whether the predicate was satisfied.

Value parameters

f

a predicate function that takes an argument of type R and returns a boolean.

r

the value of type R to be evaluated by the predicate function.

Attributes

Returns

a MatchResult[R] which is a Match if the predicate evaluates to true, or a Miss containing a message and the evaluated value if the predicate evaluates to false.

Inherited from:
Matchers
def lift[T, R](f: T => R): Matcher[T, R]

Method to define a Matcher based on the function f. The result will identify as "lift". Use namedLift if you want to be more specific.

Method to define a Matcher based on the function f. The result will identify as "lift". Use namedLift if you want to be more specific.

Type parameters

R

the result type to both f and the resulting Matcher.

T

the input type to both f and the resulting Matcher.

Value parameters

f

a function of type T => R

Attributes

Returns

a Matcher[T, R].

Inherited from:
Matchers
def loggedMatcher[T, R](name: => String)(f: T => MatchResult[R])(using logger: MatchLogger): Matcher[T, R]

Method to create a named Matcher, based on the given function f.

Method to create a named Matcher, based on the given function f.

CONSIDER eliminating this method.

Type parameters

R

the result type.

T

the input type.

Value parameters

f

a T => MatchResult[R].

name

the name for the logger to mention.

Attributes

Returns

a Matcher[T, R] based on f.

Inherited from:
Matchers
def match2All[T0, T1, R0, R1](m0: Matcher[T0, R0], m1: => Matcher[T1, R1]): Matcher[T0 ~ T1, R0 ~ R1]

Method to match all elements of a ~.

Method to match all elements of a ~.

Type parameters

R0

the MatchResult type for m0.

R1

the MatchResult type for m1.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

Value parameters

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

Attributes

Returns

a Matcher[T0 ~ T1, R0 ~ R1] that matches all the elements of the given ~.

Inherited from:
Matchers
def match2Any[T0, T1, R](m0: Matcher[T0, R], m1: => Matcher[T1, R]): Matcher[T0 ~ T1, R]

Method to match any element of a ~.

Method to match any element of a ~.

Type parameters

R

the MatchResult type.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

Value parameters

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

Attributes

Returns

a Matcher[T0 ~ T1, R] that matches at least one of the elements of the given tilde.

Inherited from:
Matchers
def match3All[T0, T1, T2, R0, R1, R2](m0: Matcher[T0, R0], m1: => Matcher[T1, R1], m2: => Matcher[T2, R2]): Matcher[T0 ~ T1 ~ T2, R0 ~ R1 ~ R2]

Method to match all elements of a ~~.

Method to match all elements of a ~~.

Type parameters

R0

the MatchResult type for m0.

R1

the MatchResult type for m1.

R2

the MatchResult type for m2.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

Value parameters

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

Attributes

Returns

a Matcher[T0 ~ T1 ~ T2, R0 ~ R1 ~ R2] that matches at least one of the elements of the given ~~.

Inherited from:
Matchers
def match3Any[T0, T1, T2, R](m0: Matcher[T0, R], m1: => Matcher[T1, R], m2: => Matcher[T2, R]): Matcher[(T0, T1, T2), R]

Method to match any element of a Tuple3.

Method to match any element of a Tuple3.

TODO fix me

Type parameters

R

the MatchResult type.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

T2

the input type for the third Matcher.

Value parameters

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

m2

the Matcher corresponding to the third element.

Attributes

Returns

a Matcher[(T0, T1, T2), R] that matches at least one of the elements of the given tuple.

Inherited from:
Matchers
def matchAll[T](m: AutoMatcher[T]): AutoMatcher[Seq[T]]

Creates a matcher that checks if all elements in a sequence satisfy the given matcher.

Creates a matcher that checks if all elements in a sequence satisfy the given matcher.

Value parameters

m

A matcher of type AutoMatcher[T].

Attributes

Returns

A new matcher that validates sequences of type Seq[T]. The matcher succeeds if all elements in the sequence satisfy the given matcher m, otherwise it returns a miss with the name "matchAll" and the unmatched sequence.

Inherited from:
Matchers
def matchAny[T](m: AutoMatcher[T]): AutoMatcher[Seq[T]]

Creates a matcher that checks if any element in a sequence satisfies the given matcher.

Creates a matcher that checks if any element in a sequence satisfies the given matcher.

Value parameters

m

A matcher of type AutoMatcher[T].

Attributes

Returns

a new matcher that takes a sequence of type T and returns a sequence of type T. indicating whether at least one element in the sequence satisfies the given matcher m.

Inherited from:
Matchers
def matchIfDefined[T, R](ry: Option[R])(t: T): MatchResult[R]

Matches the input wrapped in an Option and returns a corresponding MatchResult.

Matches the input wrapped in an Option and returns a corresponding MatchResult.

Value parameters

ry

an optional value of type R to be matched

t

the value of type T used when the optional value is not defined

Attributes

Returns

a MatchResult of type R. Returns a Match wrapping the value when the optional is defined, otherwise returns a Miss with a message and the provided value t.

Inherited from:
Matchers
def matchIfSuccess[T, R](ry: Try[R])(t: T): MatchResult[R]

Matches the result of a Try operation and produces a MatchResult.

Matches the result of a Try operation and produces a MatchResult.

Value parameters

ry

the Try instance representing a successful or failed computation

t

the input value to be used in case of a failure

Attributes

Returns

a MatchResult containing the success value if the Try is successful, or a failure message along with the input value if the Try is a failure

Inherited from:
Matchers
def matchOptionFunc[T, R](f: T => Option[R])(t: T): MatchResult[R]

Creates a MatchResult[R] from applying a given T => Option[R] function to a value of T. NOTE this replaces the previous (1.0.12) version which had only one parametric type (T). It will be backwards-compatible but providing the types are not explicitly specified.

Creates a MatchResult[R] from applying a given T => Option[R] function to a value of T. NOTE this replaces the previous (1.0.12) version which had only one parametric type (T). It will be backwards-compatible but providing the types are not explicitly specified.

Value parameters

f

A function that takes an input of type T and returns an Option[R].

t

The input of type T to which the function f is applied.

Attributes

Returns

A MatchResult[R] based on the result of applying the function f to the input t.

Inherited from:
Matchers
def matchProduct2All[T0, T1, R0, R1, P <: Product](m0: Matcher[T0, R0], m1: => Matcher[T1, R1])(f: (T0, T1) => P): Matcher[P, R0 ~ R1]

Method to match any element of a Product with two elements.

Method to match any element of a Product with two elements.

Type parameters

P

the input type.

R0

the first MatchResult type.

R1

the second MatchResult type.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

Value parameters

f

a function that takes a (t0, t1) and returns a P.

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

Attributes

Returns

a Matcher[P, R0 ~ R1] that matches at least one of the elements of the given P.

Inherited from:
Matchers
def matchProduct2Any[T0, T1, R, P <: Product](m0: Matcher[T0, R], m1: => Matcher[T1, R])(f: (T0, T1) => P): Matcher[P, R]

Method to match any element of a Product with two elements.

Method to match any element of a Product with two elements.

Type parameters

P

the input type.

R

the MatchResult type.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

Value parameters

f

a function that takes a (t0, t1) and returns a P.

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

Attributes

Returns

a Matcher[P, R] that matches at least one of the elements of the given P.

Inherited from:
Matchers
def matchProduct3All[T0, T1, T2, R0, R1, R2, P <: Product](m0: Matcher[T0, R0], m1: => Matcher[T1, R1], m2: => Matcher[T2, R2])(f: (T0, T1, T2) => P): Matcher[P, R0 ~ R1 ~ R2]

Method to match any element of a Product with two elements.

Method to match any element of a Product with two elements.

Type parameters

P

the input type.

R0

the first MatchResult type.

R1

the second MatchResult type.

R2

the third MatchResult type.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

T2

the input type for the third Matcher.

Value parameters

f

a function that takes a (t0, t1, t3) and returns a P.

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

m2

the Matcher corresponding to the third element.

Attributes

Returns

a Matcher[P, R0 ~ R1 ~ R2] that matches at least one of the elements of the given P.

Inherited from:
Matchers
def matchProduct3Any[T0, T1, T2, R, P <: Product](m0: Matcher[T0, R], m1: => Matcher[T1, R], m2: => Matcher[T2, R])(f: (T0, T1, T2) => P): Matcher[P, R]

Method to match any element of a Product with two elements.

Method to match any element of a Product with two elements.

Type parameters

P

the input type.

R

the MatchResult type.

T0

the input type for the first Matcher.

T1

the input type for the second Matcher.

T2

the input type for the third Matcher.

Value parameters

f

a function that takes a (t0, t1, t3) and returns a P.

m0

the Matcher corresponding to the first element.

m1

the Matcher corresponding to the second element.

m2

the Matcher corresponding to the third element.

Attributes

Returns

a Matcher[P, R] that matches at least one of the elements of the given P.

Inherited from:
Matchers
def matchResult3[T0, T1, T2, P <: Product](f: (T0, T1, T2) => P)(r0: MatchResult[T0], r1: MatchResult[T1], r2: MatchResult[T2]): MatchResult[P]

Method to create a Matcher, of three MatchResults whose result is a P.

Method to create a Matcher, of three MatchResults whose result is a P.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Value parameters

f

method to convert a (T0, T1, T2) into a P.

Attributes

Returns

r0 a MatchResult[T0].

Inherited from:
Matchers
def matchResultTilde3[T0, T1, T2, P <: Product](f: (T0, T1, T2) => P)(t: MatchResult[T0 ~ T1 ~ T2]): MatchResult[P]

Method to convert a MatchResult[~~] to a MatchResult[P].

Method to convert a MatchResult[~~] to a MatchResult[P].

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Value parameters

f

method to convert a (T0, T1, T2) into a P.

Attributes

Returns

t a MatchResult[T0 ~ T1 ~ T2].

Inherited from:
Matchers
def matchTryFunc[T, R](f: T => Try[R])(t: T): MatchResult[R]

Creates a MatchResult[R] from applying a given T => Try[R] function to a value of T. NOTE this replaces the previous (1.0.12) version which had only one parametric type (T). It will be backwards-compatible but providing the types are not explicitly specified.

Creates a MatchResult[R] from applying a given T => Try[R] function to a value of T. NOTE this replaces the previous (1.0.12) version which had only one parametric type (T). It will be backwards-compatible but providing the types are not explicitly specified.

Value parameters

f

A function that takes an input of type T and returns a Try of type R.

t

The input value of type T to be processed by the function f.

Attributes

Returns

A MatchResult of type R, which represents the result of matching the successful outcome of f(t).

Inherited from:
Matchers
def matches[R](r: R): AutoMatcher[R]

Defines a Matcher which succeeds if the input is equal to the given r. The result will be named "matches."

Defines a Matcher which succeeds if the input is equal to the given r. The result will be named "matches."

Type parameters

R

both the input type and the result type.

Value parameters

r

the value that must be matched.

Attributes

Returns

an AutoMatcher[R].

Inherited from:
Matchers
def maybe[R](b: Boolean): AutoMatcher[R]

Defines a Matcher which succeeds only if b is true (regardless of the input to the Matcher). The result will be named "maybe."

Defines a Matcher which succeeds only if b is true (regardless of the input to the Matcher). The result will be named "maybe."

Type parameters

R

both the input type and the result type.

Value parameters

b

a Boolean value that determines whether the result succeeds.

Attributes

Returns

an AutoMatcher[R] which succeeds if b is true.

Inherited from:
Matchers
def namedLift[T, R](name: String)(f: T => R): Matcher[T, R]

Method to define a named Matcher based on the function f.

Method to define a named Matcher based on the function f.

Type parameters

R

the result type to both f and the resulting Matcher.

T

the input type to both f and the resulting Matcher.

Value parameters

f

a function of type T => R

name

the name by which the resulting Matcher will be identified.

Attributes

Returns

a Matcher[T, R].

Inherited from:
Matchers
def not[T, R](m: Matcher[T, R], r: => R): Matcher[T, R]

Defines a Matcher which reverses the sense of this Matcher. However, an Error remains an Error. The result is named "not." TODO define this in terms of MatchResult.invert

Defines a Matcher which reverses the sense of this Matcher. However, an Error remains an Error. The result is named "not." TODO define this in terms of MatchResult.invert

Type parameters

R

the result type of m.

T

the input type of m.

Value parameters

m

a Matcher[T, R]

r

the default result value, only to be used in the even of a Miss.

Attributes

Returns

a Matcher[T, R] which works in the opposite sense to this.

Inherited from:
Matchers
def opt[T, R](m: Matcher[T, R]): Matcher[T, Option[R]]

Matcher that always succeeds but whose result is an Option[R]. The result is named "opt." If the bound variable t of the resulting Matcher is null, then it will result in a Match(None).

Matcher that always succeeds but whose result is an Option[R]. The result is named "opt." If the bound variable t of the resulting Matcher is null, then it will result in a Match(None).

Type parameters

R

the result type of m.

T

the input type of m.

Value parameters

m

a Matcher[T, R]

Attributes

Returns

Matcher[T, Option of R]

Inherited from:
Matchers
def parseWithParser[R](regex: String)(p: Parser[R]): Parser[R]

Method to yield a parser af R from a String interpreted as a regular expression.

Method to yield a parser af R from a String interpreted as a regular expression.

Type parameters

R

the underlying type of resulting Parser.

Value parameters

p

a Parser[R].

regex

the String representation of the regular expression.

Attributes

Returns

a Parser[R]

Inherited from:
Matchers
def parseWithParser[R](regex: Regex)(p: Parser[R]): Parser[R]

Method to yield a parser af R from a regular expression.

Method to yield a parser af R from a regular expression.

Type parameters

R

the underlying type of resulting Parser.

Value parameters

p

a Parser[R].

regex

a Regex.

Attributes

Returns

a Parser[R]

Inherited from:
Matchers
def parser(regex: String): Parser[String]

Method to yield a parser af String from a regular expression.

Method to yield a parser af String from a regular expression.

Value parameters

regex

the String representation of the regular expression.

Attributes

Returns

a Parser[String]

Inherited from:
Matchers
def parser(regex: Regex): Parser[String]

Method to yield a parser af String from a regular expression.

Method to yield a parser af String from a regular expression.

Value parameters

regex

a Regex.

Attributes

Returns

a Parser[String]

Inherited from:
Matchers
def parser1[P0, Z](regex: String, groups: Int*)(p0: Parser[P0])(construct: P0 => Z): Parser[Z]

Method to yield a Parser[Z] using the given regex, a function String=>P0 and a function P0=>Z. Typically, Z will be a case class.

Method to yield a Parser[Z] using the given regex, a function String=>P0 and a function P0=>Z. Typically, Z will be a case class.

TESTME

Type parameters

P0

the type of the first member of Z.

Z

the underlying type of the resulting parser.

Value parameters

construct

a function P0 => Z.

groups

a list of required group indexes, starting at 1 (if empty, then all groups are selected).

p0

a Parser[P0].

regex

a regular expression.

Attributes

Returns

a Parser[Z].

Inherited from:
Matchers
def parser2[P0, P1, Z](regex: String, groups: Int*)(p0: Parser[P0], p1: Parser[P1])(construct: (P0, P1) => Z): Parser[Z]

Method to yield a Parser[Z] using the given regex, several intermediate functions, and a function (P0, P1)=>Z. Typically, Z will be a case class with two members.

Method to yield a Parser[Z] using the given regex, several intermediate functions, and a function (P0, P1)=>Z. Typically, Z will be a case class with two members.

Type parameters

P0

the type of the first member of Z.

P1

the type of the second member of Z.

Z

the underlying type of the resulting parser.

Value parameters

construct

a function (P0, P1) => Z.

groups

a list of required group indexes, starting at 1 (if empty, then all groups are selected).

p0

a Parser[P0].

p1

a Parser[P1].

regex

a regular expression.

Attributes

Returns

a Parser[Z].

Inherited from:
Matchers
def parser3[P0, P1, P2, Z](regex: String, groups: Int*)(p0: Parser[P0], p1: Parser[P1], p2: Parser[P2])(construct: (P0, P1, P2) => Z): Parser[Z]

Method to yield a Parser[Z] using the given regex, several intermediate functions, and a function (P0, P1, P2)=>Z. Typically, Z will be a case class with three members.

Method to yield a Parser[Z] using the given regex, several intermediate functions, and a function (P0, P1, P2)=>Z. Typically, Z will be a case class with three members.

Type parameters

P0

the type of the first member of Z.

P1

the type of the second member of Z.

P2

the type of the third member of Z.

Z

the underlying type of the resulting parser.

Value parameters

construct

a function (P0, P1, P2) => Z.

groups

a list of required group indexes, starting at 1 (if empty, then all groups are selected).

p0

a Parser[P0].

p1

a Parser[P1].

p2

a Parser[P2].

regex

a regular expression.

Attributes

Returns

a Parser[Z].

Inherited from:
Matchers
def parserGroup[R](regex: String, group: Int*)(p: Parser[R]): Parser[R]

Method to yield a parser af R from a regular expression and groups. There must be only one matching group.

Method to yield a parser af R from a regular expression and groups. There must be only one matching group.

Type parameters

R

the underlying type of resulting Parser.

Value parameters

group

an optional group index, starting at 1 (if empty, then all groups are selected).

p

a Parser[R].

regex

the String representation of the regular expression.

Attributes

Returns

a Parser[R]

Inherited from:
Matchers
def parserGroup[R](regex: Regex, group: Int*)(p: Parser[R]): Parser[R]

Method to yield a parser af R from a regular expression and groups. There must be only one matching group.

Method to yield a parser af R from a regular expression and groups. There must be only one matching group.

Type parameters

R

the underlying type of resulting Parser.

Value parameters

group

an optional group index, starting at 1 (if empty, then all groups are selected).

p

a Parser[R].

regex

a Regex.

Attributes

Returns

a Parser[R]

Inherited from:
Matchers
def parserGroup[R](regexGroups: RegexGroups)(p: Parser[R]): Parser[R]

Method to yield a parser af R from a regular expression and groups. There must be only one matching group.

Method to yield a parser af R from a regular expression and groups. There must be only one matching group.

Type parameters

R

the underlying type of the resulting Parser.

Value parameters

p

a Parser[R].

regexGroups

an instance of RegexGroups.

Attributes

Returns

a Parser[R]

Inherited from:
Matchers
def parserList(regex: String, groups: Int*): Parser[List[String]]

Parser that succeeds if the input matches the given regular expression. The result of the parser is the desired List of matched Strings.

Parser that succeeds if the input matches the given regular expression. The result of the parser is the desired List of matched Strings.

Value parameters

groups

a list of required group indexes, starting at 1 (if empty, then all groups are selected).

regex

a regular expression as a String.

Attributes

Returns

a Parser[List of Strings].

Inherited from:
Matchers
def parserList(regex: Regex, groups: Int*): Parser[List[String]]

Parser that succeeds if the input matches the given regular expression. The result of the parser is the desired List of matched Strings.

Parser that succeeds if the input matches the given regular expression. The result of the parser is the desired List of matched Strings.

Value parameters

groups

a list of required group indexes, starting at 1 (if empty, then all groups are selected).

regex

a regular expression.

Attributes

Returns

a Parser[List of Strings].

Inherited from:
Matchers
def parserList(rg: RegexGroups): Parser[List[String]]

Parser that succeeds if the input matches the given regular expression. The result of the parser is the desired List of matched Strings.

Parser that succeeds if the input matches the given regular expression. The result of the parser is the desired List of matched Strings.

Value parameters

rg

an instance of RegexGroups.

Attributes

Returns

a Parser[List of Strings].

Inherited from:
Matchers
def parserTilde(regex: String, groups: Int*): Parser[String ~ String]

Method to parse two Strings from a regular expression.

Method to parse two Strings from a regular expression.

Value parameters

groups

a list of required group indexes, starting at 1 (if empty, then all groups are selected).

regex

the String representation of the regular expression.

Attributes

Returns

a Parser[String ~ String]

Inherited from:
Matchers
def parserTilde(regex: Regex, groups: Int*): Parser[String ~ String]

Method to parse two Strings from a regular expression.

Method to parse two Strings from a regular expression.

Value parameters

groups

a list of required group indexes, starting at 1 (if empty, then all groups are selected).

regex

a Regex.

Attributes

Returns

a Parser[String ~ String]

Inherited from:
Matchers
def parserTilde(regexGroups: RegexGroups): Parser[String ~ String]

Method to parse two Strings from a regular expression.

Method to parse two Strings from a regular expression.

Value parameters

regexGroups

an instance of RegexGroups.

Attributes

Returns

a Parser[String ~ String]

Inherited from:
Matchers
def product2[T0, T1, P <: Product](f: (T0, T1) => P): Matcher[T0 ~ T1, P]

Method to create a Matcher, which always succeeds, of a ~ whose result is a P. This method is the inverse of tilde2.

Method to create a Matcher, which always succeeds, of a ~ whose result is a P. This method is the inverse of tilde2.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

Value parameters

f

method to convert a (T0, T1) into a P.

Attributes

Returns

a Matcher[T0 ~ T1, P].

Inherited from:
Matchers
def product3[T0, T1, T2, P <: Product](f: (T0, T1, T2) => P): Matcher[T0 ~ T1 ~ T2, P]

Method to create a Matcher, which always succeeds, of a ~~ whose result is a P. This method is the inverse of tilde2.

Method to create a Matcher, which always succeeds, of a ~~ whose result is a P. This method is the inverse of tilde2.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

Value parameters

f

method to convert a (T0, T1) into a P.

Attributes

Returns

a Matcher[T0 ~ T1 ~ T2, P].

Inherited from:
Matchers
def rotate3[T0, T1, T2]: Matcher[T0 ~ T1 ~ T2, T1 ~ T2 ~ T0]

Method to rotate the order of elements in a ~~.

Method to rotate the order of elements in a ~~.

Type parameters

T0

the first element type.

T1

the second element type.

T2

the third element type.

Attributes

Returns

a Matcher[T0 ~ T1 ~ T2, T1 ~ T2 ~ T0].

Inherited from:
Matchers
def select2_0[T0, T1, P <: Product](f: (T0, T1) => P): Matcher[P, T0]

Method to create a Matcher, which always succeeds, of a P whose result is a T0, based on the first element of P.

Method to create a Matcher, which always succeeds, of a P whose result is a T0, based on the first element of P.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

Value parameters

f

method to convert a (T0, T1) into a P (used at compile-time only).

Attributes

Returns

a Matcher[P,T0]

Inherited from:
Matchers
def select2_1[T0, T1, P <: Product](f: (T0, T1) => P): Matcher[P, T1]

Method to create a Matcher, which always succeeds, of a P whose result is a T1, based on the second element of P.

Method to create a Matcher, which always succeeds, of a P whose result is a T1, based on the second element of P.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

Value parameters

f

method to convert a (T0, T1) into a P (used at compile-time only).

Attributes

Returns

a Matcher[P,T1]

Inherited from:
Matchers
def select3_0[T0, T1, T2, P <: Product](f: (T0, T1, T2) => P): Matcher[P, T0]

Method to create a Matcher, which always succeeds, of a P whose result is a T0, based on the first element of P.

Method to create a Matcher, which always succeeds, of a P whose result is a T0, based on the first element of P.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Value parameters

f

method to convert a (T0, T1, T2) into a P (used at compile-time only).

Attributes

Returns

a Matcher[P,T0]

Inherited from:
Matchers
def select3_1[T0, T1, T2, P <: Product](f: (T0, T1, T2) => P): Matcher[P, T1]

Method to create a Matcher, which always succeeds, of a P whose result is a T1, based on the second element of P.

Method to create a Matcher, which always succeeds, of a P whose result is a T1, based on the second element of P.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Value parameters

f

method to convert a (T0, T1, T2) into a P (used at compile-time only).

Attributes

Returns

a Matcher[P,T1]

Inherited from:
Matchers
def select3_2[T0, T1, T2, P <: Product](f: (T0, T1, T2) => P): Matcher[P, T2]

Method to create a Matcher, which always succeeds, of a P whose result is a T2, based on the third element of P.

Method to create a Matcher, which always succeeds, of a P whose result is a T2, based on the third element of P.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Value parameters

f

method to convert a (T0, T1, T2) into a P (used at compile-time only).

Attributes

Returns

a Matcher[P,T1]

Inherited from:
Matchers
def sequence[R](rmo: Option[MatchResult[R]]): MatchResult[Option[R]]

Method to convert an Option of MatchResult[R] into a MatchResult of Option[R].

Method to convert an Option of MatchResult[R] into a MatchResult of Option[R].

Type parameters

R

the underlying result type.

Value parameters

rmo

an optional MatchResult[R].

Attributes

Returns

a MatchResult of Option[R].

Inherited from:
Matchers
def sequence[T, R](m: Matcher[T, R]): Matcher[Seq[T], Seq[R]]

Transforms (lifts) a matcher for individual elements into a matcher for sequences of those elements.

Transforms (lifts) a matcher for individual elements into a matcher for sequences of those elements.

This method applies the provided matcher to each element of the input sequence and aggregates the results.

Value parameters

m

the matcher to apply to each element of the sequence

Attributes

Returns

a matcher that processes a sequence of elements and matches them based on the provided matcher

Inherited from:
Matchers
def sequenceStrict[T, R](m: Matcher[T, R]): Matcher[Seq[T], Seq[R]]

Transforms (lifts) a matcher for individual elements into a matcher for sequences of those elements. The returned Matcher ensures that all elements in the input sequence are matched using the provided Matcher.

Transforms (lifts) a matcher for individual elements into a matcher for sequences of those elements. The returned Matcher ensures that all elements in the input sequence are matched using the provided Matcher.

Value parameters

m

The Matcher to apply to each element of the sequence.

Attributes

Returns

A Matcher that matches a sequence of elements using the provided Matcher.

See also

MatchResult#sequenceStrict

Inherited from:
Matchers
def success[T, R](r: => R): Matcher[T, R]

Defines a Matcher which always succeeds and creates a Match with value r.

Defines a Matcher which always succeeds and creates a Match with value r.

NOTE: be careful not to force evaluation of r outside MatchResult.

Type parameters

R

the result type.

T

the input type (input is ignored).

Value parameters

r

the predetermined result (call-by-name).

Attributes

Returns

a Matcher[T, R]

Inherited from:
Matchers
def swap[T0, T1]: Matcher[T0 ~ T1, T1 ~ T0]

Method to swap the order of elements in a Tilde.

Method to swap the order of elements in a Tilde.

Type parameters

T0

the first element type.

T1

the second element type.

Attributes

Returns

a Matcher from T0 ~ T1 to T1 ~ T0.

Inherited from:
Matchers
def tilde2[T0, T1, P <: Product](f: (T0, T1) => P): Matcher[P, T0 ~ T1]

Method to create a Matcher, which always succeeds, of a P whose result is a ~.

Method to create a Matcher, which always succeeds, of a P whose result is a ~.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

Value parameters

f

method to convert a (T0, T1) into a P.

Attributes

Returns

a Matcher[P, T0 ~ T1].

Inherited from:
Matchers
def tilde3[T0, T1, T2, P <: Product](f: (T0, T1, T2) => P): Matcher[P, T0 ~ T1 ~ T2]

Method to create a Matcher, which always succeeds, of a P whose result is a ~~.

Method to create a Matcher, which always succeeds, of a P whose result is a ~~.

Type parameters

P

the product type.

T0

first of the member types.

T1

second of the member types.

T2

third of the member types.

Value parameters

f

method to convert a (T0, T1, T2) into a P.

Attributes

Returns

a Matcher[P, T0 ~ T1 ~ T2].

Inherited from:
Matchers
def unpack[R](rom: MatchResult[Option[R]]): MatchResult[R]

Method to convert a MatchResult of Option[R] into a MatchResult[R]. NOTE this was formerly called sequence.

Method to convert a MatchResult of Option[R] into a MatchResult[R]. NOTE this was formerly called sequence.

Type parameters

R

the underlying result type.

Value parameters

rom

a MatchResult of Option[R].

Attributes

Returns

a Match[R] if rom is a Match(Some(r)) otherwise a Miss.

Inherited from:
Matchers
def valve[Q, T](p: (Q, T) => Boolean): Matcher[(Q, T), T]

Matcher whose success depends on the application of a function f to the input, then the application of a predicate to a control value and the result of f.

Matcher whose success depends on the application of a function f to the input, then the application of a predicate to a control value and the result of f.

CONSIDER what to do with this

Type parameters

Q

the "control" type.

T

the "input" type.

Value parameters

p

a predicate based on the tuple (q, r) where r is the result of applying f to t.

Attributes

Returns

a Matcher[(Q, R), T].

Inherited from:
Matchers
def valve[Q, T, R](f: T => R, p: (Q, R) => Boolean): Matcher[(Q, T), R]

Matcher whose success depends on the application of a function f to the input, then the application of a predicate to a control value and the result of f.

Matcher whose success depends on the application of a function f to the input, then the application of a predicate to a control value and the result of f.

CONSIDER what to do with this

Type parameters

Q

the "control" type.

R

the result type.

T

the "input" type.

Value parameters

f

a T => R.

p

a predicate based on the tuple (q, r) where r is the result of applying f to t.

Attributes

Returns

a Matcher[(Q, R), T].

Inherited from:
Matchers

Inherited fields

lazy val decimalNumber: Parser[String]

A parser that matches a decimal number. The parser matches numbers with optional leading digits, a decimal point, and optional trailing digits.

A parser that matches a decimal number. The parser matches numbers with optional leading digits, a decimal point, and optional trailing digits.

Examples of matched patterns include:

  • Whole numbers: "123"
  • Floating-point numbers with leading digits: "123.456"
  • Floating-point numbers without leading digits: ".456"
  • Floating-point numbers with trailing decimal point: "123."

Attributes

Inherited from:
Matchers
lazy val floatingPointNumber: Parser[String]

A parser for matching floating-point numbers in string format. This parser identifies numbers with optional signs, decimal points, optional scientific notation (e/E with an optional sign), and optional floating-point type suffixes (f/F/d/D).

A parser for matching floating-point numbers in string format. This parser identifies numbers with optional signs, decimal points, optional scientific notation (e/E with an optional sign), and optional floating-point type suffixes (f/F/d/D).

The recognized pattern includes:

  • Optional leading negative sign (-).
  • Digits before and/or after a decimal point.
  • Scientific notation with an optional positive or negative sign.
  • Optional floating-point suffix (f, F, d, D).

The parsing is performed using a provided regular expression pattern.

Attributes

Inherited from:
Matchers
lazy val parserBigDecimal: Parser[BigDecimal]

Attributes

Returns

a Parser[BigDecimal]

Inherited from:
Matchers
lazy val parserBigInt: Parser[BigInt]

Attributes

Returns

a Parser[BigInt]

Inherited from:
Matchers
lazy val parserDouble: Parser[Double]

Attributes

Returns

a Parser[Double]

Inherited from:
Matchers
lazy val parserInt: Parser[Int]

Attributes

Returns

a Parser[Int]

Inherited from:
Matchers
lazy val parserLong: Parser[Long]

Attributes

Returns

a Parser[Long]

Inherited from:
Matchers

Implicits

Inherited implicits

final implicit def MatchResultOps[R](rr: MatchResult[R]): MatchResultOps[R]

Implicit class MatchResultOps, which allows us to use the method tee on a MatchResult[R].

Implicit class MatchResultOps, which allows us to use the method tee on a MatchResult[R].

Type parameters

R

the result type of m.

Value parameters

rr

a MatchResult[R].

Attributes

Inherited from:
Matchers
final implicit def MatcherOps[T, R](p: Matcher[T, R]): MatcherOps[T, R]

Implicit class MatcherOps, which allows us to use the method :| on a Matcher[T,R].

Implicit class MatcherOps, which allows us to use the method :| on a Matcher[T,R].

Type parameters

R

the result type of p.

T

the input type of p.

Value parameters

p

a Matcher[T,R].

Attributes

Inherited from:
Matchers
final implicit def ParserOps(s: String): ParserOps

Implicit class ParserOps, which allows us to use the method m on a String.

Implicit class ParserOps, which allows us to use the method m on a String.

Value parameters

s

a String.

Attributes

Inherited from:
Matchers