scalax.rules

trait StateRules

[source: scalax/rules/StateRules.scala]

trait StateRules
extends AnyRef
A factory for rules that apply to a particular context. @requires S the context to which rules apply.
Author
Andrew Foggin Inspired by the Scala parser combinator.
Direct Known Subclasses:
RulesWithState

Type Summary
type Rule
abstract type S
Value Summary
abstract val factory : Rules
Method Summary
def allOf [A, X](rules : scala.Seq[Rule[A, X]]) : Rule[scala.List[A], X]
Create a rule that succeeds if all of the given rules succeed.
def apply [A, X](f : (S) => Result[S, A, X]) : Rule[S, S, A, X]
def cond (f : (S) => Boolean) : Rule[S, S, S, Nothing]
Create a rule that suceeds if f(in) is true.
def get : Rule[S, S, S, Nothing]
def nil : Rule[S, S, scala.Nil, Nothing]
def none : Rule[S, S, scala.None, Nothing]
def read [A](f : (S) => A) : Rule[S, S, A, Nothing]
def set (s : => S) : Rule[S, S, S, Nothing]
def unit [A](a : => A) : Rule[S, S, A, Nothing]
def update (f : (S) => S) : Rule[S, S, S, 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
Type Details
abstract type S

type Rule

Value Details
abstract val factory : Rules

Method Details
def apply[A, X](f : (S) => Result[S, A, X]) : Rule[S, S, A, X]

def unit[A](a : => A) : Rule[S, S, A, Nothing]

def read[A](f : (S) => A) : Rule[S, S, A, Nothing]

def get : Rule[S, S, S, Nothing]

def set(s : => S) : Rule[S, S, S, Nothing]

def update(f : (S) => S) : Rule[S, S, S, Nothing]

def nil : Rule[S, S, scala.Nil, Nothing]

def none : Rule[S, S, scala.None, Nothing]

def cond(f : (S) => Boolean) : Rule[S, S, S, Nothing]
Create a rule that suceeds if f(in) is true.

def allOf[A, X](rules : scala.Seq[Rule[A, X]]) : Rule[scala.List[A], X]
Create a rule that succeeds if all of the given rules succeed.
Parameters
rules - the rules to apply in sequence.
Returns
the results as a list.


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