MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / FdfParser

Class FdfParser

BaseTools/Source/Python/GenFds/FdfParser.py:241–4498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239# Get*** procedures mean these procedures will make judgement on current token only.
240#
241class FdfParser:
242 ## The constructor
243 #
244 # @param self The object pointer
245 # @param FileName The file that to be parsed
246 #
247 def __init__(self, FileName):
248 self.Profile = FileProfile(FileName)
249 self.FileName = FileName
250 self.CurrentLineNumber = 1
251 self.CurrentOffsetWithinLine = 0
252 self.CurrentFdName = None
253 self.CurrentFvName = None
254 self._Token = ""
255 self._SkippedChars = ""
256 GlobalData.gFdfParser = self
257
258 # Used to section info
259 self._CurSection = []
260 # Key: [section name, UI name, arch]
261 # Value: {MACRO_NAME: MACRO_VALUE}
262 self._MacroDict = tdict(True, 3)
263 self._PcdDict = OrderedDict()
264
265 self._WipeOffArea = []
266 if GenFdsGlobalVariable.WorkSpaceDir == '':
267 GenFdsGlobalVariable.WorkSpaceDir = os.getenv("WORKSPACE")
268
269 ## _SkipWhiteSpace() method
270 #
271 # Skip white spaces from current char.
272 #
273 # @param self The object pointer
274 #
275 def _SkipWhiteSpace(self):
276 while not self._EndOfFile():
277 if self._CurrentChar() in {TAB_PRINTCHAR_NUL, T_CHAR_CR, TAB_LINE_BREAK, TAB_SPACE_SPLIT, T_CHAR_TAB}:
278 self._SkippedChars += str(self._CurrentChar())
279 self._GetOneChar()
280 else:
281 return
282 return
283
284 ## _EndOfFile() method
285 #
286 # Judge current buffer pos is at file end
287 #
288 # @param self The object pointer
289 # @retval True Current File buffer position is at file end
290 # @retval False Current File buffer position is NOT at file end
291 #
292 def _EndOfFile(self):
293 NumberOfLines = len(self.Profile.FileLinesList)
294 SizeOfLastLine = len(self.Profile.FileLinesList[-1])
295 if self.CurrentLineNumber == NumberOfLines and self.CurrentOffsetWithinLine >= SizeOfLastLine - 1:
296 return True
297 if self.CurrentLineNumber > NumberOfLines:
298 return True

Callers 4

GenFdsApiFunction · 0.90
LoadFdfFileMethod · 0.90
FdfProfileMethod · 0.90
FdfParser.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected