Skip to content
Grammar::Debugger and Grammer::Tracer Perl 6 modules
Perl 6
Branch: master
Clone or download
jnthn Merge pull request #38 from ethus3h/exception-handling-2017sept24n2
Fix indentation level not being reset between parses when exceptions are thrown
Latest commit 0375008 Sep 25, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/Grammar Fix whitespace errors I introduced Sep 25, 2017
t Pass on NFA from wrapper, fixing LTM issues. Feb 2, 2017
.gitignore
.travis.yml Just try Travis against latest. Feb 26, 2017
META6.json Use modern META filename Apr 25, 2017
README.markdown make use a code thingy with `` Feb 15, 2017

README.markdown

Grammar::Debugger Build Status

This module provides a simple debugger for grammars. Just use it:

use Grammar::Debugger;

And any grammar in the lexical scope of the use statement will automatically have debugging enabled. The debugger will break execution when you first enter the grammar, and provide a prompt. Type "h" for a list of commands.

If you are debugging a grammar and want to set up breakpoints in code rather than entering them manually at the debug prompt, you can apply the breakpoint trait to any rule:

token name is breakpoint { \w+ [\h+ \w+]* }

If you want to conditionally break, you can also do something like:

token name will break { $^m eq 'Russia' } { \w+ [\h+ \w+]* }

Which will only break after the name rule has matched "Russia".

Grammar::Tracer

This gives similar output to Grammar::Debugger, but just runs through the whole grammar without stopping until it is successful or fails. Once again, after a use:

use Grammar::Tracer;

It will apply to any grammars in the lexical scope of the use statement.

Bugs? Ideas?

Please file them in GitHub issues.

You can’t perform that action at this time.