-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add suppot for CSV input #34
base: main
Are you sure you want to change the base?
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More type annotations for this Python project would also be welcome in the future. Good start 👍
@@ -501,19 +579,26 @@ def parse_lines(lines, skip_calls, target_name): # noqa pylint: disable=unused- | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.