184 |
184 |
185 fun asts_of_position c tok = |
185 fun asts_of_position c tok = |
186 [Ast.Appl [Ast.Constant c, ast_of (Parser.Tip tok), ast_of_position tok]] |
186 [Ast.Appl [Ast.Constant c, ast_of (Parser.Tip tok), ast_of_position tok]] |
187 |
187 |
188 and asts_of (Parser.Markup (markup, pts)) = maps asts_of pts |
188 and asts_of (Parser.Markup (markup, pts)) = maps asts_of pts |
189 | asts_of (Parser.Node ("_class_name", [Parser.Tip tok])) = |
189 | asts_of (Parser.Node ({const = "", ...}, pts)) = maps asts_of pts |
|
190 | asts_of (Parser.Node ({const = "_class_name", ...}, [Parser.Tip tok])) = |
190 let |
191 let |
191 val pos = report_pos tok; |
192 val pos = report_pos tok; |
192 val (c, rs) = Proof_Context.check_class ctxt (Lexicon.str_of_token tok, pos); |
193 val (c, rs) = Proof_Context.check_class ctxt (Lexicon.str_of_token tok, pos); |
193 val _ = append_reports rs; |
194 val _ = append_reports rs; |
194 in [Ast.Constant (Lexicon.mark_class c)] end |
195 in [Ast.Constant (Lexicon.mark_class c)] end |
195 | asts_of (Parser.Node ("_type_name", [Parser.Tip tok])) = |
196 | asts_of (Parser.Node ({const = "_type_name", ...}, [Parser.Tip tok])) = |
196 let |
197 let |
197 val pos = report_pos tok; |
198 val pos = report_pos tok; |
198 val (c, rs) = |
199 val (c, rs) = |
199 Proof_Context.check_type_name {proper = true, strict = false} ctxt |
200 Proof_Context.check_type_name {proper = true, strict = false} ctxt |
200 (Lexicon.str_of_token tok, pos) |
201 (Lexicon.str_of_token tok, pos) |
201 |>> dest_Type_name; |
202 |>> dest_Type_name; |
202 val _ = append_reports rs; |
203 val _ = append_reports rs; |
203 in [Ast.Constant (Lexicon.mark_type c)] end |
204 in [Ast.Constant (Lexicon.mark_type c)] end |
204 | asts_of (Parser.Node ("_position", [Parser.Tip tok])) = asts_of_position "_constrain" tok |
205 | asts_of (Parser.Node ({const = "_position", ...}, [Parser.Tip tok])) = |
205 | asts_of (Parser.Node ("_position_sort", [Parser.Tip tok])) = asts_of_position "_ofsort" tok |
206 asts_of_position "_constrain" tok |
206 | asts_of (Parser.Node (a as "\<^const>Pure.dummy_pattern", [Parser.Tip tok])) = |
207 | asts_of (Parser.Node ({const = "_position_sort", ...}, [Parser.Tip tok])) = |
|
208 asts_of_position "_ofsort" tok |
|
209 | asts_of (Parser.Node ({const = a as "\<^const>Pure.dummy_pattern", ...}, [Parser.Tip tok])) = |
207 [ast_of_dummy a tok] |
210 [ast_of_dummy a tok] |
208 | asts_of (Parser.Node (a as "_idtdummy", [Parser.Tip tok])) = |
211 | asts_of (Parser.Node ({const = a as "_idtdummy", ...}, [Parser.Tip tok])) = |
209 [ast_of_dummy a tok] |
212 [ast_of_dummy a tok] |
210 | asts_of (Parser.Node ("_idtypdummy", pts as [Parser.Tip tok, _, _])) = |
213 | asts_of (Parser.Node ({const = "_idtypdummy", ...}, pts as [Parser.Tip tok, _, _])) = |
211 [Ast.Appl (Ast.Constant "_constrain" :: ast_of_dummy "_idtdummy" tok :: maps asts_of pts)] |
214 [Ast.Appl (Ast.Constant "_constrain" :: ast_of_dummy "_idtdummy" tok :: maps asts_of pts)] |
212 | asts_of (Parser.Node (a, pts)) = |
215 | asts_of (Parser.Node ({const = a, ...}, pts)) = |
213 let val _ = List.app (report_token a) pts; |
216 let val _ = List.app (report_token a) pts; |
214 in [trans a (maps asts_of pts)] end |
217 in [trans a (maps asts_of pts)] end |
215 | asts_of (Parser.Tip tok) = asts_of_token tok |
218 | asts_of (Parser.Tip tok) = asts_of_token tok |
216 |
219 |
217 and ast_of pt = |
220 and ast_of pt = |