Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Network.Anonymous.Tor.Protocol.Parser.Ast
Description
Abstract syntax tree used by the Parser
, including helper functions
for traversing the tree.
Warning: This function is used internally by Tor
and using these functions directly is unsupported. The
interface of these functions might change at any time without
prior notice.
- data Token = Token {}
- data Line = Line {
- lineStatusCode :: Integer
- lineMessage :: [Token]
- key :: ByteString -> [Token] -> Bool
- value :: ByteString -> [Token] -> Maybe ByteString
- valueAs :: Parser a -> ByteString -> [Token] -> Maybe a
- line :: ByteString -> [Line] -> Maybe Line
- statusCode :: [Line] -> Integer
Documentation
A token is a key and can maybe have an associated value
Constructors
Token | |
Fields |
A line is just a sequence of tokens -- the Parser
ends the chain
when a newline is received.
Constructors
Line | |
Fields
|
Arguments
:: ByteString | The key to look for |
-> [Token] | Tokens to consider |
-> Bool | Result |
Returns true if the key was found
Arguments
:: ByteString | Key to look for |
-> [Token] | Tokens to consider |
-> Maybe ByteString | The value if the key was found |
Looks up a key and returns the value if found
valueAs :: Parser a -> ByteString -> [Token] -> Maybe a #
Retrieves value, and applies it to an Attoparsec parser
Arguments
:: ByteString | Token key to look for |
-> [Line] | Lines to consider |
-> Maybe Line | The line that starts with this key, if found |
Retrieves first line that starts with a certain token
statusCode :: [Line] -> Integer #
Returns status code of a reply.