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

Commit

Permalink
Add debugging/profiling for <EXPR>.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Aug 18, 2010
1 parent d304887 commit 1408049
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/cheats/hll-grammar.pir
Expand Up @@ -422,6 +422,13 @@ An operator precedence parser.
.param string preclim :optional
.param int has_preclim :opt_flag

.local pmc here, pos, debug
(here, pos) = self.'!cursor_start'()
debug = getattribute here, '$!debug'
if null debug goto debug_1
here.'!cursor_debug'('START', 'EXPR')
debug_1:

if has_preclim goto have_preclim
preclim = ''
have_preclim:
Expand All @@ -436,9 +443,6 @@ An operator precedence parser.
termstack = new ['ResizablePMCArray']
.lex '@termstack', termstack

.local pmc here, from, pos
(here, pos) = self.'!cursor_start'()

term_loop:
here = here.termishrx()
unless here goto fail
Expand Down Expand Up @@ -566,7 +570,14 @@ An operator precedence parser.
setattribute here, '$!pos', pos
setattribute here, '$!match', term
here.'!reduce'('EXPR')
if null debug goto done
here.'!cursor_debug'('PASS', 'EXPR')
goto done

fail:
if null debug goto done
here.'!cursor_debug'('FAIL', 'EXPR')
done:
.return (here)

err_internal:
Expand Down

0 comments on commit 1408049

Please sign in to comment.