Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Allow Grammar.parse() to take the name of a subrule as well as a rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Nov 13, 2009
1 parent b6a6b03 commit cf48f55
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Regex/Cursor.pir
Expand Up @@ -166,8 +166,13 @@ If C<regex> is omitted, then use the C<TOP> rule for the grammar.
.param int rxtrace :named('rxtrace') :optional
.param pmc options :slurpy :named

if has_regex goto regex_done
regex = find_method self, 'TOP'
if has_regex goto have_regex
regex = box 'TOP'
have_regex:
$I0 = isa regex, ['Sub']
if $I0 goto regex_done
$S0 = regex
regex = find_method self, $S0
regex_done:

.lex '$*ACTIONS', actions
Expand Down

0 comments on commit cf48f55

Please sign in to comment.