equal
deleted
inserted
replaced
189 "_Binary" :: "num_const \<Rightarrow> 'a" ("$_") |
189 "_Binary" :: "num_const \<Rightarrow> 'a" ("$_") |
190 |
190 |
191 parse_translation {* |
191 parse_translation {* |
192 let |
192 let |
193 val syntax_consts = |
193 val syntax_consts = |
194 map_aterms (fn Const (c, T) => Const (Syntax.mark_const c, T) | a => a); |
194 map_aterms (fn Const (c, T) => Const (Lexicon.mark_const c, T) | a => a); |
195 |
195 |
196 fun binary_tr [Const (num, _)] = |
196 fun binary_tr [Const (num, _)] = |
197 let |
197 let |
198 val {leading_zeros = z, value = n, ...} = Syntax.read_xnum num; |
198 val {leading_zeros = z, value = n, ...} = Lexicon.read_xnum num; |
199 val _ = z = 0 andalso n >= 0 orelse error ("Bad binary number: " ^ num); |
199 val _ = z = 0 andalso n >= 0 orelse error ("Bad binary number: " ^ num); |
200 in syntax_consts (mk_binary n) end |
200 in syntax_consts (mk_binary n) end |
201 | binary_tr ts = raise TERM ("binary_tr", ts); |
201 | binary_tr ts = raise TERM ("binary_tr", ts); |
202 |
202 |
203 in [(@{syntax_const "_Binary"}, binary_tr)] end |
203 in [(@{syntax_const "_Binary"}, binary_tr)] end |