summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r--compiler/GHC/Parser/Header.hs2
-rw-r--r--compiler/GHC/Parser/Lexer.x4
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs
index fdf854ad8e..8532cae63f 100644
--- a/compiler/GHC/Parser/Header.hs
+++ b/compiler/GHC/Parser/Header.hs
@@ -214,7 +214,7 @@ lazyGetToks popts filename handle = do
-- counteracts the quadratic slowdown we otherwise get for very
-- large module names (#5981)
nextbuf <- hGetStringBufferBlock handle new_size
- if (len nextbuf == 0) then lazyLexBuf handle state True new_size else do
+ if lengthStringBuffer nextbuf == 0 then lazyLexBuf handle state True new_size else do
newbuf <- appendStringBuffers (buffer state) nextbuf
unsafeInterleaveIO $ lazyLexBuf handle state{buffer=newbuf} False new_size
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x
index 4d7b1ab157..2bf254b7c6 100644
--- a/compiler/GHC/Parser/Lexer.x
+++ b/compiler/GHC/Parser/Lexer.x
@@ -1894,7 +1894,7 @@ lex_string_tok span buf _len = do
ITprimstring _ bs -> ITprimstring (SourceText src) bs
ITstring _ s -> ITstring (SourceText src) s
_ -> panic "lex_string_tok"
- src = lexemeToString buf (cur bufEnd - cur buf)
+ src = lexemeToString buf (lengthStringBuffer buf - lengthStringBuffer bufEnd)
return (L (mkPsSpan (psSpanStart span) end) tok')
lex_string :: String -> P Token
@@ -1994,7 +1994,7 @@ finish_char_tok buf loc ch -- We've already seen the closing quote
-- Just need to check for trailing #
= do magicHash <- getBit MagicHashBit
i@(AI end bufEnd) <- getInput
- let src = lexemeToString buf (cur bufEnd - cur buf)
+ let src = lexemeToString buf (lengthStringBuffer buf - lengthStringBuffer bufEnd)
if magicHash then do
case alexGetChar' i of
Just ('#',i@(AI end _)) -> do