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
Add debugging/profiling to <ww> builtin.
  • Loading branch information
pmichaud committed Aug 18, 2010
1 parent 8b38129 commit d304887
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Regex/Cursor-builtins.pir
Expand Up @@ -65,6 +65,11 @@ Regex::Cursor-builtins - builtin regexes for Cursor objects
.local int pos, eos
.local string tgt
(cur, pos, tgt) = self.'!cursor_start'()
.local pmc debug
debug = getattribute cur, '$!debug'
if null debug goto debug_1
cur.'!cursor_debug'('START', 'ww')
debug_1:
if pos == 0 goto fail
eos = length tgt
if pos == eos goto fail
Expand All @@ -75,7 +80,13 @@ Regex::Cursor-builtins - builtin regexes for Cursor objects
unless $I0 goto fail
pass:
cur.'!cursor_pass'(pos, 'ww')
if null debug goto done
cur.'!cursor_debug'('PASS', 'ww')
goto done
fail:
if null debug goto done
cur.'!cursor_debug'('FAIL', 'ww')
done:
.return (cur)
.end

Expand Down

0 comments on commit d304887

Please sign in to comment.