Package pygccxml :: Package declarations :: Module call_invocation

# Source Code for Module pygccxml.declarations.call_invocation

     1  # Copyright 2004-2008 Roman Yakovenko.
     2  # Distributed under the Boost Software License, Version 1.0. (See
     3  # accompanying file LICENSE_1_0.txt or copy at
     4  # http://www.boost.org/LICENSE_1_0.txt)
     5
     6  """
     7  free function call parser
     8
     9  This module implements all functionality necessary to parse C++ free function
    10  invocation. In other words this module is able to extract next information from
    11  the string like this C{ print_message( message ) }.
    12      - name ( print_message )
    13      - list of arguments ( message )
    14
    15  This module also defines few convenience function like L{split} and L{join}.
    16  """
    17
    18  import pattern_parser
    19
    20  __THE_PARSER = pattern_parser.parser_t( '(', ')', ',' )
    21
    22 -def is_call_invocation( decl_string ):
    23      """
    24      returns True if decl_string is function invocation and False otherwise
    25
    26      @param decl_string: string that should be checked for pattern presence
    27      @type decl_string: str
    28
    29      @return: bool
    30      """
    31      global __THE_PARSER
    32      return __THE_PARSER.has_pattern( decl_string )
    33
    34 -def name( decl_string ):
    35      """
    36      returns name of function
    37
    38      @type decl_string: str
    39      @return: str
    40      """
    41      global __THE_PARSER
    42      return __THE_PARSER.name( decl_string )
    43
    44 -def args( decl_string ):
    45      """
    46      returns list of function arguments
    47
    48      @type decl_string: str
    49      @return: [str]
    50      """
    51      global __THE_PARSER
    52      return __THE_PARSER.args( decl_string )
    53
    54  NOT_FOUND = __THE_PARSER.NOT_FOUND
    55 -def find_args( text, start=None ):
    56      """
    57      finds arguments within function invocation.
    58
    59      @type text: str
    60      @return: [ arguments ] or L{NOT_FOUND} if arguments could not be found
    61      """
    62      global __THE_PARSER
    63      return __THE_PARSER.find_args( text, start )
    64
    65 -def split( decl_string ):
    66      """returns (name, [arguments] )"""
    67      global __THE_PARSER
    68      return __THE_PARSER.split( decl_string )
    69
    70 -def split_recursive( decl_string ):
    71      """returns [(name, [arguments])]"""
    72      global __THE_PARSER
    73      return __THE_PARSER.split_recursive( decl_string )
    74
    75 -def join( name, args, arg_separator=None ):
    76      """returns name( argument_1, argument_2, ..., argument_n )"""
    77      global __THE_PARSER
    78      return __THE_PARSER.join( name, args, arg_separator )
    79