Special characters are:
Symbols are represented by their name. Vertical bars | can be used to delimit names that contain blanks, special characters, non printable characters, non-ASCII characters, or can be confused as a number.
Numbers follow the syntax specified by the C function strtol() with base=0.
Strings are delimited by double quotes. All C string escapes are recognized. Non-printable ASCII characters must be escaped.
List are represented by an open parenthesis ( followed by the space separated list elements, followed by a closing parenthesis ).
When the cdr of the last pair is non zero, the closed parenthesis is preceded by a space, a dot ., a space, and the textual representation of the cdr. (This is only partially supported by Python bindings.)
Inheritance diagram:
IntExpression can represent any integer in range \left[-2^{29}, 2^{29}\right).
To create objects of this class, use the Expression constructor:
>>> x = Expression(42)
>>> x
Expression(42)
>>> type(x)
<class 'djvu.sexpr.IntExpression'>
>>> x.as_string()
'42'
>>> x.value
42
To create objects of this class, use the Expression constructor:
>>> x = Expression([4, 2])
>>> x
Expression((4, 2))
>>> type(x)
<class 'djvu.sexpr.ListExpression'>
>>> x.as_string()
'(4 2)'
>>> x.value
(4, 2)
To create objects of this class, use the Expression constructor:
>>> x = Expression('eggs')
>>> x
Expression('eggs')
>>> type(x)
<class 'djvu.sexpr.StringExpression'>
>>> x.as_string()
'"eggs"'
>>> x.value
'eggs'
To create objects of this class, use the Expression constructor:
>>> x = Expression(Symbol('ham'))
>>> x
Expression(Symbol('ham'))
>>> type(x)
<class 'djvu.sexpr.SymbolExpression'>
>>> x.as_string()
'ham'
>>> x.value
Symbol('ham')