]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/Ecc/FileProfile.py
BaseTools/ECC: Fix an issue of parameter parser
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / FileProfile.py
CommitLineData
30fdf114
LG
1## @file\r
2# fragments of source file\r
3#\r
1be2ed90 4# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
30fdf114 5#\r
40d841f6 6# This program and the accompanying materials\r
30fdf114
LG
7# are licensed and made available under the terms and conditions of the BSD License\r
8# which accompanies this distribution. The full text of the license may be found at\r
9# http://opensource.org/licenses/bsd-license.php\r
10#\r
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13#\r
14\r
15##\r
16# Import Modules\r
17#\r
18\r
19import re\r
1be2ed90 20import Common.LongFilePathOs as os\r
30fdf114 21from ParserWarning import Warning\r
1be2ed90 22from Common.LongFilePathSupport import OpenLongFilePath as open\r
30fdf114
LG
23\r
24CommentList = []\r
25PPDirectiveList = []\r
26PredicateExpressionList = []\r
27FunctionDefinitionList = []\r
28VariableDeclarationList = []\r
29EnumerationDefinitionList = []\r
30StructUnionDefinitionList = []\r
31TypedefDefinitionList = []\r
32FunctionCallingList = []\r
33\r
34## record file data when parsing source\r
35#\r
36# May raise Exception when opening file.\r
37#\r
38class FileProfile :\r
39 \r
40 ## The constructor\r
41 #\r
42 # @param self The object pointer\r
43 # @param FileName The file that to be parsed\r
44 #\r
45 def __init__(self, FileName):\r
46 self.FileLinesList = []\r
47 self.FileLinesListFromFile = []\r
48 try:\r
49 fsock = open(FileName, "rb", 0)\r
50 try:\r
51 self.FileLinesListFromFile = fsock.readlines()\r
52 finally:\r
53 fsock.close()\r
54\r
55 except IOError:\r
56 raise Warning("Error when opening file %s" % FileName)\r
57 \r
58