Skip to content
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

Rewrite type system and compiler (v4) #35

Merged
merged 54 commits into from
May 17, 2024
Merged

Rewrite type system and compiler (v4) #35

merged 54 commits into from
May 17, 2024

Conversation

Schamper
Copy link
Member

@Schamper Schamper commented May 31, 2023

  • Rewrite entire type system to be class based
    • All types are now classes, and parsed values are instances of that class
  • Rewrite compiler to be compatible with this type system

TODO:

  • Add unit test for custom type
  • Add example for custom type
  • Determine repr() for structure class (not instance)
  • Work out pickling?
    • Maybe related, but work out "module path" for new type classes
  • Update README

(DIS-75, DIS-77, DIS-103, DIS-104, DIS-965, DIS-1087, DIS-1124, DIS-1970)

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Attention: 53 lines in your changes are missing coverage. Please review.

Comparison is base (92875c1) 89.04% compared to head (0ef089a) 91.40%.

Files Patch % Lines
dissect/cstruct/types/enum.py 87.25% 13 Missing ⚠️
dissect/cstruct/parser.py 83.58% 11 Missing ⚠️
dissect/cstruct/types/structure.py 97.14% 9 Missing ⚠️
dissect/cstruct/compiler.py 97.88% 5 Missing ⚠️
dissect/cstruct/types/flag.py 78.26% 5 Missing ⚠️
dissect/cstruct/types/base.py 96.07% 4 Missing ⚠️
dissect/cstruct/cstruct.py 94.11% 3 Missing ⚠️
dissect/cstruct/types/char.py 96.22% 2 Missing ⚠️
dissect/cstruct/bitbuffer.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
+ Coverage   89.04%   91.40%   +2.36%     
==========================================
  Files          20       20              
  Lines        1862     2106     +244     
==========================================
+ Hits         1658     1925     +267     
+ Misses        204      181      -23     
Flag Coverage Δ
unittests 91.40% <95.61%> (+2.36%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dissect/cstruct/cstruct.py Outdated Show resolved Hide resolved
dissect/cstruct/parser.py Show resolved Hide resolved
dissect/cstruct/parser.py Show resolved Hide resolved
dissect/cstruct/parser.py Show resolved Hide resolved
@Schamper Schamper marked this pull request as ready for review July 30, 2023 18:41
dissect/cstruct/types/enum.py Show resolved Hide resolved
dissect/cstruct/types/char.py Outdated Show resolved Hide resolved
dissect/cstruct/types/wchar.py Outdated Show resolved Hide resolved
dissect/cstruct/compiler.py Show resolved Hide resolved
dissect/cstruct/compiler.py Outdated Show resolved Hide resolved
dissect/cstruct/types/structure.py Outdated Show resolved Hide resolved
dissect/cstruct/parser.py Show resolved Hide resolved
dissect/cstruct/parser.py Show resolved Hide resolved
dissect/cstruct/compiler.py Outdated Show resolved Hide resolved
dissect/cstruct/cstruct.py Show resolved Hide resolved
dissect/cstruct/parser.py Show resolved Hide resolved
Copy link
Contributor

@cecinestpasunepipe cecinestpasunepipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dissect/cstruct/cstruct.py Show resolved Hide resolved
dissect/cstruct/cstruct.py Outdated Show resolved Hide resolved
dissect/cstruct/cstruct.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 96.86441% with 37 lines in your changes are missing coverage. Please review.

Project coverage is 92.00%. Comparing base (ca4b29a) to head (d655171).

Files Patch % Lines
dissect/cstruct/parser.py 83.58% 11 Missing ⚠️
dissect/cstruct/types/structure.py 97.14% 9 Missing ⚠️
dissect/cstruct/compiler.py 97.88% 5 Missing ⚠️
dissect/cstruct/types/base.py 96.07% 4 Missing ⚠️
dissect/cstruct/cstruct.py 94.23% 3 Missing ⚠️
dissect/cstruct/types/char.py 96.22% 2 Missing ⚠️
dissect/cstruct/bitbuffer.py 75.00% 1 Missing ⚠️
dissect/cstruct/types/enum.py 98.97% 1 Missing ⚠️
dissect/cstruct/types/flag.py 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
+ Coverage   89.32%   92.00%   +2.68%     
==========================================
  Files          21       20       -1     
  Lines        1929     2115     +186     
==========================================
+ Hits         1723     1946     +223     
+ Misses        206      169      -37     
Flag Coverage Δ
unittests 92.00% <96.86%> (+2.68%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dissect/cstruct/types/structure.py Outdated Show resolved Hide resolved
dissect/cstruct/types/structure.py Show resolved Hide resolved
dissect/cstruct/types/structure.py Show resolved Hide resolved
tests/test_align.py Outdated Show resolved Hide resolved
tests/test_align.py Outdated Show resolved Hide resolved
dissect/cstruct/parser.py Show resolved Hide resolved
dissect/cstruct/parser.py Outdated Show resolved Hide resolved
dissect/cstruct/parser.py Outdated Show resolved Hide resolved
dissect/cstruct/types/char.py Outdated Show resolved Hide resolved
dissect/cstruct/types/structure.py Show resolved Hide resolved
dissect/cstruct/utils.py Outdated Show resolved Hide resolved
dissect/cstruct/cstruct.py Outdated Show resolved Hide resolved
dissect/cstruct/types/enum.py Show resolved Hide resolved
dissect/cstruct/types/flag.py Show resolved Hide resolved
dissect/cstruct/types/enum.py Show resolved Hide resolved
dissect/cstruct/types/enum.py Outdated Show resolved Hide resolved
dissect/cstruct/types/flag.py Outdated Show resolved Hide resolved
dissect/cstruct/types/flag.py Outdated Show resolved Hide resolved
dissect/cstruct/cstruct.py Show resolved Hide resolved
dissect/cstruct/cstruct.py Show resolved Hide resolved
dissect/cstruct/types/flag.py Outdated Show resolved Hide resolved
dissect/cstruct/types/enum.py Outdated Show resolved Hide resolved
@pyrco pyrco self-requested a review May 7, 2024 09:33
Copy link
Contributor

@pyrco pyrco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that shouldn't have been a self-requested review ;)

pyrco
pyrco previously approved these changes May 13, 2024
@Schamper Schamper merged commit cd9572c into main May 17, 2024
16 checks passed
@Schamper Schamper deleted the refactor-v4 branch May 17, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants