src/Pure/General/position.ML
changeset 42204 b3277168c1e7
parent 41504 f0f20a5b54df
child 42327 7c7cc7590eb3
equal deleted inserted replaced
42203:9c9c97a5040d 42204:b3277168c1e7
    32   val markup: T -> Markup.T -> Markup.T
    32   val markup: T -> Markup.T -> Markup.T
    33   val is_reported: T -> bool
    33   val is_reported: T -> bool
    34   val reported_text: T -> Markup.T -> string -> string
    34   val reported_text: T -> Markup.T -> string -> string
    35   val report_text: T -> Markup.T -> string -> unit
    35   val report_text: T -> Markup.T -> string -> unit
    36   val report: T -> Markup.T -> unit
    36   val report: T -> Markup.T -> unit
       
    37   type reports = (T * Markup.T) list
       
    38   val reports: reports Unsynchronized.ref -> T list -> ('a -> Markup.T list) -> 'a -> unit
    37   val str_of: T -> string
    39   val str_of: T -> string
    38   type range = T * T
    40   type range = T * T
    39   val no_range: range
    41   val no_range: range
    40   val set_range: range -> T
    42   val set_range: range -> T
    41   val reset_range: T -> T
    43   val reset_range: T -> T
   152 fun is_reported pos = is_some (offset_of pos) andalso is_some (get_id pos);
   154 fun is_reported pos = is_some (offset_of pos) andalso is_some (get_id pos);
   153 
   155 
   154 fun reported_text pos m txt = if is_reported pos then Markup.markup (markup pos m) txt else "";
   156 fun reported_text pos m txt = if is_reported pos then Markup.markup (markup pos m) txt else "";
   155 fun report_text pos markup txt = Output.report (reported_text pos markup txt);
   157 fun report_text pos markup txt = Output.report (reported_text pos markup txt);
   156 fun report pos markup = report_text pos markup "";
   158 fun report pos markup = report_text pos markup "";
       
   159 
       
   160 type reports = (T * Markup.T) list;
       
   161 
       
   162 fun reports _ [] _ _ = ()
       
   163   | reports (r: reports Unsynchronized.ref) ps markup x =
       
   164       let val ms = markup x
       
   165       in Unsynchronized.change r (fold (fn p => fold (fn m => cons (p, m)) ms) ps) end;
   157 
   166 
   158 
   167 
   159 (* str_of *)
   168 (* str_of *)
   160 
   169 
   161 fun str_of pos =
   170 fun str_of pos =