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
Spurious (?) camlp4 error #6221
Comments
Comment author: @bobzhang I think the documentation may be incorrect. where do you expect 'foo1:bar' appear? |
Comment author: kosik Hi, This suggestion: <:ctyp< t : t >> I have found here: http://brion.inria.fr/gallium/index.php/Abstract_Syntax_Tree#Types It appears on the line that contains TyCol . |
Comment author: @yallop It looks like camlp4 is committing to parsing x:y as a labeled argument rather than a record field as soon as it's seen the colon. I've attached a patch that changes the parser so that it waits until it's seen the function arrow before committing. Examples: $ cat record_field.ml Without the patch: $ camlp4of labeled_arg.ml $ camlp4of record_field.ml With the patch: $ camlp4of labeled_arg.ml $ camlp4of record_field.ml |
Comment author: @yallop Fixed in Camlp4 trunk: |
Original bug ID: 6221
Reporter: kosik
Assigned to: @yallop
Status: closed (set by @xavierleroy on 2015-12-11T18:27:48Z)
Resolution: fixed
Priority: low
Severity: minor
Version: 3.12.1
Target version: later
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Tags: patch
Bug description
By looking at:
http://brion.inria.fr/gallium/index.php/Abstract_Syntax_Tree#Types
there is a line:
so it seems that it should also be somehow posible to get a quote for "field declaration", i.e.:
<:ctypfoo1:bar1>
However, if I try that, I get an error:
While expanding quotation "ctyp" in a position of "expr":
Parse error: "->" expected after [ctyp level star] (in [ctyp]
That might not be the expected camlp4 behavior.
Instead, it should expand that quotation to something like:
Ast.TyCol (_loc,
(Ast.TyId (_loc, (Ast.IdLid (_loc, "foo1")))),
(Ast.TyId (_loc, (Ast.IdLid (_loc, "bar1")))))
File attachments
The text was updated successfully, but these errors were encountered: