| Anonymous | Login | Signup for a new account | 2013-05-22 19:33 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
| 0005159 | OCaml | Camlp4 | public | 2010-09-29 15:06 | 2012-07-31 09:29 | |||||||
| Reporter | Hendrik Tews | |||||||||||
| Assigned To | doligez | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||||||
| Status | resolved | Resolution | fixed | |||||||||
| Platform | OS | OS Version | ||||||||||
| Product Version | 3.12.0 | |||||||||||
| Target Version | Fixed in Version | 3.13.0+dev | ||||||||||
| Summary | 0005159: wrong location after line directive | |||||||||||
| 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) | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Notes |
|
|
(0005679) doligez (manager) 2010-10-12 11:46 edited on: 2010-10-12 11:46 |
What makes you think it should be 0 ? The regular compiler does the same thing as camlp4. These offsets are from the start of the lexbuf, not from the start of an embedded (and possibly nonexistent) file. |
|
(0005681) Hendrik Tews (reporter) 2010-10-12 23:08 |
The documentation says that Loc.start_off "Returns the number of characters from the begining of the file of the begining of this location" and because file_name="b.ml" and in b.ml the let is at position 0 start_off should return 0. |
|
(0005682) doligez (manager) 2010-10-13 16:03 |
Hm. The documentation needs to be rewritten in a less ambiguous way. In this case, "the file" is your two-line file that contains the # and the let (i.e. the real file that OCaml is parsing). In any case, I don't think you should rely on anything else than the difference between offset and bol. |
|
(0005683) Hendrik Tews (reporter) 2010-10-18 09:56 |
doligez wrote: Hm. The documentation needs to be rewritten in a less ambiguous way. I don't see any ambiguity, there is only one file, which name is returned by Loc.file_name. In any case, I don't think you should rely on anything else than the difference between offset and bol. You mean file_name and start/stop_line may return invalid values? Why are these functions present then? How would you report an error location with only the difference between offset and bol? Something like File unknown, line unknown, characters 8-9: Error: ... ? |
|
(0005685) doligez (manager) 2010-10-19 14:09 |
Hendrik Tews wrote: I don't see any ambiguity, there is only one file, which name is returned by Loc.file_name. Actually, there is only one file, the one that OCaml is parsing (your two-line file that starts with '# 1 "b.ml"'). The fact that you're interpreting it differently definitely indicates ambiguity. You mean file_name and start/stop_line may return invalid values? Why are these functions present then? No, I mean as far as offset and bol are concerned, only the difference is significant. Of course you can use the file name and line number. |
|
(0006910) doligez (manager) 2012-02-10 10:08 |
Fixed by rewording the documentation to refer to the lexbuf rather than "the file". Fixed in trunk [3.13.0] (commit 12144). |
|
(0006911) Hendrik Tews (reporter) 2012-02-10 10:40 |
May I suggest to update the documentation in camlp4/Camlp4/Sig.ml as well? There Loc.start_off is still specified to return the number of characters from the beginning of the file. I would further suggest to add a note to camlp4/Camlp4/Sig.ml stating: Note that character numbers in locations refer to character numbers in the parsed character stream, while line numbers refer to line numbers in the source file. The source file and the parsed character stream differ, for instance, when the parsed character stream contains a line number directive. The line number directive will only update the file-name field and the line-number field of the position. It makes therefore no sense to use character numbers with the source file if the sources contain line number directives. |
|
(0006918) doligez (manager) 2012-02-13 18:46 |
Done in trunk [3.13.0] (commit 12150) |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2010-09-29 15:06 | Hendrik Tews | New Issue | |
| 2010-09-29 15:06 | Hendrik Tews | Status | new => assigned |
| 2010-09-29 15:06 | Hendrik Tews | Assigned To | => ertai |
| 2010-10-12 11:46 | doligez | Note Added: 0005679 | |
| 2010-10-12 11:46 | doligez | Note Edited: 0005679 | |
| 2010-10-12 23:08 | Hendrik Tews | Note Added: 0005681 | |
| 2010-10-13 16:03 | doligez | Note Added: 0005682 | |
| 2010-10-13 16:03 | doligez | Assigned To | ertai => doligez |
| 2010-10-18 09:56 | Hendrik Tews | Note Added: 0005683 | |
| 2010-10-19 14:09 | doligez | Note Added: 0005685 | |
| 2012-02-10 10:08 | doligez | Note Added: 0006910 | |
| 2012-02-10 10:08 | doligez | Status | assigned => closed |
| 2012-02-10 10:08 | doligez | Resolution | open => fixed |
| 2012-02-10 10:08 | doligez | Fixed in Version | => 3.13.0+dev |
| 2012-02-10 10:40 | Hendrik Tews | Note Added: 0006911 | |
| 2012-02-10 10:40 | Hendrik Tews | Status | closed => feedback |
| 2012-02-10 10:40 | Hendrik Tews | Resolution | fixed => reopened |
| 2012-02-13 18:46 | doligez | Note Added: 0006918 | |
| 2012-02-13 18:46 | doligez | Status | feedback => resolved |
| 2012-02-13 18:46 | doligez | Resolution | reopened => fixed |
| Copyright © 2000 - 2011 MantisBT Group |