2 # This file is used to parse meta files
4 # Copyright (c) 2008, Intel Corporation
5 # All rights reserved. This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 import Common
.EdkLogger
as EdkLogger
21 from CommonDataClass
.DataClass
import *
22 from Common
.DataType
import *
23 from Common
.String
import *
24 from Common
.Misc
import Blist
, GuidStructureStringToGuidString
, CheckPcdDatum
26 ## Base class of parser
28 # This class is used for derivation purpose. The specific parser for one kind
29 # type file must derive this class and implement some public interfaces.
31 # @param FilePath The path of platform description file
32 # @param FileType The raw data of DSC file
33 # @param Table Database used to retrieve module/package information
34 # @param Macros Macros used for replacement in file
35 # @param Owner Owner ID (for sub-section parsing)
36 # @param From ID from which the data comes (for !INCLUDE directive)
38 class MetaFileParser(object):
39 # data type (file content) for specific file type
42 ## Constructor of MetaFileParser
44 # Initialize object of MetaFileParser
46 # @param FilePath The path of platform description file
47 # @param FileType The raw data of DSC file
48 # @param Table Database used to retrieve module/package information
49 # @param Macros Macros used for replacement in file
50 # @param Owner Owner ID (for sub-section parsing)
51 # @param From ID from which the data comes (for !INCLUDE directive)
53 def __init__(self
, FilePath
, FileType
, Table
, Macros
=None, Owner
=-1, From
=-1):
55 self
._FileType
= FileType
56 self
.MetaFile
= FilePath
57 self
._FileDir
= os
.path
.dirname(self
.MetaFile
)
60 # for recursive parsing
64 # parsr status for parsing
66 self
._ValueList
= ['', '', '', '', '']
69 self
._CurrentLine
= ''
70 self
._SectionType
= MODEL_UNKNOWN
71 self
._SectionName
= ''
72 self
._InSubsection
= False
73 self
._SubsectionType
= MODEL_UNKNOWN
74 self
._SubsectionName
= ''
77 self
._Finished
= False
79 ## Store the parsed data in table
80 def _Store(self
, *Args
):
81 return self
._Table
.Insert(*Args
)
83 ## Virtual method for starting parse
85 raise NotImplementedError
87 ## Set parsing complete flag in both class and table
90 self
._Table
.SetEndFlag()
92 ## Return the table containg parsed data
94 # If the parse complete flag is not set, this method will try to parse the
95 # file before return the table
98 if not self
._Finished
:
102 ## Get the parse complete flag
103 def _GetFinished(self
):
104 return self
._Finished
106 ## Set the complete flag
107 def _SetFinished(self
, Value
):
108 self
._Finished
= Value
110 ## Use [] style to query data in table, just for readability
112 # DataInfo = [data_type, scope1(arch), scope2(platform,moduletype)]
114 def __getitem__(self
, DataInfo
):
115 if type(DataInfo
) != type(()):
116 DataInfo
= (DataInfo
,)
117 return self
.Table
.Query(*DataInfo
)
119 ## Data parser for the common format in different type of file
121 # The common format in the meatfile is like
125 def _CommonParser(self
):
126 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
)
127 self
._ValueList
[0:len(TokenList
)] = TokenList
129 ## Data parser for the format in which there's path
131 # Only path can have macro used. So we need to replace them before use.
133 def _PathParser(self
):
134 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
)
135 self
._ValueList
[0:len(TokenList
)] = TokenList
136 if len(self
._Macros
) > 0:
137 for Index
in range(0, len(self
._ValueList
)):
138 Value
= self
._ValueList
[Index
]
139 if Value
== None or Value
== '':
141 self
._ValueList
[Index
] = NormPath(Value
, self
._Macros
)
143 ## Skip unsupported data
145 EdkLogger
.warn("Parser", "Unrecognized content", File
=self
.MetaFile
,
146 Line
=self
._LineIndex
+1, ExtraData
=self
._CurrentLine
);
147 self
._ValueList
[0:1] = [self
._CurrentLine
]
149 ## Section header parser
151 # The section header is always in following format:
153 # [section_name.arch<.platform|module_type>]
155 def _SectionHeaderParser(self
):
157 self
._SectionName
= ''
159 for Item
in GetSplitValueList(self
._CurrentLine
[1:-1], TAB_COMMA_SPLIT
):
162 ItemList
= GetSplitValueList(Item
, TAB_SPLIT
)
163 # different section should not mix in one section
164 if self
._SectionName
!= '' and self
._SectionName
!= ItemList
[0].upper():
165 EdkLogger
.error('Parser', FORMAT_INVALID
, "Different section names in the same section",
166 File
=self
.MetaFile
, Line
=self
._LineIndex
+1, ExtraData
=self
._CurrentLine
)
167 self
._SectionName
= ItemList
[0].upper()
168 if self
._SectionName
in self
.DataType
:
169 self
._SectionType
= self
.DataType
[self
._SectionName
]
171 self
._SectionType
= MODEL_UNKNOWN
172 EdkLogger
.warn("Parser", "Unrecognized section", File
=self
.MetaFile
,
173 Line
=self
._LineIndex
+1, ExtraData
=self
._CurrentLine
)
175 if len(ItemList
) > 1:
176 S1
= ItemList
[1].upper()
180 # S2 may be Platform or ModuleType
181 if len(ItemList
) > 2:
182 S2
= ItemList
[2].upper()
185 self
._Scope
.append([S1
, S2
])
187 # 'COMMON' must not be used with specific ARCHs at the same section
188 if 'COMMON' in ArchList
and len(ArchList
) > 1:
189 EdkLogger
.error('Parser', FORMAT_INVALID
, "'common' ARCH must not be used with specific ARCHs",
190 File
=self
.MetaFile
, Line
=self
._LineIndex
+1, ExtraData
=self
._CurrentLine
)
192 ## [defines] section parser
193 def _DefineParser(self
):
194 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_EQUAL_SPLIT
, 1)
195 self
._ValueList
[0:len(TokenList
)] = TokenList
196 if self
._ValueList
[1] == '':
197 EdkLogger
.error('Parser', FORMAT_INVALID
, "No value specified",
198 ExtraData
=self
._CurrentLine
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
200 ## DEFINE name=value parser
201 def _MacroParser(self
):
202 TokenList
= GetSplitValueList(self
._CurrentLine
, ' ', 1)
203 MacroType
= TokenList
[0]
204 if len(TokenList
) < 2 or TokenList
[1] == '':
205 EdkLogger
.error('Parser', FORMAT_INVALID
, "No macro name/value given",
206 ExtraData
=self
._CurrentLine
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
207 TokenList
= GetSplitValueList(TokenList
[1], TAB_EQUAL_SPLIT
, 1)
208 if TokenList
[0] == '':
209 EdkLogger
.error('Parser', FORMAT_INVALID
, "No macro name given",
210 ExtraData
=self
._CurrentLine
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
211 if len(TokenList
) == 1:
212 self
._Macros
[TokenList
[0]] = ''
214 # keep the macro definition for later use
215 self
._Macros
[TokenList
[0]] = ReplaceMacro(TokenList
[1], self
._Macros
, False)
217 return TokenList
[0], self
._Macros
[TokenList
[0]]
219 ## [BuildOptions] section parser
220 def _BuildOptionParser(self
):
221 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_EQUAL_SPLIT
, 1)
222 TokenList2
= GetSplitValueList(TokenList
[0], ':', 1)
223 if len(TokenList2
) == 2:
224 self
._ValueList
[0] = TokenList2
[0] # toolchain family
225 self
._ValueList
[1] = TokenList2
[1] # keys
227 self
._ValueList
[1] = TokenList
[0]
228 if len(TokenList
) == 2: # value
229 self
._ValueList
[2] = ReplaceMacro(TokenList
[1], self
._Macros
)
231 if self
._ValueList
[1].count('_') != 4:
235 "'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self
._ValueList
[1],
236 ExtraData
=self
._CurrentLine
,
238 Line
=self
._LineIndex
+1
242 Table
= property(_GetTable
)
243 Finished
= property(_GetFinished
, _SetFinished
)
246 ## INF file parser class
248 # @param FilePath The path of platform description file
249 # @param FileType The raw data of DSC file
250 # @param Table Database used to retrieve module/package information
251 # @param Macros Macros used for replacement in file
253 class InfParser(MetaFileParser
):
254 # INF file supported data types (one type per section)
256 TAB_UNKNOWN
.upper() : MODEL_UNKNOWN
,
257 TAB_INF_DEFINES
.upper() : MODEL_META_DATA_HEADER
,
258 TAB_BUILD_OPTIONS
.upper() : MODEL_META_DATA_BUILD_OPTION
,
259 TAB_INCLUDES
.upper() : MODEL_EFI_INCLUDE
,
260 TAB_LIBRARIES
.upper() : MODEL_EFI_LIBRARY_INSTANCE
,
261 TAB_LIBRARY_CLASSES
.upper() : MODEL_EFI_LIBRARY_CLASS
,
262 TAB_PACKAGES
.upper() : MODEL_META_DATA_PACKAGE
,
263 TAB_NMAKE
.upper() : MODEL_META_DATA_NMAKE
,
264 TAB_INF_FIXED_PCD
.upper() : MODEL_PCD_FIXED_AT_BUILD
,
265 TAB_INF_PATCH_PCD
.upper() : MODEL_PCD_PATCHABLE_IN_MODULE
,
266 TAB_INF_FEATURE_PCD
.upper() : MODEL_PCD_FEATURE_FLAG
,
267 TAB_INF_PCD_EX
.upper() : MODEL_PCD_DYNAMIC_EX
,
268 TAB_INF_PCD
.upper() : MODEL_PCD_DYNAMIC
,
269 TAB_SOURCES
.upper() : MODEL_EFI_SOURCE_FILE
,
270 TAB_GUIDS
.upper() : MODEL_EFI_GUID
,
271 TAB_PROTOCOLS
.upper() : MODEL_EFI_PROTOCOL
,
272 TAB_PPIS
.upper() : MODEL_EFI_PPI
,
273 TAB_DEPEX
.upper() : MODEL_EFI_DEPEX
,
274 TAB_BINARIES
.upper() : MODEL_EFI_BINARY_FILE
,
275 TAB_USER_EXTENSIONS
.upper() : MODEL_META_DATA_USER_EXTENSION
278 ## Constructor of InfParser
280 # Initialize object of InfParser
282 # @param FilePath The path of module description file
283 # @param FileType The raw data of DSC file
284 # @param Table Database used to retrieve module/package information
285 # @param Macros Macros used for replacement in file
287 def __init__(self
, FilePath
, FileType
, Table
, Macros
=None):
288 MetaFileParser
.__init
__(self
, FilePath
, FileType
, Table
, Macros
)
294 self
._Content
= open(self
.MetaFile
, 'r').readlines()
296 EdkLogger
.error("Parser", FILE_READ_FAILURE
, ExtraData
=self
.MetaFile
)
298 # parse the file line by line
299 IsFindBlockComment
= False
301 for Index
in range(0, len(self
._Content
)):
302 # skip empty, commented, block commented lines
303 Line
= CleanString(self
._Content
[Index
], AllowCppStyleComment
=True)
305 if Index
+ 1 < len(self
._Content
):
306 NextLine
= CleanString(self
._Content
[Index
+ 1])
309 if Line
.find(DataType
.TAB_COMMENT_R8_START
) > -1:
310 IsFindBlockComment
= True
312 if Line
.find(DataType
.TAB_COMMENT_R8_END
) > -1:
313 IsFindBlockComment
= False
315 if IsFindBlockComment
:
318 self
._LineIndex
= Index
319 self
._CurrentLine
= Line
322 if Line
[0] == TAB_SECTION_START
and Line
[-1] == TAB_SECTION_END
:
323 self
._SectionHeaderParser
()
325 # merge two lines specified by '\' in section NMAKE
326 elif self
._SectionType
== MODEL_META_DATA_NMAKE
:
329 self
._CurrentLine
= NmakeLine
+ Line
[0:-1]
332 if NextLine
[0] == TAB_SECTION_START
and NextLine
[-1] == TAB_SECTION_END
:
333 self
._CurrentLine
= NmakeLine
+ Line
[0:-1]
336 NmakeLine
= NmakeLine
+ ' ' + Line
[0:-1]
339 self
._CurrentLine
= NmakeLine
+ Line
341 elif Line
.upper().startswith('DEFINE '):
342 # file private macros
347 self
._ValueList
= ['','','']
348 # parse current line, result will be put in self._ValueList
349 self
._SectionParser
[self
._SectionType
](self
)
350 if self
._ValueList
== None:
353 # Model, Value1, Value2, Value3, Arch, Platform, BelongsToItem=-1,
354 # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
356 for Arch
, Platform
in self
._Scope
:
357 self
._Store
(self
._SectionType
,
372 ## Data parser for the format in which there's path
374 # Only path can have macro used. So we need to replace them before use.
376 def _IncludeParser(self
):
377 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
)
378 self
._ValueList
[0:len(TokenList
)] = TokenList
379 if len(self
._Macros
) > 0:
380 for Index
in range(0, len(self
._ValueList
)):
381 Value
= self
._ValueList
[Index
]
382 if Value
.upper().find('$(EFI_SOURCE)\Edk'.upper()) > -1 or Value
.upper().find('$(EFI_SOURCE)/Edk'.upper()) > -1:
383 Value
= '$(EDK_SOURCE)' + Value
[17:]
384 if Value
.find('$(EFI_SOURCE)') > -1 or Value
.find('$(EDK_SOURCE)') > -1:
386 elif Value
.startswith('.'):
388 elif Value
.startswith('$('):
391 Value
= '$(EFI_SOURCE)/' + Value
393 if Value
== None or Value
== '':
395 self
._ValueList
[Index
] = NormPath(Value
, self
._Macros
)
397 ## Parse [Sources] section
399 # Only path can have macro used. So we need to replace them before use.
401 def _SourceFileParser(self
):
402 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
)
403 self
._ValueList
[0:len(TokenList
)] = TokenList
404 # For Acpi tables, remove macro like ' TABLE_NAME=Sata1'
405 if 'COMPONENT_TYPE' in self
._Macros
:
406 if self
._Macros
['COMPONENT_TYPE'].upper() == 'ACPITABLE':
407 self
._ValueList
[0] = GetSplitValueList(self
._ValueList
[0], ' ', 1)[0]
408 if self
._Macros
['BASE_NAME'] == 'Microcode':
410 if len(self
._Macros
) > 0:
411 for Index
in range(0, len(self
._ValueList
)):
412 Value
= self
._ValueList
[Index
]
413 if Value
== None or Value
== '':
415 self
._ValueList
[Index
] = NormPath(Value
, self
._Macros
)
417 ## Parse [Binaries] section
419 # Only path can have macro used. So we need to replace them before use.
421 def _BinaryFileParser(self
):
422 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
, 2)
423 if len(TokenList
) < 2:
424 EdkLogger
.error('Parser', FORMAT_INVALID
, "No file type or path specified",
425 ExtraData
=self
._CurrentLine
+ " (<FileType> | <FilePath> [| <Target>])",
426 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
428 EdkLogger
.error('Parser', FORMAT_INVALID
, "No file type specified",
429 ExtraData
=self
._CurrentLine
+ " (<FileType> | <FilePath> [| <Target>])",
430 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
432 EdkLogger
.error('Parser', FORMAT_INVALID
, "No file path specified",
433 ExtraData
=self
._CurrentLine
+ " (<FileType> | <FilePath> [| <Target>])",
434 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
435 self
._ValueList
[0:len(TokenList
)] = TokenList
436 self
._ValueList
[1] = NormPath(self
._ValueList
[1], self
._Macros
)
438 ## [defines] section parser
439 def _DefineParser(self
):
440 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_EQUAL_SPLIT
, 1)
441 self
._ValueList
[0:len(TokenList
)] = TokenList
442 self
._Macros
[TokenList
[0]] = ReplaceMacro(TokenList
[1], self
._Macros
, False)
443 if self
._ValueList
[1] == '':
444 EdkLogger
.error('Parser', FORMAT_INVALID
, "No value specified",
445 ExtraData
=self
._CurrentLine
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
447 ## [nmake] section parser (R8.x style only)
448 def _NmakeParser(self
):
449 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_EQUAL_SPLIT
, 1)
450 self
._ValueList
[0:len(TokenList
)] = TokenList
452 self
._ValueList
[1] = ReplaceMacro(self
._ValueList
[1], self
._Macros
, False)
453 # remove self-reference in macro setting
454 #self._ValueList[1] = ReplaceMacro(self._ValueList[1], {self._ValueList[0]:''})
456 ## [FixedPcd], [FeaturePcd], [PatchPcd], [Pcd] and [PcdEx] sections parser
457 def _PcdParser(self
):
458 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
, 1)
459 self
._ValueList
[0:1] = GetSplitValueList(TokenList
[0], TAB_SPLIT
)
460 if len(TokenList
) > 1:
461 self
._ValueList
[2] = TokenList
[1]
462 if self
._ValueList
[0] == '' or self
._ValueList
[1] == '':
463 EdkLogger
.error('Parser', FORMAT_INVALID
, "No token space GUID or PCD name specified",
464 ExtraData
=self
._CurrentLine
+ " (<TokenSpaceGuidCName>.<PcdCName>)",
465 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
467 ## [depex] section parser
468 def _DepexParser(self
):
469 self
._ValueList
[0:1] = [self
._CurrentLine
]
472 MODEL_UNKNOWN
: MetaFileParser
._Skip
,
473 MODEL_META_DATA_HEADER
: _DefineParser
,
474 MODEL_META_DATA_BUILD_OPTION
: MetaFileParser
._BuildOptionParser
,
475 MODEL_EFI_INCLUDE
: _IncludeParser
, # for R8.x modules
476 MODEL_EFI_LIBRARY_INSTANCE
: MetaFileParser
._CommonParser
, # for R8.x modules
477 MODEL_EFI_LIBRARY_CLASS
: MetaFileParser
._PathParser
,
478 MODEL_META_DATA_PACKAGE
: MetaFileParser
._PathParser
,
479 MODEL_META_DATA_NMAKE
: _NmakeParser
, # for R8.x modules
480 MODEL_PCD_FIXED_AT_BUILD
: _PcdParser
,
481 MODEL_PCD_PATCHABLE_IN_MODULE
: _PcdParser
,
482 MODEL_PCD_FEATURE_FLAG
: _PcdParser
,
483 MODEL_PCD_DYNAMIC_EX
: _PcdParser
,
484 MODEL_PCD_DYNAMIC
: _PcdParser
,
485 MODEL_EFI_SOURCE_FILE
: _SourceFileParser
,
486 MODEL_EFI_GUID
: MetaFileParser
._CommonParser
,
487 MODEL_EFI_PROTOCOL
: MetaFileParser
._CommonParser
,
488 MODEL_EFI_PPI
: MetaFileParser
._CommonParser
,
489 MODEL_EFI_DEPEX
: _DepexParser
,
490 MODEL_EFI_BINARY_FILE
: _BinaryFileParser
,
491 MODEL_META_DATA_USER_EXTENSION
: MetaFileParser
._Skip
,
494 ## DSC file parser class
496 # @param FilePath The path of platform description file
497 # @param FileType The raw data of DSC file
498 # @param Table Database used to retrieve module/package information
499 # @param Macros Macros used for replacement in file
500 # @param Owner Owner ID (for sub-section parsing)
501 # @param From ID from which the data comes (for !INCLUDE directive)
503 class DscParser(MetaFileParser
):
504 # DSC file supported data types (one type per section)
506 TAB_SKUIDS
.upper() : MODEL_EFI_SKU_ID
,
507 TAB_LIBRARIES
.upper() : MODEL_EFI_LIBRARY_INSTANCE
,
508 TAB_LIBRARY_CLASSES
.upper() : MODEL_EFI_LIBRARY_CLASS
,
509 TAB_BUILD_OPTIONS
.upper() : MODEL_META_DATA_BUILD_OPTION
,
510 TAB_PCDS_FIXED_AT_BUILD_NULL
.upper() : MODEL_PCD_FIXED_AT_BUILD
,
511 TAB_PCDS_PATCHABLE_IN_MODULE_NULL
.upper() : MODEL_PCD_PATCHABLE_IN_MODULE
,
512 TAB_PCDS_FEATURE_FLAG_NULL
.upper() : MODEL_PCD_FEATURE_FLAG
,
513 TAB_PCDS_DYNAMIC_DEFAULT_NULL
.upper() : MODEL_PCD_DYNAMIC_DEFAULT
,
514 TAB_PCDS_DYNAMIC_HII_NULL
.upper() : MODEL_PCD_DYNAMIC_HII
,
515 TAB_PCDS_DYNAMIC_VPD_NULL
.upper() : MODEL_PCD_DYNAMIC_VPD
,
516 TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL
.upper() : MODEL_PCD_DYNAMIC_EX_DEFAULT
,
517 TAB_PCDS_DYNAMIC_EX_HII_NULL
.upper() : MODEL_PCD_DYNAMIC_EX_HII
,
518 TAB_PCDS_DYNAMIC_EX_VPD_NULL
.upper() : MODEL_PCD_DYNAMIC_EX_VPD
,
519 TAB_COMPONENTS
.upper() : MODEL_META_DATA_COMPONENT
,
520 TAB_COMPONENTS_SOURCE_OVERRIDE_PATH
.upper() : MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH
,
521 TAB_DSC_DEFINES
.upper() : MODEL_META_DATA_HEADER
,
522 TAB_INCLUDE
.upper() : MODEL_META_DATA_INCLUDE
,
523 TAB_IF
.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IF
,
524 TAB_IF_DEF
.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF
,
525 TAB_IF_N_DEF
.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF
,
526 TAB_ELSE_IF
.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF
,
527 TAB_ELSE
.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE
,
528 TAB_END_IF
.upper() : MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF
,
531 # sections which allow "!include" directive
532 _IncludeAllowedSection
= [
533 TAB_LIBRARIES
.upper(),
534 TAB_LIBRARY_CLASSES
.upper(),
536 TAB_COMPONENTS
.upper(),
537 TAB_BUILD_OPTIONS
.upper(),
538 TAB_PCDS_FIXED_AT_BUILD_NULL
.upper(),
539 TAB_PCDS_PATCHABLE_IN_MODULE_NULL
.upper(),
540 TAB_PCDS_FEATURE_FLAG_NULL
.upper(),
541 TAB_PCDS_DYNAMIC_DEFAULT_NULL
.upper(),
542 TAB_PCDS_DYNAMIC_HII_NULL
.upper(),
543 TAB_PCDS_DYNAMIC_VPD_NULL
.upper(),
544 TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL
.upper(),
545 TAB_PCDS_DYNAMIC_EX_HII_NULL
.upper(),
546 TAB_PCDS_DYNAMIC_EX_VPD_NULL
.upper(),
549 # operators which can be used in "!if/!ifdef/!ifndef" directives
551 "!" : lambda a
: not a
,
552 "!=" : lambda a
,b
: a
!=b
,
553 "==" : lambda a
,b
: a
==b
,
554 ">" : lambda a
,b
: a
>b
,
555 "<" : lambda a
,b
: a
<b
,
556 "=>" : lambda a
,b
: a
>=b
,
557 ">=" : lambda a
,b
: a
>=b
,
558 "<=" : lambda a
,b
: a
<=b
,
559 "=<" : lambda a
,b
: a
<=b
,
562 ## Constructor of DscParser
564 # Initialize object of DscParser
566 # @param FilePath The path of platform description file
567 # @param FileType The raw data of DSC file
568 # @param Table Database used to retrieve module/package information
569 # @param Macros Macros used for replacement in file
570 # @param Owner Owner ID (for sub-section parsing)
571 # @param From ID from which the data comes (for !INCLUDE directive)
573 def __init__(self
, FilePath
, FileType
, Table
, Macros
=None, Owner
=-1, From
=-1):
574 MetaFileParser
.__init
__(self
, FilePath
, FileType
, Table
, Macros
, Owner
, From
)
575 # to store conditional directive evaluation result
581 if self
._Content
== None:
582 self
._Content
= open(self
.MetaFile
, 'r').readlines()
584 EdkLogger
.error("Parser", FILE_READ_FAILURE
, ExtraData
=self
.MetaFile
)
586 for Index
in range(0, len(self
._Content
)):
587 Line
= CleanString(self
._Content
[Index
])
591 self
._CurrentLine
= Line
592 self
._LineIndex
= Index
595 if Line
[0] == TAB_SECTION_START
and Line
[-1] == TAB_SECTION_END
:
596 self
._SectionHeaderParser
()
600 self
._InSubsection
= False
601 self
._SubsectionType
= MODEL_UNKNOWN
602 self
._SubsectionName
= ''
606 elif Line
[0] == TAB_OPTION_START
and Line
[-1] == TAB_OPTION_END
:
607 self
._SubsectionHeaderParser
()
611 self
._DirectiveParser
()
613 # file private macros
614 elif Line
.upper().startswith('DEFINE '):
617 elif Line
.upper().startswith('EDK_GLOBAL '):
618 (Name
, Value
) = self
._MacroParser
()
619 for Arch
, ModuleType
in self
._Scope
:
620 self
._LastItem
= self
._Store
(
621 MODEL_META_DATA_DEFINE
,
638 if self
._InSubsection
:
639 SectionType
= self
._SubsectionType
640 SectionName
= self
._SubsectionName
641 if self
._Owner
== -1:
642 self
._Owner
= self
._LastItem
644 SectionType
= self
._SectionType
645 SectionName
= self
._SectionName
647 self
._ValueList
= ['', '', '']
648 self
._SectionParser
[SectionType
](self
)
649 if self
._ValueList
== None:
653 # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
654 # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1
656 for Arch
, ModuleType
in self
._Scope
:
657 self
._LastItem
= self
._Store
(
674 ## [defines] section parser
675 def _DefineParser(self
):
676 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_EQUAL_SPLIT
, 1)
677 if len(TokenList
) < 2:
678 EdkLogger
.error('Parser', FORMAT_INVALID
, "No value specified",
679 ExtraData
=self
._CurrentLine
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
680 # 'FLASH_DEFINITION', 'OUTPUT_DIRECTORY' need special processing
681 if TokenList
[0] in ['FLASH_DEFINITION', 'OUTPUT_DIRECTORY']:
682 TokenList
[1] = NormPath(TokenList
[1], self
._Macros
)
683 self
._ValueList
[0:len(TokenList
)] = TokenList
685 ## <subsection_header> parser
686 def _SubsectionHeaderParser(self
):
687 self
._SubsectionName
= self
._CurrentLine
[1:-1].upper()
688 if self
._SubsectionName
in self
.DataType
:
689 self
._SubsectionType
= self
.DataType
[self
._SubsectionName
]
691 self
._SubsectionType
= MODEL_UNKNOWN
692 EdkLogger
.warn("Parser", "Unrecognized sub-section", File
=self
.MetaFile
,
693 Line
=self
._LineIndex
+1, ExtraData
=self
._CurrentLine
)
695 ## Directive statement parser
696 def _DirectiveParser(self
):
697 self
._ValueList
= ['','','']
698 TokenList
= GetSplitValueList(self
._CurrentLine
, ' ', 1)
699 self
._ValueList
[0:len(TokenList
)] = TokenList
700 DirectiveName
= self
._ValueList
[0].upper()
701 if DirectiveName
not in self
.DataType
:
702 EdkLogger
.error("Parser", FORMAT_INVALID
, "Unknown directive [%s]" % DirectiveName
,
703 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
704 if DirectiveName
in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self
._ValueList
[1] == '':
705 EdkLogger
.error("Parser", FORMAT_INVALID
, "Missing expression",
706 File
=self
.MetaFile
, Line
=self
._LineIndex
+1,
707 ExtraData
=self
._CurrentLine
)
708 # keep the directive in database first
709 self
._LastItem
= self
._Store
(
710 self
.DataType
[DirectiveName
],
725 # process the directive
726 if DirectiveName
== "!INCLUDE":
727 if not self
._SectionName
in self
._IncludeAllowedSection
:
728 EdkLogger
.error("Parser", FORMAT_INVALID
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1,
729 ExtraData
="'!include' is not allowed under section [%s]" % self
._SectionName
)
730 # the included file must be relative to the parsing file
731 IncludedFile
= os
.path
.join(self
._FileDir
, self
._ValueList
[1])
732 Parser
= DscParser(IncludedFile
, self
._FileType
, self
._Table
, self
._Macros
, From
=self
._LastItem
)
733 # set the parser status with current status
734 Parser
._SectionName
= self
._SectionName
735 Parser
._SectionType
= self
._SectionType
736 Parser
._Scope
= self
._Scope
737 Parser
._Enabled
= self
._Enabled
741 EdkLogger
.error("Parser", PARSER_ERROR
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1,
742 ExtraData
="Failed to parse content in file %s" % IncludedFile
)
743 # update current status with sub-parser's status
744 self
._SectionName
= Parser
._SectionName
745 self
._SectionType
= Parser
._SectionType
746 self
._Scope
= Parser
._Scope
747 self
._Enabled
= Parser
._Enabled
749 if DirectiveName
in ["!IF", "!IFDEF", "!IFNDEF"]:
750 # evaluate the expression
751 Result
= self
._Evaluate
(self
._ValueList
[1])
752 if DirectiveName
== "!IFNDEF":
754 self
._Eval
.append(Result
)
755 elif DirectiveName
in ["!ELSEIF"]:
756 # evaluate the expression
757 self
._Eval
[-1] = (not self
._Eval
[-1]) & self
._Evaluate
(self
._ValueList
[1])
758 elif DirectiveName
in ["!ELSE"]:
759 self
._Eval
[-1] = not self
._Eval
[-1]
760 elif DirectiveName
in ["!ENDIF"]:
761 if len(self
._Eval
) > 0:
764 EdkLogger
.error("Parser", FORMAT_INVALID
, "!IF..[!ELSE]..!ENDIF doesn't match",
765 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
766 if self
._Eval
.Result
== False:
767 self
._Enabled
= 0 - len(self
._Eval
)
769 self
._Enabled
= len(self
._Eval
)
771 ## Evaludate the value of expression in "if/ifdef/ifndef" directives
772 def _Evaluate(self
, Expression
):
773 TokenList
= Expression
.split()
774 TokenNumber
= len(TokenList
)
775 # one operand, guess it's just a macro name
777 return TokenList
[0] in self
._Macros
778 # two operands, suppose it's "!xxx" format
779 elif TokenNumber
== 2:
781 if Op
not in self
._OP
_:
782 EdkLogger
.error('Parser', FORMAT_INVALID
, "Unsupported operator [%s]" % Op
, File
=self
.MetaFile
,
783 Line
=self
._LineIndex
+1, ExtraData
=Expression
)
784 if TokenList
[1].upper() == 'TRUE':
788 return self
._OP
_[Op
](Value
)
790 elif TokenNumber
== 3:
792 if Name
not in self
._Macros
:
795 if Value
[0] in ["'", '"'] and Value
[-1] in ["'", '"']:
798 if Op
not in self
._OP
_:
799 EdkLogger
.error('Parser', FORMAT_INVALID
, "Unsupported operator [%s]" % Op
, File
=self
.MetaFile
,
800 Line
=self
._LineIndex
+1, ExtraData
=Expression
)
801 return self
._OP
_[Op
](self
._Macros
[Name
], Value
)
803 EdkLogger
.error('Parser', FORMAT_INVALID
, File
=self
.MetaFile
, Line
=self
._LineIndex
+1,
804 ExtraData
=Expression
)
806 ## PCD sections parser
809 # [PcdsPatchableInModule]
812 # [PcdsDynamicExDefault]
816 # [PcdsDynamicDefault]
820 def _PcdParser(self
):
821 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
, 1)
822 self
._ValueList
[0:1] = GetSplitValueList(TokenList
[0], TAB_SPLIT
)
823 if len(TokenList
) == 2:
824 self
._ValueList
[2] = TokenList
[1]
825 if self
._ValueList
[0] == '' or self
._ValueList
[1] == '':
826 EdkLogger
.error('Parser', FORMAT_INVALID
, "No token space GUID or PCD name specified",
827 ExtraData
=self
._CurrentLine
+ " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
828 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
829 if self
._ValueList
[2] == '':
830 EdkLogger
.error('Parser', FORMAT_INVALID
, "No PCD value given",
831 ExtraData
=self
._CurrentLine
+ " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
832 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
834 ## [components] section parser
835 def _ComponentParser(self
):
836 if self
._CurrentLine
[-1] == '{':
837 self
._ValueList
[0] = self
._CurrentLine
[0:-1].strip()
838 self
._InSubsection
= True
840 self
._ValueList
[0] = self
._CurrentLine
841 if len(self
._Macros
) > 0:
842 self
._ValueList
[0] = NormPath(self
._ValueList
[0], self
._Macros
)
844 def _LibraryClassParser(self
):
845 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
)
846 if len(TokenList
) < 2:
847 EdkLogger
.error('Parser', FORMAT_INVALID
, "No library class or instance specified",
848 ExtraData
=self
._CurrentLine
+ " (<LibraryClassName>|<LibraryInstancePath>)",
849 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
850 if TokenList
[0] == '':
851 EdkLogger
.error('Parser', FORMAT_INVALID
, "No library class specified",
852 ExtraData
=self
._CurrentLine
+ " (<LibraryClassName>|<LibraryInstancePath>)",
853 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
854 if TokenList
[1] == '':
855 EdkLogger
.error('Parser', FORMAT_INVALID
, "No library instance specified",
856 ExtraData
=self
._CurrentLine
+ " (<LibraryClassName>|<LibraryInstancePath>)",
857 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
858 self
._ValueList
[0:len(TokenList
)] = TokenList
859 if len(self
._Macros
) > 0:
860 self
._ValueList
[1] = NormPath(self
._ValueList
[1], self
._Macros
)
862 def _CompponentSourceOverridePathParser(self
):
863 if len(self
._Macros
) > 0:
864 self
._ValueList
[0] = NormPath(self
._CurrentLine
, self
._Macros
)
867 MODEL_META_DATA_HEADER
: _DefineParser
,
868 MODEL_EFI_SKU_ID
: MetaFileParser
._CommonParser
,
869 MODEL_EFI_LIBRARY_INSTANCE
: MetaFileParser
._PathParser
,
870 MODEL_EFI_LIBRARY_CLASS
: _LibraryClassParser
,
871 MODEL_PCD_FIXED_AT_BUILD
: _PcdParser
,
872 MODEL_PCD_PATCHABLE_IN_MODULE
: _PcdParser
,
873 MODEL_PCD_FEATURE_FLAG
: _PcdParser
,
874 MODEL_PCD_DYNAMIC_DEFAULT
: _PcdParser
,
875 MODEL_PCD_DYNAMIC_HII
: _PcdParser
,
876 MODEL_PCD_DYNAMIC_VPD
: _PcdParser
,
877 MODEL_PCD_DYNAMIC_EX_DEFAULT
: _PcdParser
,
878 MODEL_PCD_DYNAMIC_EX_HII
: _PcdParser
,
879 MODEL_PCD_DYNAMIC_EX_VPD
: _PcdParser
,
880 MODEL_META_DATA_COMPONENT
: _ComponentParser
,
881 MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH
: _CompponentSourceOverridePathParser
,
882 MODEL_META_DATA_BUILD_OPTION
: MetaFileParser
._BuildOptionParser
,
883 MODEL_UNKNOWN
: MetaFileParser
._Skip
,
884 MODEL_META_DATA_USER_EXTENSION
: MetaFileParser
._Skip
,
887 ## DEC file parser class
889 # @param FilePath The path of platform description file
890 # @param FileType The raw data of DSC file
891 # @param Table Database used to retrieve module/package information
892 # @param Macros Macros used for replacement in file
894 class DecParser(MetaFileParser
):
895 # DEC file supported data types (one type per section)
897 TAB_DEC_DEFINES
.upper() : MODEL_META_DATA_HEADER
,
898 TAB_INCLUDES
.upper() : MODEL_EFI_INCLUDE
,
899 TAB_LIBRARY_CLASSES
.upper() : MODEL_EFI_LIBRARY_CLASS
,
900 TAB_GUIDS
.upper() : MODEL_EFI_GUID
,
901 TAB_PPIS
.upper() : MODEL_EFI_PPI
,
902 TAB_PROTOCOLS
.upper() : MODEL_EFI_PROTOCOL
,
903 TAB_PCDS_FIXED_AT_BUILD_NULL
.upper() : MODEL_PCD_FIXED_AT_BUILD
,
904 TAB_PCDS_PATCHABLE_IN_MODULE_NULL
.upper() : MODEL_PCD_PATCHABLE_IN_MODULE
,
905 TAB_PCDS_FEATURE_FLAG_NULL
.upper() : MODEL_PCD_FEATURE_FLAG
,
906 TAB_PCDS_DYNAMIC_NULL
.upper() : MODEL_PCD_DYNAMIC
,
907 TAB_PCDS_DYNAMIC_EX_NULL
.upper() : MODEL_PCD_DYNAMIC_EX
,
910 ## Constructor of DecParser
912 # Initialize object of DecParser
914 # @param FilePath The path of platform description file
915 # @param FileType The raw data of DSC file
916 # @param Table Database used to retrieve module/package information
917 # @param Macros Macros used for replacement in file
919 def __init__(self
, FilePath
, FileType
, Table
, Macro
=None):
920 MetaFileParser
.__init
__(self
, FilePath
, FileType
, Table
, Macro
, -1)
925 if self
._Content
== None:
926 self
._Content
= open(self
.MetaFile
, 'r').readlines()
928 EdkLogger
.error("Parser", FILE_READ_FAILURE
, ExtraData
=self
.MetaFile
)
930 for Index
in range(0, len(self
._Content
)):
931 Line
= CleanString(self
._Content
[Index
])
935 self
._CurrentLine
= Line
936 self
._LineIndex
= Index
939 if Line
[0] == TAB_SECTION_START
and Line
[-1] == TAB_SECTION_END
:
940 self
._SectionHeaderParser
()
942 elif Line
.startswith('DEFINE '):
945 elif len(self
._SectionType
) == 0:
949 self
._ValueList
= ['','','']
950 self
._SectionParser
[self
._SectionType
[0]](self
)
951 if self
._ValueList
== None:
955 # Model, Value1, Value2, Value3, Arch, BelongsToItem=-1, LineBegin=-1,
956 # ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, FeatureFlag='', Enabled=-1
958 for Arch
, ModuleType
, Type
in self
._Scope
:
959 self
._LastItem
= self
._Store
(
975 ## Section header parser
977 # The section header is always in following format:
979 # [section_name.arch<.platform|module_type>]
981 def _SectionHeaderParser(self
):
983 self
._SectionName
= ''
984 self
._SectionType
= []
986 for Item
in GetSplitValueList(self
._CurrentLine
[1:-1], TAB_COMMA_SPLIT
):
989 ItemList
= GetSplitValueList(Item
, TAB_SPLIT
)
991 # different types of PCD are permissible in one section
992 self
._SectionName
= ItemList
[0].upper()
993 if self
._SectionName
in self
.DataType
:
994 if self
.DataType
[self
._SectionName
] not in self
._SectionType
:
995 self
._SectionType
.append(self
.DataType
[self
._SectionName
])
997 EdkLogger
.warn("Parser", "Unrecognized section", File
=self
.MetaFile
,
998 Line
=self
._LineIndex
+1, ExtraData
=self
._CurrentLine
)
1001 if MODEL_PCD_FEATURE_FLAG
in self
._SectionType
and len(self
._SectionType
) > 1:
1005 "%s must not be in the same section of other types of PCD" % TAB_PCDS_FEATURE_FLAG_NULL
,
1007 Line
=self
._LineIndex
+1,
1008 ExtraData
=self
._CurrentLine
1011 if len(ItemList
) > 1:
1012 S1
= ItemList
[1].upper()
1016 # S2 may be Platform or ModuleType
1017 if len(ItemList
) > 2:
1018 S2
= ItemList
[2].upper()
1021 if [S1
, S2
, self
.DataType
[self
._SectionName
]] not in self
._Scope
:
1022 self
._Scope
.append([S1
, S2
, self
.DataType
[self
._SectionName
]])
1024 # 'COMMON' must not be used with specific ARCHs at the same section
1025 if 'COMMON' in ArchList
and len(ArchList
) > 1:
1026 EdkLogger
.error('Parser', FORMAT_INVALID
, "'common' ARCH must not be used with specific ARCHs",
1027 File
=self
.MetaFile
, Line
=self
._LineIndex
+1, ExtraData
=self
._CurrentLine
)
1029 ## [guids], [ppis] and [protocols] section parser
1030 def _GuidParser(self
):
1031 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_EQUAL_SPLIT
, 1)
1032 if len(TokenList
) < 2:
1033 EdkLogger
.error('Parser', FORMAT_INVALID
, "No GUID name or value specified",
1034 ExtraData
=self
._CurrentLine
+ " (<CName> = <GuidValueInCFormat>)",
1035 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1036 if TokenList
[0] == '':
1037 EdkLogger
.error('Parser', FORMAT_INVALID
, "No GUID name specified",
1038 ExtraData
=self
._CurrentLine
+ " (<CName> = <GuidValueInCFormat>)",
1039 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1040 if TokenList
[1] == '':
1041 EdkLogger
.error('Parser', FORMAT_INVALID
, "No GUID value specified",
1042 ExtraData
=self
._CurrentLine
+ " (<CName> = <GuidValueInCFormat>)",
1043 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1044 if TokenList
[1][0] != '{' or TokenList
[1][-1] != '}' or GuidStructureStringToGuidString(TokenList
[1]) == '':
1045 EdkLogger
.error('Parser', FORMAT_INVALID
, "Invalid GUID value format",
1046 ExtraData
=self
._CurrentLine
+ \
1047 " (<CName> = <GuidValueInCFormat:{8,4,4,{2,2,2,2,2,2,2,2}}>)",
1048 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1049 self
._ValueList
[0] = TokenList
[0]
1050 self
._ValueList
[1] = TokenList
[1]
1052 ## PCD sections parser
1054 # [PcdsFixedAtBuild]
1055 # [PcdsPatchableInModule]
1060 def _PcdParser(self
):
1061 TokenList
= GetSplitValueList(self
._CurrentLine
, TAB_VALUE_SPLIT
, 1)
1062 self
._ValueList
[0:1] = GetSplitValueList(TokenList
[0], TAB_SPLIT
)
1063 # check PCD information
1064 if self
._ValueList
[0] == '' or self
._ValueList
[1] == '':
1065 EdkLogger
.error('Parser', FORMAT_INVALID
, "No token space GUID or PCD name specified",
1066 ExtraData
=self
._CurrentLine
+ \
1067 " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
1068 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1069 # check PCD datum information
1070 if len(TokenList
) < 2 or TokenList
[1] == '':
1071 EdkLogger
.error('Parser', FORMAT_INVALID
, "No PCD Datum information given",
1072 ExtraData
=self
._CurrentLine
+ \
1073 " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
1074 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1076 ValueList
= GetSplitValueList(TokenList
[1])
1077 # check if there's enough datum information given
1078 if len(ValueList
) != 3:
1079 EdkLogger
.error('Parser', FORMAT_INVALID
, "Invalid PCD Datum information given",
1080 ExtraData
=self
._CurrentLine
+ \
1081 " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
1082 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1083 # check default value
1084 if ValueList
[0] == '':
1085 EdkLogger
.error('Parser', FORMAT_INVALID
, "Missing DefaultValue in PCD Datum information",
1086 ExtraData
=self
._CurrentLine
+ \
1087 " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
1088 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1090 if ValueList
[1] == '':
1091 EdkLogger
.error('Parser', FORMAT_INVALID
, "Missing DatumType in PCD Datum information",
1092 ExtraData
=self
._CurrentLine
+ \
1093 " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
1094 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1095 # check token of the PCD
1096 if ValueList
[2] == '':
1097 EdkLogger
.error('Parser', FORMAT_INVALID
, "Missing Token in PCD Datum information",
1098 ExtraData
=self
._CurrentLine
+ \
1099 " (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
1100 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1101 # check format of default value against the datum type
1102 IsValid
, Cause
= CheckPcdDatum(ValueList
[1], ValueList
[0])
1104 EdkLogger
.error('Parser', FORMAT_INVALID
, Cause
, ExtraData
=self
._CurrentLine
,
1105 File
=self
.MetaFile
, Line
=self
._LineIndex
+1)
1106 self
._ValueList
[2] = TokenList
[1]
1109 MODEL_META_DATA_HEADER
: MetaFileParser
._DefineParser
,
1110 MODEL_EFI_INCLUDE
: MetaFileParser
._PathParser
,
1111 MODEL_EFI_LIBRARY_CLASS
: MetaFileParser
._PathParser
,
1112 MODEL_EFI_GUID
: _GuidParser
,
1113 MODEL_EFI_PPI
: _GuidParser
,
1114 MODEL_EFI_PROTOCOL
: _GuidParser
,
1115 MODEL_PCD_FIXED_AT_BUILD
: _PcdParser
,
1116 MODEL_PCD_PATCHABLE_IN_MODULE
: _PcdParser
,
1117 MODEL_PCD_FEATURE_FLAG
: _PcdParser
,
1118 MODEL_PCD_DYNAMIC
: _PcdParser
,
1119 MODEL_PCD_DYNAMIC_EX
: _PcdParser
,
1120 MODEL_UNKNOWN
: MetaFileParser
._Skip
,
1121 MODEL_META_DATA_USER_EXTENSION
: MetaFileParser
._Skip
,
1126 # This acts like the main() function for the script, unless it is 'import'ed into another
1129 if __name__
== '__main__':