scalax.rules

trait Rules

[source: scalax/rules/Rules.scala]

trait Rules
extends AnyRef
A factory for rules.
Author
Andrew Foggin Inspired by the Scala parser combinator.
Direct Known Subclasses:
MemoisableRules, RulesWithState

Method Summary
def error [X](err : X) : Rule[Any, Nothing, Nothing, X]
def error [In] : Rule[In, Nothing, Nothing, In]
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.
def failure : Rule[Any, Nothing, Nothing, Nothing]
def from [In] : AnyRef
implicit def inRule [In, Out, A, X](rule : Rule[In, Out, A, X]) : InRule[In, Out, A, X]
def oneOf [In, Out, A, X](rules : scala.Seq[Rule[In, Out, A, X]]) : Rule[In, Out, A, X]
implicit def rule [In, Out, A, X](f : (In) => Result[Out, A, X]) : Rule[In, Out, A, X]
def ruleWithName [In, Out, A, X](_name : java.lang.String, f : (In) => Result[Out, A, X]) : Rule[In, Out, A, X] with Name
implicit def seqRule [In, A, X](rule : Rule[In, In, A, X]) : SeqRule[In, A, X]
def state [s] : StateRules
def success [Out, A](out : Out, a : A) : Rule[Any, Out, A, Nothing]
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
class DefaultRule [In, Out, A, X](f : (In) => Result[Out, A, X]) extends Rule[In, Out, A, X]
Method Details
implicit def rule[In, Out, A, X](f : (In) => Result[Out, A, X]) : Rule[In, Out, A, X]

implicit def inRule[In, Out, A, X](rule : Rule[In, Out, A, X]) : InRule[In, Out, A, X]

implicit def seqRule[In, A, X](rule : Rule[In, In, A, X]) : SeqRule[In, A, X]

def from[In] : AnyRef

def state[s] : StateRules

def success[Out, A](out : Out, a : A) : Rule[Any, Out, A, Nothing]

def failure : Rule[Any, Nothing, Nothing, Nothing]

def error[In] : Rule[In, Nothing, Nothing, In]

def error[X](err : X) : Rule[Any, Nothing, Nothing, X]

def oneOf[In, Out, A, X](rules : scala.Seq[Rule[In, Out, A, X]]) : Rule[In, Out, A, X]

def ruleWithName[In, Out, A, X](_name : java.lang.String, f : (In) => Result[Out, A, X]) : Rule[In, Out, A, X] with Name

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.


Copyright (c) 2005-8 The Scalax Project. All Rights Reserved.