This Page

Defines classes for parsing and compiling box declarations, which consist of a name followed by an attribute list in square brackets. Box declarations must occupy a single line and must not contain arrows (->):

<name> [<attributelist>]
class BoxSyntax(name, attributeList)[source]

Represents the abstract syntax of a box declaration, which has a name and an attribute list.

__init__(name, attributeList)[source]

Initializes a new box syntax object with the given name and attribute list.


Allows the use of square-bracket notation to retrieve the value of one of this box’s attributes.


Converts the syntax object into its raw string representation.

compile(boxes, relations)[source]

Checks and compiles the abstract syntax structure to create a new BoxDeclaration object of the appropriate subclass.

  • boxes – The list of box declarations compiled so far.
  • relations – The list of relation declarations compiled so far.

the newly created box declaration.

Raises :

a CompilationError if any static checks fail.

classmethod parse(text)[source]

Parses the given input text to produce a new BoxSyntax object.

Returns:the newly created box syntax object.
Raises :a ParsingError if syntax is invalid.