diff options
-rw-r--r-- | src/intel/genxml/gen_bits_header.py | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py index ded2d2dcfcf..aac49fb49e2 100644 --- a/src/intel/genxml/gen_bits_header.py +++ b/src/intel/genxml/gen_bits_header.py @@ -25,6 +25,7 @@ from __future__ import ( import argparse import os +import re import xml.parsers.expat from mako.template import Template @@ -130,33 +131,10 @@ ${emit_per_gen_prop_func(field, 'start')} #endif /* ${guard} */""", output_encoding='utf-8') +alphanum_nono = re.compile(r'[ /\[\]()\-:.,=>#&*"+\\]+') def to_alphanum(name): - substitutions = { - ' ': '', - '/': '', - '[': '', - ']': '', - '(': '', - ')': '', - '-': '', - ':': '', - '.': '', - ',': '', - '=': '', - '>': '', - '#': '', - 'α': 'alpha', - '&': '', - '*': '', - '"': '', - '+': '', - '\'': '', - } - - for i, j in substitutions.items(): - name = name.replace(i, j) - - return name + global alphanum_nono + return alphanum_nono.sub('', name).replace('α', 'alpha') def safe_name(name): name = to_alphanum(name) |