src/Tools/Code/code_target.ML
changeset 38913 d1d4d808be26
parent 38912 c79c1e4e1111
child 38914 0a49a34e5d37
equal deleted inserted replaced
38912:c79c1e4e1111 38913:d1d4d808be26
    20   val assert_target: theory -> string -> string
    20   val assert_target: theory -> string -> string
    21 
    21 
    22   type destination
    22   type destination
    23   type serialization
    23   type serialization
    24   val parse_args: 'a parser -> Token.T list -> 'a
    24   val parse_args: 'a parser -> Token.T list -> 'a
    25   val stmt_names_of_destination: destination -> string list
       
    26   val mk_serialization: (int -> Path.T option -> 'a -> unit)
    25   val mk_serialization: (int -> Path.T option -> 'a -> unit)
    27     -> (int -> 'a -> string * string option list)
    26     -> (int -> 'a -> string * string option list)
    28     -> 'a -> int -> serialization
    27     -> 'a -> int -> serialization
    29   val serialize: theory -> string -> int option -> string option -> Token.T list
    28   val serialize: theory -> string -> int option -> string option -> Token.T list
    30     -> Code_Thingol.naming -> Code_Thingol.program -> string list -> serialization
    29     -> Code_Thingol.naming -> Code_Thingol.program -> string list -> serialization
    65 
    64 
    66 datatype destination = File of Path.T option | String of string list;
    65 datatype destination = File of Path.T option | String of string list;
    67 type serialization = destination -> (string * string option list) option;
    66 type serialization = destination -> (string * string option list) option;
    68 
    67 
    69 fun export f = (f (File NONE); ());
    68 fun export f = (f (File NONE); ());
    70 fun file p f = (f (File (SOME p)); ());
    69 fun file path f = (f (File (SOME path)); ());
    71 fun string stmts f = fst (the (f (String stmts)));
    70 fun string stmt_names f = fst (the (f (String stmt_names)));
    72 
    71 
    73 fun stmt_names_of_destination (String stmts) = stmts
    72 fun stmt_names_of_destination (String stmt_names) = stmt_names
    74   | stmt_names_of_destination _ = [];
    73   | stmt_names_of_destination _ = [];
    75 
    74 
    76 fun mk_serialization output _ code width (File p) = (output width p code; NONE)
    75 fun mk_serialization output _ pretty width (File path) = (output width path pretty; NONE)
    77   | mk_serialization _ string code width (String _) = SOME (string width code);
    76   | mk_serialization _ string pretty width (String _) = SOME (string width pretty);
    78 
    77 
    79 
    78 
    80 (** theory data **)
    79 (** theory data **)
    81 
    80 
    82 datatype name_syntax_table = NameSyntaxTable of {
    81 datatype name_syntax_table = NameSyntaxTable of {