| Safe Haskell | None |
|---|
Language.Sexp.Parser
- data Sexp
- = List [Sexp]
- | Atom ByteString
- sexpParser :: Parser Sexp
- data ParseException = ParseException String ByteString
- parse :: ByteString -> Either (String, ByteString) [Sexp]
- parseExn :: ByteString -> [Sexp]
- parseMaybe :: ByteString -> Maybe [Sexp]
Documentation
A ByteString-based S-Expression. Conceptually, a Sexp is
either an single atom represented by a ByteString, or a list of
Sexp.
Constructors
| List [Sexp] | |
| Atom ByteString |
sexpParser :: Parser SexpSource
A parser for S-Expressions. Ignoring whitespace, we follow the following EBNF:
SEXP ::= '(' ATOM* ')' | ATOM ATOM ::= '' ESCAPED_STRING* '' | [^ tn()]+ ESCAPED_STRING ::= ...
data ParseException Source
Constructors
| ParseException String ByteString |
parse :: ByteString -> Either (String, ByteString) [Sexp]Source
Parse S-Expressions from a lazy ByteString. If the parse was
successful, Right sexps is returned; otherwise, Left (errorMsg,
leftover) is returned.
parseExn :: ByteString -> [Sexp]Source
A variant of parse that throws a ParseException if the parse
fails.
parseMaybe :: ByteString -> Maybe [Sexp]Source