riscv-opcodes
riscv-opcodes copied to clipboard
Add static type hints
Add static type hints, and switch to literals for some dicts to improve type inference (and it's nicer code anyway).
This makes the code easier to understand and navigate, and also detected a few bugs:
- Missing brackets on
e.upper. ext_namemay not exist on line 399 (I haven't fixed this).- Not strictly related to types, but a lot of the regexes were not raw strings and therefore contained invalid escape sequences. Python prints a warning about these in recent versions.
It is currently not verified in CI by pyright, but that will come in a future MR. These changes were just verified by VSCode.