let indtyuri_of_uri uri =
let index_sharp = String.index uri '#' in
let index_num = index_sharp + 3 in
- (UriManager.uri_of_string (String.sub uri 0 index_sharp),
- int_of_string (String.sub uri index_num (String.length uri - index_num)) - 1
- )
+ try
+ (UriManager.uri_of_string (String.sub uri 0 index_sharp),
+ int_of_string(String.sub uri index_num (String.length uri - index_num)) - 1
+ )
+ with
+ Failure msg ->
+ raise (CicTextualParser0.LexerFailure "Not an inductive URI")
;;
let indconuri_of_uri uri =
let index_sharp = String.index uri '#' in
let index_div = String.rindex uri '/' in
let index_con = index_div + 1 in
- (UriManager.uri_of_string (String.sub uri 0 index_sharp),
- int_of_string
- (String.sub uri (index_sharp + 3) (index_div - index_sharp - 3)) - 1,
- int_of_string
- (String.sub uri index_con (String.length uri - index_con))
- )
+ try
+ (UriManager.uri_of_string (String.sub uri 0 index_sharp),
+ int_of_string
+ (String.sub uri (index_sharp + 3) (index_div - index_sharp - 3)) - 1,
+ int_of_string
+ (String.sub uri index_con (String.length uri - index_con))
+ )
+ with
+ Failure msg ->
+ raise (CicTextualParser0.LexerFailure "Not a constructor URI")
;;
}
let num = ['1'-'9']['0'-'9']* | '0'
let indtyuri_of_uri uri =
let index_sharp = String.index uri '#' in
let index_num = index_sharp + 3 in
- (UriManager.uri_of_string (String.sub uri 0 index_sharp),
- int_of_string (String.sub uri index_num (String.length uri - index_num)) - 1
- )
+ try
+ (UriManager.uri_of_string (String.sub uri 0 index_sharp),
+ int_of_string(String.sub uri index_num (String.length uri - index_num)) - 1
+ )
+ with
+ Failure msg ->
+ raise (CicTextualParser0.LexerFailure "Not an inductive URI")
;;
let indconuri_of_uri uri =
let index_sharp = String.index uri '#' in
let index_div = String.rindex uri '/' in
let index_con = index_div + 1 in
- (UriManager.uri_of_string (String.sub uri 0 index_sharp),
- int_of_string
- (String.sub uri (index_sharp + 3) (index_div - index_sharp - 3)) - 1,
- int_of_string
- (String.sub uri index_con (String.length uri - index_con))
- )
+ try
+ (UriManager.uri_of_string (String.sub uri 0 index_sharp),
+ int_of_string
+ (String.sub uri (index_sharp + 3) (index_div - index_sharp - 3)) - 1,
+ int_of_string
+ (String.sub uri index_con (String.length uri - index_con))
+ )
+ with
+ Failure msg ->
+ raise (CicTextualParser0.LexerFailure "Not a constructor URI")
;;
(* TeX unquoting for "_" *)