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

Extraneous trailing parentheses are allowed #204

Open
ryantrinkle opened this issue Oct 9, 2015 · 2 comments
Open

Extraneous trailing parentheses are allowed #204

ryantrinkle opened this issue Oct 9, 2015 · 2 comments

Comments

@ryantrinkle
Copy link

When parsing an expression, extra closing parentheses are allowed; I would expect to receive an error:

parse mainParser "" "())"

produces Right ()

I would expect it to produce a Left value

@ryantrinkle
Copy link
Author

I solved this by doing

parse (mainParser <* eof) ""

So, I'm not sure if the eof should be built into mainParser or not.

@justinethier
Copy link
Owner

Thanks for the report. Yes, right now the parser only reads the first expression and discards any trailing characters in the input:

huski> (+ 1 2))
3
huski> 1 2 3
1

It probably should throw an error if an extra parenthesis is found, and it would be nice if, at a higher level, more expressions were parsed.

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