Conversation
Add the input format InputFormat.CSV in parse_lines. In parse_line call the function parse_line_csv if the input format is InputFormat.CSV. The parse_line_csv function extracts the instruction from the line and generates an Instruction instance. Creat an abstract base class TargetInfo for the X86 and ARM target infos. Make the class InputFormat inherit from Enum. Move the classes to the top of the file. Add some comments to document the code.
|
Nice to see some improvements, also in the readme. Thanks! At quick glance the PR looks very solid, but I'll give this a thorough review after I'm not so busy with work. Some tests for CSV would be nice to have though. Also, where this CSV input is coming from? |
Kazhuu
left a comment
There was a problem hiding this comment.
Very good work and thank you a lot for contributing! Would you add some minimal tests for CVS input? Also in the readme mentioning where the CVS input is coming from and how to obtain one would be good information to have in my opinion :)
|
|
||
| def parse_function_header(line): | ||
| """ | ||
| Return function name of memory range from the given string line. |
There was a problem hiding this comment.
This comment does not match to what the function is actually returning anymore. This was already here before this PR, so I can also update these after this is merged.
| elements: list[str] = line.split(';') | ||
| addr: Address = Address(int(elements[0])) | ||
| operands: str = elements[3] | ||
| target: Address | None = None |
There was a problem hiding this comment.
More type annotations for this Python project would also be welcome in the future. Good start 👍
| continue | ||
|
|
||
| instruction_or_encoding = parse_line(line, num, current_function_name, current_format, target_info) | ||
| # print(instruction_or_encoding) |
There was a problem hiding this comment.
Please don't leave commented out lines in the code. Probably mistake :)
Add support for CSV like input and do some minor refactoring, also update the README.