package syntax
Ordering
- Alphabetic
Visibility
- Public
- Protected
Type Members
- class Prettyprint extends AnyRef
Value Members
- object RuleParser
Concrete syntax parser for the rule DSL.
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 overand
which as precedence overor
. This means that!m1 and m2 or m3
is equivalent to((!m1) and m2) or m3
. Combinators are left associative. - object literals
- object pretty
Pretty prints rules in the concrete syntax.
Pretty prints rules in the concrete syntax. Note: anonymous functions cannot be rendered as then include scala code. Instances are printed as concatenation of the arguments.