| Trees | Indices | Help | 
 | 
|---|
|  | 
 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  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   
35      """ 
36      returns name of instantiated template 
37       
38      @type decl_string: str 
39      @return: str 
40      """ 
41      global __THE_PARSER 
42      return __THE_PARSER.name( decl_string ) 
43   
45      """ 
46      returns list of template arguments 
47       
48      @type decl_string: str 
49      @return: [str] 
50      """ 
51      global __THE_PARSER 
52      return __THE_PARSER.args( decl_string ) 
53           
55      """returns (name, [arguments] )""" 
56      global __THE_PARSER 
57      return __THE_PARSER.split( decl_string ) 
58       
60      """returns [(name, [arguments])]""" 
61      global __THE_PARSER 
62      return __THE_PARSER.split_recursive( decl_string ) 
63   
65      """returns name< argument_1, argument_2, ..., argument_n >""" 
66      global __THE_PARSER 
67      return __THE_PARSER.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   
| Trees | Indices | Help | 
 | 
|---|
| Generated by Epydoc 3.0.1 on Mon Oct 20 08:51:42 2008 | http://epydoc.sourceforge.net |