From 09ef8e92580caddc24f8f1db6ea0e8223890085f Mon Sep 17 00:00:00 2001 From: Yunhua Feng Date: Sun, 17 Jun 2018 17:22:21 +0800 Subject: BaseTools: introduce !error statement The DSC and FDF file can use `!error` statement. The argument of this statement is an error message, it causes build tool to stop at the location where the statement is encountered and error message following the `!error` statement is output as a message. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=701 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/GenFds/FdfParser.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'BaseTools/Source/Python/GenFds/FdfParser.py') diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 78cb049c61..ceedcf8a28 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1361,6 +1361,7 @@ class FdfParser: try: self.Preprocess() + self.__GetError() # # Keep processing sections of the FDF until no new sections or a syntax error is found # @@ -1441,6 +1442,17 @@ class FdfParser: return False + ##__GetError() method + def __GetError(self): + #save the Current information + CurrentLine = self.CurrentLineNumber + CurrentOffset = self.CurrentOffsetWithinLine + while self.__GetNextToken(): + if self.__Token == TAB_ERROR: + EdkLogger.error('FdfParser', ERROR_STATEMENT, self.__CurrentLine().replace(TAB_ERROR, '', 1), File=self.FileName, Line=self.CurrentLineNumber) + self.CurrentLineNumber = CurrentLine + self.CurrentOffsetWithinLine = CurrentOffset + ## __GetFd() method # # Get FD section contents and store its data into FD dictionary of self.Profile -- cgit v1.2.3