rc perl: Don't highlight regex, fix string escapes

Highlighting perl regex patterns with regular expressions (with
highlighters) caused several misses that made most of the file
unreadable. This commit makes `perl.kak` not try to highlight
those patterns in the code, and also addresses issues with string
highlighting.
This commit is contained in:
Frank LENORMAND 2017-09-14 14:13:59 +03:00
parent 772f85b883
commit 1b11412796

View File

@ -12,10 +12,10 @@ hook global BufCreate .*\.p[lm] %{
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter -group / regions -default code perl \
command '(?<!\$)`' (?<!\\)(\\\\)*` '' \
double_string '(?<!\$)"' (?<!\\)(\\\\)*" '' \
single_string "(?<!\$)'" (?<!\\)(\\\\)*' '' \
comment '(?<!\$)#' $ ''
command '(?<!\$|\\)`' (?<!\\)(\\\\)*` '' \
double_string '(?<!\$|\\)"' (?<!\\)(\\\\)*" '' \
single_string "(?<!\\$|\\\\)'" (?<!\\)(\\\\)*' '' \
comment '(?<!\$|\\)#' $ ''
add-highlighter -group /perl/command fill magenta
add-highlighter -group /perl/double_string fill string
@ -62,9 +62,6 @@ add-highlighter -group /perl/code regex \$\^(RE_TRIE_MAXBUF|TAINT|UNICODE|UTF8LO
add-highlighter -group /perl/code regex \$[0-9]+ 0:attribute
add-highlighter -group /perl/code regex \b-(B|b|C|c|d|e|f|g|k|l|M|O|o|p|r|R|S|s|T|t|u|w|W|X|x|z)\b 0:attribute
add-highlighter -group /perl/code regex %{(?:\b[stqrmwy]+)?/[^\n/]*/([msixpodualngecr]+\b)?} 0:magenta
add-highlighter -group /perl/code regex %{(?:\b[stqrmwy]+)?/[^\n/]+/[^\n/]*/([msixpeodualngcr]+\b)?} 0:magenta
add-highlighter -group /perl/code regex \$[a-zA-Z_][a-zA-Z0-9_]* 0:variable
add-highlighter -group /perl/code regex \$(a|b|LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR)\b 0:value