add support in pyparser for negative numbers
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 8 Jun 2021 12:08:18 +0000 (13:08 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 8 Jun 2021 12:08:18 +0000 (13:08 +0100)
src/openpower/decoder/pseudo/lexer.py

index b420798b17533118a8440e91c077b38f2b68180f..aad11a04a9f8ce59108974587c769e64e9ae2fea 100644 (file)
@@ -346,7 +346,7 @@ class PowerLexer:
     #t_NUMBER = r'\d+'
     # taken from decmial.py but without the leading sign
     def t_NUMBER(self, t):
-        r"""(\d+(\.\d*)?|\.\d+)([eE][-+]? \d+)?"""
+        r"""[-]?(\d+(\.\d*)?|\.\d+)([eE][-+]? \d+)?"""
         t.value = int(t.value)
         return t