equal
deleted
inserted
replaced
62 |
62 |
63 fun markup_bound def ps (name, id) = |
63 fun markup_bound def ps (name, id) = |
64 Markup.bound :: map (fn pos => Position.make_entity_markup def id Markup.boundN (name, pos)) ps; |
64 Markup.bound :: map (fn pos => Position.make_entity_markup def id Markup.boundN (name, pos)) ps; |
65 |
65 |
66 fun markup_entity ctxt c = |
66 fun markup_entity ctxt c = |
67 (case Syntax.lookup_const (Proof_Context.syn_of ctxt) c of |
67 (case Syntax.lookup_const (Proof_Context.syntax_of ctxt) c of |
68 SOME "" => [] |
68 SOME "" => [] |
69 | SOME b => markup_entity ctxt b |
69 | SOME b => markup_entity ctxt b |
70 | NONE => c |> Lexicon.unmark |
70 | NONE => c |> Lexicon.unmark |
71 {case_class = markup_class ctxt, |
71 {case_class = markup_class ctxt, |
72 case_type = markup_type ctxt, |
72 case_type = markup_type ctxt, |
336 |
336 |
337 (* parse raw asts *) |
337 (* parse raw asts *) |
338 |
338 |
339 fun parse_asts ctxt raw root (syms, pos) = |
339 fun parse_asts ctxt raw root (syms, pos) = |
340 let |
340 let |
341 val syn = Proof_Context.syn_of ctxt; |
341 val syn = Proof_Context.syntax_of ctxt; |
342 val ast_tr = Syntax.parse_ast_translation syn; |
342 val ast_tr = Syntax.parse_ast_translation syn; |
343 |
343 |
344 val toks = Syntax.tokenize syn raw syms; |
344 val toks = Syntax.tokenize syn raw syms; |
345 val _ = Context_Position.reports ctxt (maps Lexicon.reports_of_token toks); |
345 val _ = Context_Position.reports ctxt (maps Lexicon.reports_of_token toks); |
346 |
346 |
362 |
362 |
363 in (ambig_msgs, map (parsetree_to_ast ctxt ast_tr) pts) end; |
363 in (ambig_msgs, map (parsetree_to_ast ctxt ast_tr) pts) end; |
364 |
364 |
365 fun parse_tree ctxt root input = |
365 fun parse_tree ctxt root input = |
366 let |
366 let |
367 val syn = Proof_Context.syn_of ctxt; |
367 val syn = Proof_Context.syntax_of ctxt; |
368 val tr = Syntax.parse_translation syn; |
368 val tr = Syntax.parse_translation syn; |
369 val parse_rules = Syntax.parse_rules syn; |
369 val parse_rules = Syntax.parse_rules syn; |
370 val (ambig_msgs, asts) = parse_asts ctxt false root input; |
370 val (ambig_msgs, asts) = parse_asts ctxt false root input; |
371 val results = |
371 val results = |
372 (map o apsnd o Exn.maps_res) |
372 (map o apsnd o Exn.maps_res) |
456 |
456 |
457 (* parse_ast_pattern *) |
457 (* parse_ast_pattern *) |
458 |
458 |
459 fun parse_ast_pattern ctxt (root, str) = |
459 fun parse_ast_pattern ctxt (root, str) = |
460 let |
460 let |
461 val syn = Proof_Context.syn_of ctxt; |
461 val syn = Proof_Context.syntax_of ctxt; |
462 |
462 |
463 val reports = Unsynchronized.ref ([]: Position.report_text list); |
463 val reports = Unsynchronized.ref ([]: Position.report_text list); |
464 fun report ps = Position.store_reports reports ps; |
464 fun report ps = Position.store_reports reports ps; |
465 |
465 |
466 fun decode_const ps c = (report ps (markup_entity ctxt) c; Ast.Constant c); |
466 fun decode_const ps c = (report ps (markup_entity ctxt) c; Ast.Constant c); |
729 let |
729 let |
730 val show_markup = Config.get ctxt show_markup; |
730 val show_markup = Config.get ctxt show_markup; |
731 val show_sorts = Config.get ctxt show_sorts; |
731 val show_sorts = Config.get ctxt show_sorts; |
732 val show_types = Config.get ctxt show_types orelse show_sorts; |
732 val show_types = Config.get ctxt show_types orelse show_sorts; |
733 |
733 |
734 val syn = Proof_Context.syn_of ctxt; |
734 val syn = Proof_Context.syntax_of ctxt; |
735 val prtabs = Syntax.prtabs syn; |
735 val prtabs = Syntax.prtabs syn; |
736 val trf = Syntax.print_ast_translation syn; |
736 val trf = Syntax.print_ast_translation syn; |
737 |
737 |
738 fun markup_extern c = |
738 fun markup_extern c = |
739 (case Syntax.lookup_const syn c of |
739 (case Syntax.lookup_const syn c of |
799 val unparse_typ = unparse_t typ_to_ast Printer.pretty_typ_ast (Markup.language_type false); |
799 val unparse_typ = unparse_t typ_to_ast Printer.pretty_typ_ast (Markup.language_type false); |
800 |
800 |
801 fun unparse_term ctxt = |
801 fun unparse_term ctxt = |
802 let |
802 let |
803 val thy = Proof_Context.theory_of ctxt; |
803 val thy = Proof_Context.theory_of ctxt; |
804 val syn = Proof_Context.syn_of ctxt; |
804 val syn = Proof_Context.syntax_of ctxt; |
805 in |
805 in |
806 unparse_t (term_to_ast (is_some o Syntax.lookup_const syn)) |
806 unparse_t (term_to_ast (is_some o Syntax.lookup_const syn)) |
807 (Printer.pretty_term_ast (not (Pure_Thy.old_appl_syntax thy))) |
807 (Printer.pretty_term_ast (not (Pure_Thy.old_appl_syntax thy))) |
808 (Markup.language_term false) ctxt |
808 (Markup.language_term false) ctxt |
809 end; |
809 end; |