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

Camlp4 accepts multiple private keywords #5861

Closed
vicuna opened this issue Dec 20, 2012 · 7 comments
Closed

Camlp4 accepts multiple private keywords #5861

vicuna opened this issue Dec 20, 2012 · 7 comments

Comments

@vicuna
Copy link

vicuna commented Dec 20, 2012

Original bug ID: 5861
Reporter: @lpw25
Assigned to: @bobzhang
Status: closed (set by @xavierleroy on 2015-12-11T18:19:52Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.01.0+dev
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues

Bug description

Both camlp4o and camlp4r accept the following:

type foo

type bar = private private foo

@vicuna
Copy link
Author

vicuna commented Dec 20, 2012

Comment author: @bobzhang

This is due to strict_parsing in the file Camlp4/Struct/Grammar/Parser.ml is set to false, then the backtracking for lower precedence is automatically turned on.
But I am afraid if it was set to true, it may break other programs

@vicuna
Copy link
Author

vicuna commented Dec 20, 2012

Comment author: @bobzhang

I have set strict_parsing to true, and bootstrapped successfully, but it needs to add some parens in some places, I don't know it's worth the change.
I would like to hear other people's opinion

@vicuna
Copy link
Author

vicuna commented Dec 23, 2012

Comment author: @lpw25

I don't know that much about camlp4, but I was thinking of something more along the lines of:

--- a/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
+++ b/camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml
@@ -352,7 +352,7 @@ module Make (Ast : Sig.Camlp4Ast) = struct
fun
[ <:ctyp< $t1$ == $t2$ >> ->
type_decl tl cl loc (Some (ctyp t1)) pflag t2

  • | <:ctyp< private $t$ >> ->
  • | <:ctyp< private $t$ >> when not pflag ->
    type_decl tl cl loc m True t
    | <:ctyp< { $t$ } >> ->
    mktype loc tl cl

@vicuna
Copy link
Author

vicuna commented Dec 23, 2012

Comment author: @bobzhang

@lpw25, you mean delay the parsing error into a dumping error?

@vicuna
Copy link
Author

vicuna commented Dec 23, 2012

Comment author: @lpw25

Yes. Plenty of syntax errors seem to be dumping errors already, since this is quite an unlikely error I don't see the need to change the parser.

@vicuna
Copy link
Author

vicuna commented Dec 23, 2012

Comment author: @bobzhang

It's fair, I will fix it later, thanks

@vicuna
Copy link
Author

vicuna commented Dec 24, 2012

Comment author: @bobzhang

fixed in revision 13157

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