aboutsummaryrefslogtreecommitdiffstats
path: root/man.sublime-syntax
diff options
context:
space:
mode:
Diffstat (limited to 'man.sublime-syntax')
-rw-r--r--man.sublime-syntax39
1 files changed, 25 insertions, 14 deletions
diff --git a/man.sublime-syntax b/man.sublime-syntax
index 093dcda..afd6665 100644
--- a/man.sublime-syntax
+++ b/man.sublime-syntax
@@ -9,29 +9,26 @@ variables:
# Requests always have a period (‘.’) or an apostrophe (‘'’)
# as the first character of the input line.
cc: ^([.']) # cc - control character
+ escape: \\f
macro: (TH|SH|SS|TP|LP|PP|P|HP|RS|RE)\b
numeric: '\b(-)?[0-9.]+\b'
font_size: (SM|SB)\b
font_alt: (BI|IB|RI|IR|BR|RB)\b
font_style: ([BRI])
+ end_format: (?={{escape}}|{{cc}})
contexts:
main:
- match: (?={{cc}})
push: macros
- - match: '{{cc}}(?={{font_style}})\b'
- scope: keyword.control.man
+ - match: (?={{escape}}{{font_style}})
push: font_styles
with_prototype:
- - match: $
+ - match: '{{end_format}}'
+ meta_content_scope: markup.regular.man
pop: true
- - match: (\\f){{font_style}}
- captures:
- 1: keyword.control.man
- 2: constant.character.escape.man
-
# Comments begin and finish at the end of the line
- match: \\["#]
scope: comment.man
@@ -47,6 +44,14 @@ contexts:
push: macros_line
pop: true
+ - match: '{{cc}}(?={{font_style}})\b'
+ scope: keyword.control.man
+ push: font_styles
+ with_prototype:
+ - match: '{{end_format}}'
+ pop: true
+ pop: true
+
- match: '{{cc}}\w+\b'
scope: support.function.groff
push: macros_line
@@ -75,13 +80,19 @@ contexts:
font_styles:
- - match: B
- scope: keyword.control.man
+ - match: (B\b|{{escape}}(B))
+ captures:
+ 1: keyword.control.man
+ 2: constant.character.escape.man
push:
- meta_content_scope: markup.bold.man
- - match: R
- scope: keyword.control.man
- - match: I
- scope: keyword.control.man
+ - match: ({{escape}})(R) # only \fR
+ captures:
+ 1: keyword.control.man
+ 2: constant.character.escape.man
+ - match: (I\b|{{escape}}(I))
+ captures:
+ 1: keyword.control.man
+ 2: constant.character.escape.man
push:
- meta_content_scope: markup.italic.man