blob: 0ead222551016ad2420baf39942e4a0c4679a019 (
plain) (
tree)
|
|
class ActionDispatch::Journey::Parser
token SLASH LITERAL SYMBOL LPAREN RPAREN DOT STAR OR
rule
expressions
: expression expressions { result = Cat.new(val.first, val.last) }
| expression { result = val.first }
| or
;
expression
: terminal
| group
| star
;
group
: LPAREN expressions RPAREN { result = Group.new(val[1]) }
;
or
: expression OR expression { result = Or.new([val.first, val.last]) }
| expression OR or { result = Or.new([val.first, val.last]) }
;
star
: STAR { result = Star.new(Symbol.new(val.last)) }
;
terminal
: symbol
| literal
| slash
| dot
;
slash
: SLASH { result = Slash.new('/') }
;
symbol
: SYMBOL { result = Symbol.new(val.first) }
;
literal
: LITERAL { result = Literal.new(val.first) }
;
dot
: DOT { result = Dot.new(val.first) }
;
end
---- header
require 'action_dispatch/journey/parser_extras'
|