| None -> None
| Some lexeme -> Some (int_of_string lexeme)
+ (** the uri of an inductive type (a ".ind" uri) is not meaningful without an
+ * xpointer. Still, it's likely that an user who wrote "cic:/blabla/foo.ind"
+ * actually meant "cic:/blabla/foo.ind#xpointer(1/1)", i.e. the first inductive
+ * type in a block of mutual inductive types.
+ *
+ * This function performs the expansion foo.ind -> foo#xpointer..., if needed
+ *)
+let ind_expansion uri =
+ let len = String.length uri in
+ if len >= 4 && String.sub uri (len - 4) 4 = ".ind" then
+ uri ^ "#xpointer(1/1)"
+ else
+ uri
+
EXTEND
GLOBAL: term term0 tactic tactical tactical0 command script;
int: [
| i = IDENT -> (name_of_string i, None)
]
];
- substituted_name: [ (* a subs.name is an explicit substitution subject *)
- [ s = IDENT;
- subst = OPT [
+ subst: [
+ [ subst = OPT [
SYMBOL "\\subst"; (* to avoid catching frequent "a [1]" cases *)
PAREN "[";
substs = LIST1 [
] SEP SYMBOL ";";
PAREN "]" ->
substs
- ] ->
- CicAst.Ident (s, subst)
+ ] -> subst
+ ]
+ ];
+ substituted_name: [ (* a subs.name is an explicit substitution subject *)
+ [ s = IDENT; subst = subst -> CicAst.Ident (s, subst)
+ | s = URI; subst = subst -> CicAst.Uri (ind_expansion s, subst)
]
];
name: [ (* as substituted_name with no explicit substitution *)