diff options
author | Simon Van Casteren <simonvancasteren@localhost.localdomain> | 2019-12-10 21:12:59 +0100 |
---|---|---|
committer | Simon Van Casteren <simonvancasteren@localhost.localdomain> | 2019-12-13 11:46:57 +0100 |
commit | 3515286a783fb1eb38acc001d23389dd67fdc910 (patch) | |
tree | 4c6d62f98fce83b8ef06eccb7a54da94f25ac57e /src/errormsg.sml | |
parent | 053783525d8365b8a498ac38942d44f4669d6a54 (diff) |
First publishDiagnostics implementation
Diffstat (limited to 'src/errormsg.sml')
-rw-r--r-- | src/errormsg.sml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/errormsg.sml b/src/errormsg.sml index eee20768..d40789ed 100644 --- a/src/errormsg.sml +++ b/src/errormsg.sml @@ -88,6 +88,9 @@ fun spanOf (pos1, pos2) = {file = !file, val errors = ref false +val errorLog = ref ([]: { span: span + , message: string } list) +fun readErrorLog () = !errorLog val structuresCurrentlyElaborating: ((string * bool) list) ref = ref nil fun startElabStructure s = @@ -106,7 +109,7 @@ fun stopElabStructureAndGetErrored s = fun resetStructureTracker () = structuresCurrentlyElaborating := [] -fun resetErrors () = errors := false +fun resetErrors () = (errors := false; errorLog := []) fun anyErrors () = !errors fun error s = (TextIO.output (TextIO.stdErr, s); TextIO.output1 (TextIO.stdErr, #"\n"); @@ -120,6 +123,9 @@ fun errorAt (span : span) s = (TextIO.output (TextIO.stdErr, #file span); TextIO.output (TextIO.stdErr, ": (to "); TextIO.output (TextIO.stdErr, posToString (#last span)); TextIO.output (TextIO.stdErr, ") "); + errorLog := ({ span = span + , message = s + } :: !errorLog); error s) fun errorAt' span s = errorAt (spanOf span) s |