Rules

trait Rules

A factory for rules.

A factory for rules.

Authors

Andrew Foggin Inspired by the Scala parser combinator.

class Object
trait Matchable
class Any

Type members

Classlikes

class DefaultRule[In, Out, A, X](f: In => Result[Out, A, X]) extends Rule[In, Out, A, X]
trait FromRule[In]

Value members

Concrete methods

def error[In]: Rule[In, Nothing, Nothing, In]
def error[X](err: X): Rule[Any, Nothing, Nothing, X]
def expect[In, Out, A, Any](rule: Rule[In, Out, A, Any]): In => A

Converts a rule into a function that throws an Exception on failure.

Converts a rule into a function that throws an Exception on failure.

def failure: Rule[Any, Nothing, Nothing, Nothing]
def from[In]: FromRule[In]
def oneOf[In, Out, A, X](rules: Rule[In, Out, A, X]*): Rule[In, Out, A, X]
def ruleWithName[In, Out, A, X](_name: String, f: In => Result[Out, A, X]): Rule[In, Out, A, X] & Name
def state[s]: StateRules { type S = s; }
def success[Out, A](out: Out, a: A): Rule[Any, Out, A, Nothing]

Implicits

Implicits

implicit def inRule[In, Out, A, X](rule: Rule[In, Out, A, X]): InRule[In, Out, A, X]
implicit def rule[In, Out, A, X](f: In => Result[Out, A, X]): Rule[In, Out, A, X]
implicit def seqRule[In, A, X](rule: Rule[In, In, A, X]): SeqRule[In, A, X]