Navigation Menu

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

Commit

Permalink
[nqp]: Add --parsetrace option to nqp.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Oct 30, 2009
1 parent ed6362d commit 2cd14a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/NQP/Compiler.pir
Expand Up @@ -27,6 +27,8 @@ NQP::Compiler - NQP compiler
nqpproto.'parsegrammar'($P0)
$P0 = get_hll_global ['NQP'], 'Actions'
nqpproto.'parseactions'($P0)
$P0 = split ' ', 'e=s help|h target=s dumper=s trace|t=s encoding=s output|o=s combine version|v parsetrace'
setattribute nqpproto, '@cmdoptions', $P0
.end

.sub 'main' :main
Expand Down
4 changes: 4 additions & 0 deletions src/Regex/Cursor.pir
Expand Up @@ -163,6 +163,7 @@ If C<regex> is omitted, then use the C<TOP> rule for the grammar.
.param pmc regex :optional
.param int has_regex :opt_flag
.param pmc action :named('action') :optional
.param int rxtrace :named('rxtrace') :optional
.param pmc options :slurpy :named

if has_regex goto regex_done
Expand All @@ -173,6 +174,9 @@ If C<regex> is omitted, then use the C<TOP> rule for the grammar.

.local pmc cur, match
cur = self.'!cursor_init'(target, options :flat :named)
unless rxtrace goto rxtrace_done
cur.'DEBUG'()
rxtrace_done:
cur = cur.regex()
match = cur.'MATCH'()
.return (match)
Expand Down
4 changes: 3 additions & 1 deletion src/cheats/hll-compiler.pir
Expand Up @@ -24,7 +24,9 @@
parseactions = self.'parseactions'()
have_parseactions:
match = parsegrammar.'parse'(source, 'from'=>0, 'action'=>parseactions)
.local int rxtrace
rxtrace = options['parsetrace']
match = parsegrammar.'parse'(source, 'from'=>0, 'action'=>parseactions, 'rxtrace'=>rxtrace)
unless match goto err_parsefail
.return (match)
Expand Down

0 comments on commit 2cd14a3

Please sign in to comment.