13 let |
13 let |
14 val {file = text, startLine = line, startPosition = offset, |
14 val {file = text, startLine = line, startPosition = offset, |
15 endLine = _, endPosition = end_offset} = loc; |
15 endLine = _, endPosition = end_offset} = loc; |
16 val props = |
16 val props = |
17 (case YXML.parse text of |
17 (case YXML.parse text of |
18 XML.Elem ((e, atts), _) => if e = Isabelle_Markup.positionN then atts else [] |
18 XML.Elem ((e, atts), _) => if e = Markup.positionN then atts else [] |
19 | XML.Text s => Position.file_name s); |
19 | XML.Text s => Position.file_name s); |
20 in |
20 in |
21 Position.make {line = line, offset = offset, end_offset = end_offset, props = props} |
21 Position.make {line = line, offset = offset, end_offset = end_offset, props = props} |
22 end; |
22 end; |
23 |
23 |
39 SOME (Context.Proof ctxt) => Context_Position.reported_text ctxt |
39 SOME (Context.Proof ctxt) => Context_Position.reported_text ctxt |
40 | _ => Position.reported_text); |
40 | _ => Position.reported_text); |
41 |
41 |
42 fun reported_entity kind loc decl = |
42 fun reported_entity kind loc decl = |
43 reported_text (position_of loc) |
43 reported_text (position_of loc) |
44 (Isabelle_Markup.entityN, |
44 (Markup.entityN, (Markup.kindN, kind) :: Position.def_properties_of (position_of decl)) ""; |
45 (Markup.kindN, kind) :: Position.def_properties_of (position_of decl)) ""; |
|
46 |
45 |
47 fun reported loc (PolyML.PTtype types) = |
46 fun reported loc (PolyML.PTtype types) = |
48 cons |
47 cons |
49 (PolyML.NameSpace.displayTypeExpression (types, depth, space) |
48 (PolyML.NameSpace.displayTypeExpression (types, depth, space) |
50 |> pretty_ml |> Pretty.from_ML |> Pretty.string_of |
49 |> pretty_ml |> Pretty.from_ML |> Pretty.string_of |
51 |> reported_text (position_of loc) Isabelle_Markup.ML_typing) |
50 |> reported_text (position_of loc) Markup.ML_typing) |
52 | reported loc (PolyML.PTdeclaredAt decl) = |
51 | reported loc (PolyML.PTdeclaredAt decl) = |
53 cons (reported_entity Isabelle_Markup.ML_defN loc decl) |
52 cons (reported_entity Markup.ML_defN loc decl) |
54 | reported loc (PolyML.PTopenedAt decl) = |
53 | reported loc (PolyML.PTopenedAt decl) = |
55 cons (reported_entity Isabelle_Markup.ML_openN loc decl) |
54 cons (reported_entity Markup.ML_openN loc decl) |
56 | reported loc (PolyML.PTstructureAt decl) = |
55 | reported loc (PolyML.PTstructureAt decl) = |
57 cons (reported_entity Isabelle_Markup.ML_structN loc decl) |
56 cons (reported_entity Markup.ML_structN loc decl) |
58 | reported _ (PolyML.PTnextSibling tree) = reported_tree (tree ()) |
57 | reported _ (PolyML.PTnextSibling tree) = reported_tree (tree ()) |
59 | reported _ (PolyML.PTfirstChild tree) = reported_tree (tree ()) |
58 | reported _ (PolyML.PTfirstChild tree) = reported_tree (tree ()) |
60 | reported _ _ = I |
59 | reported _ _ = I |
61 and reported_tree (loc, props) = fold (reported loc) props; |
60 and reported_tree (loc, props) = fold (reported loc) props; |
62 in fn tree => Output.report (implode (reported_tree tree [])) end; |
61 in fn tree => Output.report (implode (reported_tree tree [])) end; |
71 |
70 |
72 |
71 |
73 (* input *) |
72 (* input *) |
74 |
73 |
75 val location_props = |
74 val location_props = |
76 op ^ (YXML.output_markup (Isabelle_Markup.position |> Markup.properties |
75 op ^ |
77 (filter (member (op =) |
76 (YXML.output_markup (Markup.position |> Markup.properties |
78 [Isabelle_Markup.idN, Isabelle_Markup.fileN] o #1) (Position.properties_of pos)))); |
77 (filter (member (op =) [Markup.idN, Markup.fileN] o #1) (Position.properties_of pos)))); |
79 |
78 |
80 val input_buffer = |
79 val input_buffer = |
81 Unsynchronized.ref (toks |> map |
80 Unsynchronized.ref (toks |> map |
82 (`(maps (String.explode o Symbol.esc) o Symbol.explode o ML_Lex.check_content_of))); |
81 (`(maps (String.explode o Symbol.esc) o Symbol.explode o ML_Lex.check_content_of))); |
83 |
82 |