summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/FdfParser.py
diff options
context:
space:
mode:
authorYunhua Feng <yunhuax.feng@intel.com>2018-06-17 17:22:21 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-06-22 13:38:40 +0800
commit09ef8e92580caddc24f8f1db6ea0e8223890085f (patch)
tree98649a1da3637d25ba4ebb941b1d92b7388e8b54 /BaseTools/Source/Python/GenFds/FdfParser.py
parent58cf30f71f03bcf2fbf369d51e05c8f17176e129 (diff)
downloadedk2-09ef8e92580caddc24f8f1db6ea0e8223890085f.tar.gz
edk2-09ef8e92580caddc24f8f1db6ea0e8223890085f.tar.bz2
edk2-09ef8e92580caddc24f8f1db6ea0e8223890085f.zip
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>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/FdfParser.py')
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py12
1 files changed, 12 insertions, 0 deletions
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