kschiess / parslet

A small PEG based parser library. See the Hacking page in the Wiki as well.
kschiess.github.com/parslet
MIT License
809 stars 95 forks source link

Stateful error trees are buggy #66

Closed kschiess closed 12 years ago

kschiess commented 12 years ago

Saving the '@offending_parslet' in alternatives (but not only there) in the parslet instance itself is not correct. In cases where one parslet can be nested in itself, the @offending_parslet will contain only the innermost error after the parse.

This can be seen in Johns gist in issue #64: (https://gist.github.com/2374233) In the sample

define foo()
  begin
     @bar.baz
  end
end

the error message will contain why the define-rule didn't match '@bar.baz' and not why it didn't match 'begin ... end'.

Storing this kind of stuff in instance variables is a design-smell anyway. This is the issue why we need to take that out.

kschiess commented 12 years ago

Addressing this bug in the error_msg_rehaul branch. Tests don't pass yet, but the error messages look better.

kschiess commented 12 years ago

This issue is largely solved on master.

The removal of @last_error makes issue #64 all the more important. See the mailing list for a status report on that.