Commit be5816a8 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-05-17 18:45:09 by beppe] Empty log message

Original author: beppe
Date: 2005-05-17 18:45:09+00:00
parent 96b1764b
......@@ -211,12 +211,27 @@ unary_op_warning "int_of"
string intstr int
(fun v ->
let (s,_) = Value.get_string_utf8 v in
let str = U.get_str s in
try let modifier = str.[(String.index str '0')+1] in
if ( modifier = 'x' ||
modifier = 'X' ||
modifier = 'b' ||
modifier = 'B' ||
modifier = 'o' ||
modifier = 'O')
then
Value.Integer (Intervals.V.from_int (int_of_string(str)))
else
Value.Integer (Intervals.V.mk (str))
with _ ->
(try Value.Integer (Intervals.V.mk (str))
with Failure _ -> raise exn_int_of));;
(* It was like that *)
(* try Value.Integer (Intervals.V.mk (U.get_str s)) *)
(* UTF-8 is ASCII compatible ! *)
(* modified to allow 0x 0b 0o notations *)
try Value.Integer (Intervals.V.from_int (int_of_string(U.get_str s)))
with Failure _ -> raise exn_int_of);;
register_fun "atom_of"
string atom
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment