equal
deleted
inserted
replaced
287 $$ "'" |-- Scan.repeat (~$$ "'") --| $$ "'" >> implode |
287 $$ "'" |-- Scan.repeat (~$$ "'") --| $$ "'" >> implode |
288 || (Scan.repeat ($$ "$") -- Scan.many1 Symbol.is_letdig >> (op ^ o apply2 implode)) |
288 || (Scan.repeat ($$ "$") -- Scan.many1 Symbol.is_letdig >> (op ^ o apply2 implode)) |
289 -- Scan.optional (Scan.repeat ($$ "!") -- Scan.many1 Symbol.is_letdig >> (op ^ o apply2 implode)) "" |
289 -- Scan.optional (Scan.repeat ($$ "!") -- Scan.many1 Symbol.is_letdig >> (op ^ o apply2 implode)) "" |
290 >> op ^ |
290 >> op ^ |
291 |
291 |
292 val skip_term = |
292 fun skip_term x = |
293 let |
293 let |
294 fun skip _ accum [] = (accum, []) |
294 fun skip _ accum [] = (accum, []) |
295 | skip n accum (ss as s :: ss') = |
295 | skip n accum (ss as s :: ss') = |
296 if (s = "," orelse s = ".") andalso n = 0 then |
296 if (s = "," orelse s = ".") andalso n = 0 then |
297 (accum, ss) |
297 (accum, ss) |
300 else if member (op =) ["(", "["] s then |
300 else if member (op =) ["(", "["] s then |
301 skip (n + 1) (s :: accum) ss' |
301 skip (n + 1) (s :: accum) ss' |
302 else |
302 else |
303 skip n (s :: accum) ss' |
303 skip n (s :: accum) ss' |
304 in |
304 in |
305 skip 0 [] #>> (rev #> implode) |
305 (skip 0 [] #>> (rev #> implode)) x |
306 end |
306 end |
|
307 and skip_terms x = (skip_term ::: Scan.repeat ($$ "," |-- skip_term)) x |
307 |
308 |
308 datatype source = |
309 datatype source = |
309 File_Source of string * string option | |
310 File_Source of string * string option | |
310 Inference_Source of string * string list | |
311 Inference_Source of string * string list | |
311 Introduced_Source of string |
312 Introduced_Source of string |
344 fun parse_class x = scan_general_id x |
345 fun parse_class x = scan_general_id x |
345 and parse_classes x = (parse_class ::: Scan.repeat ($$ "&" |-- parse_class)) x |
346 and parse_classes x = (parse_class ::: Scan.repeat ($$ "&" |-- parse_class)) x |
346 |
347 |
347 fun parse_type x = |
348 fun parse_type x = |
348 (($$ "(" |-- parse_type --| $$ ")" |
349 (($$ "(" |-- parse_type --| $$ ")" |
349 || Scan.this_string tptp_pi_binder |-- $$ "[" |-- skip_term --| $$ "]" --| $$ ":" -- parse_type |
350 || Scan.this_string tptp_pi_binder |-- $$ "[" |-- skip_terms --| $$ "]" --| $$ ":" -- parse_type |
350 >> (fn (_, ty) => ty (* currently ignoring type constructor declarations anyway *)) |
351 >> (fn (_, ty) => ty (* currently ignoring type constructor declarations anyway *)) |
351 || (scan_general_id -- Scan.optional ($$ "{" |-- parse_classes --| $$ "}") []) |
352 || (scan_general_id -- Scan.optional ($$ "{" |-- parse_classes --| $$ "}") []) |
352 -- Scan.optional ($$ "(" |-- parse_types --| $$ ")") [] |
353 -- Scan.optional ($$ "(" |-- parse_types --| $$ ")") [] |
353 >> AType) |
354 >> AType) |
354 -- Scan.option (($$ tptp_app || $$ tptp_fun_type || $$ tptp_product_type) -- parse_type) |
355 -- Scan.option (($$ tptp_app || $$ tptp_fun_type || $$ tptp_product_type) -- parse_type) |