1
2
3
4
5
6 """
7 template instantiation parser
8
9 This module implements all functionality necessary to parse C++ template
10 instantiations.In other words this module is able to extract next information from
11 the string like this C{ std::vector<int> }.
12 - name ( std::vector )
13 - list of arguments ( int )
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 template instantiation 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
58
63
64 -def join( name, args ):
68
70 """returns decl_string, which contains "normalized" spaces
71
72 this functionality allows to implement comparison of 2 different string
73 which are actually same: x::y< z > and x::y<z>
74 """
75 global __THE_PARSER
76 return __THE_PARSER.normalize( decl_string )
77