src/Pure/ML/ml_compiler_polyml.ML
changeset 51639 b7f908c99546
parent 50914 fe4714886d92
child 53709 84522727f9d3
equal deleted inserted replaced
51638:1275716f395b 51639:b7f908c99546
    15     val props = Exn_Properties.of_location loc;
    15     val props = Exn_Properties.of_location loc;
    16   in
    16   in
    17     Position.make {line = line, offset = offset, end_offset = end_offset, props = props}
    17     Position.make {line = line, offset = offset, end_offset = end_offset, props = props}
    18   end;
    18   end;
    19 
    19 
       
    20 
       
    21 (* exn_info *)
       
    22 
    20 fun exn_position exn =
    23 fun exn_position exn =
    21   (case PolyML.exceptionLocation exn of
    24   (case PolyML.exceptionLocation exn of
    22     NONE => Position.none
    25     NONE => Position.none
    23   | SOME loc => position_of loc);
    26   | SOME loc => position_of loc);
    24 
    27 
    25 val exn_messages_ids = Runtime.exn_messages_ids exn_position;
    28 fun pretty_exn (exn: exn) =
    26 val exn_messages = Runtime.exn_messages exn_position;
    29   Pretty.from_ML (pretty_ml (PolyML.prettyRepresentation (exn, get_print_depth ())));
    27 val exn_message = Runtime.exn_message exn_position;
    30 
       
    31 val exn_info = {exn_position = exn_position, pretty_exn = pretty_exn};
       
    32 
       
    33 
       
    34 (* exn_message *)
       
    35 
       
    36 val exn_messages_ids = Runtime.exn_messages_ids exn_info;
       
    37 val exn_messages = Runtime.exn_messages exn_info;
       
    38 val exn_message = Runtime.exn_message exn_info;
    28 
    39 
    29 
    40 
    30 (* parse trees *)
    41 (* parse trees *)
    31 
    42 
    32 fun report_parse_tree depth space =
    43 fun report_parse_tree depth space =
   178           let
   189           let
   179             val exn_msg =
   190             val exn_msg =
   180               (case exn of
   191               (case exn of
   181                 STATIC_ERRORS () => ""
   192                 STATIC_ERRORS () => ""
   182               | Runtime.TOPLEVEL_ERROR => ""
   193               | Runtime.TOPLEVEL_ERROR => ""
   183               | _ => "Exception- " ^ General.exnMessage exn ^ " raised");
   194               | _ => "Exception- " ^ Pretty.string_of (pretty_exn exn) ^ " raised");
   184             val _ = output_warnings ();
   195             val _ = output_warnings ();
   185             val _ = output_writeln ();
   196             val _ = output_writeln ();
   186           in raise_error exn_msg end;
   197           in raise_error exn_msg end;
   187   in
   198   in
   188     if verbose then (output_warnings (); flush_error (); output_writeln ())
   199     if verbose then (output_warnings (); flush_error (); output_writeln ())