/usr/share/pyshared/pygccxml/declarations/templates.py is in python-pygccxml 1.0.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
"""
template instantiation parser
This module implements all functionality necessary to parse C++ template
instantiations.In other words this module is able to extract next information from
the string like this C{ std::vector<int> }.
- name ( std::vector )
- list of arguments ( int )
This module also defines few convenience function like L{split} and L{join}.
"""
import pattern_parser
__THE_PARSER = pattern_parser.parser_t( '<', '>', ',' )
def is_instantiation( decl_string ):
"""
returns True if decl_string is template instantiation and False otherwise
@param decl_string: string that should be checked for pattern presence
@type decl_string: str
@return: bool
"""
global __THE_PARSER
return __THE_PARSER.has_pattern( decl_string )
def name( decl_string ):
"""
returns name of instantiated template
@type decl_string: str
@return: str
"""
global __THE_PARSER
return __THE_PARSER.name( decl_string )
def args( decl_string ):
"""
returns list of template arguments
@type decl_string: str
@return: [str]
"""
global __THE_PARSER
return __THE_PARSER.args( decl_string )
def split( decl_string ):
"""returns (name, [arguments] )"""
global __THE_PARSER
return __THE_PARSER.split( decl_string )
def split_recursive( decl_string ):
"""returns [(name, [arguments])]"""
global __THE_PARSER
return __THE_PARSER.split_recursive( decl_string )
def join( name, args ):
"""returns name< argument_1, argument_2, ..., argument_n >"""
global __THE_PARSER
return __THE_PARSER.join( name, args )
def normalize( decl_string ):
"""returns decl_string, which contains "normalized" spaces
this functionality allows to implement comparison of 2 different string
which are actually same: x::y< z > and x::y<z>
"""
global __THE_PARSER
return __THE_PARSER.normalize( decl_string )
|