From 19b54a8a6e2c16bda671cdefb5af1db464e60a86 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 18 Sep 2020 19:18:39 +0200 Subject: [PATCH] Highlight more Perl quoting syntaxes This adds highlighting for - quoting operators qw, qr, and qx, like `qw< some words >` - angle brackets after a quoting operator, like `q` - punctuation as quoting delimiter, like `q|string|` - POD sections, which start with ^=\w and and with ^=cut - heredocs; the marker can be a bare word, or a quoted word, like print <<~ 'EOF' single quoted heredoc EOF Closes #3736 No attempt is made to use different highlighting for interpolated (qq or "") strings just yet. Recognizing quote boundaries is more important. --- rc/filetype/perl.kak | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index 348b4cd3..a7dcaa2a 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -37,21 +37,25 @@ provide-module perl %ยง add-highlighter shared/perl regions add-highlighter shared/perl/code default-region group -add-highlighter shared/perl/command region (? fill string +add-highlighter shared/perl/quote_punct region -match-capture '\bq[qwx]?([:;!@#$%^&*|,.?/~=+-])' '(.)' fill string +add-highlighter shared/perl/quote_regex region -match-capture '\bqr([:;!@#$%^&*|,.?/~=+-])' '(.)' fill meta -add-highlighter shared/perl/qq1 region -recurse \{ qq\{ \} fill string -add-highlighter shared/perl/qq2 region -recurse \( qq\( \) fill string -add-highlighter shared/perl/qq3 region -recurse \[ qq\[ \] fill string +add-highlighter shared/perl/double_heredoc region -match-capture <<~?\h*'(\w+)' ^\t*(\w+)\b fill string +add-highlighter shared/perl/single_heredoc region -match-capture <<~?\h*"(\w+)" ^\t*(\w+)\b fill string +add-highlighter shared/perl/bare_heredoc region -match-capture <<~?(\w+) ^\t*(\w+)\b fill string +add-highlighter shared/perl/pod region ^=\w+ ^=cut\b fill string evaluate-commands %sh{ # Grammar