equal
deleted
inserted
replaced
375 (* classes *) |
375 (* classes *) |
376 |
376 |
377 fun read_class ctxt text = |
377 fun read_class ctxt text = |
378 let |
378 let |
379 val tsig = tsig_of ctxt; |
379 val tsig = tsig_of ctxt; |
380 val {text, pos, ...} = Syntax.read_token_source text; |
380 val (s, pos) = Symbol_Pos.source_content (Syntax.read_token text); |
381 val syms = Symbol_Pos.explode (text, pos); |
381 val c = Type.cert_class tsig (Type.intern_class tsig s) |
382 val c = Type.cert_class tsig (Type.intern_class tsig (Symbol_Pos.content syms)) |
|
383 handle TYPE (msg, _, _) => error (msg ^ Position.here pos); |
382 handle TYPE (msg, _, _) => error (msg ^ Position.here pos); |
384 val _ = Context_Position.report ctxt pos (Name_Space.markup (Type.class_space tsig) c); |
383 val _ = Context_Position.report ctxt pos (Name_Space.markup (Type.class_space tsig) c); |
385 in c end; |
384 in c end; |
386 |
385 |
387 |
386 |
458 in |
457 in |
459 |
458 |
460 fun read_type_name ctxt strict text = |
459 fun read_type_name ctxt strict text = |
461 let |
460 let |
462 val tsig = tsig_of ctxt; |
461 val tsig = tsig_of ctxt; |
463 val (c, pos) = Syntax.read_token_content text; |
462 val (c, pos) = Symbol_Pos.source_content (Syntax.read_token text); |
464 in |
463 in |
465 if Lexicon.is_tid c then |
464 if Lexicon.is_tid c then |
466 (Context_Position.report ctxt pos Markup.tfree; |
465 (Context_Position.report ctxt pos Markup.tfree; |
467 TFree (c, default_sort ctxt (c, ~1))) |
466 TFree (c, default_sort ctxt (c, ~1))) |
468 else |
467 else |
484 T as Type _ => T |
483 T as Type _ => T |
485 | T => error ("Not a type constructor: " ^ Syntax.string_of_typ ctxt T)); |
484 | T => error ("Not a type constructor: " ^ Syntax.string_of_typ ctxt T)); |
486 |
485 |
487 |
486 |
488 fun read_const_proper ctxt strict = |
487 fun read_const_proper ctxt strict = |
489 prep_const_proper ctxt strict o Syntax.read_token_content; |
488 prep_const_proper ctxt strict o Symbol_Pos.source_content o Syntax.read_token; |
490 |
489 |
491 fun read_const ctxt strict ty text = |
490 fun read_const ctxt strict ty text = |
492 let |
491 let |
493 val (c, pos) = Syntax.read_token_content text; |
492 val (c, pos) = Symbol_Pos.source_content (Syntax.read_token text); |
494 val _ = no_skolem false c; |
493 val _ = no_skolem false c; |
495 in |
494 in |
496 (case (Variable.lookup_fixed ctxt c, Variable.is_const ctxt c) of |
495 (case (Variable.lookup_fixed ctxt c, Variable.is_const ctxt c) of |
497 (SOME x, false) => |
496 (SOME x, false) => |
498 (Context_Position.report ctxt pos |
497 (Context_Position.report ctxt pos |