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

Syntax error messages involving unclosed parens are sometimes incorrect #5770

Closed
vicuna opened this Issue Oct 1, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

vicuna commented Oct 1, 2012

Original bug ID: 5770
Reporter: @mauny
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:20:03Z)
Resolution: fixed
Priority: low
Severity: minor
Platform: all
OS: all
OS Version: all
Version: 4.00.0
Target version: later
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Child of: #5068
Monitored by: @hcarty

Bug description

Parsing invalid patterns inside well-balanced parentheses produces an error message saying that parens don't match.

I provide a patch that fixes the problem by adding a few more error rules in the parser and relevant error messages.

Steps to reproduce

$ echo 'match x with (1 as ) -> 0;;' > /tmp/a.ml
$ ocamlc /tmp/a.ml -o /tmp/a
File "/tmp/a.ml", line 1, characters 19-20:
Error: Syntax error: ')' expected
File "/tmp/a.ml", line 1, characters 13-14:
Error: This '(' might be unmatched

Additional information

After applying the patch, the new error message is

File "/tmp/a.ml", line 1, characters 19-20:
Error: Syntax error: identifier expected.

File attachments

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Oct 16, 2012

Comment author: @alainfrisch

Thanks, I've applied your patch on the trunk (commit 13019) and adapted labltk/browser to support the new error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.