git.iko.soy/typeable/attoparsec
on master help sign in
More tweaks.
commit7ffb15841baf18c23066f107cd78957db0c8d294 authorBryan O'Sullivan <bos@serpentine.com> dateFri 5 Mar 2010, 23:26 (17 years ago) parent11c7008
1 file changed+19−9
Data/Attoparsec/Char8.hs+19−9
Data/Attoparsec/Char8.hs+19−9
@@ -9,17 +9,12 @@
99--
1010-- Simple, efficient, character-oriented combinator parsing for
1111-- 'B.ByteString' strings, loosely based on the Parsec library.
12−--
13−-- /Note/: This module is intended for parsing text that is
14−-- represented using an 8-bit character set, e.g. ASCII or
15−-- ISO-8859-15. It /does not/ make any attempt to deal with character
16−-- encodings, multibyte characters, or wide characters. In
17−-- particular, all attempts to use characters above code point U+00FF
18−-- will give wrong answers. Characters below U+00FF are simply
19−-- translated to and from the byte values of their Unicode code
20−-- points.
12+
2113module Data.Attoparsec.Char8
2214 (
15+ -- * Character encodings
16+ -- $encodings
17+
2318 -- * Parser types
2419 Parser
2520 , A.Result(..)
@@ -94,6 +89,21 @@ import qualified Data.Attoparsec.Internal as I
9489import qualified Data.ByteString as B8
9590import qualified Data.ByteString.Char8 as B
9691
92+-- $encodings
93+--
94+-- This module is intended for parsing text that is
95+-- represented using an 8-bit character set, e.g. ASCII or
96+-- ISO-8859-15. It /does not/ make any attempt to deal with character
97+-- encodings, multibyte characters, or wide characters. In
98+-- particular, all attempts to use characters above code point U+00FF
99+-- will give wrong answers.
100+--
101+-- Code points below U+0100 are simply translated to and from their
102+-- numeric values, so e.g. the code point U+00A4 becomes the byte
103+-- @0xA4@ (which is the Euro symbol in ISO-8859-15, but the generic
104+-- currency sign in ISO-8859-1). Haskell 'Char' values above U+00FF
105+-- are truncated, so e.g. U+1D6B7 is truncated to the byte @0xB7@.
106+
97107-- ASCII-specific but fast, oh yes.
98108toLower :: Word8 -> Word8
99109toLower w | w >= 65 && w <= 90 = w + 32