diff --git a/docs/generate.py b/docs/generate.py index 01d423761..303f5c0e2 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -48,7 +48,6 @@ "object ": "any ", } - def replace_all(text): for repl, wth in replace_table.items(): pos = text.find(repl) @@ -59,7 +58,6 @@ def replace_all(text): text = text.replace(repl, wth) return text - ps.configure_parse(replace_all, "slate.pickle") ps.run_parse() @@ -126,11 +124,11 @@ def include_example(name): def format_af(lf, af): - ret = replace_all(af["return"]) or "nil" + ret = af["return"] or "nil" ret = ret.replace("<", "<").replace(">", ">") ret = link_custom_type(ret) name = lf["name"] - param = replace_all(af["param"]).replace("vector<", "array<") + param = af["param"].replace("vector<", "array<") param = link_custom_type(param) fun = f"{ret} {name}({param})".strip() return fun diff --git a/docs/parse_source.py b/docs/parse_source.py index c4ee629c2..eb5411935 100644 --- a/docs/parse_source.py +++ b/docs/parse_source.py @@ -516,9 +516,7 @@ def run_parse(): index = literal_eval(index.strip()) if binds := re.search(r"BackBinder<([^>]*)>", signature_and_binder): binds = binds.group(1) - binds = replace_fun( - "{} {}".format(binds, camel_case_to_snake_case(binds)) - ) + binds = "{} {}".format(binds, camel_case_to_snake_case(binds)) else: binds = None signature = re.sub( @@ -527,9 +525,9 @@ def run_parse(): signature = re.search( r"([_a-zA-Z][_a-zA-Z0-9]*.*)\((.*)\)", signature ) - ret = replace_fun(signature.group(1)) + ret = signature.group(1) args = [ - replace_fun(t) for t in signature.group(2).split(",") + t for t in signature.group(2).split(",") ] vtable_entries[name] = { "name": name, @@ -650,7 +648,7 @@ def run_parse(): if var[0].startswith("sol::constructors"): for fun in underlying_cpp_type["member_funs"][cpp_type]: - param = replace_fun(fun["param"]) + param = fun["param"] if cpp_type not in constructors: constructors[cpp_type] = [] diff --git a/docs/validator.py b/docs/validator.py index 53370be36..d4cc2a7fa 100644 --- a/docs/validator.py +++ b/docs/validator.py @@ -69,7 +69,8 @@ def replace_all(text): "variadic_args", "MAX_PLAYERS", "any", - "IMAGE", + "IMAGE" + "VTABLE_OFFSET", ] unknown_types = [] @@ -100,10 +101,9 @@ def check_types(ret): ret = "nil" param = "" if m: - ret = replace_all(m.group(2)).strip() or "nil" + ret = m.group(2) or "nil" if m or m2: param = (m or m2).group(1) - param = replace_all(param).strip() check_types(ret) check_types(param) @@ -135,11 +135,11 @@ def check_types(ret): if n: if n.group(2): - param = replace_all(n.group(2).strip()) + param = n.group(2) elif m: - ret = replace_all(m.group(1)) or "nil" + ret = m.group(1) or "nil" if m.group(3): - param = replace_all(m.group(3).strip()) + param = m.group(3) if(param): check_types(param)