445 fun read_type_name ctxt strict text = |
445 fun read_type_name ctxt strict text = |
446 let |
446 let |
447 val tsig = tsig_of ctxt; |
447 val tsig = tsig_of ctxt; |
448 val (c, pos) = token_content text; |
448 val (c, pos) = token_content text; |
449 in |
449 in |
450 if Syntax.is_tid c then |
450 if Lexicon.is_tid c then |
451 (Context_Position.report ctxt pos Markup.tfree; |
451 (Context_Position.report ctxt pos Markup.tfree; |
452 TFree (c, default_sort ctxt (c, ~1))) |
452 TFree (c, default_sort ctxt (c, ~1))) |
453 else |
453 else |
454 let |
454 let |
455 val d = Type.intern_type tsig c; |
455 val d = Type.intern_type tsig c; |
922 |
922 |
923 fun prep_vars prep_typ internal = |
923 fun prep_vars prep_typ internal = |
924 fold_map (fn (b, raw_T, mx) => fn ctxt => |
924 fold_map (fn (b, raw_T, mx) => fn ctxt => |
925 let |
925 let |
926 val x = Name.of_binding b; |
926 val x = Name.of_binding b; |
927 val _ = Syntax.is_identifier (no_skolem internal x) orelse |
927 val _ = Lexicon.is_identifier (no_skolem internal x) orelse |
928 error ("Illegal variable name: " ^ quote (Binding.str_of b)); |
928 error ("Illegal variable name: " ^ quote (Binding.str_of b)); |
929 |
929 |
930 fun cond_tvars T = |
930 fun cond_tvars T = |
931 if internal then T |
931 if internal then T |
932 else Type.no_tvars T handle TYPE (msg, _, _) => error msg; |
932 else Type.no_tvars T handle TYPE (msg, _, _) => error msg; |
947 local |
947 local |
948 |
948 |
949 fun const_ast_tr intern ctxt [Ast.Variable c] = |
949 fun const_ast_tr intern ctxt [Ast.Variable c] = |
950 let |
950 let |
951 val Const (c', _) = read_const_proper ctxt false c; |
951 val Const (c', _) = read_const_proper ctxt false c; |
952 val d = if intern then Syntax.mark_const c' else c; |
952 val d = if intern then Lexicon.mark_const c' else c; |
953 in Ast.Constant d end |
953 in Ast.Constant d end |
954 | const_ast_tr _ _ asts = raise Ast.AST ("const_ast_tr", asts); |
954 | const_ast_tr _ _ asts = raise Ast.AST ("const_ast_tr", asts); |
955 |
955 |
956 val typ = Simple_Syntax.read_typ; |
956 val typ = Simple_Syntax.read_typ; |
957 |
957 |
976 (* notation *) |
976 (* notation *) |
977 |
977 |
978 local |
978 local |
979 |
979 |
980 fun type_syntax (Type (c, args), mx) = |
980 fun type_syntax (Type (c, args), mx) = |
981 SOME (Local_Syntax.Type, (Syntax.mark_type c, Mixfix.make_type (length args), mx)) |
981 SOME (Local_Syntax.Type, (Lexicon.mark_type c, Mixfix.make_type (length args), mx)) |
982 | type_syntax _ = NONE; |
982 | type_syntax _ = NONE; |
983 |
983 |
984 fun const_syntax _ (Free (x, T), mx) = SOME (Local_Syntax.Fixed, (x, T, mx)) |
984 fun const_syntax _ (Free (x, T), mx) = SOME (Local_Syntax.Fixed, (x, T, mx)) |
985 | const_syntax ctxt (Const (c, _), mx) = |
985 | const_syntax ctxt (Const (c, _), mx) = |
986 (case try (Consts.type_scheme (consts_of ctxt)) c of |
986 (case try (Consts.type_scheme (consts_of ctxt)) c of |
987 SOME T => SOME (Local_Syntax.Const, (Syntax.mark_const c, T, mx)) |
987 SOME T => SOME (Local_Syntax.Const, (Lexicon.mark_const c, T, mx)) |
988 | NONE => NONE) |
988 | NONE => NONE) |
989 | const_syntax _ _ = NONE; |
989 | const_syntax _ _ = NONE; |
990 |
990 |
991 fun gen_notation syntax add mode args ctxt = |
991 fun gen_notation syntax add mode args ctxt = |
992 ctxt |> map_syntax |
992 ctxt |> map_syntax |