-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
wrong location after line directive #5159
Comments
Comment author: @damiendoligez What makes you think it should be 0 ? The regular compiler does the same thing as camlp4. |
Comment author: Hendrik Tews The documentation says that Loc.start_off "Returns the number of |
Comment author: @damiendoligez Hm. The documentation needs to be rewritten in a less ambiguous way. In any case, I don't think you should rely on anything else than the |
Comment author: Hendrik Tews doligez wrote:
I don't see any ambiguity, there is only one file, which name is
You mean file_name and start/stop_line may return invalid values? How would you report an error location with only the difference File unknown, line unknown, characters 8-9: ? |
Comment author: @damiendoligez Hendrik Tews wrote: I don't see any ambiguity, there is only one file, which name is Actually, there is only one file, the one that OCaml is parsing (your two-line You mean file_name and start/stop_line may return invalid values? No, I mean as far as offset and bol are concerned, only the difference is |
Comment author: @damiendoligez Fixed by rewording the documentation to refer to the lexbuf rather than "the file". Fixed in trunk [3.13.0] (commit 12144). |
Comment author: Hendrik Tews May I suggest to update the documentation in camlp4/Camlp4/Sig.ml I would further suggest to add a note to camlp4/Camlp4/Sig.ml stating: Note that character numbers in locations refer to character |
Comment author: @damiendoligez Done in trunk [3.13.0] (commit 12150) |
Original bug ID: 5159
Reporter: Hendrik Tews
Assigned to: @damiendoligez
Status: closed (set by @xavierleroy on 2015-12-11T18:07:30Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.0
Fixed in version: 3.13.0+dev
Category: -for Camlp4 use https://github.com/ocaml/camlp4/issues
Monitored by: @bobzhang mehdi
Bug description
After line directives the offsets in the camlp4 locations are wrong.
For instance for a file containing the following two lines
1 "b.ml"
let a = 5
the location for the StVal node is
file = b.ml (OK)
start line = 1 (OK)
start bol = 11 (should be 0)
start offset = 11 (should be 0)
end line = 1 (OK)
end bol = ee (should be 0)
end offset = 20 (should be 9)
The text was updated successfully, but these errors were encountered: