Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002954OCamlOCaml generalpublic2004-07-16 20:332010-04-29 14:26
Assigned Toertai 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version3.10.0 
Summary0002954: pos_lnum and pos_bol are worngs on exceptions from Grammar.Entry.parse
DescriptionFull_Name: Aleksey Nogin
Submission from: (

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

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!

TagsNo tags attached.
Attached Files

- Relationships
parent of 0003407closedxleroy Bug 2954 (camlp4) 

-  Notes
administrator (administrator)
2005-01-04 16:10

see also PR#3407
Assigned to MM.
ertai (developer)
2007-12-17 15:12

This has been fixed during the upgrade of camlp4. Parsing functions now takes an extra location argument that represent the starting location.

- Issue History
Date Modified Username Field Change
2005-11-18 10:14 administrator New Issue
2005-12-15 15:34 doligez Relationship added parent of 0003407
2007-12-12 16:24 doligez Summary pos_lnum and pos_bol are worngs on exceptons from Grammar.Entry.parse => pos_lnum and pos_bol are worngs on exceptions from Grammar.Entry.parse
2007-12-12 16:24 doligez Description Updated
2007-12-17 15:12 ertai Note Added: 0004393
2007-12-17 15:12 ertai Assigned To => ertai
2007-12-17 15:12 ertai Status acknowledged => resolved
2007-12-17 15:12 ertai Resolution open => fixed
2007-12-17 15:12 ertai Fixed in Version => 3.10.0
2010-04-29 14:26 xleroy Status resolved => closed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker