From 9a3b737729b12565c38cb865cf85d32392e70a43 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Thu, 18 May 2023 23:26:51 -0700 Subject: [PATCH] support binary literals with embedded _ (e.g. 0b10_01) --- src/openpower/decoder/pseudo/lexer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openpower/decoder/pseudo/lexer.py b/src/openpower/decoder/pseudo/lexer.py index 6cf3020b..d90105e4 100644 --- a/src/openpower/decoder/pseudo/lexer.py +++ b/src/openpower/decoder/pseudo/lexer.py @@ -368,8 +368,9 @@ class PowerLexer: return t def t_BINARY(self, t): - r"""0b[01]+""" - t.value = SelectableInt(int(t.value, 2), len(t.value)-2) + r"""0b[01_]+""" + val = t.value.replace("_", "") + t.value = SelectableInt(int(val, 2), len(val)-2) return t #t_NUMBER = r'\d+' -- 2.30.2