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

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow subrules to return non-Cursor objects.
  • Loading branch information
pmichaud committed Oct 19, 2009
1 parent 4778331 commit 557d3bf
Show file tree
Hide file tree
Showing 3 changed files with 811 additions and 571 deletions.
10 changes: 8 additions & 2 deletions src/PAST/Compiler-Regex.pir
Expand Up @@ -1029,11 +1029,17 @@ Perform a subrule call.
ops.'push_pirop'('callmethod', subpost, cur, posargs :flat, namedargs :flat, 'result'=>'$P10')
ops.'push_pirop'(testop, '$P10', fail)
if subtype == 'zerowidth' goto done
ops.'push_pirop'('callmethod', '"pos"', '$P10', 'result'=>pos)
if subtype == 'method' goto subrule_pos
self.'!cursorop'(ops, '!mark_push', 0, 0, CURSOR_FAIL, 0, '$P10')
if subtype == 'method' goto done
ops.'push'(name)
ops.'push_pirop'('callmethod', '"!cursor_names"', '$P10', name)
subrule_pos:
.local pmc poslabel
poslabel = self.'post_new'('Label', 'name'=>'rxsubrule_')
ops.'push_pirop'('can', '$I10', '$P10', '"pos"')
ops.'push_pirop'('unless', '$I10', poslabel)
ops.'push_pirop'('callmethod', '"pos"', '$P10', 'result'=>pos)
ops.'push'(poslabel)
done:
.return (ops)
.end
Expand Down

0 comments on commit 557d3bf

Please sign in to comment.