From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ml01.01.org (Postfix) with ESMTP id CD2211A1E10 for ; Tue, 2 Aug 2016 04:32:01 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 02 Aug 2016 04:32:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,460,1464678000"; d="scan'208";a="1006932931" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 02 Aug 2016 04:32:02 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Liming Gao , Felix Date: Tue, 2 Aug 2016 19:31:55 +0800 Message-Id: <1470137515-83680-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Allow string token identifier to use lower case letters X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 11:32:01 -0000 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 Cc: Felix Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/UniClassObject.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py index 183b2b2..856d19c 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -346,15 +346,15 @@ class UniFileClassObject(object): def GetStringObject(self, Item): Language = '' Value = '' Name = Item.split()[1] - # Check the string name is the upper character + # Check the string name if Name != '': - MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE) + MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.UNICODE) if MatchString == None or MatchString.end(0) != len(Name): - 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)) + EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File)) LanguageList = Item.split(u'#language ') for IndexI in range(len(LanguageList)): if IndexI == 0: continue else: @@ -516,15 +516,15 @@ class UniFileClassObject(object): else: IndexI = IndexJ break # Value = Value.replace(u'\r\n', u'') Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File) - # Check the string name is the upper character + # Check the string name if not self.IsCompatibleMode and Name != '': - MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE) + MatchString = re.match('^[a-zA-Z][a-zA-Z0-9_]*$', Name, re.UNICODE) if MatchString == None or MatchString.end(0) != len(Name): - 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)) + EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid character.' % (Name, self.File)) self.AddStringToList(Name, Language, Value) continue # # Get string def information format 2 as below -- 2.6.1.windows.1