I guess this is as good a time as any to share the Vim syntax
highlighting rules I use, which I rewrote from the ground up, and last
worked on about a year ago.

I undertook this because I found the stock Vim one, with Pedro Alejandro
López-Valencia's and Jérôme Plût's names on it, difficult to understand.
This might be more my problem than theirs.

I didn't _finish_ to my satisfaction--I ran into some kind of problems
involving the boundaries of the highlighting vs. the boundaries of the
lexical matching, which made some nested escape sequences not render to
my satisfaction.  (I am demanding in this regard.)  Even after much
reading of the Vim manual and experimentation I couldn't get this to
work the way I wanted.  I am prone to using perverse cases for testing.

On the other hand, for practical work--hacking on groff, which has
hairier exhibits of *roff source code than most code bases--I have gone
a year without noticing or being annoyed by bad lexical coloring, so I
guess other people might benefit from this as well.

Things I had planned for this and even implemented at one point, but
which broke in my quest for nested escape sequence rendering perfection:

1.  Coloring control characters in yellow.
2.  Coloring request names in bright yellow.
3.  Coloring macro names (anything in the position of a request name
    that doesn't match the list of all request names) in yellow.

I had these working just fine for a while in my initial hack-up of the
stock nroff.vim, but since my deeper rewrite they got lost and I've
found I don't miss them.  I might still have the giant declarations of
all CSTR #54 and groff extension request names lying around
somewhere.[1]

Here are the relevant pieces of my .vimrc.

"let nroff_is_groff = 1
"let g:nroff_show_groffisms = 1
let nroff_space_errors = 1

" man pages--source or nroff output?
autocmd BufNewFile,BufRead *.man call s:FTman()

" If any of the first 10 lines of the file begin with a . or ', assume it's roff
" source.
function s:FTman()
    let t = "man"
    let n = 1
    while n < 10
        let line = getline(n)
        if line =~ "^['.]"
            let t = "groff"
            break
        endif
        let n = n + 1
    endwhile
    execute "setfiletype" t
endfunction

" troff/groff files
autocmd BufNewFile,BufRead *.groff setfiletype groff
autocmd BufNewFile,BufRead *.troff setfiletype nroff

autocmd BufReadPost *.man,*.me,*.mm,*.mom,*.ms,*.groff,*.roff,*.tmac
\    set comments=:.\\\",:'\\\",:.\\#,:'\\#

I'm attaching my nroff.vim.  This goes in $HOME/.vim/syntax if you want
to try it out.

And, for grins, my "git log -p" is also attached in case anyone would
find that edifying.

I also have the following.

$ cat /home/branden/.vim/after/syntax/nroff.vim
" Fix nearly unreadable highlight definition.
highlight Special ctermfg=red

hi nroffComment term=italic cterm=italic gui=italic ctermfg=cyan
hi nroffTodo    term=italic cterm=italic gui=italic ctermfg=black 
ctermbg=yellow guifg=blue guibg=yellow
hi nroffNote    term=reverse,italic cterm=reverse,italic gui=reverse,italic 
ctermfg=cyan
hi nroffRequest term=bold cterm=bold gui=bold ctermfg=yellow

Regards,
Branden

[1] They can be reconstructed using CSTR #54 and the groff(7) man page.
    N.B., groff 1.23 adds four new requests, 'stringup', 'stringdown',
    'soquiet' and 'msoquiet', and there are two undocumented requests:
    'tag' and 'taga'.  I learned this last fact only in the past
    year.[2]  But I'm happy to share my lists if someone asks for them,
    and if I can find them--I hacked them into the Plût/Valencia syntax
    file, so I might have thrown them away when I undertook my rewrite.

[2] I would, of course, document them, but (1) I don't understand them
    yet and (2) I am not sure I will want to keep them once I do.  They
    have something to do with the nigh-undocumented "devtag" stuff, a
    recurring source of irritation since I began contributing to groff.
" Vim syntax file
" by G. Branden Robinson, August 2021.  GPLv3.
" Language:     nroff/groff/troff

if exists("b:current_syntax")
    finish
endif

let s:cpo_save = &cpo
set cpo&vim

" This syntax should be named 'troff'; it recognizes and does not
" distinguish typesetter-specific features, just like the stock Vim
" implementation.
let b:current_syntax = "nroff"

if exists("b:nroff_is_groff")
    syntax keyword nroffKeyword groff
endif

if exists("b:nroff_is_groff")
    syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
    \nroffSingleSpecialCharacter,
    \nroffSpecialCharacterLeftParenthesis,
    \nroffGroffLeftBracket,
    \nroffSpaceEscape,
    \nroffFixedWidthSpaceEscape,
    \nroffComment,
    \nroffOutputEscape,
    \nroffGroffOutputEscape,
    \nroffInterpolationEscape,
    \nroffArgumentInterpolationEscape,
    \nroffBracketBuildingEscape,
    \nroffCharacterEscape,
    \nroffDrawingEscape,
    \nroffGroffNullableInterpolationEscape,
    \nroffMotionOffsetEscape,
    \nroffMarkEscape,
    \nroffNumberedGlyphEscape,
    \nroffDelimitedEscape,
    \nroffTypeSizeEscape,
    \nroffSlantEscape,
    \nroffDeviceEscape
else
    syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
    \nroffSingleSpecialCharacter,
    \nroffSpecialCharacterLeftParenthesis,
    \nroffSpaceEscape,
    \nroffFixedWidthSpaceEscape,
    \nroffComment,
    \nroffOutputEscape,
    \nroffInterpolationEscape,
    \nroffArgumentInterpolationEscape,
    \nroffBracketBuildingEscape,
    \nroffCharacterEscape,
    \nroffDrawingEscape,
    \nroffMotionOffsetEscape,
    \nroffMarkEscape,
    \nroffNumberedGlyphEscape,
    \nroffDelimitedEscape,
    \nroffTypeSizeEscape,
    \nroffSlantEscape,
    \nroffDeviceEscape
endif

" Handle simple one-character escape form that takes no arguments.
" \% \& \a \c \d \e \p \r \t \u \z \{ \}
syntax match nroffSimpleEscape /[%&acdeprtuz{}]/ contained

" \) \: \E
if exists("b:nroff_is_groff")
    syntax match nroffSimpleEscape /[):E]/ contained
endif

" "\ "
" Some people might not like the following, but I like how it
" discourages use of this escape sequence.
syntax match nroffFixedWidthSpaceEscape / / contained
syntax match nroffFixedWidthSpaceEscape /\\ $/

" \0 \| \^
syntax match nroffSpaceEscape /[0|^]/ contained
" \~
if exists("b:nroff_is_groff")
    syntax match nroffSpaceEscape /\~/ contained
endif

" Handle AT&T-style special character escape sequences.
" \- \' \` \_
syntax match nroffSingleSpecialCharacter /[-'`_]/ contained

" \(xx
syntax match nroffSpecialCharacterLeftParenthesis /(/ contained
\ nextgroup=nroffDoubleSpecialCharacter,nroffEscapeCharacter
syntax match nroffDoubleSpecialCharacter /[^\\][^\\]/ contained

" Handle groff-style special character escape sequences.
" \[xxx]
if exists("b:nroff_is_groff")
    syntax match nroffGroffLeftBracket /\[/ contained
    \ nextgroup=nroffGroffSpecialCharacter
    syntax match nroffGroffSpecialCharacter /[^]]\+/ contained
    \ nextgroup=nroffGroffRightBracket
    syntax match nroffGroffRightBracket /\]/ contained
endif

" Handle comments.  They consume the rest of the line.
" \"
syntax match nroffComment /".*/ contained contains=nroffNote,nroffTodo

" \#
if exists("b:nroff_is_groff")
    syntax match nroffComment /#.*/ contained contains=nroffNote,
    \nroffTodo
endif

syntax keyword nroffNote Note NOTE contained
syntax keyword nroffTodo FIXME TODO XXX contained

" Handle "transparent line" escape.  It also eats the rest of the line.
" \!
syntax match nroffOutputEscape /!/ contained nextgroup=nroffDeviceOutput
syntax match nroffDeviceOutput /.*/ contained

" Handle groff's "inline" device output escape.
" \?
if exists("b:nroff_is_groff")
    syntax region nroffGroffDeviceOutput
    \ matchgroup=nroffGroffOutputEscape start=/\\?/ end=/\\?/ oneline
endif

" Handle escape sequences that take arguments.

" \* \f \g \n
syntax match nroffSingleCharacterIdentifer /[^\\]/ contained
syntax match nroffIdentifierLeftParenthesis /(/ contained
\ nextgroup=nroffIdentifier
syntax match nroffIdentifier /[^\\][^\\]/ contained

if exists("b:nroff_is_groff")
    syntax match nroffInterpolationEscape /[*gn]/ contained
    \ nextgroup=nroffSingleCharacterIdentifer,
    \nroffIdentifierLeftParenthesis,nroffGroffIdentifierLeftBracket
    syntax match nroffGroffIdentifierLeftBracket /\[/ contained
    \ nextgroup=nroffGroffIdentifier
    syntax match nroffGroffIdentifier /[^]]\+/ contained
    \ nextgroup=nroffGroffRightBracket

    " In groff, sometimes the bracket contents can be empty.
    syntax match nroffGroffNullableInterpolationEscape /f/ contained
    \ nextgroup=nroffSingleCharacterIdentifer,
    \nroffIdentifierLeftParenthesis,nroffGroffNullableBracketParameter
    syntax region nroffGroffNullableBracketParameter
    \ matchgroup=nroffInterpolationEscape start=/\[/ end=/\]/ contained
    \ oneline
else
    syntax match nroffInterpolationEscape /[*fgn]/ contained
    \ nextgroup=nroffSingleCharacterIdentifer,
    \nroffIdentifierLeftParenthesis
endif

" macro argument interpolation
" \$
syntax match nroffArgumentInterpolationEscape /\$/ contained
\ nextgroup=nroffSingleDigitNumber
syntax match nroffSingleDigitNumber /\d/ contained

if exists("b:nroff_is_groff")
    syntax match nroffArgumentInterpolationEscape /\$/ contained
    \ nextgroup=nroffSingleDigitNumber,
    \nroffGroffArgumentLeftParenthesis,nroffGroffArgumentLeftBracket
    syntax match nroffGroffArgumentLeftParenthesis /(/ contained
    \ nextgroup=nroffGroffDoubleDigitNumber
    syntax match nroffGroffDoubleDigitNumber /\d\d/ contained
    syntax match nroffGroffArgumentLeftBracket /\[/ contained
    \ nextgroup=nroffBracketDelimitedNumber
    syntax match nroffBracketDelimitedNumber /\d\+/ contained
    \ nextgroup=nroffGroffRightBracket
endif

" Handle escape sequences that take delimiters.

" bracket builder
" \b
syntax match nroffBracketBuildingEscape /b/ contained
\ nextgroup=nroffDelimitedEscapeArgument
syntax region nroffDelimitedEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffEscapeCharacter

" special character escape
" \C
" TODO: Tricky; practically any character can appear in a special
" character name, and predefined names (see groff_char(7)) use both
" apostrophes and double quotes.  However, the double quote is
" considerably rarer, used only for the "Hungarian umlaut" (\C'a"').
" Therefore, encourage people to use a double quote for the escape
" delimiter.  For other escapes, we encourage the apostrophe, following
" examples in CSTR #54 and much other troff literature.
syntax match nroffCharacterEscape /C/ contained
\ nextgroup=nroffCharacterEscapeArgument
syntax region nroffCharacterEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/"/ end=/"/ contained
\ contains=nroffSpecialCharacter
syntax match nroffSpecialCharacter /[^"]\+/ contained

" drawing escape
" \D
" TODO: More precisely highlight the drawing command arguments.
syntax match nroffDrawingEscape /D/ contained
\ nextgroup=nroffDrawingEscapeArgument
syntax region nroffDrawingEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffArcDrawingCommand,nroffCircleDrawingCommand,
\nroffEllipseDrawingCommand,nroffLineDrawingCommand,
\nroffSplineDrawingCommand

syntax match nroffArcDrawingCommand /a/ contained
\ nextgroup=nroffDrawingArguments
syntax match nroffCircleDrawingCommand /c/ contained
\ nextgroup=nroffDrawingArguments
syntax match nroffEllipseDrawingCommand /e/ contained
\ nextgroup=nroffDrawingArguments
syntax match nroffLineDrawingCommand /l/ contained
\ nextgroup=nroffDrawingArguments
syntax match nroffSplineDrawingCommand /\~/ contained
\ nextgroup=nroffDrawingArguments

syntax match nroffDrawingArguments /[-+.0-9cipPmnvu \t]\+/ contained

if exists("b:nroff_is_groff")
    syntax region nroffDrawingEscapeArgument
    \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
    \ contains=nroffArcDrawingCommand,nroffCircleDrawingCommand,
    \nroffEllipseDrawingCommand,nroffLineDrawingCommand,
    \nroffSplineDrawingCommand,nroffSetFillColorDrawingCommand,
    \nroffPolygonDrawingCommand,nroffSetLineThicknessDrawingCommand
    syntax match nroffCircleDrawingCommand /C/ contained
    \ nextgroup=nroffDrawingArguments
    syntax match nroffEllipseDrawingCommand /E/ contained
    \ nextgroup=nroffDrawingArguments
    syntax match nroffSetFillColorDrawingCommand /f/ contained
    \ nextgroup=nroffDrawingArguments
    syntax match nroffSetFillColorDrawingCommand /F[cgkr]/ contained
    \ nextgroup=nroffDrawingArguments
    syntax match nroffSetFillColorDrawingCommand /Fd/ contained
    syntax match nroffPolygonDrawingCommand /[pP]/ contained
    \ nextgroup=nroffDrawingArguments
    syntax match nroffSetLineThicknessDrawingCommand /t/ contained
    \ nextgroup=nroffDrawingArguments
endif

" horizontal and vertical motion, orthogonal line drawing, and line
" height adjustment
" The optional glyph argument in \[lL] lines that comes right after
" the offset is not highlighted if it is an ordinary character.
" \h \l \L \v \x
syntax match nroffMotionOffsetEscape /[hlLvx]/ contained
\ nextgroup=nroffMotionOffsetEscapeArgument
syntax region nroffMotionOffsetEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffOffsetMeasurement,nroffEscapeCharacter
syntax match nroffOffsetMeasurement /|\=[-+]\=\d\=.\=\d[cipPmnvu]\=/
\ contained

" horizontal place-marking
" The form documented in CSTR #54 is degenerate, having no \k(xx form.
" \k
if exists("b:nroff_is_groff")
    syntax match nroffMarkEscape /k/ contained
    \ nextgroup=nroffSingleCharacterIdentifer,
    \nroffIdentifierLeftParenthesis,nroffGroffIdentifierLeftBracket
else
    syntax match nroffMarkEscape /k/ contained
    \ nextgroup=nroffSingleCharacterIdentifer
endif

" font glyph access by code point number
" \N
syntax match nroffNumberedGlyphEscape /N/ contained
\ nextgroup=nroffNumberedGlyphEscapeArgument
syntax region nroffNumberedGlyphEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffDelimitedNumber,nroffEscapeCharacter
syntax match nroffDelimitedNumber /\d\+/ contained

" overstrike a sequence of glyphs
" measure the width of the delimited argument
" These escapes have no internal syntax.
" \o \w
syntax match nroffDelimitedEscape /[ow]/ contained
\ nextgroup=nroffDelimitedEscapeArgument
syntax region nroffNumberedGlyphEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffEscapeCharacter

" type size escape
" One could argue that the sign should get highlighted like the number
" even if it's not adjacent to it, but that's too much effort for the
" biggest(?) wart in troff syntax.
" \s
if exists("b:nroff_is_groff")
    syntax match nroffTypeSizeEscape /s/ contained
    \ nextgroup=nroffSingleDigitNumber,nroffSignedNumberLeftParenthesis,
    \nroffTypeSizeEscapeSign,nroffDelimitedSignedNumberEscapeArgument,
    \nroffGroffTypeSizeLeftBracket
    syntax match nroffGroffTypeSizeLeftBracket /\[/ contained
    \ nextgroup=nroffGroffSignedMultiDigitNumber
    syntax match nroffGroffSignedMultiDigitNumber /[-+]\=\d\+/ contained
    \ nextgroup=nroffGroffRightBracket
else
    syntax match nroffTypeSizeEscape /s/ contained
    \ nextgroup=nroffSingleDigitNumber,nroffSignedNumberLeftParenthesis,
    \nroffTypeSizeEscapeSign,nroffDelimitedSignedNumberEscapeArgument
endif

" \s(+10 \s(-02
syntax match nroffSignedNumberLeftParenthesis /(/ contained
\ nextgroup=nroffSignedDoubleDigitNumber
syntax match nroffSignedDoubleDigitNumber /[-+]\=\d\d/ contained

" \s+(10 \s-(02
syntax match nroffTypeSizeEscapeSign /[-+]/ contained
    \ nextgroup=nroffSingleDigitNumber,nroffNumberLeftParenthesis,
    \nroffDelimitedSignedNumberEscapeArgument
syntax match nroffNumberLeftParenthesis /(/ contained
\ nextgroup=nroffDoubleDigitNumber
syntax match nroffDoubleDigitNumber /\d\d/ contained

" \s+'40' \s-'40' \s-'+40' \s+'-40'
syntax region nroffDelimitedSignedNumberEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffDelimitedSignedNumber,nroffEscapeCharacter
syntax match nroffDelimitedSignedNumber /[-+]\=\d\+/ contained

" font slant escape
" \S
syntax match nroffSlantEscape /S/ contained
\ nextgroup=nroffSlantEscapeArgument
syntax region nroffSlantEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffDelimitedSignedNumber,nroffEscapeCharacter

" device escape
" \X
" TODO: Handle escape sequences within the delimiters.
syntax match nroffDeviceEscape /X/ contained
\ nextgroup=nroffDeviceEscapeArgument
syntax region nroffDeviceEscapeArgument
\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
\ contains=nroffDelimitedDeviceOutput,nroffEscapeCharacter
syntax match nroffDelimitedDeviceOutput /[^']/ contained

highlight default link nroffEscapeCharacter Preproc
highlight default link nroffSimpleEscape Preproc
highlight default link nroffSpecialCharacterLeftParenthesis Preproc
highlight default link nroffGroffLeftBracket Preproc
highlight default link nroffGroffRightBracket Preproc
highlight default link nroffOutputEscape Preproc
highlight default link nroffGroffOutputEscape Preproc
highlight default link nroffInterpolationEscape Preproc
highlight default link nroffIdentifierLeftParenthesis Preproc
highlight default link nroffGroffIdentifierLeftBracket Preproc
highlight default link nroffArgumentInterpolationEscape Preproc
highlight default link nroffGroffArgumentLeftParenthesis Preproc
highlight default link nroffGroffArgumentLeftBracket Preproc
highlight default link nroffBracketBuildingEscape Preproc
highlight default link nroffEscapeDelimiter Preproc
highlight default link nroffCharacterEscape Preproc
highlight default link nroffDrawingEscape Preproc
highlight default link nroffGroffNullableInterpolationEscape Preproc
highlight default link nroffMotionOffsetEscape Preproc
highlight default link nroffMarkEscape Preproc
highlight default link nroffNumberedGlyphEscape Preproc
highlight default link nroffDelimitedEscape Preproc
highlight default link nroffTypeSizeEscape Preproc
highlight default link nroffTypeSizeEscapeSign Preproc
highlight default link nroffNumberLeftParenthesis Preproc
highlight default link nroffSignedNumberLeftParenthesis Preproc
highlight default link nroffGroffTypeSizeLeftBracket Preproc
highlight default link nroffSlantEscape Preproc
highlight default link nroffDeviceEscape Preproc

highlight default link nroffFixedWidthSpaceEscape Todo
highlight default link nroffSpaceEscape SpecialChar
highlight default link nroffSingleSpecialCharacter SpecialChar
highlight default link nroffDoubleSpecialCharacter SpecialChar
highlight default link nroffGroffSpecialCharacter SpecialChar
highlight default link nroffSpecialCharacter SpecialChar

highlight default link nroffTodo Todo
highlight default link nroffKeyword Error

highlight default link nroffDeviceOutput Type
highlight default link nroffDelimitedDeviceOutput Type
highlight default link nroffGroffDeviceOutput Type
highlight default link nroffArcDrawingCommand Type
highlight default link nroffCircleDrawingCommand Type
highlight default link nroffEllipseDrawingCommand Type
highlight default link nroffLineDrawingCommand Type
highlight default link nroffPolygonDrawingCommand Type
highlight default link nroffSetFillColorDrawingCommand Type
highlight default link nroffSetLineThicknessDrawingCommand Type
highlight default link nroffSplineDrawingCommand Type

highlight default link nroffSingleCharacterIdentifer Identifier
highlight default link nroffIdentifier Identifier
highlight default link nroffGroffIdentifier Identifier
highlight default link nroffGroffNullableBracketParameter Identifier

highlight default link nroffSingleDigitNumber Number
highlight default link nroffDoubleDigitNumber Number
highlight default link nroffSignedDoubleDigitNumber Number
highlight default link nroffDelimitedNumber Number
highlight default link nroffDelimitedSignedNumber Number
highlight default link nroffGroffDoubleDigitNumber Number
highlight default link nroffGroffSignedMultiDigitNumber Number
highlight default link nroffBracketDelimitedNumber Number
highlight default link nroffDrawingArguments Number
highlight default link nroffOffsetMeasurement Number

let &cpo = s:cpo_save
unlet s:cpo_save
" vim: set autoindent shiftwidth=4 softtabstop=4 textwidth=72:
commit bc6a3f1d65411aa500030127443dce18e3466cb4
Author: G. Branden Robinson <[email protected]>
Date:   Tue Sep 6 14:36:12 2022 -0500

    nroff.vim: Add comments.
    
    Complain about Vim's choice of syntax time, and put an authorship and
    copyright license notice on it so I can share it publicly.

diff --git a/nroff.vim b/nroff.vim
index 42fa60f..3855517 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -1,4 +1,5 @@
 " Vim syntax file
+" by G. Branden Robinson, August 2021.  GPLv3.
 " Language:    nroff/groff/troff
 
 if exists("b:current_syntax")
@@ -8,6 +9,9 @@ endif
 let s:cpo_save = &cpo
 set cpo&vim
 
+" This syntax should be named 'troff'; it recognizes and does not
+" distinguish typesetter-specific features, just like the stock Vim
+" implementation.
 let b:current_syntax = "nroff"
 
 if exists("b:nroff_is_groff")

commit 60a7194095f49f359ea25895f86d13d90783a2e9
Author: G. Branden Robinson <[email protected]>
Date:   Thu Aug 19 07:47:50 2021 +1000

    nroff.vim: Improve nested escape handling.

diff --git a/nroff.vim b/nroff.vim
index a750222..42fa60f 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -87,8 +87,8 @@ syntax match nroffSingleSpecialCharacter /[-'`_]/ contained
 
 " \(xx
 syntax match nroffSpecialCharacterLeftParenthesis /(/ contained
-\ nextgroup=nroffDoubleSpecialCharacter
-syntax match nroffDoubleSpecialCharacter /\S\S/ contained
+\ nextgroup=nroffDoubleSpecialCharacter,nroffEscapeCharacter
+syntax match nroffDoubleSpecialCharacter /[^\\][^\\]/ contained
 
 " Handle groff-style special character escape sequences.
 " \[xxx]
@@ -131,7 +131,7 @@ endif
 syntax match nroffSingleCharacterIdentifer /[^\\]/ contained
 syntax match nroffIdentifierLeftParenthesis /(/ contained
 \ nextgroup=nroffIdentifier
-syntax match nroffIdentifier /\S\S/ contained
+syntax match nroffIdentifier /[^\\][^\\]/ contained
 
 if exists("b:nroff_is_groff")
     syntax match nroffInterpolationEscape /[*gn]/ contained

commit f57d3ea0fefe2da6d783cd902920c61b031ae383
Author: G. Branden Robinson <[email protected]>
Date:   Thu Aug 19 07:37:06 2021 +1000

    nroff.vim: Restyle for maintainability.

diff --git a/nroff.vim b/nroff.vim
index 8995079..a750222 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -16,23 +16,47 @@ endif
 
 if exists("b:nroff_is_groff")
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
-    \nroffSingleSpecialCharacter,nroffSpecialCharacterLeftParenthesis,
-    \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
-    \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
-    \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
-    \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffDelimitedEscape,
-    \nroffTypeSizeEscape,nroffSlantEscape,nroffDeviceEscape
+    \nroffSingleSpecialCharacter,
+    \nroffSpecialCharacterLeftParenthesis,
+    \nroffGroffLeftBracket,
+    \nroffSpaceEscape,
+    \nroffFixedWidthSpaceEscape,
+    \nroffComment,
+    \nroffOutputEscape,
+    \nroffGroffOutputEscape,
+    \nroffInterpolationEscape,
+    \nroffArgumentInterpolationEscape,
+    \nroffBracketBuildingEscape,
+    \nroffCharacterEscape,
+    \nroffDrawingEscape,
+    \nroffGroffNullableInterpolationEscape,
+    \nroffMotionOffsetEscape,
+    \nroffMarkEscape,
+    \nroffNumberedGlyphEscape,
+    \nroffDelimitedEscape,
+    \nroffTypeSizeEscape,
+    \nroffSlantEscape,
+    \nroffDeviceEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
-    \nroffSingleSpecialCharacter,nroffSpecialCharacterLeftParenthesis,
-    \nroffSpaceEscape,nroffFixedWidthSpaceEscape,nroffComment,
-    \nroffOutputEscape,nroffInterpolationEscape,
-    \nroffArgumentInterpolationEscape,nroffBracketBuildingEscape,
-    \nroffCharacterEscape,nroffDrawingEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffDelimitedEscape,
-    \nroffTypeSizeEscape,nroffSlantEscape,nroffDeviceEscape
+    \nroffSingleSpecialCharacter,
+    \nroffSpecialCharacterLeftParenthesis,
+    \nroffSpaceEscape,
+    \nroffFixedWidthSpaceEscape,
+    \nroffComment,
+    \nroffOutputEscape,
+    \nroffInterpolationEscape,
+    \nroffArgumentInterpolationEscape,
+    \nroffBracketBuildingEscape,
+    \nroffCharacterEscape,
+    \nroffDrawingEscape,
+    \nroffMotionOffsetEscape,
+    \nroffMarkEscape,
+    \nroffNumberedGlyphEscape,
+    \nroffDelimitedEscape,
+    \nroffTypeSizeEscape,
+    \nroffSlantEscape,
+    \nroffDeviceEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.

commit 9419c83e5e0e88135216917e8c05fbc11fc5c199
Author: G. Branden Robinson <[email protected]>
Date:   Thu Aug 19 07:21:32 2021 +1000

    nroff.vim: Fix erroneous matching of \s±(±nn.

diff --git a/nroff.vim b/nroff.vim
index 55d948f..8995079 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -267,28 +267,39 @@ syntax region nroffNumberedGlyphEscapeArgument
 \ contains=nroffEscapeCharacter
 
 " type size escape
-" One could argue that the sign should get highlighted like the number,
-" but that's too much effort for the biggest(?) wart in troff syntax.
+" One could argue that the sign should get highlighted like the number
+" even if it's not adjacent to it, but that's too much effort for the
+" biggest(?) wart in troff syntax.
 " \s
 if exists("b:nroff_is_groff")
-    syntax match nroffTypeSizeEscape /s[-+]\=/ contained
-    \ nextgroup=nroffSingleDigitNumber,nroffNumberLeftParenthesis,
-    \nroffDelimitedSignedNumberEscapeArgument,
+    syntax match nroffTypeSizeEscape /s/ contained
+    \ nextgroup=nroffSingleDigitNumber,nroffSignedNumberLeftParenthesis,
+    \nroffTypeSizeEscapeSign,nroffDelimitedSignedNumberEscapeArgument,
     \nroffGroffTypeSizeLeftBracket
     syntax match nroffGroffTypeSizeLeftBracket /\[/ contained
     \ nextgroup=nroffGroffSignedMultiDigitNumber
     syntax match nroffGroffSignedMultiDigitNumber /[-+]\=\d\+/ contained
     \ nextgroup=nroffGroffRightBracket
 else
-    syntax match nroffTypeSizeEscape /s[-+]\=/ contained
-    \ nextgroup=nroffSingleDigitNumber,nroffNumberLeftParenthesis,
-    \nroffDelimitedSignedNumberEscapeArgument
+    syntax match nroffTypeSizeEscape /s/ contained
+    \ nextgroup=nroffSingleDigitNumber,nroffSignedNumberLeftParenthesis,
+    \nroffTypeSizeEscapeSign,nroffDelimitedSignedNumberEscapeArgument
 endif
 
-" XXX: Bug: we accept \s±(±nn, but we shouldn't.
-syntax match nroffNumberLeftParenthesis /(/ contained
+" \s(+10 \s(-02
+syntax match nroffSignedNumberLeftParenthesis /(/ contained
 \ nextgroup=nroffSignedDoubleDigitNumber
 syntax match nroffSignedDoubleDigitNumber /[-+]\=\d\d/ contained
+
+" \s+(10 \s-(02
+syntax match nroffTypeSizeEscapeSign /[-+]/ contained
+    \ nextgroup=nroffSingleDigitNumber,nroffNumberLeftParenthesis,
+    \nroffDelimitedSignedNumberEscapeArgument
+syntax match nroffNumberLeftParenthesis /(/ contained
+\ nextgroup=nroffDoubleDigitNumber
+syntax match nroffDoubleDigitNumber /\d\d/ contained
+
+" \s+'40' \s-'40' \s-'+40' \s+'-40'
 syntax region nroffDelimitedSignedNumberEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
 \ contains=nroffDelimitedSignedNumber,nroffEscapeCharacter
@@ -335,7 +346,9 @@ highlight default link nroffMarkEscape Preproc
 highlight default link nroffNumberedGlyphEscape Preproc
 highlight default link nroffDelimitedEscape Preproc
 highlight default link nroffTypeSizeEscape Preproc
+highlight default link nroffTypeSizeEscapeSign Preproc
 highlight default link nroffNumberLeftParenthesis Preproc
+highlight default link nroffSignedNumberLeftParenthesis Preproc
 highlight default link nroffGroffTypeSizeLeftBracket Preproc
 highlight default link nroffSlantEscape Preproc
 highlight default link nroffDeviceEscape Preproc
@@ -368,6 +381,7 @@ highlight default link nroffGroffIdentifier Identifier
 highlight default link nroffGroffNullableBracketParameter Identifier
 
 highlight default link nroffSingleDigitNumber Number
+highlight default link nroffDoubleDigitNumber Number
 highlight default link nroffSignedDoubleDigitNumber Number
 highlight default link nroffDelimitedNumber Number
 highlight default link nroffDelimitedSignedNumber Number

commit 66b998fdb998fa476041a029bbbaabf71709c40d
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 12:06:21 2021 +1000

    nroff.vim: Support \X escape.

diff --git a/nroff.vim b/nroff.vim
index fa95989..55d948f 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -23,7 +23,7 @@ if exists("b:nroff_is_groff")
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
     \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
     \nroffMarkEscape,nroffNumberedGlyphEscape,nroffDelimitedEscape,
-    \nroffTypeSizeEscape,nroffSlantEscape
+    \nroffTypeSizeEscape,nroffSlantEscape,nroffDeviceEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffSpecialCharacterLeftParenthesis,
@@ -32,7 +32,7 @@ else
     \nroffArgumentInterpolationEscape,nroffBracketBuildingEscape,
     \nroffCharacterEscape,nroffDrawingEscape,nroffMotionOffsetEscape,
     \nroffMarkEscape,nroffNumberedGlyphEscape,nroffDelimitedEscape,
-    \nroffTypeSizeEscape,nroffSlantEscape
+    \nroffTypeSizeEscape,nroffSlantEscape,nroffDeviceEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -302,6 +302,16 @@ syntax region nroffSlantEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
 \ contains=nroffDelimitedSignedNumber,nroffEscapeCharacter
 
+" device escape
+" \X
+" TODO: Handle escape sequences within the delimiters.
+syntax match nroffDeviceEscape /X/ contained
+\ nextgroup=nroffDeviceEscapeArgument
+syntax region nroffDeviceEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffDelimitedDeviceOutput,nroffEscapeCharacter
+syntax match nroffDelimitedDeviceOutput /[^']/ contained
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffSpecialCharacterLeftParenthesis Preproc
@@ -328,6 +338,7 @@ highlight default link nroffTypeSizeEscape Preproc
 highlight default link nroffNumberLeftParenthesis Preproc
 highlight default link nroffGroffTypeSizeLeftBracket Preproc
 highlight default link nroffSlantEscape Preproc
+highlight default link nroffDeviceEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -340,6 +351,7 @@ highlight default link nroffTodo Todo
 highlight default link nroffKeyword Error
 
 highlight default link nroffDeviceOutput Type
+highlight default link nroffDelimitedDeviceOutput Type
 highlight default link nroffGroffDeviceOutput Type
 highlight default link nroffArcDrawingCommand Type
 highlight default link nroffCircleDrawingCommand Type

commit 2a20dbb6000e9f502436cf654574af32ca3dabea
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 12:02:38 2021 +1000

    nroff.vim: Support \x escape.

diff --git a/nroff.vim b/nroff.vim
index 908e22a..fa95989 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -222,11 +222,12 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffDrawingArguments
 endif
 
-" horizontal and vertical motion and orthogonal line drawing
+" horizontal and vertical motion, orthogonal line drawing, and line
+" height adjustment
 " The optional glyph argument in \[lL] lines that comes right after
 " the offset is not highlighted if it is an ordinary character.
-" \h \l \L \v
-syntax match nroffMotionOffsetEscape /[hlLv]/ contained
+" \h \l \L \v \x
+syntax match nroffMotionOffsetEscape /[hlLvx]/ contained
 \ nextgroup=nroffMotionOffsetEscapeArgument
 syntax region nroffMotionOffsetEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained

commit 5ffb40fb9b287ec7976e6a1dd5d477f156cb933f
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 11:44:00 2021 +1000

    nroff.vim: Support \w escape.

diff --git a/nroff.vim b/nroff.vim
index 47e6817..908e22a 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -22,7 +22,7 @@ if exists("b:nroff_is_groff")
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
     \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape,
+    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffDelimitedEscape,
     \nroffTypeSizeEscape,nroffSlantEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
@@ -31,7 +31,7 @@ else
     \nroffOutputEscape,nroffInterpolationEscape,
     \nroffArgumentInterpolationEscape,nroffBracketBuildingEscape,
     \nroffCharacterEscape,nroffDrawingEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape,
+    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffDelimitedEscape,
     \nroffTypeSizeEscape,nroffSlantEscape
 endif
 
@@ -256,10 +256,11 @@ syntax region nroffNumberedGlyphEscapeArgument
 syntax match nroffDelimitedNumber /\d\+/ contained
 
 " overstrike a sequence of glyphs
-" This escape has no internal syntax, really.
-" \o
-syntax match nroffOverstrikeEscape /o/ contained
-\ nextgroup=nroffOverstrikeEscapeArgument
+" measure the width of the delimited argument
+" These escapes have no internal syntax.
+" \o \w
+syntax match nroffDelimitedEscape /[ow]/ contained
+\ nextgroup=nroffDelimitedEscapeArgument
 syntax region nroffNumberedGlyphEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
 \ contains=nroffEscapeCharacter
@@ -321,7 +322,7 @@ highlight default link 
nroffGroffNullableInterpolationEscape Preproc
 highlight default link nroffMotionOffsetEscape Preproc
 highlight default link nroffMarkEscape Preproc
 highlight default link nroffNumberedGlyphEscape Preproc
-highlight default link nroffOverstrikeEscape Preproc
+highlight default link nroffDelimitedEscape Preproc
 highlight default link nroffTypeSizeEscape Preproc
 highlight default link nroffNumberLeftParenthesis Preproc
 highlight default link nroffGroffTypeSizeLeftBracket Preproc

commit 600cc58e8e081100acc1a95b21f4af2f043c671c
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 11:41:26 2021 +1000

    nroff.vim: Support \v escape.

diff --git a/nroff.vim b/nroff.vim
index f9b3936..47e6817 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -222,11 +222,11 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffDrawingArguments
 endif
 
-" horizontal motion and orthogonal line drawing
+" horizontal and vertical motion and orthogonal line drawing
 " The optional glyph argument in \[lL] lines that comes right after
 " the offset is not highlighted if it is an ordinary character.
-" \h \l \L
-syntax match nroffMotionOffsetEscape /[hlL]/ contained
+" \h \l \L \v
+syntax match nroffMotionOffsetEscape /[hlLv]/ contained
 \ nextgroup=nroffMotionOffsetEscapeArgument
 syntax region nroffMotionOffsetEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained

commit d64eb95f4bbf472603e593f6a2d83f9ff422d78f
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 11:30:59 2021 +1000

    nroff.vim: Support \S escape.

diff --git a/nroff.vim b/nroff.vim
index c8a4d22..f9b3936 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -23,7 +23,7 @@ if exists("b:nroff_is_groff")
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
     \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
     \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape,
-    \nroffTypeSizeEscape
+    \nroffTypeSizeEscape,nroffSlantEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffSpecialCharacterLeftParenthesis,
@@ -32,7 +32,7 @@ else
     \nroffArgumentInterpolationEscape,nroffBracketBuildingEscape,
     \nroffCharacterEscape,nroffDrawingEscape,nroffMotionOffsetEscape,
     \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape,
-    \nroffTypeSizeEscape
+    \nroffTypeSizeEscape,nroffSlantEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -292,6 +292,14 @@ syntax region nroffDelimitedSignedNumberEscapeArgument
 \ contains=nroffDelimitedSignedNumber,nroffEscapeCharacter
 syntax match nroffDelimitedSignedNumber /[-+]\=\d\+/ contained
 
+" font slant escape
+" \S
+syntax match nroffSlantEscape /S/ contained
+\ nextgroup=nroffSlantEscapeArgument
+syntax region nroffSlantEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffDelimitedSignedNumber,nroffEscapeCharacter
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffSpecialCharacterLeftParenthesis Preproc
@@ -317,6 +325,7 @@ highlight default link nroffOverstrikeEscape Preproc
 highlight default link nroffTypeSizeEscape Preproc
 highlight default link nroffNumberLeftParenthesis Preproc
 highlight default link nroffGroffTypeSizeLeftBracket Preproc
+highlight default link nroffSlantEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar

commit 29266914169d9400c7e52293e7c3c98e44171a51
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 11:22:42 2021 +1000

    nroff.vim: Support \s escape.
    
    Yeesh.

diff --git a/nroff.vim b/nroff.vim
index d089208..c8a4d22 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -22,7 +22,8 @@ if exists("b:nroff_is_groff")
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
     \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape
+    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape,
+    \nroffTypeSizeEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffSpecialCharacterLeftParenthesis,
@@ -30,7 +31,8 @@ else
     \nroffOutputEscape,nroffInterpolationEscape,
     \nroffArgumentInterpolationEscape,nroffBracketBuildingEscape,
     \nroffCharacterEscape,nroffDrawingEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape
+    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape,
+    \nroffTypeSizeEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -262,6 +264,34 @@ syntax region nroffNumberedGlyphEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
 \ contains=nroffEscapeCharacter
 
+" type size escape
+" One could argue that the sign should get highlighted like the number,
+" but that's too much effort for the biggest(?) wart in troff syntax.
+" \s
+if exists("b:nroff_is_groff")
+    syntax match nroffTypeSizeEscape /s[-+]\=/ contained
+    \ nextgroup=nroffSingleDigitNumber,nroffNumberLeftParenthesis,
+    \nroffDelimitedSignedNumberEscapeArgument,
+    \nroffGroffTypeSizeLeftBracket
+    syntax match nroffGroffTypeSizeLeftBracket /\[/ contained
+    \ nextgroup=nroffGroffSignedMultiDigitNumber
+    syntax match nroffGroffSignedMultiDigitNumber /[-+]\=\d\+/ contained
+    \ nextgroup=nroffGroffRightBracket
+else
+    syntax match nroffTypeSizeEscape /s[-+]\=/ contained
+    \ nextgroup=nroffSingleDigitNumber,nroffNumberLeftParenthesis,
+    \nroffDelimitedSignedNumberEscapeArgument
+endif
+
+" XXX: Bug: we accept \s±(±nn, but we shouldn't.
+syntax match nroffNumberLeftParenthesis /(/ contained
+\ nextgroup=nroffSignedDoubleDigitNumber
+syntax match nroffSignedDoubleDigitNumber /[-+]\=\d\d/ contained
+syntax region nroffDelimitedSignedNumberEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffDelimitedSignedNumber,nroffEscapeCharacter
+syntax match nroffDelimitedSignedNumber /[-+]\=\d\+/ contained
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffSpecialCharacterLeftParenthesis Preproc
@@ -284,6 +314,9 @@ highlight default link nroffMotionOffsetEscape Preproc
 highlight default link nroffMarkEscape Preproc
 highlight default link nroffNumberedGlyphEscape Preproc
 highlight default link nroffOverstrikeEscape Preproc
+highlight default link nroffTypeSizeEscape Preproc
+highlight default link nroffNumberLeftParenthesis Preproc
+highlight default link nroffGroffTypeSizeLeftBracket Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -312,8 +345,11 @@ highlight default link nroffGroffIdentifier Identifier
 highlight default link nroffGroffNullableBracketParameter Identifier
 
 highlight default link nroffSingleDigitNumber Number
+highlight default link nroffSignedDoubleDigitNumber Number
 highlight default link nroffDelimitedNumber Number
+highlight default link nroffDelimitedSignedNumber Number
 highlight default link nroffGroffDoubleDigitNumber Number
+highlight default link nroffGroffSignedMultiDigitNumber Number
 highlight default link nroffBracketDelimitedNumber Number
 highlight default link nroffDrawingArguments Number
 highlight default link nroffOffsetMeasurement Number

commit ba6fa15441057b885c615a5d9a5c1ea8b1672ae3
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 10:40:22 2021 +1000

    nroff.vim: Rename symbol.
    
    nroffLeftParenthesis -> nroffSpecialCharacterLeftParenthesis

diff --git a/nroff.vim b/nroff.vim
index c1f5455..d089208 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -16,7 +16,7 @@ endif
 
 if exists("b:nroff_is_groff")
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
-    \nroffSingleSpecialCharacter,nroffLeftParenthesis,
+    \nroffSingleSpecialCharacter,nroffSpecialCharacterLeftParenthesis,
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
@@ -25,12 +25,12 @@ if exists("b:nroff_is_groff")
     \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
-    \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
-    \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
-    \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
-    \nroffMotionOffsetEscape,nroffMarkEscape,nroffNumberedGlyphEscape,
-    \nroffOverstrikeEscape
+    \nroffSingleSpecialCharacter,nroffSpecialCharacterLeftParenthesis,
+    \nroffSpaceEscape,nroffFixedWidthSpaceEscape,nroffComment,
+    \nroffOutputEscape,nroffInterpolationEscape,
+    \nroffArgumentInterpolationEscape,nroffBracketBuildingEscape,
+    \nroffCharacterEscape,nroffDrawingEscape,nroffMotionOffsetEscape,
+    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -60,7 +60,7 @@ endif
 syntax match nroffSingleSpecialCharacter /[-'`_]/ contained
 
 " \(xx
-syntax match nroffLeftParenthesis /(/ contained
+syntax match nroffSpecialCharacterLeftParenthesis /(/ contained
 \ nextgroup=nroffDoubleSpecialCharacter
 syntax match nroffDoubleSpecialCharacter /\S\S/ contained
 
@@ -264,7 +264,7 @@ syntax region nroffNumberedGlyphEscapeArgument
 
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
-highlight default link nroffLeftParenthesis Preproc
+highlight default link nroffSpecialCharacterLeftParenthesis Preproc
 highlight default link nroffGroffLeftBracket Preproc
 highlight default link nroffGroffRightBracket Preproc
 highlight default link nroffOutputEscape Preproc

commit 652f2aa1e20caf29c8b470af743b866297d9719a
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 10:25:45 2021 +1000

    nroff.vim: Support \o escape.

diff --git a/nroff.vim b/nroff.vim
index f5a2dcb..c1f5455 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -22,14 +22,15 @@ if exists("b:nroff_is_groff")
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
     \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape,nroffNumberedGlyphEscape
+    \nroffMarkEscape,nroffNumberedGlyphEscape,nroffOverstrikeEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
-    \nroffMotionOffsetEscape,nroffMarkEscape,nroffNumberedGlyphEscape
+    \nroffMotionOffsetEscape,nroffMarkEscape,nroffNumberedGlyphEscape,
+    \nroffOverstrikeEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -252,6 +253,15 @@ syntax region nroffNumberedGlyphEscapeArgument
 \ contains=nroffDelimitedNumber,nroffEscapeCharacter
 syntax match nroffDelimitedNumber /\d\+/ contained
 
+" overstrike a sequence of glyphs
+" This escape has no internal syntax, really.
+" \o
+syntax match nroffOverstrikeEscape /o/ contained
+\ nextgroup=nroffOverstrikeEscapeArgument
+syntax region nroffNumberedGlyphEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffEscapeCharacter
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -273,6 +283,7 @@ highlight default link 
nroffGroffNullableInterpolationEscape Preproc
 highlight default link nroffMotionOffsetEscape Preproc
 highlight default link nroffMarkEscape Preproc
 highlight default link nroffNumberedGlyphEscape Preproc
+highlight default link nroffOverstrikeEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar

commit 65f827c1c522f69c5bb07089c6ac72766f238fd3
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 10:20:03 2021 +1000

    nroff.vim: Support \N escape.

diff --git a/nroff.vim b/nroff.vim
index 5b6c559..f5a2dcb 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -22,14 +22,14 @@ if exists("b:nroff_is_groff")
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
     \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
-    \nroffMarkEscape
+    \nroffMarkEscape,nroffNumberedGlyphEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
-    \nroffMotionOffsetEscape,nroffMarkEscape
+    \nroffMotionOffsetEscape,nroffMarkEscape,nroffNumberedGlyphEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -142,8 +142,8 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffGroffDoubleDigitNumber
     syntax match nroffGroffDoubleDigitNumber /\d\d/ contained
     syntax match nroffGroffArgumentLeftBracket /\[/ contained
-    \ nextgroup=nroffGroffMultiDigitNumber
-    syntax match nroffGroffMultiDigitNumber /\d\+/ contained
+    \ nextgroup=nroffBracketDelimitedNumber
+    syntax match nroffBracketDelimitedNumber /\d\+/ contained
     \ nextgroup=nroffGroffRightBracket
 endif
 
@@ -243,6 +243,15 @@ else
     \ nextgroup=nroffSingleCharacterIdentifer
 endif
 
+" font glyph access by code point number
+" \N
+syntax match nroffNumberedGlyphEscape /N/ contained
+\ nextgroup=nroffNumberedGlyphEscapeArgument
+syntax region nroffNumberedGlyphEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffDelimitedNumber,nroffEscapeCharacter
+syntax match nroffDelimitedNumber /\d\+/ contained
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -263,6 +272,7 @@ highlight default link nroffDrawingEscape Preproc
 highlight default link nroffGroffNullableInterpolationEscape Preproc
 highlight default link nroffMotionOffsetEscape Preproc
 highlight default link nroffMarkEscape Preproc
+highlight default link nroffNumberedGlyphEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -291,8 +301,9 @@ highlight default link nroffGroffIdentifier Identifier
 highlight default link nroffGroffNullableBracketParameter Identifier
 
 highlight default link nroffSingleDigitNumber Number
+highlight default link nroffDelimitedNumber Number
 highlight default link nroffGroffDoubleDigitNumber Number
-highlight default link nroffGroffMultiDigitNumber Number
+highlight default link nroffBracketDelimitedNumber Number
 highlight default link nroffDrawingArguments Number
 highlight default link nroffOffsetMeasurement Number
 

commit b2934352837375252b21a1d323c91f5f8ce219c5
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 10:13:13 2021 +1000

    nroff.vim: Support \n escape.

diff --git a/nroff.vim b/nroff.vim
index c1a5e02..5b6c559 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -100,14 +100,14 @@ endif
 
 " Handle escape sequences that take arguments.
 
-" \* \f \g
-syntax match nroffSingleCharacterIdentifer /\S/ contained
+" \* \f \g \n
+syntax match nroffSingleCharacterIdentifer /[^\\]/ contained
 syntax match nroffIdentifierLeftParenthesis /(/ contained
 \ nextgroup=nroffIdentifier
 syntax match nroffIdentifier /\S\S/ contained
 
 if exists("b:nroff_is_groff")
-    syntax match nroffInterpolationEscape /[*g]/ contained
+    syntax match nroffInterpolationEscape /[*gn]/ contained
     \ nextgroup=nroffSingleCharacterIdentifer,
     \nroffIdentifierLeftParenthesis,nroffGroffIdentifierLeftBracket
     syntax match nroffGroffIdentifierLeftBracket /\[/ contained
@@ -123,7 +123,7 @@ if exists("b:nroff_is_groff")
     \ matchgroup=nroffInterpolationEscape start=/\[/ end=/\]/ contained
     \ oneline
 else
-    syntax match nroffInterpolationEscape /[*fg]/ contained
+    syntax match nroffInterpolationEscape /[*fgn]/ contained
     \ nextgroup=nroffSingleCharacterIdentifer,
     \nroffIdentifierLeftParenthesis
 endif

commit 14e0132bc35f100aa13f3fbbc0981ef16831b47b
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 10:08:32 2021 +1000

    nroff.vim: Support \l, \L escapes.

diff --git a/nroff.vim b/nroff.vim
index b60c374..c1a5e02 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -219,14 +219,16 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffDrawingArguments
 endif
 
-" horizontal motion
-" \h
-syntax match nroffMotionOffsetEscape /h/ contained
+" horizontal motion and orthogonal line drawing
+" The optional glyph argument in \[lL] lines that comes right after
+" the offset is not highlighted if it is an ordinary character.
+" \h \l \L
+syntax match nroffMotionOffsetEscape /[hlL]/ contained
 \ nextgroup=nroffMotionOffsetEscapeArgument
 syntax region nroffMotionOffsetEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
-\ contains=nroffOffsetMeasurement
-syntax match nroffOffsetMeasurement /[-+]\=\d\=.\=\d[cipPmnvu]\=/
+\ contains=nroffOffsetMeasurement,nroffEscapeCharacter
+syntax match nroffOffsetMeasurement /|\=[-+]\=\d\=.\=\d[cipPmnvu]\=/
 \ contained
 
 " horizontal place-marking

commit 27847390ec8eb221db0b81d5245a2c97781b58ee
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 08:22:03 2021 +1000

    nroff.vim: Support \k escape.

diff --git a/nroff.vim b/nroff.vim
index 9f776c1..b60c374 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -21,14 +21,15 @@ if exists("b:nroff_is_groff")
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
-    \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape
+    \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape,
+    \nroffMarkEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
-    \nroffMotionOffsetEscape
+    \nroffMotionOffsetEscape,nroffMarkEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -228,6 +229,18 @@ syntax region nroffMotionOffsetEscapeArgument
 syntax match nroffOffsetMeasurement /[-+]\=\d\=.\=\d[cipPmnvu]\=/
 \ contained
 
+" horizontal place-marking
+" The form documented in CSTR #54 is degenerate, having no \k(xx form.
+" \k
+if exists("b:nroff_is_groff")
+    syntax match nroffMarkEscape /k/ contained
+    \ nextgroup=nroffSingleCharacterIdentifer,
+    \nroffIdentifierLeftParenthesis,nroffGroffIdentifierLeftBracket
+else
+    syntax match nroffMarkEscape /k/ contained
+    \ nextgroup=nroffSingleCharacterIdentifer
+endif
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -247,6 +260,7 @@ highlight default link nroffCharacterEscape Preproc
 highlight default link nroffDrawingEscape Preproc
 highlight default link nroffGroffNullableInterpolationEscape Preproc
 highlight default link nroffMotionOffsetEscape Preproc
+highlight default link nroffMarkEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar

commit b92c324324f6eb409d63b363c581e4768a1c5329
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 08:14:32 2021 +1000

    nroff.vim: Support \h escape.

diff --git a/nroff.vim b/nroff.vim
index 0ad414f..9f776c1 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -21,13 +21,14 @@ if exists("b:nroff_is_groff")
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
     \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
-    \nroffGroffNullableInterpolationEscape
+    \nroffGroffNullableInterpolationEscape,nroffMotionOffsetEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape
+    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
+    \nroffMotionOffsetEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -217,6 +218,16 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffDrawingArguments
 endif
 
+" horizontal motion
+" \h
+syntax match nroffMotionOffsetEscape /h/ contained
+\ nextgroup=nroffMotionOffsetEscapeArgument
+syntax region nroffMotionOffsetEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffOffsetMeasurement
+syntax match nroffOffsetMeasurement /[-+]\=\d\=.\=\d[cipPmnvu]\=/
+\ contained
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -235,6 +246,7 @@ highlight default link nroffEscapeDelimiter Preproc
 highlight default link nroffCharacterEscape Preproc
 highlight default link nroffDrawingEscape Preproc
 highlight default link nroffGroffNullableInterpolationEscape Preproc
+highlight default link nroffMotionOffsetEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -266,6 +278,7 @@ highlight default link nroffSingleDigitNumber Number
 highlight default link nroffGroffDoubleDigitNumber Number
 highlight default link nroffGroffMultiDigitNumber Number
 highlight default link nroffDrawingArguments Number
+highlight default link nroffOffsetMeasurement Number
 
 let &cpo = s:cpo_save
 unlet s:cpo_save

commit 9f86ea45d639d6d091ff149dbdcd6ce71429c08e
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 08:04:17 2021 +1000

    nroff.vim: Support \g escape.

diff --git a/nroff.vim b/nroff.vim
index 0450015..0ad414f 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -98,14 +98,14 @@ endif
 
 " Handle escape sequences that take arguments.
 
-" \* \f
+" \* \f \g
 syntax match nroffSingleCharacterIdentifer /\S/ contained
 syntax match nroffIdentifierLeftParenthesis /(/ contained
 \ nextgroup=nroffIdentifier
 syntax match nroffIdentifier /\S\S/ contained
 
 if exists("b:nroff_is_groff")
-    syntax match nroffInterpolationEscape /\*/ contained
+    syntax match nroffInterpolationEscape /[*g]/ contained
     \ nextgroup=nroffSingleCharacterIdentifer,
     \nroffIdentifierLeftParenthesis,nroffGroffIdentifierLeftBracket
     syntax match nroffGroffIdentifierLeftBracket /\[/ contained
@@ -121,7 +121,7 @@ if exists("b:nroff_is_groff")
     \ matchgroup=nroffInterpolationEscape start=/\[/ end=/\]/ contained
     \ oneline
 else
-    syntax match nroffInterpolationEscape /[*f]/ contained
+    syntax match nroffInterpolationEscape /[*fg]/ contained
     \ nextgroup=nroffSingleCharacterIdentifer,
     \nroffIdentifierLeftParenthesis
 endif

commit d4591c2f80096892e0b6eb8f5402a96f96590c69
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 07:25:28 2021 +1000

    nroff.vim: Support groff extensions to \f escape.
    
    The nullability of the font identifier adds a syntactical wrinkle.

diff --git a/nroff.vim b/nroff.vim
index 09af7d7..0450015 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -20,7 +20,8 @@ if exists("b:nroff_is_groff")
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape
+    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape,
+    \nroffGroffNullableInterpolationEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
@@ -98,8 +99,6 @@ endif
 " Handle escape sequences that take arguments.
 
 " \* \f
-syntax match nroffInterpolationEscape /[*f]/ contained
-\ nextgroup=nroffSingleCharacterIdentifer,nroffIdentifierLeftParenthesis
 syntax match nroffSingleCharacterIdentifer /\S/ contained
 syntax match nroffIdentifierLeftParenthesis /(/ contained
 \ nextgroup=nroffIdentifier
@@ -113,6 +112,18 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffGroffIdentifier
     syntax match nroffGroffIdentifier /[^]]\+/ contained
     \ nextgroup=nroffGroffRightBracket
+
+    " In groff, sometimes the bracket contents can be empty.
+    syntax match nroffGroffNullableInterpolationEscape /f/ contained
+    \ nextgroup=nroffSingleCharacterIdentifer,
+    \nroffIdentifierLeftParenthesis,nroffGroffNullableBracketParameter
+    syntax region nroffGroffNullableBracketParameter
+    \ matchgroup=nroffInterpolationEscape start=/\[/ end=/\]/ contained
+    \ oneline
+else
+    syntax match nroffInterpolationEscape /[*f]/ contained
+    \ nextgroup=nroffSingleCharacterIdentifer,
+    \nroffIdentifierLeftParenthesis
 endif
 
 " macro argument interpolation
@@ -223,6 +234,7 @@ highlight default link nroffBracketBuildingEscape Preproc
 highlight default link nroffEscapeDelimiter Preproc
 highlight default link nroffCharacterEscape Preproc
 highlight default link nroffDrawingEscape Preproc
+highlight default link nroffGroffNullableInterpolationEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -248,6 +260,7 @@ highlight default link nroffSplineDrawingCommand Type
 highlight default link nroffSingleCharacterIdentifer Identifier
 highlight default link nroffIdentifier Identifier
 highlight default link nroffGroffIdentifier Identifier
+highlight default link nroffGroffNullableBracketParameter Identifier
 
 highlight default link nroffSingleDigitNumber Number
 highlight default link nroffGroffDoubleDigitNumber Number

commit 35247eeb5a12e8b2b8fdc1189595404c0700347a
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 07:18:53 2021 +1000

    nroff.vim: Support \f escape.

diff --git a/nroff.vim b/nroff.vim
index 64f658c..09af7d7 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -97,9 +97,8 @@ endif
 
 " Handle escape sequences that take arguments.
 
-" string interpolation
-" \*
-syntax match nroffInterpolationEscape /\*/ contained
+" \* \f
+syntax match nroffInterpolationEscape /[*f]/ contained
 \ nextgroup=nroffSingleCharacterIdentifer,nroffIdentifierLeftParenthesis
 syntax match nroffSingleCharacterIdentifer /\S/ contained
 syntax match nroffIdentifierLeftParenthesis /(/ contained

commit 690db07b0303e288f251977f8edf90ecbad7c42b
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 06:58:29 2021 +1000

    nroff.vim: Support groff extensions to \D.

diff --git a/nroff.vim b/nroff.vim
index d4f29be..64f658c 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -185,6 +185,28 @@ syntax match nroffSplineDrawingCommand /\~/ contained
 
 syntax match nroffDrawingArguments /[-+.0-9cipPmnvu \t]\+/ contained
 
+if exists("b:nroff_is_groff")
+    syntax region nroffDrawingEscapeArgument
+    \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+    \ contains=nroffArcDrawingCommand,nroffCircleDrawingCommand,
+    \nroffEllipseDrawingCommand,nroffLineDrawingCommand,
+    \nroffSplineDrawingCommand,nroffSetFillColorDrawingCommand,
+    \nroffPolygonDrawingCommand,nroffSetLineThicknessDrawingCommand
+    syntax match nroffCircleDrawingCommand /C/ contained
+    \ nextgroup=nroffDrawingArguments
+    syntax match nroffEllipseDrawingCommand /E/ contained
+    \ nextgroup=nroffDrawingArguments
+    syntax match nroffSetFillColorDrawingCommand /f/ contained
+    \ nextgroup=nroffDrawingArguments
+    syntax match nroffSetFillColorDrawingCommand /F[cgkr]/ contained
+    \ nextgroup=nroffDrawingArguments
+    syntax match nroffSetFillColorDrawingCommand /Fd/ contained
+    syntax match nroffPolygonDrawingCommand /[pP]/ contained
+    \ nextgroup=nroffDrawingArguments
+    syntax match nroffSetLineThicknessDrawingCommand /t/ contained
+    \ nextgroup=nroffDrawingArguments
+endif
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -219,6 +241,9 @@ highlight default link nroffArcDrawingCommand Type
 highlight default link nroffCircleDrawingCommand Type
 highlight default link nroffEllipseDrawingCommand Type
 highlight default link nroffLineDrawingCommand Type
+highlight default link nroffPolygonDrawingCommand Type
+highlight default link nroffSetFillColorDrawingCommand Type
+highlight default link nroffSetLineThicknessDrawingCommand Type
 highlight default link nroffSplineDrawingCommand Type
 
 highlight default link nroffSingleCharacterIdentifer Identifier

commit bd5fce101824caa06111957a9a3a76b45479e47b
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 06:21:03 2021 +1000

    nroff.vim: Support \D escape.

diff --git a/nroff.vim b/nroff.vim
index f1ae873..d4f29be 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -20,13 +20,13 @@ if exists("b:nroff_is_groff")
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape,nroffCharacterEscape
+    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape,nroffCharacterEscape
+    \nroffBracketBuildingEscape,nroffCharacterEscape,nroffDrawingEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -161,6 +161,30 @@ syntax region nroffCharacterEscapeArgument
 \ contains=nroffSpecialCharacter
 syntax match nroffSpecialCharacter /[^"]\+/ contained
 
+" drawing escape
+" \D
+" TODO: More precisely highlight the drawing command arguments.
+syntax match nroffDrawingEscape /D/ contained
+\ nextgroup=nroffDrawingEscapeArgument
+syntax region nroffDrawingEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffArcDrawingCommand,nroffCircleDrawingCommand,
+\nroffEllipseDrawingCommand,nroffLineDrawingCommand,
+\nroffSplineDrawingCommand
+
+syntax match nroffArcDrawingCommand /a/ contained
+\ nextgroup=nroffDrawingArguments
+syntax match nroffCircleDrawingCommand /c/ contained
+\ nextgroup=nroffDrawingArguments
+syntax match nroffEllipseDrawingCommand /e/ contained
+\ nextgroup=nroffDrawingArguments
+syntax match nroffLineDrawingCommand /l/ contained
+\ nextgroup=nroffDrawingArguments
+syntax match nroffSplineDrawingCommand /\~/ contained
+\ nextgroup=nroffDrawingArguments
+
+syntax match nroffDrawingArguments /[-+.0-9cipPmnvu \t]\+/ contained
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -177,6 +201,7 @@ highlight default link nroffGroffArgumentLeftBracket Preproc
 highlight default link nroffBracketBuildingEscape Preproc
 highlight default link nroffEscapeDelimiter Preproc
 highlight default link nroffCharacterEscape Preproc
+highlight default link nroffDrawingEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -190,6 +215,11 @@ highlight default link nroffKeyword Error
 
 highlight default link nroffDeviceOutput Type
 highlight default link nroffGroffDeviceOutput Type
+highlight default link nroffArcDrawingCommand Type
+highlight default link nroffCircleDrawingCommand Type
+highlight default link nroffEllipseDrawingCommand Type
+highlight default link nroffLineDrawingCommand Type
+highlight default link nroffSplineDrawingCommand Type
 
 highlight default link nroffSingleCharacterIdentifer Identifier
 highlight default link nroffIdentifier Identifier
@@ -198,6 +228,7 @@ highlight default link nroffGroffIdentifier Identifier
 highlight default link nroffSingleDigitNumber Number
 highlight default link nroffGroffDoubleDigitNumber Number
 highlight default link nroffGroffMultiDigitNumber Number
+highlight default link nroffDrawingArguments Number
 
 let &cpo = s:cpo_save
 unlet s:cpo_save

commit 1e04fbc18537d592958bd682cbae3d4bf9d158b7
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 04:52:32 2021 +1000

    nroff.vim: Add comments to ease searches.

diff --git a/nroff.vim b/nroff.vim
index 319ccb5..f1ae873 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -30,30 +30,38 @@ else
 endif
 
 " Handle simple one-character escape form that takes no arguments.
+" \% \& \a \c \d \e \p \r \t \u \z \{ \}
 syntax match nroffSimpleEscape /[%&acdeprtuz{}]/ contained
 
+" \) \: \E
 if exists("b:nroff_is_groff")
     syntax match nroffSimpleEscape /[):E]/ contained
 endif
 
+" "\ "
 " Some people might not like the following, but I like how it
 " discourages use of this escape sequence.
 syntax match nroffFixedWidthSpaceEscape / / contained
 syntax match nroffFixedWidthSpaceEscape /\\ $/
 
+" \0 \| \^
 syntax match nroffSpaceEscape /[0|^]/ contained
+" \~
 if exists("b:nroff_is_groff")
     syntax match nroffSpaceEscape /\~/ contained
 endif
 
 " Handle AT&T-style special character escape sequences.
+" \- \' \` \_
 syntax match nroffSingleSpecialCharacter /[-'`_]/ contained
 
+" \(xx
 syntax match nroffLeftParenthesis /(/ contained
 \ nextgroup=nroffDoubleSpecialCharacter
 syntax match nroffDoubleSpecialCharacter /\S\S/ contained
 
 " Handle groff-style special character escape sequences.
+" \[xxx]
 if exists("b:nroff_is_groff")
     syntax match nroffGroffLeftBracket /\[/ contained
     \ nextgroup=nroffGroffSpecialCharacter
@@ -63,8 +71,10 @@ if exists("b:nroff_is_groff")
 endif
 
 " Handle comments.  They consume the rest of the line.
+" \"
 syntax match nroffComment /".*/ contained contains=nroffNote,nroffTodo
 
+" \#
 if exists("b:nroff_is_groff")
     syntax match nroffComment /#.*/ contained contains=nroffNote,
     \nroffTodo
@@ -74,10 +84,12 @@ syntax keyword nroffNote Note NOTE contained
 syntax keyword nroffTodo FIXME TODO XXX contained
 
 " Handle "transparent line" escape.  It also eats the rest of the line.
+" \!
 syntax match nroffOutputEscape /!/ contained nextgroup=nroffDeviceOutput
 syntax match nroffDeviceOutput /.*/ contained
 
 " Handle groff's "inline" device output escape.
+" \?
 if exists("b:nroff_is_groff")
     syntax region nroffGroffDeviceOutput
     \ matchgroup=nroffGroffOutputEscape start=/\\?/ end=/\\?/ oneline
@@ -86,6 +98,7 @@ endif
 " Handle escape sequences that take arguments.
 
 " string interpolation
+" \*
 syntax match nroffInterpolationEscape /\*/ contained
 \ nextgroup=nroffSingleCharacterIdentifer,nroffIdentifierLeftParenthesis
 syntax match nroffSingleCharacterIdentifer /\S/ contained
@@ -104,6 +117,7 @@ if exists("b:nroff_is_groff")
 endif
 
 " macro argument interpolation
+" \$
 syntax match nroffArgumentInterpolationEscape /\$/ contained
 \ nextgroup=nroffSingleDigitNumber
 syntax match nroffSingleDigitNumber /\d/ contained
@@ -124,13 +138,15 @@ endif
 " Handle escape sequences that take delimiters.
 
 " bracket builder
+" \b
 syntax match nroffBracketBuildingEscape /b/ contained
 \ nextgroup=nroffDelimitedEscapeArgument
 syntax region nroffDelimitedEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
 \ contains=nroffEscapeCharacter
 
-" \C special character escape
+" special character escape
+" \C
 " TODO: Tricky; practically any character can appear in a special
 " character name, and predefined names (see groff_char(7)) use both
 " apostrophes and double quotes.  However, the double quote is

commit e7e3f8a70ad09204131c035455522b2cb4df56e1
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 04:49:25 2021 +1000

    nroff.vim: Support \C escape.

diff --git a/nroff.vim b/nroff.vim
index 6c043f4..319ccb5 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -20,13 +20,13 @@ if exists("b:nroff_is_groff")
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape
+    \nroffBracketBuildingEscape,nroffCharacterEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
     \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
-    \nroffBracketBuildingEscape
+    \nroffBracketBuildingEscape,nroffCharacterEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -130,6 +130,21 @@ syntax region nroffDelimitedEscapeArgument
 \ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
 \ contains=nroffEscapeCharacter
 
+" \C special character escape
+" TODO: Tricky; practically any character can appear in a special
+" character name, and predefined names (see groff_char(7)) use both
+" apostrophes and double quotes.  However, the double quote is
+" considerably rarer, used only for the "Hungarian umlaut" (\C'a"').
+" Therefore, encourage people to use a double quote for the escape
+" delimiter.  For other escapes, we encourage the apostrophe, following
+" examples in CSTR #54 and much other troff literature.
+syntax match nroffCharacterEscape /C/ contained
+\ nextgroup=nroffCharacterEscapeArgument
+syntax region nroffCharacterEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/"/ end=/"/ contained
+\ contains=nroffSpecialCharacter
+syntax match nroffSpecialCharacter /[^"]\+/ contained
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -145,12 +160,14 @@ highlight default link nroffGroffArgumentLeftParenthesis 
Preproc
 highlight default link nroffGroffArgumentLeftBracket Preproc
 highlight default link nroffBracketBuildingEscape Preproc
 highlight default link nroffEscapeDelimiter Preproc
+highlight default link nroffCharacterEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
 highlight default link nroffSingleSpecialCharacter SpecialChar
 highlight default link nroffDoubleSpecialCharacter SpecialChar
 highlight default link nroffGroffSpecialCharacter SpecialChar
+highlight default link nroffSpecialCharacter SpecialChar
 
 highlight default link nroffTodo Todo
 highlight default link nroffKeyword Error

commit cb195c1999449f3925fbdf5c392fb47a3ff81435
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 04:04:41 2021 +1000

    nroff.vim: Support \b escape.

diff --git a/nroff.vim b/nroff.vim
index 42955fa..6c043f4 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -19,12 +19,14 @@ if exists("b:nroff_is_groff")
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
-    \nroffInterpolationEscape,nroffArgumentInterpolationEscape
+    \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
+    \nroffBracketBuildingEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
-    \nroffInterpolationEscape,nroffArgumentInterpolationEscape
+    \nroffInterpolationEscape,nroffArgumentInterpolationEscape,
+    \nroffBracketBuildingEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -119,6 +121,15 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffGroffRightBracket
 endif
 
+" Handle escape sequences that take delimiters.
+
+" bracket builder
+syntax match nroffBracketBuildingEscape /b/ contained
+\ nextgroup=nroffDelimitedEscapeArgument
+syntax region nroffDelimitedEscapeArgument
+\ matchgroup=nroffEscapeDelimiter start=/'/ end=/'/ contained
+\ contains=nroffEscapeCharacter
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -132,6 +143,8 @@ highlight default link nroffGroffIdentifierLeftBracket 
Preproc
 highlight default link nroffArgumentInterpolationEscape Preproc
 highlight default link nroffGroffArgumentLeftParenthesis Preproc
 highlight default link nroffGroffArgumentLeftBracket Preproc
+highlight default link nroffBracketBuildingEscape Preproc
+highlight default link nroffEscapeDelimiter Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar

commit ec69225aab68027f5daf724984c5e5b1faf0421b
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 03:45:24 2021 +1000

    nroff.vim: Support \$ escape.

diff --git a/nroff.vim b/nroff.vim
index fbaf967..42955fa 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -19,12 +19,12 @@ if exists("b:nroff_is_groff")
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
     \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
-    \nroffInterpolationEscape
+    \nroffInterpolationEscape,nroffArgumentInterpolationEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
     \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
-    \nroffInterpolationEscape
+    \nroffInterpolationEscape,nroffArgumentInterpolationEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -101,6 +101,24 @@ if exists("b:nroff_is_groff")
     \ nextgroup=nroffGroffRightBracket
 endif
 
+" macro argument interpolation
+syntax match nroffArgumentInterpolationEscape /\$/ contained
+\ nextgroup=nroffSingleDigitNumber
+syntax match nroffSingleDigitNumber /\d/ contained
+
+if exists("b:nroff_is_groff")
+    syntax match nroffArgumentInterpolationEscape /\$/ contained
+    \ nextgroup=nroffSingleDigitNumber,
+    \nroffGroffArgumentLeftParenthesis,nroffGroffArgumentLeftBracket
+    syntax match nroffGroffArgumentLeftParenthesis /(/ contained
+    \ nextgroup=nroffGroffDoubleDigitNumber
+    syntax match nroffGroffDoubleDigitNumber /\d\d/ contained
+    syntax match nroffGroffArgumentLeftBracket /\[/ contained
+    \ nextgroup=nroffGroffMultiDigitNumber
+    syntax match nroffGroffMultiDigitNumber /\d\+/ contained
+    \ nextgroup=nroffGroffRightBracket
+endif
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -111,6 +129,9 @@ highlight default link nroffGroffOutputEscape Preproc
 highlight default link nroffInterpolationEscape Preproc
 highlight default link nroffIdentifierLeftParenthesis Preproc
 highlight default link nroffGroffIdentifierLeftBracket Preproc
+highlight default link nroffArgumentInterpolationEscape Preproc
+highlight default link nroffGroffArgumentLeftParenthesis Preproc
+highlight default link nroffGroffArgumentLeftBracket Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -128,6 +149,10 @@ highlight default link nroffSingleCharacterIdentifer 
Identifier
 highlight default link nroffIdentifier Identifier
 highlight default link nroffGroffIdentifier Identifier
 
+highlight default link nroffSingleDigitNumber Number
+highlight default link nroffGroffDoubleDigitNumber Number
+highlight default link nroffGroffMultiDigitNumber Number
+
 let &cpo = s:cpo_save
 unlet s:cpo_save
 " vim: set autoindent shiftwidth=4 softtabstop=4 textwidth=72:

commit 7d480f52afda2d7a163098da9338694a8bbe9f89
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 03:23:02 2021 +1000

    nroff.vim: Add support for \* escape.

diff --git a/nroff.vim b/nroff.vim
index b45ea3a..fbaf967 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -18,11 +18,13 @@ if exists("b:nroff_is_groff")
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
-    \nroffComment,nroffOutputEscape,nroffGroffOutputEscape
+    \nroffComment,nroffOutputEscape,nroffGroffOutputEscape,
+    \nroffInterpolationEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
-    \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape
+    \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape,
+    \nroffInterpolationEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -81,6 +83,24 @@ endif
 
 " Handle escape sequences that take arguments.
 
+" string interpolation
+syntax match nroffInterpolationEscape /\*/ contained
+\ nextgroup=nroffSingleCharacterIdentifer,nroffIdentifierLeftParenthesis
+syntax match nroffSingleCharacterIdentifer /\S/ contained
+syntax match nroffIdentifierLeftParenthesis /(/ contained
+\ nextgroup=nroffIdentifier
+syntax match nroffIdentifier /\S\S/ contained
+
+if exists("b:nroff_is_groff")
+    syntax match nroffInterpolationEscape /\*/ contained
+    \ nextgroup=nroffSingleCharacterIdentifer,
+    \nroffIdentifierLeftParenthesis,nroffGroffIdentifierLeftBracket
+    syntax match nroffGroffIdentifierLeftBracket /\[/ contained
+    \ nextgroup=nroffGroffIdentifier
+    syntax match nroffGroffIdentifier /[^]]\+/ contained
+    \ nextgroup=nroffGroffRightBracket
+endif
+
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
@@ -88,6 +108,9 @@ highlight default link nroffGroffLeftBracket Preproc
 highlight default link nroffGroffRightBracket Preproc
 highlight default link nroffOutputEscape Preproc
 highlight default link nroffGroffOutputEscape Preproc
+highlight default link nroffInterpolationEscape Preproc
+highlight default link nroffIdentifierLeftParenthesis Preproc
+highlight default link nroffGroffIdentifierLeftBracket Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -101,6 +124,10 @@ highlight default link nroffKeyword Error
 highlight default link nroffDeviceOutput Type
 highlight default link nroffGroffDeviceOutput Type
 
+highlight default link nroffSingleCharacterIdentifer Identifier
+highlight default link nroffIdentifier Identifier
+highlight default link nroffGroffIdentifier Identifier
+
 let &cpo = s:cpo_save
 unlet s:cpo_save
 " vim: set autoindent shiftwidth=4 softtabstop=4 textwidth=72:

commit ec75bbcae782ac499e25994a24fbedb5cecff107
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 03:22:41 2021 +1000

    nroff.vim: Adjust comments.

diff --git a/nroff.vim b/nroff.vim
index 598cc34..b45ea3a 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -26,7 +26,6 @@ else
 endif
 
 " Handle simple one-character escape form that takes no arguments.
-
 syntax match nroffSimpleEscape /[%&acdeprtuz{}]/ contained
 
 if exists("b:nroff_is_groff")
@@ -46,14 +45,11 @@ endif
 " Handle AT&T-style special character escape sequences.
 syntax match nroffSingleSpecialCharacter /[-'`_]/ contained
 
-" Handle AT&T-style special character escape sequences.
-
 syntax match nroffLeftParenthesis /(/ contained
 \ nextgroup=nroffDoubleSpecialCharacter
 syntax match nroffDoubleSpecialCharacter /\S\S/ contained
 
 " Handle groff-style special character escape sequences.
-
 if exists("b:nroff_is_groff")
     syntax match nroffGroffLeftBracket /\[/ contained
     \ nextgroup=nroffGroffSpecialCharacter

commit 3141dac0482c9549910de16761acc6a4086f4121
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 03:01:08 2021 +1000

    nroff.vim: Support \? escape sequence.

diff --git a/nroff.vim b/nroff.vim
index 9eba0e3..598cc34 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -18,7 +18,7 @@ if exists("b:nroff_is_groff")
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
-    \nroffComment,nroffOutputEscape
+    \nroffComment,nroffOutputEscape,nroffGroffOutputEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
@@ -77,6 +77,12 @@ syntax keyword nroffTodo FIXME TODO XXX contained
 syntax match nroffOutputEscape /!/ contained nextgroup=nroffDeviceOutput
 syntax match nroffDeviceOutput /.*/ contained
 
+" Handle groff's "inline" device output escape.
+if exists("b:nroff_is_groff")
+    syntax region nroffGroffDeviceOutput
+    \ matchgroup=nroffGroffOutputEscape start=/\\?/ end=/\\?/ oneline
+endif
+
 " Handle escape sequences that take arguments.
 
 highlight default link nroffEscapeCharacter Preproc
@@ -85,6 +91,7 @@ highlight default link nroffLeftParenthesis Preproc
 highlight default link nroffGroffLeftBracket Preproc
 highlight default link nroffGroffRightBracket Preproc
 highlight default link nroffOutputEscape Preproc
+highlight default link nroffGroffOutputEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -96,6 +103,7 @@ highlight default link nroffTodo Todo
 highlight default link nroffKeyword Error
 
 highlight default link nroffDeviceOutput Type
+highlight default link nroffGroffDeviceOutput Type
 
 let &cpo = s:cpo_save
 unlet s:cpo_save

commit a815a2feece1df173c3a4238fe7e7cc51f94e711
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 01:44:10 2021 +1000

    nroff.vim: Support \! escape sequence.

diff --git a/nroff.vim b/nroff.vim
index 99b1852..9eba0e3 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -18,11 +18,11 @@ if exists("b:nroff_is_groff")
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,
     \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
-    \nroffComment
+    \nroffComment,nroffOutputEscape
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
-    \nroffFixedWidthSpaceEscape,nroffComment
+    \nroffFixedWidthSpaceEscape,nroffComment,nroffOutputEscape
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -73,6 +73,10 @@ endif
 syntax keyword nroffNote Note NOTE contained
 syntax keyword nroffTodo FIXME TODO XXX contained
 
+" Handle "transparent line" escape.  It also eats the rest of the line.
+syntax match nroffOutputEscape /!/ contained nextgroup=nroffDeviceOutput
+syntax match nroffDeviceOutput /.*/ contained
+
 " Handle escape sequences that take arguments.
 
 highlight default link nroffEscapeCharacter Preproc
@@ -80,6 +84,7 @@ highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
 highlight default link nroffGroffLeftBracket Preproc
 highlight default link nroffGroffRightBracket Preproc
+highlight default link nroffOutputEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar
@@ -90,6 +95,8 @@ highlight default link nroffGroffSpecialCharacter SpecialChar
 highlight default link nroffTodo Todo
 highlight default link nroffKeyword Error
 
+highlight default link nroffDeviceOutput Type
+
 let &cpo = s:cpo_save
 unlet s:cpo_save
 " vim: set autoindent shiftwidth=4 softtabstop=4 textwidth=72:

commit 6df07cc24271cd5baabf605dae2d04b8ae09f001
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 01:35:33 2021 +1000

    nroff.vim: Support \% and groff \: escapes.

diff --git a/nroff.vim b/nroff.vim
index 7d347b7..99b1852 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -27,10 +27,10 @@ endif
 
 " Handle simple one-character escape form that takes no arguments.
 
-syntax match nroffSimpleEscape /[&acdeprtuz{}]/ contained
+syntax match nroffSimpleEscape /[%&acdeprtuz{}]/ contained
 
 if exists("b:nroff_is_groff")
-    syntax match nroffSimpleEscape /[)E]/ contained
+    syntax match nroffSimpleEscape /[):E]/ contained
 endif
 
 " Some people might not like the following, but I like how it

commit 84972cca63ed52d1614719c069a242112984e9a5
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 01:34:09 2021 +1000

    nroff: Add support for comments.
    
    And add some comments, too.

diff --git a/nroff.vim b/nroff.vim
index 4885159..7d347b7 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -17,10 +17,12 @@ endif
 if exists("b:nroff_is_groff")
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,
-    \nroffGroffLeftBracket,nroffSpaceEscape
+    \nroffGroffLeftBracket,nroffSpaceEscape,nroffFixedWidthSpaceEscape,
+    \nroffComment
 else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
-    \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape
+    \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape,
+    \nroffFixedWidthSpaceEscape,nroffComment
 endif
 
 " Handle simple one-character escape form that takes no arguments.
@@ -50,6 +52,8 @@ syntax match nroffLeftParenthesis /(/ contained
 \ nextgroup=nroffDoubleSpecialCharacter
 syntax match nroffDoubleSpecialCharacter /\S\S/ contained
 
+" Handle groff-style special character escape sequences.
+
 if exists("b:nroff_is_groff")
     syntax match nroffGroffLeftBracket /\[/ contained
     \ nextgroup=nroffGroffSpecialCharacter
@@ -58,7 +62,18 @@ if exists("b:nroff_is_groff")
     syntax match nroffGroffRightBracket /\]/ contained
 endif
 
-" Now handle escape sequences that take arguments.
+" Handle comments.  They consume the rest of the line.
+syntax match nroffComment /".*/ contained contains=nroffNote,nroffTodo
+
+if exists("b:nroff_is_groff")
+    syntax match nroffComment /#.*/ contained contains=nroffNote,
+    \nroffTodo
+endif
+
+syntax keyword nroffNote Note NOTE contained
+syntax keyword nroffTodo FIXME TODO XXX contained
+
+" Handle escape sequences that take arguments.
 
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
@@ -72,6 +87,7 @@ highlight default link nroffSingleSpecialCharacter SpecialChar
 highlight default link nroffDoubleSpecialCharacter SpecialChar
 highlight default link nroffGroffSpecialCharacter SpecialChar
 
+highlight default link nroffTodo Todo
 highlight default link nroffKeyword Error
 
 let &cpo = s:cpo_save

commit 0ad23950e0503e092722ecd178c2bfe6e7ef799c
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 01:33:38 2021 +1000

    nroff.vim: Support groff \) escape sequence.

diff --git a/nroff.vim b/nroff.vim
index ec5833c..4885159 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -28,7 +28,7 @@ endif
 syntax match nroffSimpleEscape /[&acdeprtuz{}]/ contained
 
 if exists("b:nroff_is_groff")
-    syntax match nroffSimpleEscape /[E]/ contained
+    syntax match nroffSimpleEscape /[)E]/ contained
 endif
 
 " Some people might not like the following, but I like how it

commit 785ab79f682ccf78c8782ec10ac66517f8669ea2
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 01:17:11 2021 +1000

    nroff.vim: Handle \&, and handle "\ " specially.
    
    \& is an _input_ break, so we shouldn't set it in red like the output
    space and special character escapes.
    
    People don't really need "\ ", so make it loud when it's used.

diff --git a/nroff.vim b/nroff.vim
index a4f2abc..ec5833c 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -22,13 +22,21 @@ else
     syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
     \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape
 endif
-syntax match nroffSimpleEscape /[acdeprtuz{}]/ contained
+
+" Handle simple one-character escape form that takes no arguments.
+
+syntax match nroffSimpleEscape /[&acdeprtuz{}]/ contained
 
 if exists("b:nroff_is_groff")
     syntax match nroffSimpleEscape /[E]/ contained
 endif
 
-syntax match nroffSpaceEscape /[ 0|^]/ contained
+" Some people might not like the following, but I like how it
+" discourages use of this escape sequence.
+syntax match nroffFixedWidthSpaceEscape / / contained
+syntax match nroffFixedWidthSpaceEscape /\\ $/
+
+syntax match nroffSpaceEscape /[0|^]/ contained
 if exists("b:nroff_is_groff")
     syntax match nroffSpaceEscape /\~/ contained
 endif
@@ -36,6 +44,8 @@ endif
 " Handle AT&T-style special character escape sequences.
 syntax match nroffSingleSpecialCharacter /[-'`_]/ contained
 
+" Handle AT&T-style special character escape sequences.
+
 syntax match nroffLeftParenthesis /(/ contained
 \ nextgroup=nroffDoubleSpecialCharacter
 syntax match nroffDoubleSpecialCharacter /\S\S/ contained
@@ -55,7 +65,6 @@ highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
 highlight default link nroffGroffLeftBracket Preproc
 highlight default link nroffGroffRightBracket Preproc
-highlight default link nroffSpaceEscape Preproc
 
 highlight default link nroffFixedWidthSpaceEscape Todo
 highlight default link nroffSpaceEscape SpecialChar

commit b7120afde3631235688b8cd2fef676c6fdb28ca8
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 01:02:26 2021 +1000

    nroff.vim: Improve special character detection.
    
    ...including groff support.

diff --git a/nroff.vim b/nroff.vim
index bae2ffd..a4f2abc 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -10,38 +10,58 @@ set cpo&vim
 
 let b:current_syntax = "nroff"
 
-syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
-\nroffSimpleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape
-
 if exists("b:nroff_is_groff")
     syntax keyword nroffKeyword groff
 endif
 
+if exists("b:nroff_is_groff")
+    syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
+    \nroffSingleSpecialCharacter,nroffLeftParenthesis,
+    \nroffGroffLeftBracket,nroffSpaceEscape
+else
+    syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
+    \nroffSingleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape
+endif
 syntax match nroffSimpleEscape /[acdeprtuz{}]/ contained
 
 if exists("b:nroff_is_groff")
     syntax match nroffSimpleEscape /[E]/ contained
 endif
 
-syntax match nroffSpaceEscape /[0|^]/ contained
+syntax match nroffSpaceEscape /[ 0|^]/ contained
 if exists("b:nroff_is_groff")
-    syntax match nroffSpaceEscape /~/ contained
+    syntax match nroffSpaceEscape /\~/ contained
 endif
 
-syntax match nroffSimpleSpecialCharacter /[-'`_]/ contained
+" Handle AT&T-style special character escape sequences.
+syntax match nroffSingleSpecialCharacter /[-'`_]/ contained
+
 syntax match nroffLeftParenthesis /(/ contained
-\ nextgroup=nroffSpecialCharacter
-syntax match nroffSpecialCharacter /\S\S/ contained
+\ nextgroup=nroffDoubleSpecialCharacter
+syntax match nroffDoubleSpecialCharacter /\S\S/ contained
+
+if exists("b:nroff_is_groff")
+    syntax match nroffGroffLeftBracket /\[/ contained
+    \ nextgroup=nroffGroffSpecialCharacter
+    syntax match nroffGroffSpecialCharacter /[^]]\+/ contained
+    \ nextgroup=nroffGroffRightBracket
+    syntax match nroffGroffRightBracket /\]/ contained
+endif
 
 " Now handle escape sequences that take arguments.
 
 highlight default link nroffEscapeCharacter Preproc
 highlight default link nroffSimpleEscape Preproc
 highlight default link nroffLeftParenthesis Preproc
-"highlight default link nroffSpaceEscape Error
+highlight default link nroffGroffLeftBracket Preproc
+highlight default link nroffGroffRightBracket Preproc
+highlight default link nroffSpaceEscape Preproc
 
-highlight default link nroffSpecialCharacter SpecialChar
-highlight default link nroffSimpleSpecialCharacter SpecialChar
+highlight default link nroffFixedWidthSpaceEscape Todo
+highlight default link nroffSpaceEscape SpecialChar
+highlight default link nroffSingleSpecialCharacter SpecialChar
+highlight default link nroffDoubleSpecialCharacter SpecialChar
+highlight default link nroffGroffSpecialCharacter SpecialChar
 
 highlight default link nroffKeyword Error
 

commit 8482874b8ce246224041530fcb413b8426ae3f14
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 01:01:58 2021 +1000

    nroff.vim: Make it easy to see groff mode.

diff --git a/nroff.vim b/nroff.vim
index 6af2bf7..bae2ffd 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -12,6 +12,11 @@ let b:current_syntax = "nroff"
 
 syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
 \nroffSimpleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape
+
+if exists("b:nroff_is_groff")
+    syntax keyword nroffKeyword groff
+endif
+
 syntax match nroffSimpleEscape /[acdeprtuz{}]/ contained
 
 if exists("b:nroff_is_groff")
@@ -38,6 +43,8 @@ highlight default link nroffLeftParenthesis Preproc
 highlight default link nroffSpecialCharacter SpecialChar
 highlight default link nroffSimpleSpecialCharacter SpecialChar
 
+highlight default link nroffKeyword Error
+
 let &cpo = s:cpo_save
 unlet s:cpo_save
 " vim: set autoindent shiftwidth=4 softtabstop=4 textwidth=72:

commit 34cb39a07a5eda7f97bcc2585fab09755d28c683
Author: G. Branden Robinson <[email protected]>
Date:   Sun Aug 15 00:37:52 2021 +1000

    nroff.vim: Add rudimentary escape seq recognition.

diff --git a/nroff.vim b/nroff.vim
index fcf7e2b..6af2bf7 100644
--- a/nroff.vim
+++ b/nroff.vim
@@ -10,6 +10,34 @@ set cpo&vim
 
 let b:current_syntax = "nroff"
 
+syntax match nroffEscapeCharacter /\\/ nextgroup=nroffSimpleEscape,
+\nroffSimpleSpecialCharacter,nroffLeftParenthesis,nroffSpaceEscape
+syntax match nroffSimpleEscape /[acdeprtuz{}]/ contained
+
+if exists("b:nroff_is_groff")
+    syntax match nroffSimpleEscape /[E]/ contained
+endif
+
+syntax match nroffSpaceEscape /[0|^]/ contained
+if exists("b:nroff_is_groff")
+    syntax match nroffSpaceEscape /~/ contained
+endif
+
+syntax match nroffSimpleSpecialCharacter /[-'`_]/ contained
+syntax match nroffLeftParenthesis /(/ contained
+\ nextgroup=nroffSpecialCharacter
+syntax match nroffSpecialCharacter /\S\S/ contained
+
+" Now handle escape sequences that take arguments.
+
+highlight default link nroffEscapeCharacter Preproc
+highlight default link nroffSimpleEscape Preproc
+highlight default link nroffLeftParenthesis Preproc
+"highlight default link nroffSpaceEscape Error
+
+highlight default link nroffSpecialCharacter SpecialChar
+highlight default link nroffSimpleSpecialCharacter SpecialChar
+
 let &cpo = s:cpo_save
 unlet s:cpo_save
 " vim: set autoindent shiftwidth=4 softtabstop=4 textwidth=72:

commit 1f091c4a0911658bbdd249ff3769820ca976b127
Author: G. Branden Robinson <[email protected]>
Date:   Sat Aug 14 23:39:32 2021 +1000

    nroff.vim: New file for a ground-up rewrite.

diff --git a/nroff.vim b/nroff.vim
new file mode 100644
index 0000000..fcf7e2b
--- /dev/null
+++ b/nroff.vim
@@ -0,0 +1,15 @@
+" Vim syntax file
+" Language:    nroff/groff/troff
+
+if exists("b:current_syntax")
+    finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:current_syntax = "nroff"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+" vim: set autoindent shiftwidth=4 softtabstop=4 textwidth=72:

Attachment: signature.asc
Description: PGP signature

Reply via email to