47 (case ! in_buffer of |
47 (case ! in_buffer of |
48 [] => NONE |
48 [] => NONE |
49 | c :: cs => |
49 | c :: cs => |
50 (in_buffer := cs; if c = #"\n" then current_line := ! current_line + 1 else (); SOME c)); |
50 (in_buffer := cs; if c = #"\n" then current_line := ! current_line + 1 else (); SOME c)); |
51 fun put s = out_buffer := s :: ! out_buffer; |
51 fun put s = out_buffer := s :: ! out_buffer; |
52 fun put_message (prt, is_err, {file, line, offset}) = |
52 fun put_message {message, hard, location = {startLine = line, ...}, context} = |
53 (put (if is_err then "Error: " else "Warning: "); |
53 (put (if hard then "Error: " else "Warning: "); |
54 PolyML.prettyPrint (put, 76) prt; |
54 PolyML.prettyPrint (put, 76) message; |
55 put (str_of_pos line name ^ "\n")); |
55 put (str_of_pos line name ^ "\n")); |
56 |
56 |
57 val parameters = |
57 val parameters = |
58 [PolyML.Compiler.CPOutStream put, |
58 [PolyML.Compiler.CPOutStream put, |
59 PolyML.Compiler.CPLineNo (fn () => ! current_line), |
59 PolyML.Compiler.CPLineNo (fn () => ! current_line), |
60 PolyML.Compiler.CPErrorMessageProc put_message, |
60 PolyML.Compiler.CPErrorMessageProc put_message, |
61 PolyML.Compiler.CPNameSpace name_space]; |
61 PolyML.Compiler.CPNameSpace name_space, |
|
62 PolyML.Compiler.CPPrintInAlphabeticalOrder false]; |
62 val _ = |
63 val _ = |
63 (while not (List.null (! in_buffer)) do |
64 (while not (List.null (! in_buffer)) do |
64 PolyML.compiler (get, parameters) ()) |
65 PolyML.compiler (get, parameters) ()) |
65 handle exn => |
66 handle exn => |
66 (put ("Exception- " ^ General.exnMessage exn ^ " raised"); |
67 (put ("Exception- " ^ General.exnMessage exn ^ " raised"); |