1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Produce non-ASCII characters and longer byte strings earlier.

This commit is contained in:
Rob Rix 2017-02-16 11:53:27 -05:00
parent 6c54412778
commit 6e35a32566

View File

@ -126,15 +126,9 @@ instance Listable Source where
newtype ListableByteString = ListableByteString { unListableByteString :: B.ByteString }
instance Listable ListableByteString where
tiers = (ListableByteString . encodeUtf8 . T.pack) `mapT` setsOf (toTiers characters)
where characters
= ['a'..'z']
+| ['A'..'Z']
+| ['0'..'9']
+| [' '..'/']
+| [':'..'@']
+| ['['..'`']
+| ['{'..'~']
+| [chr 0x00..chr 0x1f] -- Control characters.
+| [chr 127]
+| [chr 0xa0..chr 0x24f] -- Non-ASCII.
tiers = (ListableByteString . encodeUtf8 . T.pack) `mapT` strings
where strings = foldr ((\\//) . listsOf . toTiers) []
[ ['a'..'z'] <> ['A'..'Z'] <> ['0'..'9']
, [' '..'/'] <> [':'..'@'] <> ['['..'`'] <> ['{'..'~']
, [chr 0x00..chr 0x1f] <> [chr 127] -- Control characters.
, [chr 0xa0..chr 0x24f] ] -- Non-ASCII.