-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
Added regex module option. #593
Conversation
Will close #590. |
Well, it's good that the tests pass. If you want to add regex-specific tests, the place to do it is in the |
@erezsh I think what @julienmalard means that we add an additional pull-request check that also installs the (Also note: |
@MegaIng Yes, I think that that is what I meant. I was referring to adding a test matrix option that runs all tests with regex installed, so that we can check that everything works when regex is used instead of re (the tests run now run without regex installed, so, effectively, with no changes as compared to the master branch). |
If regex already have tests that ensure that it's fully backwards-compatible with re, I'm not sure there's a point of also doing those tests on our end. At least not more than once in a long while. |
All right, sure then! Should I include |
Yes, you should include module-specific tests. |
I have tried adding tests as
Edit: For (2), perhaps one idea would be to replace all categories Edit 2: Apparently I haven't correctly connected my new test file, because tests are passing even though point (2) is not yet resolved. Many thanks! |
@erezsh Hope you are doing well! I have pushed a fix for point no. 2 in my comment above, so now getting the width of regexes with Unicode categories with the |
@julienmalard Is there a guarantee that using |
@erezsh I'm unfortunately unable to find standard benchmarks (though if you know of some standard tests I could run them quickly). However, the
I am not at all an expert on regex, but did note that @MegaIng above also mentionned that
|
I'm worried about adding this as the default, as users might experience performance degradation. It would be much better, imho, if this was opt-in rather than "always on" |
Hello,
Or as an option specific to each parser:
|
Option #2 sounds good. |
That looks good. Just make sure that the tests pass. |
Thanks! It was a missing tox dependency for |
Looks like this will take a bit of trial and error! Do you know how I can tell tox to install |
See Basically copy whatever we did for nearley-requirements. Maybe we can even merge them (for the tests) |
Thanks! I updated stubs and the README to match changes. Please let me know if all was done well! |
There is a reason that all the parser tests sit in Put your tests there and make sure that they pass. Also, you forgot to update And lexer.py still imports |
Thanks! Hope this works. I changed the tests, fixed the problems with |
Hmm looks like most of the tests failed.. |
That is odd! It seems that pypy3 failed and that the rest aborted for some reason (without printing out error messages). Is it possible that the pypy3 failure caused the rest to stop running? |
It shouldn't be that difficult to install - https://www.pypy.org/download.html#python-3-6-compatible-pypy3-6-v7-3-1 |
I think it worked! |
Congrats on a great PR 👍 |
Many thanks for your help and guidance throughout the process! |
Added regex module option (optional alternative to re module).
I believe we should also add a test configuration to make sure all tests pass with
pip install lark-parser[regex]
, but was unsure of where to add it in thetox.ini
file; please do let me know if you have any pointers. I could then also add a conditional test with a grammar containing aregex
module-specific terminal definition that only activates when the [regex] optional dependency is enabled.Please let me know what you think!