You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 2954 Reporter: administrator Assigned to: ertai Status: closed (set by @xavierleroy on 2010-04-29T12:26:02Z) Resolution: fixed Priority: normal Severity: minor Fixed in version: 3.10.0 Category: ~DO NOT USE (was: OCaml general) Parent of:#3407 Monitored by: nogin
I have a file that is being preprocessed by camlp4 with EXTEND'ed grammar. At
some point (after the file is fully read), the code needs to parse a string
(some of the quotations need to be parsed after the file is read in full), so it
does
Grammar.Entry.parse foo (Stream.of_string s)
If parsing fails and Grammar.Entry.parse ends up raising Stream.Error wrapped in
Stdpp.Exc_ocated, the loc in the exception will have a correct pos_cnum
(relative position in the string s being parsed), but the pos_lnum and pos_bol
seem to be inherited from the file that was originally parsed (in this case they
point at the end of file).
P.S. In addition to fixing Grammar.Entry.parse to start "counting" everything
from 0, it would be nice to also have a version of Grammar.Entry.parse that
would take an extra Lexing.position argument (representing the "offset" to start
counting at). This would make it unnecessary to catch Stdpp.Exc_located fro it,
re-raising them with a different (adjusted) loc.
Thank you!
The text was updated successfully, but these errors were encountered:
Original bug ID: 2954
Reporter: administrator
Assigned to: ertai
Status: closed (set by @xavierleroy on 2010-04-29T12:26:02Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 3.10.0
Category: ~DO NOT USE (was: OCaml general)
Parent of: #3407
Monitored by: nogin
Bug description
Full_Name: Aleksey Nogin
Version:
OS:
Submission from: charter-242-009.caltech.edu (131.215.242.9)
I have a file that is being preprocessed by camlp4 with EXTEND'ed grammar. At
some point (after the file is fully read), the code needs to parse a string
(some of the quotations need to be parsed after the file is read in full), so it
does
Grammar.Entry.parse foo (Stream.of_string s)
If parsing fails and Grammar.Entry.parse ends up raising Stream.Error wrapped in
Stdpp.Exc_ocated, the loc in the exception will have a correct pos_cnum
(relative position in the string s being parsed), but the pos_lnum and pos_bol
seem to be inherited from the file that was originally parsed (in this case they
point at the end of file).
P.S. In addition to fixing Grammar.Entry.parse to start "counting" everything
from 0, it would be nice to also have a version of Grammar.Entry.parse that
would take an extra Lexing.position argument (representing the "offset" to start
counting at). This would make it unnecessary to catch Stdpp.Exc_located fro it,
re-raising them with a different (adjusted) loc.
Thank you!
The text was updated successfully, but these errors were encountered: