diff --git a/src/NQP/Compiler.pir b/src/NQP/Compiler.pir index d7dcdca..4872474 100644 --- a/src/NQP/Compiler.pir +++ b/src/NQP/Compiler.pir @@ -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 diff --git a/src/Regex/Cursor.pir b/src/Regex/Cursor.pir index ce412fd..53f3cdc 100644 --- a/src/Regex/Cursor.pir +++ b/src/Regex/Cursor.pir @@ -163,6 +163,7 @@ If C is omitted, then use the C 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 @@ -173,6 +174,9 @@ If C is omitted, then use the C 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) diff --git a/src/cheats/hll-compiler.pir b/src/cheats/hll-compiler.pir index 9c7a028..a9c2e8e 100644 --- a/src/cheats/hll-compiler.pir +++ b/src/cheats/hll-compiler.pir @@ -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)