src/Pure/Syntax/syntax_trans.ML
changeset 44380 1b1afb1380ee
parent 44241 7943b69f0188
child 44381 c38bb61deeaa
equal deleted inserted replaced
44379:1079ab6b342b 44380:1b1afb1380ee
   253   else error ("Illegal reference to implicit structure #" ^ string_of_int i);
   253   else error ("Illegal reference to implicit structure #" ^ string_of_int i);
   254 
   254 
   255 fun struct_tr structs [Const ("_indexdefault", _)] =
   255 fun struct_tr structs [Const ("_indexdefault", _)] =
   256       Syntax.free (the_struct structs 1)
   256       Syntax.free (the_struct structs 1)
   257   | struct_tr structs [t as (Const ("_indexnum", _) $ Const (s, _))] =
   257   | struct_tr structs [t as (Const ("_indexnum", _) $ Const (s, _))] =
   258       Syntax.free (the_struct structs
   258       (case Lexicon.read_nat s of
   259         (case Lexicon.read_nat s of SOME n => n | NONE => raise TERM ("struct_tr", [t])))
   259         SOME n =>
       
   260           let
       
   261             val x = the_struct structs n;
       
   262             val advice =
       
   263               if n = 1 then " -- may be omitted"
       
   264               else " -- use " ^ quote ("\\<^bsub>" ^ x ^ "\\<^esub>") ^ " instead";
       
   265             val _ =
       
   266               legacy_feature
       
   267                 ("Old-style numbered structure index " ^ quote ("\\<^sub>" ^ s) ^ advice);
       
   268           in Syntax.free x end
       
   269       | NONE => raise TERM ("struct_tr", [t]))
   260   | struct_tr _ ts = raise TERM ("struct_tr", ts);
   270   | struct_tr _ ts = raise TERM ("struct_tr", ts);
   261 
   271 
   262 
   272 
   263 
   273 
   264 (** print (ast) translations **)
   274 (** print (ast) translations **)