Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
fileparser.CParser Class Reference
Inheritance diagram for fileparser.CParser:
fileparser.Parser

Public Member Functions

 __init__ (self)
 
 FindAllCommentBlocks (self, file_contents)
 
 CreateCopyrightBlock (self, year, holder)
 
- Public Member Functions inherited from fileparser.Parser
 FindCopyrightBlock (self, comment_blocks)
 
 GetCopyrightBlockAttributes (self, comment_block)
 

Static Public Attributes

 DEFAULT_YEAR = datetime.date.today().year
 
str DEFAULT_HOLDER = 'Google Inc.'
 
str COPYRIGHT_BLOCK_FORMAT
 

Protected Attributes

 _comment_pattern
 
- Protected Attributes inherited from fileparser.Parser
 _copyright_pattern
 
 _attribute_pattern
 

Detailed Description

Parser that knows how to parse C/C++ files.

Definition at line 57 of file fileparser.py.

Constructor & Destructor Documentation

◆ __init__()

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

Member Function Documentation

◆ CreateCopyrightBlock()

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()

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

Member Data Documentation

◆ _comment_pattern

fileparser.CParser._comment_pattern
protected

Definition at line 74 of file fileparser.py.

◆ COPYRIGHT_BLOCK_FORMAT

str 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

str fileparser.CParser.DEFAULT_HOLDER = 'Google Inc.'
static

Definition at line 62 of file fileparser.py.

◆ DEFAULT_YEAR

fileparser.CParser.DEFAULT_YEAR = datetime.date.today().year
static

Definition at line 61 of file fileparser.py.


The documentation for this class was generated from the following file: