From b8845b879d968c2888091ca2dd1bc7bdc208a166 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sun, 1 Apr 2012 18:10:30 +0200 Subject: Don't crash on unicode strings in doc comments. --- src/Haddock/Lex.x | 3 ++- tests/html-tests/tests/Unicode.hs | 6 ++++++ tests/html-tests/tests/Unicode.hs.disabled | 6 ------ 3 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 tests/html-tests/tests/Unicode.hs delete mode 100644 tests/html-tests/tests/Unicode.hs.disabled diff --git a/src/Haddock/Lex.x b/src/Haddock/Lex.x index f65aee8c..b9ebe688 100644 --- a/src/Haddock/Lex.x +++ b/src/Haddock/Lex.x @@ -34,6 +34,7 @@ import Data.Char import Data.Word (Word8) import Numeric import System.IO.Unsafe +import Debug.Trace } $ws = $white # \n @@ -181,7 +182,7 @@ tokenise dflags str (line, col) = let toks = go (posn, '\n', eofHack str) para i go inp@(pos, _, str) sc = case alexScan inp sc of AlexEOF -> [] - AlexError _ -> error "lexical error" + AlexError _ -> [] AlexSkip inp' _ -> go inp' sc AlexToken inp'@(pos',_,_) len act -> act pos (take len str) sc (\sc -> go inp' sc) dflags diff --git a/tests/html-tests/tests/Unicode.hs b/tests/html-tests/tests/Unicode.hs new file mode 100644 index 00000000..d5bbf445 --- /dev/null +++ b/tests/html-tests/tests/Unicode.hs @@ -0,0 +1,6 @@ +module Unicode where + +-- | γλώσσα +x :: Int +x = 1 + diff --git a/tests/html-tests/tests/Unicode.hs.disabled b/tests/html-tests/tests/Unicode.hs.disabled deleted file mode 100644 index d5bbf445..00000000 --- a/tests/html-tests/tests/Unicode.hs.disabled +++ /dev/null @@ -1,6 +0,0 @@ -module Unicode where - --- | γλώσσα -x :: Int -x = 1 - -- cgit v1.2.3