Skip to content
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

Cannot evaluate regex #143

Closed
patrickpichler opened this issue Dec 7, 2020 · 6 comments
Closed

Cannot evaluate regex #143

patrickpichler opened this issue Dec 7, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@patrickpichler
Copy link

I encountered a strange bug with some regex.

When trying to evaluate the following form, I get no result, nor any logs.

  (re-seq #"(?:((\d+|(?!no)\w{2,})) )?(\w+ \w+) bags" "drab coral bags contain no other bags.")

Note: When selecting the line in visual mode and pressing \E I get a result.

I'm running neovim 0.4.4 and conjure 4.9.0

@Olical Olical self-assigned this Dec 7, 2020
@Olical Olical added the bug Something isn't working label Dec 7, 2020
@Olical
Copy link
Owner

Olical commented Dec 7, 2020

Hmm I'll investigate! Not sure why this would happen, Conjure doesn't care about the code, it just grabs strings and sends them off to the nREPL, so it's probably something surprising and maybe unrelated to Conjure but worth getting to the bottom to.

@Olical
Copy link
Owner

Olical commented Dec 7, 2020

Oh yeah, I can repro! I have a hunch it's to do with the paren matching / searching, I think I need to add a special case for regex that contain parens like I do strings. I thought they'd be under the same part of the nvim syntax tree but I guess not!

Olical added a commit that referenced this issue Dec 7, 2020
We don't want to count parens within regular expressions, some syntax
files seem to define this as Regex and some as Regexp, I think. Haven't
confirmed that and I probably should.
@Olical
Copy link
Owner

Olical commented Dec 7, 2020

Should be alleviated / fixed on develop 🙂

@Olical
Copy link
Owner

Olical commented Dec 7, 2020

It still behaves weird if you try to eval from within the parens inside the regex, maybe that can be improved, although I think this allows you to eval commented out forms if you need to, which is kinda useful?

@patrickpichler
Copy link
Author

Thanks for the fast response!

I will give the develop branch a shot.

@Olical
Copy link
Owner

Olical commented Dec 12, 2020

Closing because I think this should be enough for now, further improvements to not getting confused by parens in strings will come with tree-sitter soon (tm).

@Olical Olical closed this as completed Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants