Parser that knows how to parse C/C++ files.
Definition at line 57 of file fileparser.py.
◆ __init__()
def fileparser.CParser.__init__ |
( |
|
self | ) |
|
Reimplemented from fileparser.Parser.
Definition at line 72 of file fileparser.py.
72 def __init__(self):
73 super(CParser, self).__init__()
74 self._comment_pattern = re.compile('/\*.*?\*/', re.DOTALL)
75
◆ CreateCopyrightBlock()
def fileparser.CParser.CreateCopyrightBlock |
( |
|
self, |
|
|
|
year, |
|
|
|
holder |
|
) |
| |
Returns a copyright block suitable for this language, with the
given attributes.
@param year year in which to hold copyright (defaults to DEFAULT_YEAR)
@param holder holder of copyright (defaults to DEFAULT_HOLDER)
Definition at line 81 of file fileparser.py.
81 def CreateCopyrightBlock(self, year, holder):
82 """Returns a copyright block suitable for this language, with the
83 given attributes.
84
85 @param year year in which to hold copyright (defaults to DEFAULT_YEAR)
86 @param holder holder of copyright (defaults to DEFAULT_HOLDER)
87 """
88 if not year:
89 year = self.DEFAULT_YEAR
90 if not holder:
91 holder = self.DEFAULT_HOLDER
92 return self.COPYRIGHT_BLOCK_FORMAT % (year, holder)
◆ FindAllCommentBlocks()
def fileparser.CParser.FindAllCommentBlocks |
( |
|
self, |
|
|
|
file_contents |
|
) |
| |
Returns a list of all comment blocks within these file contents.
Definition at line 76 of file fileparser.py.
76 def FindAllCommentBlocks(self, file_contents):
77 """Returns a list of all comment blocks within these file contents.
78 """
79 return self._comment_pattern.findall(file_contents)
80
◆ COPYRIGHT_BLOCK_FORMAT
string fileparser.CParser.COPYRIGHT_BLOCK_FORMAT |
|
static |
Initial value:= '''
/*
* Copyright %s %s
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
'''
Definition at line 63 of file fileparser.py.
◆ DEFAULT_HOLDER
string fileparser.CParser.DEFAULT_HOLDER = 'Google Inc.' |
|
static |
◆ DEFAULT_YEAR
fileparser.CParser.DEFAULT_YEAR = datetime.date.today().year |
|
static |
The documentation for this class was generated from the following file: