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:
digraph inheritance6e01fa2dda { rankdir=LR; size="8.0, 12.0"; "BaseExpression" [style="setlinewidth(0.5)",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Don't use this class directly. Use the Expression class instead.",height=0.25,shape=box,fontsize=10]; "Expression" [style="setlinewidth(0.5)",URL="#djvu.sexpr.Expression",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="Notes about the textual representation of S-expressions",height=0.25,shape=box,fontsize=10]; "BaseExpression" -> "Expression" [arrowsize=0.5,style="setlinewidth(0.5)"]; "IntExpression" [style="setlinewidth(0.5)",URL="#djvu.sexpr.IntExpression",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="IntExpression can represent any integer in range(-2 ** 29, 2 ** 29).",height=0.25,shape=box,fontsize=10]; "Expression" -> "IntExpression" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ListExpression" [style="setlinewidth(0.5)",URL="#djvu.sexpr.ListExpression",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="To create objects of this class, use the Expression class constructor.",height=0.25,shape=box,fontsize=10]; "Expression" -> "ListExpression" [arrowsize=0.5,style="setlinewidth(0.5)"]; "StringExpression" [style="setlinewidth(0.5)",URL="#djvu.sexpr.StringExpression",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="To create objects of this class, use the Expression class constructor.",height=0.25,shape=box,fontsize=10]; "Expression" -> "StringExpression" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SymbolExpression" [style="setlinewidth(0.5)",URL="#djvu.sexpr.SymbolExpression",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",tooltip="To create objects of this class, use the Expression class constructor.",height=0.25,shape=box,fontsize=10]; "Expression" -> "SymbolExpression" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
Return a string representation of the expression.
Print the expression into the file.
The actual “pythonic” value of the expression.
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')