96 (syntax as (Syntax {mode, mixfixes, idents = (structs, _), ...})) = |
96 (syntax as (Syntax {mode, mixfixes, idents = (structs, _), ...})) = |
97 (case filter_out (fn (_, (_, _, mx)) => mx = NoSyn) raw_decls of |
97 (case filter_out (fn (_, (_, _, mx)) => mx = NoSyn) raw_decls of |
98 [] => syntax |
98 [] => syntax |
99 | decls => |
99 | decls => |
100 let |
100 let |
101 val mixfixes' = rev (map_filter (prep_mixfix (add, mode)) decls) @ mixfixes; |
101 val new_mixfixes = map_filter (prep_mixfix (add, mode)) decls; |
102 val structs' = structs @ map_filter prep_struct decls; |
102 val new_structs = map_filter prep_struct decls; |
|
103 val mixfixes' = rev new_mixfixes @ mixfixes; |
|
104 val structs' = |
|
105 if add then structs @ new_structs |
|
106 else subtract (op =) new_structs structs; |
103 val fixes' = fold (fn ((x, true), _) => cons x | _ => I) mixfixes' []; |
107 val fixes' = fold (fn ((x, true), _) => cons x | _ => I) mixfixes' []; |
104 in build_syntax thy mode mixfixes' (structs', fixes') end); |
108 in build_syntax thy mode mixfixes' (structs', fixes') end); |
105 |
109 |
106 val add_syntax = update_syntax true; |
110 val add_syntax = update_syntax true; |
107 |
111 |