2012-12-19 15:54:47 -05:00
|
|
|
class ActionDispatch::Journey::Parser
|
2014-08-03 18:23:56 -04:00
|
|
|
options no_result_var
|
2012-12-19 15:54:47 -05:00
|
|
|
token SLASH LITERAL SYMBOL LPAREN RPAREN DOT STAR OR
|
|
|
|
|
|
|
|
rule
|
|
|
|
expressions
|
2014-08-03 18:23:56 -04:00
|
|
|
: expression expressions { Cat.new(val.first, val.last) }
|
|
|
|
| expression { val.first }
|
2012-12-19 15:54:47 -05:00
|
|
|
| or
|
|
|
|
;
|
|
|
|
expression
|
|
|
|
: terminal
|
|
|
|
| group
|
|
|
|
| star
|
|
|
|
;
|
|
|
|
group
|
2014-08-03 18:23:56 -04:00
|
|
|
: LPAREN expressions RPAREN { Group.new(val[1]) }
|
2012-12-19 15:54:47 -05:00
|
|
|
;
|
|
|
|
or
|
2014-08-03 18:23:56 -04:00
|
|
|
: expression OR expression { Or.new([val.first, val.last]) }
|
|
|
|
| expression OR or { Or.new([val.first, val.last]) }
|
2012-12-19 15:54:47 -05:00
|
|
|
;
|
|
|
|
star
|
2014-08-03 18:23:56 -04:00
|
|
|
: STAR { Star.new(Symbol.new(val.last)) }
|
2012-12-19 15:54:47 -05:00
|
|
|
;
|
|
|
|
terminal
|
|
|
|
: symbol
|
|
|
|
| literal
|
|
|
|
| slash
|
|
|
|
| dot
|
|
|
|
;
|
|
|
|
slash
|
2014-08-03 18:23:56 -04:00
|
|
|
: SLASH { Slash.new('/') }
|
2012-12-19 15:54:47 -05:00
|
|
|
;
|
|
|
|
symbol
|
2014-08-03 18:23:56 -04:00
|
|
|
: SYMBOL { Symbol.new(val.first) }
|
2012-12-19 15:54:47 -05:00
|
|
|
;
|
|
|
|
literal
|
2014-08-03 18:23:56 -04:00
|
|
|
: LITERAL { Literal.new(val.first) }
|
2013-04-30 14:43:59 -04:00
|
|
|
;
|
2012-12-19 15:54:47 -05:00
|
|
|
dot
|
2014-08-03 18:23:56 -04:00
|
|
|
: DOT { Dot.new(val.first) }
|
2012-12-19 15:54:47 -05:00
|
|
|
;
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
---- header
|
|
|
|
|
|
|
|
require 'action_dispatch/journey/parser_extras'
|