Logo Search packages:      
Sourcecode: calibre version File versions

def calibre::utils::pyparsing::ParserElement::setParseAction (   self,
  fns,
  kwargs 
) [inherited]

Define action to perform when successfully matching parse element definition.
   Parse action fn is a callable method with 0-3 arguments, called as fn(s,loc,toks),
   fn(loc,toks), fn(toks), or just fn(), where:
    - s   = the original string being parsed (see note below)
    - loc = the location of the matching substring
    - toks = a list of the matched tokens, packaged as a ParseResults object
   If the functions in fns modify the tokens, they can return them as the return
   value from fn, and the modified list of tokens will replace the original.
   Otherwise, fn does not need to return any value.

   Note: the default parsing behavior is to expand tabs in the input string
   before starting the parsing process.  See L{I{parseString}<parseString>} for more information
   on parsing strings containing <TAB>s, and suggested methods to maintain a
   consistent view of the parsed string, the parse location, and line and column
   positions within the parsed string.
   

Definition at line 837 of file pyparsing.py.

00837                                               :
        """Define action to perform when successfully matching parse element definition.
           Parse action fn is a callable method with 0-3 arguments, called as fn(s,loc,toks),
           fn(loc,toks), fn(toks), or just fn(), where:
            - s   = the original string being parsed (see note below)
            - loc = the location of the matching substring
            - toks = a list of the matched tokens, packaged as a ParseResults object
           If the functions in fns modify the tokens, they can return them as the return
           value from fn, and the modified list of tokens will replace the original.
           Otherwise, fn does not need to return any value.

           Note: the default parsing behavior is to expand tabs in the input string
           before starting the parsing process.  See L{I{parseString}<parseString>} for more information
           on parsing strings containing <TAB>s, and suggested methods to maintain a
           consistent view of the parsed string, the parse location, and line and column
           positions within the parsed string.
           """
        self.parseAction = list(map(self._normalizeParseActionArgs, list(fns)))
        self.callDuringTry = ("callDuringTry" in kwargs and kwargs["callDuringTry"])
        return self


Generated by  Doxygen 1.6.0   Back to index