1
2
3
4
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
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 ):
43
44 -def args( decl_string ):
53
54 NOT_FOUND = __THE_PARSER.NOT_FOUND
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
69
74
75 -def join( name, args, arg_separator=None ):
79