-
-
Notifications
You must be signed in to change notification settings - Fork 826
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
feat(perl)!: replace parser #5222
feat(perl)!: replace parser #5222
Conversation
Is this the one @leonerd has been working on? |
It is, yes |
So, first order of business:
|
Ah as a total aside, I was curious about that for my own implementation. I think this seems to be the most common interpretation. Good. But I'm unclear why you bring it up specifically now - I don't think we rely on that anywhere, do we? I've mostly been using/testing this via nvim anyway, so I believe nvim's interpretation is correct.
Ahyes; probably some adjusting needs doing there then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing highlights for operators and punctuation.
Also missing this for shebangs:
((source_file . (comment) @preproc)
(#lua-match? @preproc "^#!/"))
And possibly more.
It's the interpretation upstream will switch to, as far as I know.
It's just a very common gotcha when queries are downstreamed, so I thought I'd mention it just to potentially save some time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also highlight the angle brackets as @punctutation.delimiter
if possible.
I would suggest adding these as well:
(interior_sequence
(sequence_letter) @character
(#eq? @letter "X")
(content) @text.reference)
(interior_sequence
(sequence_letter) @character
(#eq? @letter "E")
(content) @string.escape)
@rabbiveesh we've just switched the format of injection queries to that of upstream, so please rebase and adapt yours. (Holler if you need help, but should be straightforward.) |
Damn, I literally just yesterday implemented injections in |
There isn't much to alter, just that only |
Oh, you were basing your own implementation on Neovim's custom format? That's not a good idea... The new format is the same that tree-sitter (and everybody else) is using, so you should, too ;) |
I'm working on the operator + punctuation highlighting RN, and I'm having an issue. We handle parsing semicolons in our scanner, and I can't for the life of me get tree-sitter to match the semicolon token. Any ideas? Worst comes to worst i can always rework the grammar to parse semicolon as a normal token, but looking fo rideas |
alias $._PERLY_SEMICOLON to ';' wherever it's used |
Or change the name so it isn't hidden. |
353ea71
to
73813e6
Compare
Rebased + force-pushed so CI can run. Still open question about the |
They are, but they won't be highlighted any differently by default. |
Okay, now it's ready! |
I'm also a bit concerned about state count, a 9000 large state count might be very laggy/slow on lower end machines, just something to consider |
Yeah; we're not happy about that either. A big part of that is because tree-sitter itself doesn't have a native concept of list-associative, or non-associative operators. When we tried to properly implement things like chaining comparisons But if you have any way on the process, or even know the right folks to talk to, please do get in touch :) We want that fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perl is still missing @punctuation.bracket
highlights, $#
(maybe @operator
?), some operators (e.g. &&
), and regexp modifiers (@character.special
). Built-in variables (e.g. ARGV
) should be highlighted as @variable.builtin
(or @constant.builtin
where applicable).
Pod should include injections for =begin
and =for
blocks. You could also add folds but they aren't necessary.
Also, if you can make the regexp content a named node or field so it can be captured in textobjects, that'd be appreciated (but not necessary). |
I actually meant INTERNAL consistency, not here. I need to test a different part of the capture in one of the injections, and that's tripping the queries test. How can I do that w/o getting an error (basically, we inject perl into itself when the replacement of a regexp is a perl expression, ie when the modifiers on your |
If you only need a capture to refer to it in a predicate, you need to mark it as private with an underscore: |
Ah, thanks a mil, fixed + repushed |
This is a problem that all markup languages share (#812). |
well, only |
That's fine then. |
Okay, only question remaining is if i can keep using plain-ol match or if we should switch it to |
Is CI borked? these failures don't seem to have anything to do w/ my PR |
Please avoid merge commits. :) |
oh sorry, i'm used to a squash merge flow. Let me rebase |
70596d2
to
1e6e4a0
Compare
CI does seem to be borked.
You can squash the commits if you want. |
No, please do squash commits, especially if you want to keep perl and pod separate. (In that case, the pod commit needs to be first for the injections to not be broken.) |
Sure, but could I just squash it down to one? POD doesn't get too much use outside of perl, so it's effectively one commit. Unless you specifically want them separate |
That's fine, too. |
c6ec228
to
6f41595
Compare
k, squashed; did it in 2 commits b/c the commit log reads bettter that way |
Thanks for your patience and contribution @rabbiveesh! |
🥳 thanks for your patience! |
This replaces the perl parser from ganezdragon with an actively maintained + considerably
more correct version. There are some features that we're still working on, but by and
large this has already proven very useful for me in my day to day.
One of the things that we support is coloring scalars, arrays and hashes differently. Is
there a way to expose that in a simple way to users? We're doing it by making a
@variable.scalar
,@variable.array
and@variable.hash
.