jnthn / grammar-debugger

Grammar::Debugger and Grammer::Tracer Perl 6 modules
36 stars 19 forks source link

Add testcase and fix for indentation bug #5

Closed ghost closed 9 years ago

ghost commented 10 years ago

Grammar::Tracer gets kinda confused if a traced .parse throws an exception followed by another trace in the same process.

This fix doesn't appear to have any unwanted side effects, though I haven't tried it with anything crazy.

meisl commented 10 years ago

There are some problems with this pr, in ascending order of severity (ie here goes "critique"):

The real problem is: Both Tracer and Debugger have state like current call-depth (~> indent), declared / manual breakpoints, auto-continue/single-step etc. This, in itself is fine and need be. However, the question is with what to associate this state?. Currently it's associated with the meta-class, which means that there's only one state, for each and every grammar, and instance thereof, plus - even worse - one state only for the whole program's live-time!

This has several implications:

So(lutions):

I'll soon provide a pull-request implementing pr #7 implements pt 2 and - hence safely - pt 3, by just enough of pt 4. Plus a bit of preparation for pt 1. Once that's ready I think I'll move much of Maybe I should move this rationale over there or maybe into a new issue? (of course leaving a link here)

Any input/comment/advice/critique is very much welcomed, as always :)