Skip to content
Snippets Groups Projects
parser.rst 7.26 KiB

Parser

The parser module implements the following class:

  • :class:`Parser`: Recursive-descent parser.

This module also defines the following exceptions:

  • :exc:`EndOfInput`: Unexpected end of input.
  • :exc:`ParserException`: Base class for parser exceptions.
  • :exc:`UnexpectedInput`: Unexpected input.

Type Alias

This abstract class provides a framework for implementing a recursive-descent parser. The text argument contains the input text to be parsed.

Concrete parsers should be implemented as a subclass of :class:`Parser`. By convention, such a parser class should define the :meth:`parse` method.

>>> p = Parser("x \t #quu0a,foo:bar< qwerty")

Instance Attributes

Public Methods