Module bison :: Class ParserEngine
[show private | hide private]
[frames | no frames]

Class ParserEngine

object --+
         |
        ParserEngine


Wraps the interface to the binary bison/lex-generated parser engine dynamic library.

You shouldn't need to deal with this at all.

Takes care of: Makes direct calls to the platform-dependent routines in bisondynlib-[linux|windows].c
Method Summary
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __del__(...)
Clean up and bail
  buildLib(...)
Creates the parser engine lib
  closeLib(...)
Does the necessary cleanups and closes the parser library
  openCurrentLib(...)
Tests if library exists and is current.
  openLib(...)
Loads the parser engine's dynamic library, and extracts the following symbols:
  runEngine(...)
Runs the binary parser engine, as loaded from the lib
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T

Method Details

__init__(...)
(Constructor)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides:
__builtin__.object.__init__

__del__(...)
(Destructor)

Clean up and bail

buildLib(...)

Creates the parser engine lib

This consists of:
  1. Ripping the tokens list, precedences, start target, handler docstrings and lex script from this Parser instance's attribs and methods
  2. Creating bison and lex files
  3. Compiling bison/lex files to C
  4. Compiling the C files, and link into a dynamic lib

closeLib(...)

Does the necessary cleanups and closes the parser library

openCurrentLib(...)

Tests if library exists and is current. If not, builds a fresh one

Opens the library

openLib(...)

Loads the parser engine's dynamic library, and extracts the following symbols:
  • void *do_parse() (runs parser)
  • char *parserHash (contains hash of python parser rules)

Returns lib handle, plus pointer to do_parse() function, as long ints (which later need to be cast to pointers)

Important note -this is totally linux-specific. If you want windows support, you'll have to modify these funcs to use glib instead (or create windows equivalents), in which case I'd greatly appreciate you sending me a patch.

runEngine(...)

Runs the binary parser engine, as loaded from the lib

Generated by Epydoc 2.0 on Fri Apr 23 19:00:01 2004 http://epydoc.sf.net