Skip to content

Commit

Permalink
make the AST go from left to right, rather than right to left
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed May 20, 2014
1 parent dc2e3ea commit fe06e9a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 45 deletions.
88 changes: 45 additions & 43 deletions actionpack/lib/action_dispatch/journey/parser.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions actionpack/lib/action_dispatch/journey/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -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
;
Expand All @@ -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)) }
Expand Down

0 comments on commit fe06e9a

Please sign in to comment.