flatparse-0.3.5.1: High-performance parsing from strict bytestrings
Safe HaskellNone
LanguageHaskell2010

FlatParse.Internal

Synopsis

Documentation

isDigit :: Char -> Bool Source #

isDigit c = '0' <= c && c <= '9'

isLatinLetter :: Char -> Bool Source #

isLatinLetter c = ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')

isGreekLetter :: Char -> Bool Source #

isGreekLetter c = ('Α' <= c && c <= 'Ω') || ('α' <= c && c <= 'ω')

readInt' :: Int# -> Addr# -> Addr# -> (# Int#, Addr# #) Source #

readInt :: Addr# -> Addr# -> (# (# #) | (# Int#, Addr# #) #) Source #

Read an Int from the input, as a non-empty digit sequence. The Int may overflow in the result.

readInteger :: ForeignPtrContents -> Addr# -> Addr# -> (# (# #) | (# Integer, Addr# #) #) Source #

Read an Integer from the input, as a non-empty digit sequence.

newtype Pos Source #

Byte offset counted backwards from the end of the buffer.

Constructors

Pos Int 

Instances

Instances details
Eq Pos Source # 
Instance details

Defined in FlatParse.Internal

Methods

(==) :: Pos -> Pos -> Bool #

(/=) :: Pos -> Pos -> Bool #

Ord Pos Source # 
Instance details

Defined in FlatParse.Internal

Methods

compare :: Pos -> Pos -> Ordering #

(<) :: Pos -> Pos -> Bool #

(<=) :: Pos -> Pos -> Bool #

(>) :: Pos -> Pos -> Bool #

(>=) :: Pos -> Pos -> Bool #

max :: Pos -> Pos -> Pos #

min :: Pos -> Pos -> Pos #

Show Pos Source # 
Instance details

Defined in FlatParse.Internal

Methods

showsPrec :: Int -> Pos -> ShowS #

show :: Pos -> String #

showList :: [Pos] -> ShowS #

data Span Source #

A pair of positions.

Constructors

Span !Pos !Pos 

Instances

Instances details
Eq Span Source # 
Instance details

Defined in FlatParse.Internal

Methods

(==) :: Span -> Span -> Bool #

(/=) :: Span -> Span -> Bool #

Show Span Source # 
Instance details

Defined in FlatParse.Internal

Methods

showsPrec :: Int -> Span -> ShowS #

show :: Span -> String #

showList :: [Span] -> ShowS #

unsafeSlice :: ByteString -> Span -> ByteString Source #

Slice into a ByteString using a Span. The result is invalid if the Span is not a valid slice of the first argument.

packUTF8 :: String -> ByteString Source #

Convert a String to an UTF-8-coded ByteString.

splitBytes :: [Word] -> ([Word], [Word]) Source #

data Trie a Source #

Constructors

Branch !a !(Map Word (Trie a)) 

Instances

Instances details
Show a => Show (Trie a) Source # 
Instance details

Defined in FlatParse.Internal

Methods

showsPrec :: Int -> Trie a -> ShowS #

show :: Trie a -> String #

showList :: [Trie a] -> ShowS #

mindepths :: Trie Rule -> Trie (Rule, Int) Source #

Decorate a trie with the minimum lengths of non-empty paths. This is used later to place ensureBytes#.

data Trie' a Source #

Constructors

Branch' !a !(Map Word (Trie' a)) 
Path !a ![Word] !(Trie' a) 

Instances

Instances details
Show a => Show (Trie' a) Source # 
Instance details

Defined in FlatParse.Internal

Methods

showsPrec :: Int -> Trie' a -> ShowS #

show :: Trie' a -> String #

showList :: [Trie' a] -> ShowS #

pathify :: Trie (Rule, Int) -> Trie' (Rule, Int) Source #

Compress linear paths.

fallbacks :: Trie' (Rule, Int) -> Trie' (Rule, Int, Int) Source #

Compute where to fall back after we exhausted a branch. If the branch is empty, that means we've succeded at reading and we jump to the rhs rule.

ensureBytes :: Trie' (Rule, Int, Int) -> Trie' (Rule, Int, Maybe Int) Source #

Decorate with ensureBytes# invocations, represented as `Maybe Int`.