|Anonymous | Login | Signup for a new account||2014-11-26 12:15 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004006||OCaml||OCaml documentation||public||2006-04-16 20:58||2012-07-12 11:25|
|Target Version||Fixed in Version|
|Summary||0004006: Camlp4's default lexer fails on negative numbers|
|Description||I put here this message for I wasted hours in understandig why my code did not work. This is due to a lack of information provided in Camlp4's Reference Manual and Tutorial, although these ones are generally speaking very usefull.|
The INT and FLOAT statements only work with positive numbers : this might be trivial if you have a look to Camlp4's source code, but it is not "natural" at all.
I have put down a whole session under Solaris 9, running the 3.06 version, but it is reproductible with any version up to 3.09, I guess, for the source code I examined was the one of the 3.09 version.
Objective Caml version 3.06
# #load "camlp4o.cma";;
Camlp4 Parsing version 3.06
# #load "pa_extend.cmo";;
# let gram = Grammar.gcreate (Plexer.gmake ());;
val gram : Grammar.g = <abstr>
# let flottant = Grammar.Entry.create gram "flottant";;
val flottant : '_a Grammar.Entry.e = <abstr>
# let entier = Grammar.Entry.create gram "entier";;
val entier : '_a Grammar.Entry.e = <abstr>
[ z = FLOAT -> print_endline z ]
[ e = INT -> print_endline e ]
- : unit = ()
# let apply_flottant s = Grammar.Entry.parse flottant (Stream.of_string s);;
val apply_flottant : string -> unit = <fun>
# let apply_entier s = Grammar.Entry.parse entier (Stream.of_string s);;
val apply_entier : string -> unit = <fun>
# apply_flottant "-3.5676876";;
Stdpp.Exc_located ((0, 1), Stream.Error "illegal begin of flottant").
# apply_entier "-586689";;
Stdpp.Exc_located ((0, 1), Stream.Error "illegal begin of entier").
# apply_flottant "8.7697";;
- : unit = ()
# apply_entier "65765";;
- : unit = ()
|Additional Information||When you have -3.5676876 there is two tokens, that's all.|
The camlp4 doc needs an update but that's not the topic here.
|Tags||No tags attached.|
Before I put the issue here, I sent en e-mail to the OCaml team. I had no answer at all and that is why I decided to create an issue here in order to warn people who had experienced the same trouble.
I am not saying it is a bug; I am not saying it is an error either, just an odd feature that I think would deserve to be documented.
When I posted the message, I saw the "OCaml documentation" item in the list of categories in which to create the issue, so I thought it REALLY was the right place.
Excuse my ignorance in knowing how to interpret english statements.
We need to make sure that the documentation explains the behaviour clearly and correctly.
|2006-04-16 20:58||Pasinelli||New Issue|
|2006-08-29 17:51||doligez||Assigned To||=> ertai|
|2006-08-29 17:51||doligez||Status||new => acknowledged|
|2006-09-05 13:38||ertai||Status||acknowledged => closed|
|2006-09-05 13:38||ertai||Resolution||open => no change required|
|2006-09-05 13:38||ertai||Additional Information Updated|
|2006-09-05 20:25||Pasinelli||Status||closed => feedback|
|2006-09-05 20:25||Pasinelli||Resolution||no change required => reopened|
|2006-09-05 20:25||Pasinelli||Note Added: 0003762|
|2012-04-10 17:48||doligez||Note Added: 0007313|
|2012-04-10 17:48||doligez||Status||feedback => confirmed|
|2012-04-10 17:48||doligez||Resolution||reopened => open|
|2012-07-12 11:25||doligez||Assigned To||ertai =>|
|Copyright © 2000 - 2011 MantisBT Group|