let term = CicNotationParser.term
let statement = Grammar.Entry.create grammar "statement"
-let add_raw_attribute ?context ~text term =
- CicNotationPt.AttributedTerm (`Raw (text, context), term)
+let add_raw_attribute ~text t = CicNotationPt.AttributedTerm (`Raw text, t)
+
+let default_precedence = 50
+let default_associativity = Gramext.NonA
EXTEND
GLOBAL: term statement;
IDENT "for";
p2 =
[ blob = UNPARSED_AST ->
- add_raw_attribute ~context:`Ast ~text:blob
+ add_raw_attribute ~text:(sprintf "@{%s}" blob)
(CicNotationParser.parse_level2_ast (Stream.of_string blob))
| blob = UNPARSED_META ->
- add_raw_attribute ~context:`Meta ~text:blob
+ add_raw_attribute ~text:(sprintf "${%s}" blob)
(CicNotationParser.parse_level2_meta (Stream.of_string blob))
] ->
+ let assoc =
+ match assoc with
+ | None -> default_associativity
+ | Some assoc -> assoc
+ in
+ let prec =
+ match prec with
+ | None -> default_precedence
+ | Some prec -> prec
+ in
(add_raw_attribute ~text:s
(CicNotationParser.parse_level1_pattern (Stream.of_string s)),
assoc, prec, p2)