src/Pure/General/markup.ML
changeset 23637 f3e16ee56f32
parent 23626 5e6c5388e836
child 23642 10672e025b83
equal deleted inserted replaced
23636:6f04e0d6809a 23637:f3e16ee56f32
     6 *)
     6 *)
     7 
     7 
     8 signature MARKUP =
     8 signature MARKUP =
     9 sig
     9 sig
    10   type property = string * string
    10   type property = string * string
    11   type T = string * property list
       
    12   val none: T
       
    13   val property: string * string -> T -> T
       
    14   val nameN: string
    11   val nameN: string
    15   val pos_lineN: string
    12   val pos_lineN: string
    16   val pos_nameN: string
    13   val pos_nameN: string
    17   val classN: string
    14   type T = string * property list
    18   val class: string -> T
    15   val none: T
    19   val tyconN: string
    16   val classN: string val class: string -> T
    20   val tycon: string -> T
    17   val tyconN: string val tycon: string -> T
    21   val constN: string
    18   val constN: string val const: string -> T
    22   val const: string -> T
    19   val axiomN: string val axiom: string -> T
    23   val axiomN: string
    20   val sortN: string val sort: T
    24   val axiom: string -> T
    21   val typN: string val typ: T
    25   val sortN: string
    22   val termN: string val term: T
    26   val sort: T
    23   val keywordN: string val keyword: string -> T
    27   val typN: string
    24   val commandN: string val command: string -> T
    28   val typ: T
    25   val promptN: string val prompt: T
    29   val termN: string
    26   val stateN: string val state: T
    30   val term: T
    27   val no_stateN: string val no_state: T
    31   val keywordN: string
    28   val subgoalN: string val subgoal: T
    32   val keyword: string -> T
       
    33   val commandN: string
       
    34   val command: string -> T
       
    35 end;
    29 end;
    36 
    30 
    37 structure Markup: MARKUP =
    31 structure Markup: MARKUP =
    38 struct
    32 struct
    39 
    33 
    40 type property = string * string;
       
    41 type T = string * property list;
       
    42 
       
    43 val none = ("", []);
       
    44 
       
    45 
       
    46 (* properties *)
    34 (* properties *)
    47 
    35 
    48 fun property x (name, xs) : T = (name, x :: xs);
    36 type property = string * string;
    49 
    37 
    50 val nameN = "name";
    38 val nameN = "name";
    51 val pos_lineN = "pos_line";
    39 val pos_lineN = "pos_line";
    52 val pos_nameN = "pos_name";
    40 val pos_nameN = "pos_name";
    53 
    41 
    54 
    42 
       
    43 (* markup *)
       
    44 
       
    45 type T = string * property list;
       
    46 
       
    47 val none = ("", []);
       
    48 
       
    49 fun markup kind = (kind, (kind, []));
       
    50 fun markup_name kind = (kind, fn name => (kind, [(nameN, name)]): T);
       
    51 
       
    52 
    55 (* logical entities *)
    53 (* logical entities *)
    56 
    54 
    57 val classN = "class";
    55 val (classN, class) = markup_name "class";
    58 fun class name = (classN, [(nameN, name)]);
    56 val (tyconN, tycon) = markup_name "tycon";
    59 
    57 val (constN, const) = markup_name "const";
    60 val tyconN = "tycon";
    58 val (axiomN, axiom) = markup_name "axiom";
    61 fun tycon name = (tyconN, [(nameN, name)]);
       
    62 
       
    63 val constN = "const";
       
    64 fun const name = (constN, [(nameN, name)]);
       
    65 
       
    66 val axiomN = "axiom";
       
    67 fun axiom name = (axiomN, [(nameN, name)]);
       
    68 
    59 
    69 
    60 
    70 (* inner syntax *)
    61 (* inner syntax *)
    71 
    62 
    72 val sortN = "sort";
    63 val (sortN, sort) = markup "sort";
    73 val sort = (sortN, []);
    64 val (typN, typ) = markup "typ";
    74 
    65 val (termN, term) = markup "term";
    75 val typN = "typ";
       
    76 val typ = (typN, []);
       
    77 
       
    78 val termN = "term";
       
    79 val term = (termN, []);
       
    80 
    66 
    81 
    67 
    82 (* outer syntax *)
    68 (* outer syntax *)
    83 
    69 
    84 val keywordN = "keyword";
    70 val (keywordN, keyword) = markup_name "keyword";
    85 fun keyword name = (keywordN, [(nameN, name)]);
    71 val (commandN, command) = markup_name "command";
    86 
    72 
    87 val commandN = "command";
    73 
    88 fun command name = (commandN, [(nameN, name)]);
    74 (* toplevel *)
       
    75 
       
    76 val (promptN, prompt) = markup "prompt";
       
    77 val (stateN, state) = markup "state";
       
    78 val (no_stateN, no_state) = markup "no_state";
       
    79 val (subgoalN, subgoal) = markup "subgoal";
    89 
    80 
    90 end;
    81 end;