src/Pure/Syntax/syntax.ML
changeset 26678 a3ae088dc20f
parent 25993 d542486e39e7
child 26684 0701201def95
equal deleted inserted replaced
26677:ab629324081c 26678:a3ae088dc20f
   139   val string_of_term: Proof.context -> term -> string
   139   val string_of_term: Proof.context -> term -> string
   140   val string_of_typ: Proof.context -> typ -> string
   140   val string_of_typ: Proof.context -> typ -> string
   141   val string_of_sort: Proof.context -> sort -> string
   141   val string_of_sort: Proof.context -> sort -> string
   142   val string_of_classrel: Proof.context -> class list -> string
   142   val string_of_classrel: Proof.context -> class list -> string
   143   val string_of_arity: Proof.context -> arity -> string
   143   val string_of_arity: Proof.context -> arity -> string
       
   144   val guess_infix: syntax -> string -> mixfix option
   144   val pp: Proof.context -> Pretty.pp
   145   val pp: Proof.context -> Pretty.pp
   145 end;
   146 end;
   146 
   147 
   147 structure Syntax: SYNTAX =
   148 structure Syntax: SYNTAX =
   148 struct
   149 struct
   831   fn x => pretty_typ ctxt x,
   832   fn x => pretty_typ ctxt x,
   832   fn x => pretty_sort ctxt x,
   833   fn x => pretty_sort ctxt x,
   833   fn x => pretty_classrel ctxt x,
   834   fn x => pretty_classrel ctxt x,
   834   fn x => pretty_arity ctxt x);
   835   fn x => pretty_arity ctxt x);
   835 
   836 
       
   837 (*educated guess for reconstructing infixes*)
       
   838 fun guess_infix (Syntax (syn, _)) c = case Parser.guess_infix_lr (#gram syn) c
       
   839  of SOME (s, l, r, j) => SOME (if l then Mixfix.InfixlName (s, j)
       
   840       else if r then Mixfix.InfixrName (s, j)
       
   841       else Mixfix.InfixName (s, j))
       
   842   | NONE => NONE
       
   843 
   836 (*export parts of internal Syntax structures*)
   844 (*export parts of internal Syntax structures*)
   837 open Lexicon SynExt Ast Parser TypeExt SynTrans Mixfix Printer;
   845 open Lexicon SynExt Ast Parser TypeExt SynTrans Mixfix Printer;
   838 
   846 
   839 end;
   847 end;
   840 
   848