[gtksourceview/gtksourceview-5-4] perl.lang: fix POD =begin keyword
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gtksourceview-5-4] perl.lang: fix POD =begin keyword
- Date: Sun, 12 Jun 2022 17:42:46 +0000 (UTC)
commit f53941b3cf90cbf8983a82136360b4683be601db
Author: Matt Merhar <mattmerhar protonmail com>
Date: Wed Apr 27 22:28:04 2022 -0400
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'.
data/language-specs/perl.lang | 4 ++--
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]