Logo Search packages:      
Sourcecode: calibre version File versions

def calibre::utils::pyparsing::ParserElement::enablePackrat (  )  [inherited]

Enables "packrat" parsing, which adds memoizing to the parsing logic.
   Repeated parse attempts at the same string location (which happens
   often in many complex grammars) can immediately return a cached value,
   instead of re-executing parsing/validating code.  Memoizing is done of
   both valid results and parsing exceptions.

   This speedup may break existing programs that use parse actions that
   have side-effects.  For this reason, packrat parsing is disabled when
   you first import pyparsing.  To activate the packrat feature, your
   program must call the class method ParserElement.enablePackrat().  If
   your program uses psyco to "compile as you go", you must call
   enablePackrat before calling psyco.full().  If you do not do this,
   Python will crash.  For best results, call enablePackrat() immediately
   after importing pyparsing.

Definition at line 1014 of file pyparsing.py.

01014                        :
        """Enables "packrat" parsing, which adds memoizing to the parsing logic.
           Repeated parse attempts at the same string location (which happens
           often in many complex grammars) can immediately return a cached value,
           instead of re-executing parsing/validating code.  Memoizing is done of
           both valid results and parsing exceptions.

           This speedup may break existing programs that use parse actions that
           have side-effects.  For this reason, packrat parsing is disabled when
           you first import pyparsing.  To activate the packrat feature, your
           program must call the class method ParserElement.enablePackrat().  If
           your program uses psyco to "compile as you go", you must call
           enablePackrat before calling psyco.full().  If you do not do this,
           Python will crash.  For best results, call enablePackrat() immediately
           after importing pyparsing.
        """
        if not ParserElement._packratEnabled:
            ParserElement._packratEnabled = True
            ParserElement._parse = ParserElement._parseCache


Generated by  Doxygen 1.6.0   Back to index