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

Public Member Functions

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

Static Public Attributes

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

Detailed Description

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

Definition at line 57 of file fileparser.py.

Constructor & Destructor Documentation

◆ __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

Member Function Documentation

◆ 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

Member Data Documentation

◆ 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

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: