My Makefiles contain something like the following:
@set -o pipefail ; \ poly --use load.sml \ | tee polyml.log \ | (grep -E -e "^(Warning-|Error-|Exception-)" || true)
The primary purpose is to print any warnings in the terminal as they are produced whilst redirecting the full log to a file for reference. (I don't like this because it's necessary to use the Bash-specific option "pipefail" to prevent piping losing the exit status and this doesn't work with other shells like Dash.)
Is there a way to tell Poly/ML to print warning/error message to stderr as well as stdout? That would avoid needing to match on the
I don't have any objection to the patch however - the above is easily changed.
Phil
15/03/15 14:38, David Matthews wrote:
Peter, Thanks for that. I've applied it to SVN so unless someone objects that it has messed up their error message parsing it will be in the next release. Regards, David
On 14/03/2015 20:39, Peter Gammie wrote:
David,
On 14 Dec 2014, at 9:23, David Matthews <David.Matthews at prolingua.co.uk> wrote:
I seem to recall that the current format of error messages was designed to be parsed by emacs but probably as long ago as the 1980s. I have no objection at all to changing the format to something more appropriate. It probably needs no more than a change to the bit of code around line 443 in basis/FinalPolyML.sml that assembles a text error message from the location information. If you want to experiment and send me a patch that works for you I?m happy to look at it.
Here?s a very minor patch to generate Emacs-compatible errors and warnings. See below. It?s an SVN diff - hope that works for you.
cheers, peter
Index: basis/FinalPolyML.sml
--- basis/FinalPolyML.sml (revision 1980) +++ basis/FinalPolyML.sml (working copy) @@ -441,10 +441,14 @@ else (* Plain text form. *) ( printString(concat
( (if hard then ["Error-"] else ["Warning-"]) @
( (if file = "" then ["poly: "] else [file, ":"]) @
(if startLine = 0 then [] else [Int.toString
startLine]) @
(if startPosition = 0 then [": "] else [".",
Int.toString startPosition, "-", Int.toString endPosition, ": "]) @
(if hard then ["error: "] else ["warning: "]) ));
+(* ( (if hard then ["Error-"] else ["Warning-"]) @ (if file = "" then [] else [" in '", file, "',"]) @ (if startLine = 0 then [] else [" line ", Int.toString startLine]) @
(if startLine = 0 andalso file = "" then [] else
[".\n"])));
(if startLine = 0 andalso file = "" then [] else
[".\n"]))); *) PolyML.prettyPrint(printString, !lineLength) fullMessage ) end _______________________________________________ polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml