[commit: ghc] master: Clean up Lexer.srcParseErr (1c69305)
git at git.haskell.org
git at git.haskell.org
Thu Dec 5 08:31:32 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1c69305e47bd01d9be42716a3d308681bfb1b0b4/ghc
>---------------------------------------------------------------
commit 1c69305e47bd01d9be42716a3d308681bfb1b0b4
Author: Patrick Palka <patrick at parcs.ath.cx>
Date: Fri Nov 29 19:06:29 2013 -0500
Clean up Lexer.srcParseErr
The lexer now uses unicode single quotation marks in its error messages
if possible. This is due to the use of the 'quotes' combinator.
>---------------------------------------------------------------
1c69305e47bd01d9be42716a3d308681bfb1b0b4
compiler/parser/Lexer.x | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 49f6dcd..490ca5f 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -2088,11 +2088,9 @@ srcParseErr
-> Int -- length of the previous token
-> MsgDoc
srcParseErr buf len
- = hcat [ if null token
- then ptext (sLit "parse error (possibly incorrect indentation or mismatched brackets)")
- else hcat [ptext (sLit "parse error on input "),
- char '`', text token, char '\'']
- ]
+ = if null token
+ then ptext (sLit "parse error (possibly incorrect indentation or mismatched brackets)")
+ else ptext (sLit "parse error on input") <+> quotes (text token)
where token = lexemeToString (offsetBytes (-len) buf) len
-- Report a parse failure, giving the span of the previous token as
More information about the ghc-commits
mailing list