Enhance error handling for disableif statement.
authorlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 13 Apr 2009 05:10:29 +0000 (05:10 +0000)
committerlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 13 Apr 2009 05:10:29 +0000 (05:10 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1549 7335b38e-4728-0410-8992-fb3ffe349368

Source/C/VfrCompile/VfrSyntax.g

index af974ce..d0c7154 100644 (file)
@@ -673,6 +673,7 @@ subclassDefinition[UINT16 & SubClass] :
 vfrStatementDisableIfFormSet :\r
   <<\r
     CIfrDisableIf DIObj;\r
+    mConstantOnlyInExpression = TRUE;\r
   >>\r
   D:DisableIf                                       << DIObj.SetLineNo(D->getLine()); >>\r
   vfrStatementExpression[0] ";"                     << mConstantOnlyInExpression = FALSE; >>\r
@@ -893,14 +894,22 @@ vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
                                                        _STRCAT(&VarIdStr, "[");\r
                                                        _STRCAT(&VarIdStr, I1->getText());\r
                                                        _STRCAT(&VarIdStr, "]");\r
+                                                       mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask);\r
+                                                       if (mConstantOnlyInExpression) {\r
+                                                         _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);\r
+                                                       }\r
                                                     >>\r
-                                                    << mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, $QId, $Mask); >>\r
   )\r
   |\r
   (\r
     SN2:StringIdentifier                            << _STRCAT (&VarIdStr, SN2->getText()); LineNo = SN2->getLine(); >>\r
     (\r
-      "."                                           << _STRCAT (&VarIdStr, "."); >>\r
+      "."                                           << \r
+                                                       _STRCAT (&VarIdStr, ".");\r
+                                                       if (mConstantOnlyInExpression) {\r
+                                                         _PCATCH(VFR_RETURN_CONSTANT_ONLY, LineNo);\r
+                                                       }\r
+                                                    >>\r
       SF:StringIdentifier                           << _STRCAT (&VarIdStr, SF->getText()); >>\r
       {\r
         OpenBracket I2:Number CloseBracket          <<\r
@@ -1911,9 +1920,12 @@ vfrStatementStatListOld :
   ;\r
 \r
 vfrStatementDisableIfStat :\r
-  << CIfrDisableIf DIObj; >>\r
+  << \r
+    CIfrDisableIf DIObj; \r
+    mConstantOnlyInExpression = TRUE;\r
+  >>\r
   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>\r
-  vfrStatementExpression[0] ";"\r
+  vfrStatementExpression[0] ";"                        << mConstantOnlyInExpression = FALSE; >>\r
   ( vfrStatementStatList )*\r
   E:EndIf                                              << CRT_END_OP (E); >>\r
   ";"\r
@@ -2055,9 +2067,12 @@ vfrStatementNoSubmitIf :
   ;\r
 \r
 vfrStatementDisableIfQuest :\r
-  << CIfrDisableIf DIObj; >>\r
+  << \r
+    CIfrDisableIf DIObj; \r
+    mConstantOnlyInExpression = TRUE;\r
+  >>\r
   L:DisableIf                                          << DIObj.SetLineNo(L->getLine()); >>\r
-  vfrStatementExpression[0] ";"\r
+  vfrStatementExpression[0] ";"                        << mConstantOnlyInExpression = FALSE; >>\r
   vfrStatementQuestionOptionList\r
   E:EndIf                                              << CRT_END_OP (E); >>\r
   ;\r