network-anonymous-tor-0.11.0: Haskell API for Tor anonymous networking

Safe HaskellSafe
LanguageHaskell2010

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.

Synopsis

Documentation

data Token #

A token is a key and can maybe have an associated value

Constructors

Token 

Instances

Eq Token # 

Methods

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

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

Show Token # 

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

data Line #

A line is just a sequence of tokens -- the Parser ends the chain when a newline is received.

Constructors

Line 

Instances

Eq Line # 

Methods

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

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

Show Line # 

Methods

showsPrec :: Int -> Line -> ShowS #

show :: Line -> String #

showList :: [Line] -> ShowS #

key #

Arguments

:: ByteString

The key to look for

-> [Token]

Tokens to consider

-> Bool

Result

Returns true if the key was found

value #

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

line #

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.