sexp-grammar-1.2.1: Invertible parsers for S-expressions

Safe HaskellNone
LanguageHaskell2010

Language.Sexp

Contents

Synopsis

Parse and print

decode :: ByteString -> Either String Sexp Source

Quickly decode a ByteString-formatted S-expression into Sexp structure

encode :: Sexp -> ByteString Source

Quickly encode Sexp to non-indented ByteString

parseSexp :: FilePath -> ByteString -> Either String Sexp Source

Parse a ByteString-formatted S-expression into Sexp structure. Takes file name for better error messages.

parseSexps :: FilePath -> ByteString -> Either String [Sexp] Source

Parse a ByteString-formatted sequence of S-expressions into list of Sexp structures. Takes file name for better error messages.

parseSexp' :: Position -> ByteString -> Either String Sexp Source

Parse a ByteString-formatted S-expression into Sexp structure. Takes file name for better error messages.

parseSexps' :: Position -> ByteString -> Either String [Sexp] Source

Parse a ByteString-formatted sequence of S-expressions into list of Sexp structures. Takes file name for better error messages.

prettySexp :: Sexp -> ByteString Source

Pretty-print a Sexp to a ByteString

prettySexps :: [Sexp] -> ByteString Source

Pretty-print a list of Sexps as a sequence of S-expressions to a ByteString

Type

data Sexp Source

Sexp ADT

Instances

newtype Kw Source

Keyword newtype wrapper to distinguish keywords from symbols

Constructors

Kw 

Fields

unKw :: Text
 

Instances

Position

data Position Source

File position

Constructors

Position !FilePath !Int !Int 

getPos :: Sexp -> Position Source

Get position of Sexp element