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

Commit

Permalink
Fix bug with calculating subrule prefixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Nov 16, 2009
1 parent 9ded5d3 commit 2212d9b
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/Regex/Cursor-protoregex-peek.pir
Expand Up @@ -389,21 +389,29 @@ tokrx hash.
goto caller_loop
caller_done:

.local pmc tokens, tokens_it
tokens = self.peekname()
unless tokens goto subrule_none
unless prefix goto tokens_done
tokens_it = iter tokens
.local pmc subtokens, tokens
subtokens = self.peekname()
unless subtokens goto subrule_none
unless prefix goto prefix_none
tokens = new ['ResizablePMCArray']
tokens_loop:
unless tokens_it goto tokens_done
$S0 = shift tokens_it
subtokens_loop:
unless subtokens goto subtokens_done
$P0 = shift subtokens
$I0 = isa $P0, ['ResizablePMCArray']
unless $I0 goto subtokens_item
splice subtokens, $P0, 0, 0
goto subtokens_loop
subtokens_item:
$S0 = $P0
$S0 = concat prefix, $S0
push tokens, $S0
goto tokens_loop
tokens_done:
goto subtokens_loop
subtokens_done:
.return (tokens)

prefix_none:
.return (subtokens)

subrule_none:
.return (prefix)
.end
Expand Down

0 comments on commit 2212d9b

Please sign in to comment.