merlin
merlin copied to clipboard
Improve location of some custom operators
This (maybe?) closes #1915.
It adds the same test as #1916, plus a:
- Definite fix for
:=- Just lex this as an operator.
- Definite fix for reified custom indexing (e.g, something like
( .@(;..)<- ))- We lex this as
DOTOP SEMI DOTDOT ...and detect it in the driver code
- We lex this as
- Heuristic fix for other custom indexing
- When we see a
DOTOPin the wild, we assume it is single-indexing without assignment and complete it accordingly. E.g., the codename.@( (* whatever here ... *)will get turned into.@ ( )by reconstruct_id, even if we'd like to also detect things like;or<-to disambiguate. - This is obviously wrong-in-general, but I think it's more useful than the current behavior, since users are encouraged to always define this variant if using the custom indexing, and they're often near each other. I also don't know if it can be done any better, since truly disambiguating requires I think arbitrary amounts of parsing?
- When we see a
The test shows both the cases that don't work before (see existing output in #1917) and the cases that "work" but produce incorrect locations due to the third bullet point above.
Fuzzy CI diff looks all intentional to me
Thanks for the patch @WardBrian. I will review it when I get some spare cycles (it might take some time..).
@voodoos gentle ping -- is there still interest in this being looked at?