-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the new API off of the legacy parsers, extract inits to helper f…
…unctions The bridging of the legacy parsers and the new results turns out to be pretty mid. Create similar but better typed matcher classes, with a slightly different API: they return `None` on a match failure instead of a triplet, which make them compose better in iterations (e.g. can just `filter` them out). And add a `Matchers` alias to carry them around (a tuple of lists of matchers) for convenience. And the UA matcher now supports patch_minor, though that requires excluding that bit from the tests as there are apparently broken test cases around that item. Also clarify the replacer rules, and hopefully implement the thing more clearly. Rename the old "types" to "core" to better clarify what it's about and put the matchers there as even for non-basic parsers they would likely be needed both to generate the regex groups and to do the final extraction. Finally move the loaders off of the basic parser and into their own module, hopefully cleaner and more reusable than having the things be embedded a bit ad-hoc as classmethods. Instead have the basic parser just take a `Matchers` directly. This does require updating the tests as the parser now takes a triple (instead of 3 lists), but I think the regularity is a gain.
- Loading branch information
Showing
9 changed files
with
339 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.