src/HOL/BNF/Tools/bnf_fp_def_sugar.ML
changeset 53553 d4191bf88529
parent 53476 eb3865c3ee58
child 53569 b4db0ade27bd
equal deleted inserted replaced
53552:eed6efba4e3f 53553:d4191bf88529
  1536 val parse_ctr_arg =
  1536 val parse_ctr_arg =
  1537   @{keyword "("} |-- parse_binding_colon -- Parse.typ --| @{keyword ")"} ||
  1537   @{keyword "("} |-- parse_binding_colon -- Parse.typ --| @{keyword ")"} ||
  1538   (Parse.typ >> pair Binding.empty);
  1538   (Parse.typ >> pair Binding.empty);
  1539 
  1539 
  1540 val parse_defaults =
  1540 val parse_defaults =
  1541   @{keyword "("} |-- @{keyword "defaults"} |-- Scan.repeat parse_bound_term --| @{keyword ")"};
  1541   @{keyword "("} |-- Parse.reserved "defaults" |-- Scan.repeat parse_bound_term --| @{keyword ")"};
  1542 
  1542 
  1543 val parse_type_arg_constrained =
  1543 val parse_type_arg_constrained =
  1544   Parse.type_ident -- Scan.option (@{keyword "::"} |-- Parse.!!! Parse.sort);
  1544   Parse.type_ident -- Scan.option (@{keyword "::"} |-- Parse.!!! Parse.sort);
  1545 
  1545 
  1546 val parse_type_arg_named_constrained = parse_opt_binding_colon -- parse_type_arg_constrained;
  1546 val parse_type_arg_named_constrained = parse_opt_binding_colon -- parse_type_arg_constrained;
  1552 
  1552 
  1553 val parse_map_rel_binding = Parse.short_ident --| @{keyword ":"} -- parse_binding;
  1553 val parse_map_rel_binding = Parse.short_ident --| @{keyword ":"} -- parse_binding;
  1554 
  1554 
  1555 val no_map_rel = (Binding.empty, Binding.empty);
  1555 val no_map_rel = (Binding.empty, Binding.empty);
  1556 
  1556 
  1557 (* "map" and "rel" are purposedly not registered as keywords, because they are short and nice names
       
  1558    that we don't want them to be highlighted everywhere. *)
       
  1559 fun extract_map_rel ("map", b) = apfst (K b)
  1557 fun extract_map_rel ("map", b) = apfst (K b)
  1560   | extract_map_rel ("rel", b) = apsnd (K b)
  1558   | extract_map_rel ("rel", b) = apsnd (K b)
  1561   | extract_map_rel (s, _) = error ("Unknown label " ^ quote s ^ " (expected \"map\" or \"rel\")");
  1559   | extract_map_rel (s, _) = error ("Unknown label " ^ quote s ^ " (expected \"map\" or \"rel\")");
  1562 
  1560 
  1563 val parse_map_rel_bindings =
  1561 val parse_map_rel_bindings =