summaryrefslogtreecommitdiff
path: root/compiler/utils/StringBuffer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/StringBuffer.hs')
-rw-r--r--compiler/utils/StringBuffer.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/utils/StringBuffer.hs b/compiler/utils/StringBuffer.hs
index a5fc4e7f12..64578bffde 100644
--- a/compiler/utils/StringBuffer.hs
+++ b/compiler/utils/StringBuffer.hs
@@ -81,7 +81,7 @@ data StringBuffer
cur :: {-# UNPACK #-} !Int -- current pos
}
-- The buffer is assumed to be UTF-8 encoded, and furthermore
- -- we add three '\0' bytes to the end as sentinels so that the
+ -- we add three @\'\\0\'@ bytes to the end as sentinels so that the
-- decoder doesn't have to check for overflow at every single byte
-- of a multibyte sequence.
@@ -187,7 +187,7 @@ stringToStringBuffer str =
-- the remaining portion (analogous to 'Data.List.uncons'). __Warning:__ The
-- behavior is undefined if the 'StringBuffer' is empty. The result shares
-- the same buffer as the original. Similar to 'utf8DecodeChar', if the
--- character cannot be decoded as UTF-8, '\0' is returned.
+-- character cannot be decoded as UTF-8, @\'\\0\'@ is returned.
{-# INLINE nextChar #-}
nextChar :: StringBuffer -> (Char,StringBuffer)
nextChar (StringBuffer buf len (I# cur#)) =
@@ -202,7 +202,7 @@ nextChar (StringBuffer buf len (I# cur#)) =
-- | Return the first UTF-8 character of a nonempty 'StringBuffer' (analogous
-- to 'Data.List.head'). __Warning:__ The behavior is undefined if the
-- 'StringBuffer' is empty. Similar to 'utf8DecodeChar', if the character
--- cannot be decoded as UTF-8, '\0' is returned.
+-- cannot be decoded as UTF-8, @\'\\0\'@ is returned.
currentChar :: StringBuffer -> Char
currentChar = fst . nextChar
@@ -285,7 +285,7 @@ skipToLine !line !len !op0 = go 1 op0
-- | Decode the first @n@ bytes of a 'StringBuffer' as UTF-8 into a 'String'.
-- Similar to 'utf8DecodeChar', if the character cannot be decoded as UTF-8,
--- they will be replaced with '\0'.
+-- they will be replaced with @\'\\0\'@.
lexemeToString :: StringBuffer
-> Int -- ^ @n@, the number of bytes
-> String