flatparse-0.5.1.0: High-performance parsing from strict bytestrings
Safe HaskellSafe-Inferred
LanguageHaskell2010

FlatParse.Common.Switch

Synopsis

Documentation

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.Common.Switch

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.Common.Switch

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`.