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 <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Yunhua Feng
2018-06-17 17:22:21 +08:00
committed by Yonghong Zhu
parent 58cf30f71f
commit 09ef8e9258
4 changed files with 24 additions and 2 deletions

View File

@ -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