@@ -46,7 +46,6 @@ def dump_enum(d, enum_name, derives, strip_prefix=""):
4646 list: A list of strings representing the enum definition.
4747 """
4848 items = sorted (d )
49- print (f"items is { items } " )
5049 content = [f"{ derives } \n " ]
5150 content .append ("#[repr(u32)]\n " )
5251 content .append ("#[allow(non_camel_case_types, clippy::upper_case_acronyms)]\n " )
@@ -73,7 +72,8 @@ def dump_bitflags(d, prefix, derives, struct_name, int_t):
7372 """
7473 items = [(value , name ) for name , value in d .items () if name .startswith (prefix )]
7574 content = ["bitflags! {\n " ]
76- content .append (f"{ derives } \n " ) if derives else None
75+ if derives :
76+ content .append (f"{ derives } \n " )
7777 content .append (f" pub struct { struct_name } : { int_t } {{\n " )
7878 for value , name in sorted (items ):
7979 name = str (name ).removeprefix (prefix )
@@ -136,50 +136,4 @@ def main(
136136if __name__ == "__main__" :
137137 import sys
138138
139- main (* sys .argv [1 :])
140-
141-
142- # dump(f, OPCODES, "SreOpcode", "u32", "")
143- # dump(f, ATCODES, "SreAtCode", "u32", "AT_")
144- # dump(f, CHCODES, "SreCatCode", "u32", "CATEGORY_")
145-
146- # def bitflags(typ, int_t, prefix, flags):
147- # f.write(f"""\
148- # bitflags! {{
149- # pub struct {typ}: {int_t} {{
150- # """)
151- # for name in flags:
152- # val = globals()[prefix + name]
153- # f.write(f" const {name} = {val};\n")
154- # f.write("""\
155- # }
156- # }
157- # """)
158-
159- # bitflags("SreFlag", "u16", "SRE_FLAG_", [
160- # "TEMPLATE",
161- # "IGNORECASE",
162- # "LOCALE",
163- # "MULTILINE",
164- # "DOTALL",
165- # "UNICODE",
166- # "VERBOSE",
167- # "DEBUG",
168- # "ASCII",
169- # ])
170-
171- # bitflags("SreInfo", "u32", "SRE_INFO_", [
172- # "PREFIX", "LITERAL", "CHARSET",
173- # ])
174-
175- # print("done")
176-
177-
178- # if __name__ == "__main__":
179- # import sys
180- # if len(sys.argv) > 1:
181- # constants_file = sys.argv[1]
182- # else:
183- # import os
184- # constants_file = os.path.join(os.path.dirname(__file__), "../../sre-engine/src/constants.rs")
185- # with open(constants_file, "w") as f:
139+ main (* sys .argv [1 :])
0 commit comments