aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-06-26 20:17:41 +0000
committerJoursoir <chat@joursoir.net>2021-06-26 20:17:41 +0000
commit9b65c090d21dc9da6f9bdda2d41a3f9435efda2b (patch)
tree8e82f56e1803744017a4d8f82c6a6be6e05d57dd
downloadsubl-syntax-man-9b65c090d21dc9da6f9bdda2d41a3f9435efda2b.tar.gz
subl-syntax-man-9b65c090d21dc9da6f9bdda2d41a3f9435efda2b.tar.bz2
subl-syntax-man-9b65c090d21dc9da6f9bdda2d41a3f9435efda2b.zip
init project
-rw-r--r--man.sublime-syntax77
1 files changed, 77 insertions, 0 deletions
diff --git a/man.sublime-syntax b/man.sublime-syntax
new file mode 100644
index 0000000..ba2de71
--- /dev/null
+++ b/man.sublime-syntax
@@ -0,0 +1,77 @@
+%YAML 1.2
+---
+name: Man (*roff)
+scope: text.man
+file_extensions: \d
+first_line_match: ^([.'])TH\b
+
+variables:
+ # Requests always have a period (‘.’) or an apostrophe (‘'’)
+ # as the first character of the input line.
+ cc: ^([.']) # cc - control character
+ 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])
+
+contexts:
+ main:
+ - match: '{{cc}}{{macro}}'
+ scope: keyword.control.man
+ push: macros
+
+ - match: '{{cc}}(?={{font_style}})\b'
+ scope: keyword.control.man
+ push: font_styles
+ with_prototype:
+ - match: $
+ 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
+ push: line_comment
+
+
+ macros:
+ - match: '"'
+ scope: punctuation.definition.string.begin.man
+ push: string
+
+ - match: '{{numeric}}'
+ scope: constant.numeric.man
+
+ - match: $
+ pop: true
+
+
+ font_styles:
+ - match: B
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.bold.man
+ - match: R
+ scope: keyword.control.man
+ - match: I
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.italic.man
+
+
+ line_comment:
+ - meta_scope: comment.line.man
+ - match: $
+ pop: true
+
+
+ string:
+ - meta_scope: string.quoted.double.man
+ - match: '"'
+ scope: punctuation.definition.string.end.man
+ pop: true