The Python Parser
Prev | Chapter 4. Processor Design | Next

## The Python Parser

The Python parser expects Python source files as input, and compiles them into an Abstract Semantic Graph. Note that directory names are valid input, too, if they correspond to Python packages, i.e. have an `__init__.py` file in them. At this time, this compilation is based purely on static analysis (parsing), and no runtime-inspection of the code is involved.

This obviously is obviously only of limitted use if objects change at runtime.

The found docstrings are identified and attached to their corresponding objects. If a `docformat` specifier is provided (either in terms of a `__docformat__` variable embedded into the Python source or the definition of the parser's `default_docformat` parameter, this format is used to parse and format the given docstrings.

Here are the available Python-Parser parameters:

primary_file_only

  If false, in addition to the primary python file imported modules are parsed, too, if they are found.

base_path

  A prefix (directory) to strip off of the Python code filename.

sxr_prefix

  If this variable is defined, it points to a directory within which the parser will store cross-referenced source code. This information may be used to render the source code with cross-references during formatting.

default_docformat

  Specify the doc-string format for the given python file. By default doc-strings are interpreted as plaintext, though other popular markup formats exist, such as ReStructuredText (`rst`), or JavaDoc (`javadoc`)

Prev | Up | Next
Chapter 4. Processor Design | Home | The IDL Parser