/*++ @file\r
Vfr Syntax\r
\r
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
--*/\r
\r
//\r
// Define a lexical class for parsing quoted strings. Basically\r
// starts with a double quote, and ends with a double quote that\r
-// is not preceeded with a backslash.\r
+// is not preceded with a backslash.\r
//\r
#lexclass QUOTED_STRING\r
#token TheString "~[\"]*\"" << mode (START); >>\r
;\r
\r
//\r
-// keep classDeinition and validClassNames for compatibility but not generate\r
+// keep classDefinition and validClassNames for compatibility but not generate\r
// any IFR object\r
//\r
classDefinition[UINT16 & Class] :\r
// Root expression extension function called by other function.\r
//\r
vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :\r
- << if ($RootLevel == 0) {mCIfrOpHdrIndex ++; if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!"); _CLEAR_SAVED_OPHDR ();} >>\r
+ <<\r
+ if ($RootLevel == 0) {\r
+ mCIfrOpHdrIndex ++;\r
+ if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) {\r
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!");\r
+ }\r
+ _INIT_OPHDR_COND ();\r
+ }\r
+ >>\r
andTerm[$RootLevel, $ExpOpCount]\r
(\r
L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>\r
\r
//\r
// Add new sub function for the sub expression extension to remember the ExpOpCount\r
-// This funciton is only called by sub expression.\r
+// This function is only called by sub expression.\r
//\r
vfrStatementExpressionSub [UINT32 RootLevel, UINT32 & ExpOpCount] :\r
andTerm[$RootLevel, $ExpOpCount]\r
UINT8 mCIfrOpHdrIndex;\r
VOID _SAVE_OPHDR_COND (IN CIfrOpHeader &, IN BOOLEAN, UINT32 LineNo = 0);\r
VOID _CLEAR_SAVED_OPHDR (VOID);\r
+ VOID _INIT_OPHDR_COND (VOID);\r
BOOLEAN _SET_SAVED_OPHDR_SCOPE (VOID);\r
\r
\r
}\r
}\r
\r
+VOID\r
+EfiVfrParser::_INIT_OPHDR_COND (\r
+ VOID\r
+ )\r
+{\r
+ mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;\r
+ mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;\r
+}\r
+\r
VOID\r
EfiVfrParser::_CLEAR_SAVED_OPHDR (\r
VOID\r
{\r
if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {\r
delete mCIfrOpHdr[mCIfrOpHdrIndex];\r
- mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;\r
+ mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;\r
}\r
- mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;\r
}\r
\r
BOOLEAN\r
}\r
if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue))) {\r
sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT8", OrigString);\r
- gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
}\r
}\r
\r
}\r
if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue))) {\r
sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT16", OrigString);\r
- gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
}\r
}\r
\r
}\r
if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue ))) {\r
sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT32", OrigString);\r
- gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
}\r
}\r
\r
}\r
if((IsHex && ((Value/16) != PreviousValue)) || ((!IsHex && (Value/10) != PreviousValue))) {\r
sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT64", OrigString);\r
- gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
+ mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (VFR_RETURN_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);\r
}\r
}\r
\r
VSEObj.SetAttributes (0x00000002); //hardcode EFI_VARIABLE_BOOTSERVICE_ACCESS attribute\r
VSEObj.SetGuid (&pNode->mGuid);\r
VSEObj.SetVarStoreId (pNode->mVarStoreId);\r
- // Generate old efi varstore storage structure for compatiable with old "VarEqVal" opcode,\r
+ // Generate old efi varstore storage structure for compatible with old "VarEqVal" opcode,\r
// which is 3 bytes less than new structure define in UEFI Spec 2.3.1.\r
VSEObj.SetBinaryLength (sizeof (EFI_IFR_VARSTORE_EFI) - 3);\r
#ifdef VFREXP_DEBUG\r