The "0o" prefix is only supported by YAML 1.2 integer spec

In the Types repository, the prefix for base 8 is "0" only.
This commit is contained in:
Jean-Sébastien Pédron 2011-09-28 15:30:48 +02:00
parent 781b27791e
commit e65bda25db

View File

@ -88,13 +88,11 @@ string_to_integer2("0b" ++ Text) ->
base2_to_integer(Text, 0); base2_to_integer(Text, 0);
string_to_integer2("0x" ++ Text) -> string_to_integer2("0x" ++ Text) ->
base16_to_integer(Text, 0); base16_to_integer(Text, 0);
string_to_integer2("0o" ++ Text) ->
base8_to_integer(Text, 0);
string_to_integer2("0" ++ Text) -> string_to_integer2("0" ++ Text) ->
base8_to_integer(Text, 0); base8_to_integer(Text, 0);
string_to_integer2(Text) -> string_to_integer2(Text) ->
Opts = [{capture, none}], Opts = [{capture, none}],
case re:run(Text, "[1-9][0-9_]*(?::[0-5]?[0-9])+", Opts) of case re:run(Text, "[1-9][0-9_]*(:[0-5]?[0-9])+", Opts) of
match -> base60_to_integer(Text, 0, 0); match -> base60_to_integer(Text, 0, 0);
nomatch -> base10_to_integer(Text, 0) nomatch -> base10_to_integer(Text, 0)
end. end.