chumsky icon indicating copy to clipboard operation
chumsky copied to clipboard

Examples for using Parser::debug()

Open natemartinsf opened this issue 2 years ago • 4 comments

Can you share any examples for using the debug() parser? It requires a single argument, x, but the documentation doesn't specify what this should be.

I've tried wrapping another parser in debug(), and tried adding it as the final combinator, but neither would compile.

natemartinsf avatar Nov 02 '21 03:11 natemartinsf

The debugging features of Chumsky are still quite early in development and I'm still doing some thinking about how I want to proceed with them.

It requires a single argument, x, but the documentation doesn't specify what this should be.

It can be literally anything that you want to use to label a particular parser in the debugging output. I tend to use things like "expression", "pattern", "atom", etc. depending on the context. It doesn't mean anything to the debugger, it just gets used to identify it in the output.

zesterer avatar Nov 02 '21 08:11 zesterer

Ah, thanks! Would it be worth me doing a PR to add a sentence to the documentation, or is this likely to change too much as you add debugging features?

natemartinsf avatar Nov 03 '21 02:11 natemartinsf

Some documentation would be useful, yes! I'll also open an issue regard parser debugging to help flesh out some ideas about how it should work.

zesterer avatar Nov 03 '21 08:11 zesterer

(The issue is here: #19 )

zesterer avatar Nov 03 '21 08:11 zesterer

Closing in favour of #19.

zesterer avatar Feb 20 '23 22:02 zesterer