Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forgetting to wrap a string in a (string) combinator should produce helpful error message #133

Open
vkz opened this issue Apr 27, 2016 · 1 comment

Comments

@vkz
Copy link

vkz commented Apr 27, 2016

(i/parser
 {:foo (cat (string "foo") "." (string "bar"))}
 :start :foo)

;; =>
;; IllegalArgumentException No matching clause:   instaparse.cfg/seq-nt (cfg.clj:236)
;; followed by unhelpful stack

You can easily spot an error in this tiny grammar: we forgot to wrap "." in (string "."). Imagine however trying to find a problem in 100+ lines grammar when all you get is No matching clause: and the last frame that points to some internal library function. I'm not sure if there's a general way to identify and report cases like this, but it might save someone else plenty of time and head-scratching.

@Engelberg
Copy link
Owner

This is a good idea. There are a few error reporting things like this I want to do, so I'll add this to the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants