Safe Haskell | None |
---|---|
Language | Haskell2010 |
- basicParser :: SExprParser Text (SExpr Text)
- basicPrinter :: SExprPrinter Text (SExpr Text)
Spec
The basicSpec
describes S-expressions whose atoms are simply
text strings that contain alphanumeric characters and a small
set of punctuation. It does no parsing of numbers or other data
types, and will accept tokens that typical Lisp implementations
would find nonsensical (like 77foo
).
Atoms recognized by the basicSpec
are any string matching the
regular expression [A-Za-z0-9+*<>/=!?-]+
.
basicParser :: SExprParser Text (SExpr Text) Source #
A SExprParser
that understands atoms to be sequences of
alphanumeric characters as well as the punctuation
characters [-*/+<>=!?]
, and does no processing of them.
>>>
decode basicParser "(1 elephant)"
Right [SCons (SAtom "1") (SCons (SAtom "elephant") SNil)]
basicPrinter :: SExprPrinter Text (SExpr Text) Source #
A SExprPrinter
that prints textual atoms directly (without quoting
or any other processing) onto a single line.
>>>
encode basicPrinter [L [A "1", A "elephant"]]
"(1 elephant)"