-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: ParsePositional::non_strict
#374
Conversation
Adds new catchable error NotStrictPos, and a utility to set the condition. Also adds derive support.
I think it can be an enum with 3 states: Going to sleep for now, dealing with a newborn is like two full time jobs. Will check tomorrow. |
Refactored the conditionals into a marker trait, in order to only implement the strict/non_strict modifier methods for the default unrestricted parser type. I know it's not the enum, but this way prevents misusage at the type level. Trying to use both of the modifiers results in a compilation error for manual usage: As well as derive usage: |
fa75fbc
to
4475163
Compare
4475163
to
338cf8f
Compare
917e01f
to
4868361
Compare
Derive macro part looks good, but I'm not sure if it's worth extra complexity to go type level stuff. Can we go back to having a simple enum field and changing runtime behavior based on that? |
This technically allows for subsequent calls to `strict` and `non_strict`, but only the last call will actually be used.
ParsePositional::not_strict
ParsePositional::non_strict
Sure, it's your call, maintainability is important 👍 |
Attempt to resolve #373 by adding
ParsePositional::non_strict
, the inverse ofParsePositional::strict
. Derive support also added. Internally adds an enum for the position states;Unrestricted
,Strict
, andNonStrict
.Tested manually against lutgen, as well as some unit tests, and is a working as expected.