summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-23 14:16:58 -0400
committerBen Gamari <ben@smart-cactus.org>2020-11-29 18:26:15 -0500
commitb3027eb0a1c1b3cedbb54b0fc8d0924283a7cd25 (patch)
tree428241e11a6a5d15592964d049344b85d8160cf4 /compiler/GHC/Parser
parentf40b662b9ea555bab6e9729f4165eaca7021d322 (diff)
downloadhaskell-wip/stringbuffer.tar.gz
StringBuffer: Rid it of ForeignPtrswip/stringbuffer
Bumps haddock submodule.
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