Permalink
Browse files

make the AST go from left to right, rather than right to left

  • Loading branch information...
1 parent dc2e3ea commit fe06e9ac2358654d2bc875775140807eb5406def @tenderlove tenderlove committed May 20, 2014
Showing with 48 additions and 45 deletions.
  1. +45 −43 actionpack/lib/action_dispatch/journey/parser.rb
  2. +3 −2 actionpack/lib/action_dispatch/journey/parser.y

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -4,7 +4,7 @@ token SLASH LITERAL SYMBOL LPAREN RPAREN DOT STAR OR
rule
expressions
- : expressions expression { result = Cat.new(val.first, val.last) }
+ : expression expressions { result = Cat.new(val.first, val.last) }
| expression { result = val.first }
| or
;
@@ -17,7 +17,8 @@ rule
: LPAREN expressions RPAREN { result = Group.new(val[1]) }
;
or
- : expressions OR expression { result = Or.new([val.first, val.last]) }
+ : 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)) }

0 comments on commit fe06e9a

Please sign in to comment.