sexpr-0.2.0: S-expression printer and parserSource codeContentsIndex
Codec.Sexpr.Parser
Description

All present parsers work on Strings, one character at a time. The canonical encoding is clearly susceptible to efficient parsing as a Lazy ByteString.

This package also includes the Read instance for Sexprs.

From Rivest's documentation:

 <sexpr>    	:: <string> | <list>
 <string>   	:: <display>? <simple-string> ;
 <simple-string>	:: <raw> | <token> | <base-64> | <hexadecimal> | 
 		           <quoted-string> ;
 <display>  	:: "[" <simple-string> "]" ;
 <raw>      	:: <decimal> ":" <bytes> ;
 <decimal>  	:: <decimal-digit>+ ;
 		-- decimal numbers should have no unnecessary leading zeros
 <bytes> 	-- any string of bytes, of the indicated length
 <token>    	:: <tokenchar>+ ;
 <base-64>  	:: <decimal>? "|" ( <base-64-char> | <whitespace> )* "|" ;
 <hexadecimal>      :: "#" ( <hex-digit> | <white-space> )* "#" ;
 <quoted-string>    :: <decimal>? <quoted-string-body>  
 <quoted-string-body> :: "\"" <bytes> "\""
 <list>     	:: "(" ( <sexp> | <whitespace> )* ")" ;
 <whitespace> 	:: <whitespace-char>* ;
 <token-char>  	:: <alpha> | <decimal-digit> | <simple-punc> ;
 <alpha>       	:: <upper-case> | <lower-case> | <digit> ;
 <lower-case>  	:: "a" | ... | "z" ;
 <upper-case>  	:: "A" | ... | "Z" ;
 <decimal-digit>    :: "0" | ... | "9" ;
 <hex-digit>        :: <decimal-digit> | "A" | ... | "F" | "a" | ... | "f" ;
 <simple-punc> 	:: "-" | "." | "/" | "_" | ":" | "*" | "+" | "=" ;
 <whitespace-char>  :: " " | "\t" | "\r" | "\n" ;
 <base-64-char> 	:: <alpha> | <decimal-digit> | "+" | "/" | "=" ;
 <null>        	:: "" ;
Synopsis
readSexprString :: String -> Sexpr String
readCanonicalSexprString :: String -> Sexpr String
readSexpr :: Read a => String -> Sexpr a
sexpr :: Bool -> ReadP (Sexpr String)
canonicalSexpr :: ReadP (Sexpr String)
advancedSexpr :: ReadP (Sexpr String)
internalSexpr :: Bool -> ReadP (Sexpr String)
basicTransport :: Bool -> ReadP (Sexpr String)
b64char :: ReadP Char
b64char' :: ReadP Char
hexchar :: ReadP Char
hexchar' :: ReadP Char
listR :: Bool -> ReadP (Sexpr String)
atomR :: Bool -> ReadP (Sexpr String)
simpleString :: Bool -> ReadP String
quotedString :: ReadP String
hexAtom :: ReadP String
hexDecode :: String -> String
b64Atom :: ReadP String
token :: ReadP String
raw :: ReadP String
decimal :: ReadP Int
Documentation
readSexprString :: String -> Sexpr StringSource
Read a Sexpr String in any encoding: Canonical, Basic, or Advanced.
readCanonicalSexprString :: String -> Sexpr StringSource
Read a Sexpr String in canonical encoding.
readSexpr :: Read a => String -> Sexpr aSource
Read a Sexpr a using the Read instance for a. The Sexpr may be in any encoding: Canonical, Basic, or Advanced.
sexpr :: Bool -> ReadP (Sexpr String)Source
Parser for Sexpr Strings suitable for embedding in other ReadP parsers.
canonicalSexpr :: ReadP (Sexpr String)Source
For some applications it is wise to accept only very carefully specified input. This is useful when you know you are receiving exactly a Canonical S-Expression. It will read only a Canonical S-expression (and optional terminating NUL), but not the Basic or Advanced encodings.
advancedSexpr :: ReadP (Sexpr String)Source
internalSexpr :: Bool -> ReadP (Sexpr String)Source
basicTransport :: Bool -> ReadP (Sexpr String)Source
b64char :: ReadP CharSource
b64char' :: ReadP CharSource
hexchar :: ReadP CharSource
hexchar' :: ReadP CharSource
listR :: Bool -> ReadP (Sexpr String)Source
atomR :: Bool -> ReadP (Sexpr String)Source
simpleString :: Bool -> ReadP StringSource
quotedString :: ReadP StringSource
hexAtom :: ReadP StringSource
hexDecode :: String -> StringSource
b64Atom :: ReadP StringSource
token :: ReadP StringSource
raw :: ReadP StringSource
decimal :: ReadP IntSource
Produced by Haddock version 2.4.2