Closed mingodad closed 2 years ago
Another interesting tool is https://github.com/mqnc/pegdebug but it stoped updating some time ago and doesn't works with the actual peglib
it uses .enter
, .match
and .leave
handlers and uses a call to any->get
that doesn't exists anymore for indentation and looking at peglint
that uses .trace_enter
and trace_leave
and get the indentation from Context
can someone with more knowledge of the internals of peglib
update pegdebug
?
Thank you for the suggestion, but I don't need the feature at this point for my project. Could you send a pull request, so that I can review the code and determine if it's worth to be merged. Thanks.
Even for a small input the output of trace can be big, I'm proposing to implement a way to trim down the output, as a prove of concept show bellow I'm accepting an optional integer value after the
--trace
option and using it to only show output with level <= opt_trace_level, ideally we would run it first with low trace level and will grow as needed depending on what we see in the reduced trace output, an enhanced version could also accept optionalmim_position
and ormax_position
to allow better control of the output.Example of parsing the snippet bellow using the
peglib
grammar shown here https://github.com/yhirose/cpp-peglib/issues/193#issuecomment-1114776706 to parse it:With the actual
--trace
option we get 992 lines of output, with an optional trace level of 4 we get only 22 lines: