diff --git a/autotests/folding/highlight.pl.fold b/autotests/folding/highlight.pl.fold index 7cd42fd..6845697 100644 --- a/autotests/folding/highlight.pl.fold +++ b/autotests/folding/highlight.pl.fold @@ -1,55 +1,75 @@ #!/usr/bin/perl -w # This is a pseudo Perl file to test Kate's Perl syntax highlighting. # TODO: this is incomplete, add more syntax examples! sub prg($) { my $var = shift; $var =~ s/bla/foo/igs;/foo/igs; $var =~ s!bla!foo!igs;!foo!igs; $var =~ s#bla#foo#igs;#foo#igs; $var =~ tr/a-z/A-Z/; ($match) = ($var =~ m/(.*?)/igs); $test = 2/453453.21; $test /= 2; print qq~d fsd fsdf sdfl sd~ $" = '/'; $foo = <<__EOF; d ahfdklf klsdfl sdf sd fsd sdf sdfsdlkf sd __EOF $x = "dasds"; next if( $match eq "two" ); next if( $match =~ /go/i ); @array = (1,2,3); # a comment @array = qw(apple foo bar); push(@array, 4); %hash = (red => 'rot', blue => 'blau'); print keys(%hash); } sub blah { my $str = << ' EOS'; this is my string and it's continuation EOS $str = "hello world"; $str = << " EOS"; this is my string and it's continuation EOS } &blah; prg("test"); + +# Bracket closures in RegExp patterns (bug #364866) +qr{ ${var} aa{aa{a}a} aa*b?}; +qr(aa(a(a(a(b|c)a)a)a)aa*b?); +s{aaa {aaa} a \x{A2} *b?}{aa}; +s(aa(a(a(a(b|c)a)a)a)aa)(aa); + +# Strings as scalar references (bug #348765) +$x = \'Reference of a String'; +$y = \"Reference of a String"; + +# Variables that start with underscore (bug #355300) +$_variable +$_ # Reserved var. + +for my $x ($hash->{arr}->@*) { + for my $k (keys $k->%*) { + ... + } +} diff --git a/autotests/html/highlight.pl.html b/autotests/html/highlight.pl.html index 98e4703..4e31dda 100644 --- a/autotests/html/highlight.pl.html +++ b/autotests/html/highlight.pl.html @@ -1,62 +1,82 @@ highlight.pl
 #!/usr/bin/perl -w
 # This is a pseudo Perl file to test Kate's Perl syntax highlighting.
 # TODO: this is incomplete, add more syntax examples!
 
 sub prg($)
 {
 	my $var = shift;
 
 	$var =~ s/bla/foo/igs;
 	$var =~ s!bla!foo!igs;
 	$var =~ s#bla#foo#igs;
 	$var =~ tr/a-z/A-Z/;
 	($match) = ($var =~ m/(.*?)/igs);
 
 	$test = 2/453453.21;
 	$test /= 2;
 
 	print qq~d fsd fsdf sdfl sd~
 	
 	$" = '/';
 	
 	$foo = <<__EOF;
 d ahfdklf klsdfl sdf sd
 fsd sdf sdfsdlkf sd
 __EOF
 
 	$x = "dasds";
 
 	next if( $match eq "two" );
 	next if( $match =~ /go/i );
 
 	@array = (1,2,3);		# a comment
 	@array = qw(apple foo bar);
 	push(@array, 4);
 	%hash = (red => 'rot',
 		blue => 'blau');
 	print keys(%hash);
 }
 
 sub blah {
     my $str = << '    EOS';
         this is my string
         and it's continuation
     EOS
 
     $str = "hello world";
 
     $str = << "    EOS";
         this is my string
         and it's continuation
     EOS
 }
 
 &blah;
 prg("test");
+
+# Bracket closures in RegExp patterns (bug #364866)
+qr{ ${var} aa{aa{a}a} aa*b?};
+qr(aa(a(a(a(b|c)a)a)a)aa*b?);
+s{aaa {aaa} a \x{A2} *b?}{aa};
+s(aa(a(a(a(b|c)a)a)a)aa)(aa);
+
+# Strings as scalar references (bug #348765)
+$x = \'Reference of a String';
+$y = \"Reference of a String";
+
+# Variables that start with underscore (bug #355300)
+$_variable
+$_ # Reserved var.
+
+for my $x ($hash->{arr}->@*) {
+    for my $k (keys $k->%*) {
+        ...
+    }
+}
 
diff --git a/autotests/input/highlight.pl b/autotests/input/highlight.pl index f3bfd30..7d15d24 100644 --- a/autotests/input/highlight.pl +++ b/autotests/input/highlight.pl @@ -1,55 +1,75 @@ #!/usr/bin/perl -w # This is a pseudo Perl file to test Kate's Perl syntax highlighting. # TODO: this is incomplete, add more syntax examples! sub prg($) { my $var = shift; $var =~ s/bla/foo/igs; $var =~ s!bla!foo!igs; $var =~ s#bla#foo#igs; $var =~ tr/a-z/A-Z/; ($match) = ($var =~ m/(.*?)/igs); $test = 2/453453.21; $test /= 2; print qq~d fsd fsdf sdfl sd~ $" = '/'; $foo = <<__EOF; d ahfdklf klsdfl sdf sd fsd sdf sdfsdlkf sd __EOF $x = "dasds"; next if( $match eq "two" ); next if( $match =~ /go/i ); @array = (1,2,3); # a comment @array = qw(apple foo bar); push(@array, 4); %hash = (red => 'rot', blue => 'blau'); print keys(%hash); } sub blah { my $str = << ' EOS'; this is my string and it's continuation EOS $str = "hello world"; $str = << " EOS"; this is my string and it's continuation EOS } &blah; prg("test"); + +# Bracket closures in RegExp patterns (bug #364866) +qr{ ${var} aa{aa{a}a} aa*b?}; +qr(aa(a(a(a(b|c)a)a)a)aa*b?); +s{aaa {aaa} a \x{A2} *b?}{aa}; +s(aa(a(a(a(b|c)a)a)a)aa)(aa); + +# Strings as scalar references (bug #348765) +$x = \'Reference of a String'; +$y = \"Reference of a String"; + +# Variables that start with underscore (bug #355300) +$_variable +$_ # Reserved var. + +for my $x ($hash->{arr}->@*) { + for my $k (keys $k->%*) { + ... + } +} diff --git a/autotests/reference/highlight.pl.ref b/autotests/reference/highlight.pl.ref index 182025e..e9cedd1 100644 --- a/autotests/reference/highlight.pl.ref +++ b/autotests/reference/highlight.pl.ref @@ -1,55 +1,75 @@ #!/usr/bin/perl -w
# This is a pseudo Perl file to test Kate's Perl syntax highlighting.
# TODO: this is incomplete, add more syntax examples!

sub prg($)
{
my $var = shift;

$var =~ s/bla/foo/igs;
$var =~ s!bla!foo!igs;
$var =~ s#bla#foo#igs;
$var =~ tr/a-z/A-Z/;
($match) = ($var =~ m/(.*?)/igs);

$test = 2/453453.21;
$test /= 2;

print qq~d fsd fsdf sdfl sd~

$" = '/';

$foo = <<__EOF;
d ahfdklf klsdfl sdf sd
fsd sdf sdfsdlkf sd
__EOF

$x = "dasds";

next if( $match eq "two" );
next if( $match =~ /go/i );

@array = (1,2,3); # a comment
@array = qw(apple foo bar);
push(@array, 4);
%hash = (red => 'rot',
blue => 'blau');
print keys(%hash);
}

sub blah {
my $str = << ' EOS';
this is my string
and it's continuation
EOS

$str = "hello world";

$str = << " EOS";
this is my string
and it's continuation
EOS
}

&blah;
prg("test");
+
+# Bracket closures in RegExp patterns (bug #364866)
+qr{ ${var} aa{aa{a}a} aa*b?};
+qr(aa(a(a(a(b|c)a)a)a)aa*b?);
+s{aaa {aaa} a \x{A2} *b?}{aa};
+s(aa(a(a(a(b|c)a)a)a)aa)(aa);
+
+# Strings as scalar references (bug #348765)
+$x = \'Reference of a String';
+$y = \"Reference of a String";
+
+# Variables that start with underscore (bug #355300)
+$_variable
+$_ # Reserved var.
+
+for my $x ($hash->{arr}->@*) {
+ for my $k (keys $k->%*) {
+ ...
+ }
+}
diff --git a/data/syntax/perl.xml b/data/syntax/perl.xml index a29a49b..cd3d3ce 100644 --- a/data/syntax/perl.xml +++ b/data/syntax/perl.xml @@ -1,833 +1,878 @@ - + if unless else elsif while until for each foreach next last break continue return my our local state BEGIN END package sub do given when default __END__ __DATA__ __FILE__ __LINE__ __PACKAGE__ = != ~= += -= *= /= **= |= ||= //= &= &&= ?= + - * % || // && | & < << > >> ^ -> => . , ; :: \ and or not eq ne lt gt le ge cmp abs accept alarm atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir connect cos crypt dbmclose dbmopen defined delete die dump endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime goto grep hex import index int ioctl join keys kill last lc lcfirst length link listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd no oct open opendir ord pack package pipe pop pos print printf prototype push quotemeta rand read readdir readline readlink recv redo ref rename require reset return reverse rewinddir rindex rmdir scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study sub substr symlink syscall sysread sysseek system syswrite tell telldir tie time times truncate uc ucfirst umask undef unlink unpack unshift untie use utime values vec wait waitpid wantarray warn write strict english warnings vars subs utf8 sigtrap locale open less integer filetest constant bytes diagnostics - + + - + - + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + - + + + + - - + - + + + + + - - - + +