From 0a2541f73acea5c24a19cacad7aeec8d6a22aec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kruszewski?= Date: Tue, 4 Apr 2023 10:22:46 +0200 Subject: [PATCH] troff filetype: Add support for pic syntax highlighting --- rc/filetype/troff.kak | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/rc/filetype/troff.kak b/rc/filetype/troff.kak index d8e2e2bc..52036aa0 100644 --- a/rc/filetype/troff.kak +++ b/rc/filetype/troff.kak @@ -22,22 +22,28 @@ provide-module troff %{ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ -add-highlighter shared/troff group +add-highlighter shared/troff regions -add-highlighter shared/troff/ regex '(^\.)?\\".*?\n' 0:comment - -add-highlighter shared/troff/ regex '\\f[A-Z]' 0:attribute -add-highlighter shared/troff/ regex '\\fB(.+?)\\f[A-Z]' 1:+b -add-highlighter shared/troff/ regex '\\fI(.+?)\\f[A-Z]' 1:+i - -add-highlighter shared/troff/ regex '^\.[a-zA-Z]{1,2}\b' 0:meta -add-highlighter shared/troff/ regex '^\.\.$' 0:meta -add-highlighter shared/troff/ regex '^\.TH\s+[^\n]+' 0:title -add-highlighter shared/troff/ regex '^\.NH(\s+\d+(\s+\d+)?)?\s*\n' 0:header -add-highlighter shared/troff/ regex '^\.SH(\s+\d+)?\s*\n' 0:header -add-highlighter shared/troff/ regex '^\.IR\s+(\S+)' 1:+i -add-highlighter shared/troff/ regex '^\.BR\s+(\S+)' 1:+b -add-highlighter shared/troff/ regex '^\.I\s+([^\n]+)' 1:+i -add-highlighter shared/troff/ regex '^\.B\s+([^\n]+)' 1:+b +add-highlighter shared/troff/text default-region group +add-highlighter shared/troff/text/ regex '(^\.)?\\".*?\n' 0:comment +add-highlighter shared/troff/text/ regex '\\f[A-Z]' 0:attribute +add-highlighter shared/troff/text/ regex '\\fB(.+?)\\f[A-Z]' 1:+b +add-highlighter shared/troff/text/ regex '\\fI(.+?)\\f[A-Z]' 1:+i +add-highlighter shared/troff/text/ regex '^\.[a-zA-Z]{1,2}\b' 0:meta +add-highlighter shared/troff/text/ regex '^\.\.$' 0:meta +add-highlighter shared/troff/text/ regex '^\.TH\s+[^\n]+' 0:title +add-highlighter shared/troff/text/ regex '^\.NH(\s+\d+(\s+\d+)?)?\s*\n' 0:header +add-highlighter shared/troff/text/ regex '^\.SH(\s+\d+)?\s*\n' 0:header +add-highlighter shared/troff/text/ regex '^\.IR\s+(\S+)' 1:+i +add-highlighter shared/troff/text/ regex '^\.BR\s+(\S+)' 1:+b +add-highlighter shared/troff/text/ regex '^\.I\s+([^\n]+)' 1:+i +add-highlighter shared/troff/text/ regex '^\.B\s+([^\n]+)' 1:+b +add-highlighter shared/troff/pic region '^\.PS' '^\.PE' group +add-highlighter shared/troff/pic/ regex '^(\.PS|\.PE\b)' 1:meta +add-highlighter shared/troff/pic/ regex '^(copy)\s+' 1:keyword +add-highlighter shared/troff/pic/ regex '\b(arc|arrow|box|circle|ellipse|line|move|spline)\b' 1:type +add-highlighter shared/troff/pic/ regex '\b(above|at|below|by|center|chop|dashed|diam|diameter|down|dotted|fill|from|ht|height|invis|left|ljust|rad|radius|right|rjust|solid|then|to|up|wid|width|with)\b' 1:attribute +add-highlighter shared/troff/pic/ regex '(\s+|\+|-|\*|/)(\d+(\.\d+)?)' 2:value +add-highlighter shared/troff/pic/ regex '"[^"]*"' 0:string }