Closed tylergibbs2 closed 1 year ago
Thank you so much for this PR!
I was struggling with parser_number.py
and parser_helper.py
because I didn't want to pass the Elements and Tokens instances for all those functions. But looking at your implementation it seems fine.
About the failing tests: Those are ambiguous cases that Anitopy cannot parse (bonus points if you figure out how to parse some of them). They came from Anitomy and I decided to keep them. Maybe they should be renamed to something better to not confuse any more people.
Thanks for the merge! I do agree it is a bit less nice to look at passing Elements and Tokens into those methods... I thought about pulling those methods out into separate classes, but I didn't want to make any changes that strayed from the goal of this PR and I also didn't want to assume how you would prefer it in your codebase.
I've released version 2.2.0rc2
if you want to check if everything is alright before I do the final release.
Did some quick tests with the RC and everything looked good to me! 👍
Pulls Elements and Tokens out into objects and passes them around while parsing to avoid the usage of singletons.
Implementation details:
parser_number.py
: functions that require access to elements and/or tokens are passed the argumentselements
andparsed_tokens
always with those names and always in that order.parser_helper.py
: same as above.Closes #11. See discussion there for the purpose of this PR.
Note: I'm getting 35/35 tests failed, but I was also getting that even before I made any changes. Please check locally.