On Tue, Jan 12, 2021 at 07:41:56PM +0100, Philippe Mathieu-Daudé wrote: > 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.
Will something break if we just use underscores instead of dots in the input file? > > Signed-off-by: Philippe Mathieu-Daudé <f4...@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_.]*' If pattern identifiers are going to follow different rules, doesn't this need to be documented at docs/devel/decodetree.rst? > > 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) Do we want error messages generated by the script to use the modified identifier with underscores, or the original identifier with dots? (This patch does the former) > else: > error(lineno, 'invalid token "{0}"'.format(name)) > -- > 2.26.2 > -- Eduardo