publicsuffix / list

The Public Suffix List
https://publicsuffix.org/
Mozilla Public License 2.0
2.03k stars 1.22k forks source link

tools/internal/parser: rework metadata extraction for more accurate reformatting #2027

Closed danderson closed 2 months ago

danderson commented 3 months ago

Several commits, each one is self-contained.

I promise the formatting is coming soon, this rework is making the metadata extraction more precise, so that we can look at options for reformatting the suffix block headers into some canonical form.

I added some tests specifically for metadata parsing, to cover the layouts that exist in the PSL. I also removed a couple of parser tests that were just exercising metadata parsing, and were testing behavior for formats that aren't actually present in the real PSL :facepalm:

Next PR after this one is pslfmt with sorting of suffixes and suffix blocks, and possibly metadata reformatting if we find a format that we like.

danderson commented 2 months ago

Added a few more no-op cleanup commits. Each commit can still be reviewed mostly independently to reduce the overall size of the review.