Skip to content

Add EmptyElementFilter #131

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

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open

Conversation

NebelNidas
Copy link
Member

@NebelNidas NebelNidas commented Apr 5, 2025

This is an adapter which filters out elements that effectively don't contain any data. Entries are only forwarded if they contain:

  1. a non-null comment,
  2. a non-null or non-equal destination name,
  3. a non-null or non-equal destination descriptor, or
  4. a child element to which one of these points applies.

@NebelNidas NebelNidas added this to the 0.8.0 milestone Apr 5, 2025
@NebelNidas NebelNidas marked this pull request as ready for review April 13, 2025 11:37
Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

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

Looks good, great tests.

@NebelNidas NebelNidas changed the title Add EmptyEntryFilter Add EmptyElementFilter Apr 13, 2025
@Player3324
Copy link
Contributor

Relying on the visit passes to have the same order seems a bit fragile and the 2 pass approach seems unnecessary?

I believe all it'd have to hold onto is a stack to record the src data and a pass-through-grant boolean for the parents and their parents, giving the data retention abilities of recursion to the iterative visitation.

If that stack's elements are a mutable class with a few fields to hold a resetable kind, src name, desc, arg index etc it would only have to allocate max(stack_depth) objects for the entire pass.

@NebelNidas
Copy link
Member Author

Done. I used the two-pass design first because it's harder to mess things up that way, but with all the tests I added I think the new version I just pushed works just as fine.

Copy link
Contributor

@Player3324 Player3324 left a comment

Choose a reason for hiding this comment

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

I see you ended up flattening it, bu that's fine I think

Thanks, looks good from a cursory glance

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.

3 participants