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

Make solidity-match-variable-decls regexp's unhighlited matches shy. #56

Merged
merged 1 commit into from
Jan 24, 2020

Conversation

coventry
Copy link
Contributor

This ensures that if the two optional matches in the regexp, \\[ *[0-9]*\\] or
(regexp-opt solidity-variable-modifier 'words) have no match, the name of the
variable being declared can be still be found via the absolute match index 2.
Prior to this change, a simple address foo would match the regexp, but the
expected match index for the variable, 4, would have no match, which could lead
to font-lock errors in some circumstances.

Reference for shy matches

Fixes #47

This ensures that if the two optional matches in the regexp, `\\[ *[0-9]*\\]` or
`(regexp-opt solidity-variable-modifier 'words)` have no match, the name of the
variable being declared can be still be found via the absolute match index 2.
Prior to this change, a simple `address foo` would match the regexp, but the
expected match index for the variable, 4, would have no match, which could lead
to font-lock errors in some circumstances.

[Reference for shy matches](
https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Backslash.html#index-shy-group_002c-in-regexp-1000)
@LefterisJP
Copy link
Collaborator

Hey @coventry very nice catch. Thank you!

@LefterisJP LefterisJP merged commit b190993 into ethereum:master Jan 24, 2020
@coventry
Copy link
Contributor Author

NP, glad I could help.

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.

swiper/solidity-mode incompatibility
2 participants