Navigation Menu

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

Identifier location inside anti-quotes is wrong. #6177

Closed
vicuna opened this issue Sep 13, 2013 · 3 comments
Closed

Identifier location inside anti-quotes is wrong. #6177

vicuna opened this issue Sep 13, 2013 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Sep 13, 2013

Original bug ID: 6177
Reporter: furuse
Assigned to: @bobzhang
Status: closed (set by @diml on 2016-12-07T17:27:33Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.01.0
Target version: later
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Monitored by: @gasche

Bug description

Compile the following by ocamlc -c -I +camlp4 -pp camlp4of x.ml :

(* x.ml *)
open Camlp4
open PreCast
open Ast

let _loc = Loc.ghost

let _ = <:expr< $hello$ >>

It reports an error:

File "x.ml", line 8, characters 16-21:
Error: Unbound value hello

and this position line 8, char 16-21 is one char left from the correct position of the identifier hello. It is not a big issue but exists for years.

@vicuna
Copy link
Author

vicuna commented Sep 17, 2013

Comment author: furuse

I think it is not limited to identifiers but true for general expressions.

@vicuna
Copy link
Author

vicuna commented Sep 17, 2013

Comment author: @bobzhang

I don't have time to look into the problem so far, but I think it's a known issue in Camlp4. The problem lies in all the Ant variants in Camlp4Ast only carries string.
For example:

BAnt of string
ReAnt of string

For a single identifier $xx, the location could be correct, but for a general expression it would be hard.
By the way, my branch of Camlp4, Fan solves the problem in this way.

type ant = `Ant of (loc * content)

The type ant is attached to each node types

@vicuna
Copy link
Author

vicuna commented Dec 7, 2016

Comment author: @diml

Camlp4 is now a separate project. Please re-open a ticket on github [1] if you are still interested in seeing the original issue fixed.

[1] https://github.com/ocaml/camlp4/issues

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