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

No trailing semicolon allowed in list and array patterns #4706

Closed
vicuna opened this issue Jan 31, 2009 · 0 comments
Closed

No trailing semicolon allowed in list and array patterns #4706

vicuna opened this issue Jan 31, 2009 · 0 comments

Comments

@vicuna
Copy link

vicuna commented Jan 31, 2009

Original bug ID: 4706
Reporter: @mjambon
Assigned to: ertai
Status: closed (set by @xavierleroy on 2012-09-25T18:06:17Z)
Resolution: fixed
Priority: normal
Severity: trivial
Version: 3.11.0
Fixed in version: 3.12.0
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Monitored by: tmeyer

Bug description

Trailing semicolons e.g. [ 1; ] in patterns for arrays and lists are not allowed by camlp4o.

The reference manual does not mention that it should be legal, but the compilers tolerate them everywhere (patterns and expressions), so it seems natural to allow them in the camlp4o parser as well.

(*
This is foo.ml

camlp4o -parser pa_foo.cmo -printer o foo.ml
ocamlc -c -pp 'camlp4o -parser pa_foo.cmo' foo.ml
*)

match [| |] with
[| 1; |] -> ()
| _ -> ()

(**************************************)

$ camlp4o -printer o foo.ml
File "foo.ml", line 9, characters 8-9:
Parse error: [sem_patt] expected after ";" (in [sem_patt])

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

No branches or pull requests

1 participant