-
Notifications
You must be signed in to change notification settings - Fork 16
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
Inline flags #25
Comments
can you please elaborate the issue a little more. |
Python supports a feature called "inline flags", which you can read about in the python regular expression docs. See https://docs.python.org/3/library/re.html section Currently, there is no syntax in Kleenexp that would compile to this regex syntax. This issue proposes syntax for this. e.g.
Should compile to:
This would involve adding a line to Then we could do something similar for the rust compiler, the mapping is pretty straightforward but with different names ( |
Names for all the settings:
We obviously don't need to support the |
Hey, I started implementing this feature - a few questions: e. Almost forgot: There seems to be a special case for inline flags in the beginning of a regular expression |
Hi Yehuda, good to hear you're trying your hand at this. Welcome to kleenexp! a. Seems like someone accidentally pressed Enter while a symbol was selected. Fixed. b. Fork, push to fork, open a PR against my repo. Specifically, I don't think we should raise for this case, just use the innermost setting, but I could be convinced otherwise. c. I'm going to guess you're testing the rust compiler. Try d. Look at e. As far as I understand, we never need this special case, right? Nothing wrong will happen if we only implement the local version and not the global version, and nothing will be felt as missing by our users? |
c. I think this line is your fix to the typo you found in (a)? Use my fix instead (return False) and it will work. e. Agreed. This is a design mistake in Regex that we're fixing. f. I don't remember if bad[0] is always a syntax error or sometimes just meaningless, but otherwise you're correct. g. I just went over all the "Changed in version 3.x" notes in the docs, none of them seems to affect us in the sense that users will get the expected behavior from their version (e.g. flags are correctly h. If a user tries to use |
Also, you're being very thorough, that's a good habit to have! |
g + h: My PR includes some validations on the flags locale_dependent, ascii_only and unicode. From what I understand, you would want these removed, and the error messages should come from regex and not kleenexp? |
I'll have to have a look at the code before I form an opinion, but my gut instinct is to rely on the |
Implement syntax for inline flags, e.g.:
Should compile to:
See https://docs.python.org/3/library/re.html section
(?aiLmsux-imsx:...)
The text was updated successfully, but these errors were encountered: