]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Allow string token identifier to use lower case letters
authorYonghong Zhu <yonghong.zhu@intel.com>
Tue, 2 Aug 2016 09:21:34 +0000 (17:21 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Mon, 8 Aug 2016 02:52:31 +0000 (10:52 +0800)
This patch is to align the code behavior with UNI spec that string token
identifier can use upper case and lower case letters.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Felix <Felixp@ami.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/AutoGen/UniClassObject.py

index 183b2b2337abadfa43d3024b5fbb8e0c5370b4d2..856d19cda270cdc64b84812f578860f2a35a4c1f 100644 (file)
@@ -348,11 +348,11 @@ class UniFileClassObject(object):
         Value = ''\r
 \r
         Name = Item.split()[1]\r
-        # Check the string name is the upper character\r
+        # Check the string name\r
         if Name != '':\r
-            MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)\r
+            MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.UNICODE)\r
             if MatchString == None or MatchString.end(0) != len(Name):\r
-                EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' % (Name, self.File))\r
+                EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))\r
         LanguageList = Item.split(u'#language ')\r
         for IndexI in range(len(LanguageList)):\r
             if IndexI == 0:\r
@@ -518,11 +518,11 @@ class UniFileClassObject(object):
                         break\r
                 # Value = Value.replace(u'\r\n', u'')\r
                 Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)\r
-                # Check the string name is the upper character\r
+                # Check the string name\r
                 if not self.IsCompatibleMode and Name != '':\r
-                    MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)\r
+                    MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.UNICODE)\r
                     if MatchString == None or MatchString.end(0) != len(Name):\r
-                        EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' % (Name, self.File))\r
+                        EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File))\r
                 self.AddStringToList(Name, Language, Value)\r
                 continue\r
 \r