[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Martin Jambon <martin1977@l...> |
| Subject: | Re: [Caml-list] caml versions format |
On Wed, 13 Sep 2006, Virgile Prevosto wrote:
> Hello Guillaume,
>
> 2006/9/13, Guillaume Rousse <Guillaume.Rousse@inria.fr>:
> > I just get struck by a "3.10+dev8" version string, which breaks my
> > assumtion that ocaml version are always formated as X.Y.Z, where X, Y
> > and Z are numerical only.
>
> I had the same issue once. Since then, the documentation for
> Sys.ocaml_version details what you can find in the string:
> http://caml.inria.fr/pub/docs/manual-ocaml/libref/Sys.html
> (this is the last item in the page). Basically, you have something like
> X.Y[.Z][+comment], where the last two parts are optional.
In the micmatch tutorial, I give this example, which should parse the
version string correctly (or abort):
# Sys.ocaml_version;;
- : string = "3.08.3"
# RE num = digit+;;
# let / (num as major : int)
"." (num as minor : int)
("." (num as patchlevel := fun s -> Some (int_of_string s))
| ("" as patchlevel = None))
("+" (_* as additional_info := fun s -> Some s)
| ("" as additional_info = None))
eos / = Sys.ocaml_version
;;
val additional_info : string option = None
val major : int = 3
val minor : int = 8
val patchlevel : int option = Some 3
--
Martin Jambon, PhD
http://martin.jambon.free.fr