kschiess / parslet

A small PEG based parser library. See the Hacking page in the Wiki as well.
kschiess.github.com/parslet
MIT License
809 stars 95 forks source link

What's the order of Parslet::Transform rules? #144

Closed niuage closed 8 years ago

niuage commented 8 years ago

tl;dr: I want to make sure it's always the rule defined last that will be matched first.

My parsed inputs can look something like that:

So I have 2 rules, one that matches the simple "start", and one that matches the subtree [{}, {}...].

rule(map_start: simple(:no_options)) do
 # some code
end
rule(map_start: subtree(:options)) do
  # some code
end

Seems like the subtree one is always matched first. If I put the rule with simple second, then it matches correctly. Just want to make sure it's always the last rule that will be matched first?