Packages

object RuleParser

Concrete syntax parser for the rule DSL. The parsed grammar is defined as follows:

ident = [a-zA-Z] [a-zA-Z0-9_-]*
str = '"' <any character with " and \ escaped> '"'
regex = '/' <any character with / and \ escaped> '/'

file = ruleset*

ruleset = 'ruleset' 'for' filename '{' rule ('or' rule)* '}'

filename = 'agency'
          | 'stops'
          | 'routes'
          | 'trips'
          | 'stop_times'
          | 'calendar'
          | 'calendar_dates'
          | 'fare_attributes'
          | 'fare_rules'
          | 'shapes'
          | 'frequencies'
          | 'transfers'
          | 'pathways'
          | 'levels'
          | 'feed_info'
          | 'translations'
          | 'attributions'

rule = 'rule' ident '{' 'when' matcher 'then' action '}'

matcher = '(' matcher ')'
        | '!' factor
        | 'any'
        | variable 'exists'
        | value valueMatcher
        | matcher 'and' matcher
        | matcher 'or' matcher

valueMatcher = '==' value
              | 'in' '[' value* ']'
              | 'matches' regex

action = 'delete'
        | transformation ('then' transformation)*
        | log

transformation = 'set' 'row' '[' str ']' 'to' value
                | 'search' regex 'in' 'row' '[' str ']' 'and' 'replace' 'by' value

log = 'debug' '(' expr ')'
    | 'info' '(' expr ')'
    | 'warning' '(' expr ')'
    | 'error' '(' expr ')'

expr = ident '(' (expr (',' expr)*)? ')'
      | value
      | expr + expr

value = str
      | variable

variable = 'row' '[' value ']'
          | 'ctx' '[' value ']' ('[' value ']')*

For matchers, operators have natural precendence: ! has precedence over and which as precedence over or. This means that !m1 and m2 or m3 is equivalent to ((!m1) and m2) or m3. Combinators are left associative.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RuleParser
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val action: Parser[Action[Id]]
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. val expr: Parser[Expr[Id]]
  10. val file: Parser0[List[RuleSet[Id]]]
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. val log: Parser[(LogLevel, Expr[Id])]
  15. val matcher: Parser[Matcher]
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. val rule: Parser[Rule[Id]]
  20. val ruleset: Parser[RuleSet[Id]]
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. val transformation: Parser[Transformation[Id]]
  24. def transformations: Parser[NonEmptyList[Transformation[Id]]]
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped