old-style numbered structure index is legacy feature (hardly ever used now);
authorwenzelm
Mon, 22 Aug 2011 17:10:22 +0200
changeset 44380 1b1afb1380ee
parent 44379 1079ab6b342b
child 44381 c38bb61deeaa
old-style numbered structure index is legacy feature (hardly ever used now);
src/Pure/Syntax/syntax_trans.ML
--- a/src/Pure/Syntax/syntax_trans.ML	Mon Aug 22 16:12:23 2011 +0200
+++ b/src/Pure/Syntax/syntax_trans.ML	Mon Aug 22 17:10:22 2011 +0200
@@ -255,8 +255,18 @@
 fun struct_tr structs [Const ("_indexdefault", _)] =
       Syntax.free (the_struct structs 1)
   | struct_tr structs [t as (Const ("_indexnum", _) $ Const (s, _))] =
-      Syntax.free (the_struct structs
-        (case Lexicon.read_nat s of SOME n => n | NONE => raise TERM ("struct_tr", [t])))
+      (case Lexicon.read_nat s of
+        SOME n =>
+          let
+            val x = the_struct structs n;
+            val advice =
+              if n = 1 then " -- may be omitted"
+              else " -- use " ^ quote ("\\<^bsub>" ^ x ^ "\\<^esub>") ^ " instead";
+            val _ =
+              legacy_feature
+                ("Old-style numbered structure index " ^ quote ("\\<^sub>" ^ s) ^ advice);
+          in Syntax.free x end
+      | NONE => raise TERM ("struct_tr", [t]))
   | struct_tr _ ts = raise TERM ("struct_tr", ts);