diff options
author | Matt Merhar <mattmerhar@protonmail.com> | 2022-04-27 22:28:04 -0400 |
---|---|---|
committer | Christian Hergert <chergert@redhat.com> | 2022-06-12 10:21:12 -0700 |
commit | f53941b3cf90cbf8983a82136360b4683be601db (patch) | |
tree | f71915bc8a36133deafc3317b46e7e04af999a9c | |
parent | e6fd24aa7fe3924e3d1a38a2709bc07a1c25edc4 (diff) | |
download | gtksourceview-f53941b3cf90cbf8983a82136360b4683be601db.tar.gz |
perl.lang: fix POD =begin keyword
There were two issues:
- The first regex was matching =end as well
- The wrong capture variable was being referenced in the =end regex
These led to =end being completely ignored, causing syntax highlighting
to cease for anything after the initial =begin (including =cut).
This also modifies the file.pl test cases to include a section of POD
that'll break highlighting without this commit applied. An example of
__END__ was added as well. The POD in the file additionally now renders
properly with 'perldoc'.
-rw-r--r-- | data/language-specs/perl.lang | 4 | ||||
-rw-r--r-- | tests/syntax-highlighting/file.pl | 35 |
2 files changed, 37 insertions, 2 deletions
diff --git a/data/language-specs/perl.lang b/data/language-specs/perl.lang index 5764dd44..4b38ec4b 100644 --- a/data/language-specs/perl.lang +++ b/data/language-specs/perl.lang @@ -1022,7 +1022,7 @@ FIXME: =pod should require an empty line before/after, as written in perlpod </context> <context id="pod" style-ref="pod" class-disabled="no-spell-check"> - <start>^(?=(=[a-z]))</start> + <start>^(?=(=(?!end))[a-z])</start> <end>^=(cut)$</end> <include> <context sub-pattern="1" where="end" style-ref="pod-keyword"/> @@ -1033,7 +1033,7 @@ FIXME: =pod should require an empty line before/after, as written in perlpod </context> <context> <start>^=(begin)\s+(.*)$</start> - <end>^=(end)\s+\%{1@start}$</end> + <end>^=(end)\s+\%{2@start}$</end> <include> <context sub-pattern="1" where="start" style-ref="pod-keyword"/> <context sub-pattern="1" where="end" style-ref="pod-keyword"/> diff --git a/tests/syntax-highlighting/file.pl b/tests/syntax-highlighting/file.pl index 36742a41..4ac90ad7 100644 --- a/tests/syntax-highlighting/file.pl +++ b/tests/syntax-highlighting/file.pl @@ -102,16 +102,51 @@ sub login { } until /^\s+$/; } +=pod + =head1 EXAMPLE + B<collateindex.pl> B<-o> F<index.sgml> F<HTML.index> + =head1 EXIT STATUS + =over 5 + =item B<0> Success + =item B<1> Failure + =back + =head1 AUTHOR + Norm Walsh E<lt>ndw@nwalsh.comE<gt> Minor updates by Adam Di Carlo E<lt>adam@onshore.comE<gt> and Peter Eisentraut E<lt>peter_e@gmx.netE<gt> + +=begin html +<!-- +This is raw data ignored by POD processors. +=end not_the_end =cut +--> +=end html + +Still POD. + +=cut + +sub end { +=pod + +Here's another snippet of valid C<POD>. + +=cut + + my $foo = { bar => \*STDOUT }; +} + +__END__ + +if present, this data isn't supposed to be processed as Perl. |