[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] decodetree: Allow 'dot' in opcode names
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH] decodetree: Allow 'dot' in opcode names |
Date: |
Tue, 12 Jan 2021 19:41:56 +0100 |
Some ISA use a dot in their opcodes. Allow the decodetree
script to process them. The dot is replaced by an underscore
in the generated code.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
scripts/decodetree.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 47aa9caf6d1..b7572589e64 100644
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -49,7 +49,7 @@
re_arg_ident = '&[a-zA-Z0-9_]*'
re_fld_ident = '%[a-zA-Z0-9_]*'
re_fmt_ident = '@[a-zA-Z0-9_]*'
-re_pat_ident = '[a-zA-Z0-9_]*'
+re_pat_ident = '[a-zA-Z0-9_.]*'
def error_with_file(file, lineno, *args):
"""Print an error message from file:line and args and exit."""
@@ -1082,6 +1082,7 @@ def parse_file(f, parent_pat):
elif re.fullmatch(re_fmt_ident, name):
parse_generic(start_lineno, None, name[1:], toks)
elif re.fullmatch(re_pat_ident, name):
+ name = name.replace('.', '_')
parse_generic(start_lineno, parent_pat, name, toks)
else:
error(lineno, 'invalid token "{0}"'.format(name))
--
2.26.2