Skip to content

Make regular expressions use character classes #605

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

Closed
wants to merge 2 commits into from

Conversation

antalsz
Copy link
Contributor

@antalsz antalsz commented Apr 25, 2015

Instead of using A-Z, a-z, A-Za-z, and A-Za-z0-9, regular expressions for matching Haskell identifiers should use [:upper:], [:lower:], [:alpha:], and [:alnum:] (_, ', and . can stay, though.)

This pull request doesn't change all such uses – for instance, looking for a -XExtension flag is guaranteed to use ASCII, and there are similar output-matching cases – but I hope I got everything syntax-sensitive.

Review on Reviewable

Upper case characters should use `[:upper:]`, identifiers can contain
`[:alnum:]`s, etc. -- not `A-Z`, `A-Za-z0-9`, and so on.  (`_` and `'`
can stay, though.)

Some things were left out -- for instance, looking for a `-XExtension`
flag is guaranteed to use ASCII -- but I hope I got everything
syntax-sensitive.
@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015

@antalsz
Copy link
Contributor Author

antalsz commented Apr 25, 2015

sigh Yes, you're right, I do want to create such a file :-)

I don't think the places you highlighted ought to be alnums, though – those are places where the code is trying to match the start of the identifier. But again, having actual named regular expressions would make that clear :-)

@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015

Oh, I thought it matched whole identifier or module name... I remember fixing one such spot that said [a-zA-B] (notice problem).

I would really love haskell-lexeme.el, defconst and matching whole identifiers.

Anyway, you have my initial haskell-lexeme.el here https://github.com/gracjan/haskell-mode/commit/7893cc2ab4b8cdc1e37a753b8253ef13cdea8d67. It probably does not even compile, I intended to submit it much later. But then you came and I would be glad if you took this over so that I can get some other stuff done.

Copy of gracjan/haskell-mode@7893cc2ab4b8cdc1e37a753b8253ef13cdea8d67.
@gracjan
Copy link
Contributor

gracjan commented May 9, 2015

@antalsz: Any progress on this one?

@antalsz
Copy link
Contributor Author

antalsz commented May 11, 2015

@gracjan: Sorry, I'm a grad student, and the end of the semester just hit :-) No real progress worth showing, but it is still on my radar (and once the end of semester detritus winds down, I'll be able to spend some more cycles on it).

@gracjan
Copy link
Contributor

gracjan commented May 11, 2015

Good luck with your exams!

For the lazy that didn't know the word (like me): http://en.wikipedia.org/wiki/Detritus

@gracjan
Copy link
Contributor

gracjan commented Jun 4, 2015

@antalsz: Reminder that this one is needed very much!

@gracjan
Copy link
Contributor

gracjan commented Jul 20, 2015

@antalsz: I did #757 so you can base your work on haskell-lexeme.el.

@gracjan
Copy link
Contributor

gracjan commented Jul 23, 2015

@antalsz: ping. Can you help out with this one?

@gracjan
Copy link
Contributor

gracjan commented Aug 22, 2015

@antalsz: Are you able to return to this topic?

@gracjan
Copy link
Contributor

gracjan commented Sep 3, 2015

Review status: 0 of 10 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


haskell-commands.el, line 417 [r2] (raw file):
This regexp is missing apostrophes


Comments from the review on Reviewable.io

@gracjan
Copy link
Contributor

gracjan commented Sep 28, 2015

@antalsz: If you will find time to update this feel free to reopen or create a new pull request. This change is needed!

@gracjan gracjan closed this Sep 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants