Skip to content

Commit 4487313

Browse files
garesCohenCyril
authored andcommitted
hack: backport from coq-elpi a new kind of attribute (map)
in this way we can parse #[infer(P = "foo", Q = "bar")]
1 parent 7b4463d commit 4487313

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

hb.elpi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,31 @@ under.do! Then LP :- Then (_\ std.do! LP) _.
8282

8383
%%%%% HB Utils %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8484

85+
86+
% HACK: move to coq-elpi proper
87+
type attmap attribute-type.
88+
8589
% runs P in a context where Coq #[attributes] are parsed
8690
pred with-attributes i:prop.
8791
with-attributes P :-
8892
attributes A,
93+
% HACK: move to coq-elpi proper
94+
(pi S L AS Prefix R R1 Map PS\
95+
parse-attributes.aux [attribute S (node L)|AS] Prefix R :-
96+
if (Prefix = "") (PS = S) (PS is Prefix ^ "." ^ S), supported-attribute (att PS attmap), !,
97+
parse-attributes.aux AS Prefix R1,
98+
(pi x\ supported-attribute (att x string) :- !) => parse-attributes.aux L "" Map,
99+
std.append R1 [get-option PS Map] R
100+
) =>
89101
coq.parse-attributes A [
90102
att "verbose" bool,
91103
att "mathcomp" bool,
92104
att "mathcomp.axiom" string,
105+
att "infer" attmap,
93106
] Opts, !,
94107
Opts => P.
95108

109+
96110
pred if-verbose i:prop.
97111
if-verbose P :- get-option "verbose" tt, !, P.
98112
if-verbose _.

0 commit comments

Comments
 (0)