]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/RangeExpression.py
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / Python / Common / RangeExpression.py
index f6c4dcd66634952491a03386d57a122dfa23e405..e9296e03f6a1d7101714634d13eb65bd7df3dea8 100644 (file)
@@ -2,22 +2,18 @@
 # This file is used to parse and evaluate range expression in Pcd declaration.\r
 #\r
 # Copyright (c) 2015 - 2018, 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
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 # # Import Modules\r
 #\r
+from __future__ import print_function\r
 from Common.GlobalData import *\r
 from CommonDataClass.Exceptions import BadExpression\r
 from CommonDataClass.Exceptions import WrnExpression\r
 import uuid\r
 from Common.Expression import PcdPattern, BaseExpression\r
 from Common.DataType import *\r
+from re import compile\r
 \r
 ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'\r
 ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'\r
@@ -201,7 +197,7 @@ class RangeExpression(BaseExpression):
 \r
     NonLetterOpLst = ['+', '-', '&', '|', '^', '!', '=', '>', '<']\r
 \r
-    RangePattern = re.compile(r'[0-9]+ - [0-9]+')\r
+    RangePattern = compile(r'[0-9]+ - [0-9]+')\r
 \r
     def preProcessRangeExpr(self, expr):\r
         # convert hex to int\r
@@ -288,7 +284,7 @@ class RangeExpression(BaseExpression):
         return rangeid\r
 \r
 \r
-    def NegtiveRange(self, Oprand1):\r
+    def NegativeRange(self, Oprand1):\r
         rangeContainer1 = self.operanddict[Oprand1]\r
 \r
 \r
@@ -330,7 +326,7 @@ class RangeExpression(BaseExpression):
         if Operator in ["!", "NOT", "not"]:\r
             if not gGuidPattern.match(Oprand1.strip()):\r
                 raise BadExpression(ERR_STRING_EXPR % Operator)\r
-            return self.NegtiveRange(Oprand1)\r
+            return self.NegativeRange(Oprand1)\r
         else:\r
             if Operator in ["==", ">=", "<=", ">", "<", '^']:\r
                 return self.EvalRange(Operator, Oprand1)\r
@@ -347,7 +343,7 @@ class RangeExpression(BaseExpression):
 \r
 \r
     def __init__(self, Expression, PcdDataType, SymbolTable = {}):\r
-        super().__init__(self, Expression, PcdDataType, SymbolTable)\r
+        super(RangeExpression, self).__init__(self, Expression, PcdDataType, SymbolTable)\r
         self._NoProcess = False\r
         if not isinstance(Expression, type('')):\r
             self._Expr = Expression\r