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

Looks like this breaks the parser #10

Open
willt opened this issue Oct 11, 2021 · 16 comments
Open

Looks like this breaks the parser #10

willt opened this issue Oct 11, 2021 · 16 comments

Comments

@willt
Copy link

willt commented Oct 11, 2021

I just installed tree-sitter and this tree-sitter-perl grammar file. I'm using latest neovim with the gurvbox colorscheme.
The image on the left is with tree-sitter highlighting on and the one on the right is with it off.
Looks like the parser breaks if qw/ /; contains a question mark.

image

@ganezdragon
Copy link
Owner

@willt , this is a known issue.. the parser doesn't behave properly for all the quote like operators in perl with deliimiters other than, {, /, [, '

I'm currently fixing it since users are requesting. Expect it to be fixed by this week. Or you could use the delimiters I have mentioned above in the meantime.

@willt
Copy link
Author

willt commented Oct 12, 2021 via email

@DavidEGx
Copy link

Any news on this? Is it fixed?

Similar issue when my code contains something like:

print("${key}");

print("$key") looks ok.

@ganezdragon
Copy link
Owner

@DavidEGx , in recent commits, I have fixed it for qw as mentioned in the above example. And there were other quote based operators which were facing the issue, so fixed them too. But there is still s// and tr// syntax left. Should push them, and make a version upgrade. Very soon!

@marcelarie
Copy link

marcelarie commented Jan 10, 2022

I got the same problem with =~ s!!!;
And some subroutines have different color.

with OceanicNext
ArcoLinux_2022-01-10_17-30-15
ArcoLinux_2022-01-10_17-30-27

with gruvbox-flat
ArcoLinux_2022-01-10_17-31-52
ArcoLinux_2022-01-10_17-32-30

@ganezdragon
Copy link
Owner

@marcelarie , I'm still working on the s/// and tr// syntaxes with other identifiers. Currently it should work with s///.

And let me checkout why that subname is highlighted differently and get back

@ganezdragon
Copy link
Owner

I have publish version 0.3.0 . This should parse all these syntax properly. Let me know otherwise. :)

@marcelarie
Copy link

Amazing, thanks @ganezdragon!! I will test it at work tomorrow.

@DavidEGx
Copy link

Thanks for the work.

This one seems to break it currently:

my $x;
if ($x =~ m/^asf$/) {
}

Also this one:

my $x;
if ($x =~ //) {
}

As far as I know I'm using the last version (run :TSUpdateSync).

@ganezdragon
Copy link
Owner

okay, I see the $ in the regex is causing the problem. It starts to expect a scalar variable. Let me fix that.

But the latter with just // works fine for me.

@DavidEGx
Copy link

Weird.

Code

@DavidEGx
Copy link

Another one:

use strict;
use warnings;

=head1 METHODS

=head2 test1

Test

=cut

sub test1 : Path('/') {
}

=head2 test2

Looks good. But now...

=cut

sub test2 : Path('/') Args(0) {
}

=head3 test3

Hmmm, this is looks odd now

=cut

sub test3 {
}

See:

code

BTW, shall I create separate separate github issues for any separate new problem I find?

@ganezdragon
Copy link
Owner

yea we could create separate issues, as a fallout of 0.3.0 version maybe, to better keep on track.

@ganezdragon
Copy link
Owner

@DavidEGx , I'm not sure if your last snippet is syntactically correct. When I compile the code I get the following,

Invalid CODE attribute: Path('/') at examples/test.pl line 13.
BEGIN failed--compilation aborted at examples/test.pl line 13.

@DavidEGx
Copy link

@ganezdragon forgot to inherit from Catalyst::Controller in the example.

Fixed version:

use strict;
use warnings;
use base qw/Catalyst::Controller/;

=head1 METHODS

=head2 test1                      

Test

=cut

sub test1 : Path('/') {
}

=head2 test2

Looks good. But now...

=cut

sub test2 : Path('/') Args(0) {
}

=head3 test3

Hmmm, this is looks odd now

=cut

sub test3 {
}

1;

Same syntax highlighting issue.

@Noino
Copy link

Noino commented Aug 29, 2023

also in the category of things that break the parser?
image

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

No branches or pull requests

5 participants