public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Allow string token identifier to use lower case letters
@ 2016-08-02 11:31 Yonghong Zhu
  2016-08-08  2:38 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2016-08-02 11:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Felix

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>
---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Allow string token identifier to use lower case letters
  2016-08-02 11:31 [Patch] BaseTools: Allow string token identifier to use lower case letters Yonghong Zhu
@ 2016-08-08  2:38 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2016-08-08  2:38 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: Felix

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Yonghong Zhu
> Sent: Tuesday, August 02, 2016 7:32 PM
> To: edk2-devel@lists.01.org
> Cc: Felix <Felixp@ami.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [Patch] BaseTools: Allow string token identifier to use lower
> case letters
> 
> 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>
> ---
>  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
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-08  2:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02 11:31 [Patch] BaseTools: Allow string token identifier to use lower case letters Yonghong Zhu
2016-08-08  2:38 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox