equal
deleted
inserted
replaced
61 else warning ("Redefined text antiquotation " ^ kind ^ ": " ^ quote name); |
61 else warning ("Redefined text antiquotation " ^ kind ^ ": " ^ quote name); |
62 Symtab.update (name, x) tab); |
62 Symtab.update (name, x) tab); |
63 |
63 |
64 in |
64 in |
65 |
65 |
66 val add_commands = Library.change global_commands o fold (add_item "command"); |
66 fun add_commands xs = CRITICAL (fn () => change global_commands (fold (add_item "command") xs)); |
67 val add_options = Library.change global_options o fold (add_item "option"); |
67 fun add_options xs = CRITICAL (fn () => change global_options (fold (add_item "option") xs)); |
68 |
68 |
69 fun command src = |
69 fun command src = |
70 let val ((name, _), pos) = Args.dest_src src in |
70 let val ((name, _), pos) = Args.dest_src src in |
71 (case Symtab.lookup (! global_commands) name of |
71 (case Symtab.lookup (! global_commands) name of |
72 NONE => error ("Unknown text antiquotation command: " ^ quote name ^ Position.str_of pos) |
72 NONE => error ("Unknown text antiquotation command: " ^ quote name ^ Position.str_of pos) |
73 | SOME f => transform_failure (curry Antiquote.ANTIQUOTE_FAIL (name, pos)) (f src)) |
73 | SOME f => f src) |
74 end; |
74 end; |
75 |
75 |
76 fun option (name, s) f () = |
76 fun option (name, s) f () = |
77 (case Symtab.lookup (! global_options) name of |
77 (case Symtab.lookup (! global_options) name of |
78 NONE => error ("Unknown text antiquotation option: " ^ quote name) |
78 NONE => error ("Unknown text antiquotation option: " ^ quote name) |