(String.sub uri index_con (String.length uri - index_con))
)
;;
+
+ (* TeX unquoting for "_" *)
+ let unquote str =
+ Str.global_replace (Str.regexp "\\\\_") "_" str
+ ;;
}
let dollar = '$'
let num = ['1'-'9']['0'-'9']* | '0'
| "\\Set" { SET }
| "\\Prop" { PROP }
| "\\Type" { TYPE }
- | ident { ID (L.lexeme lexbuf) }
- | conuri { CONURI (U.uri_of_string ("cic:" ^ L.lexeme lexbuf)) }
- | varuri { VARURI (U.uri_of_string ("cic:" ^ L.lexeme lexbuf)) }
- | indtyuri { INDTYURI (indtyuri_of_uri ("cic:" ^ L.lexeme lexbuf)) }
- | indconuri { INDCONURI (indconuri_of_uri("cic:" ^ L.lexeme lexbuf)) }
+ | ident { ID (unquote (L.lexeme lexbuf)) }
+ | conuri { CONURI
+ (U.uri_of_string ("cic:" ^ (unquote (L.lexeme lexbuf)))) }
+ | varuri { VARURI
+ (U.uri_of_string ("cic:" ^ (unquote (L.lexeme lexbuf)))) }
+ | indtyuri { INDTYURI
+ (indtyuri_of_uri ("cic:" ^ (unquote (L.lexeme lexbuf)))) }
+ | indconuri { INDCONURI
+ (indconuri_of_uri("cic:" ^ (unquote (L.lexeme lexbuf)))) }
| num { NUM (int_of_string (L.lexeme lexbuf)) }
| '?' num { let lexeme = L.lexeme lexbuf in
META