From 575888d81b3ecdb49dc31406d12053ab135f648e Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Thu, 15 Oct 2020 06:39:27 +0300 Subject: [PATCH] Fix Manpage C highlighting regression --- .../syntaxes/02_Extra/Manpage.sublime-syntax | 15 +++++++++++-- assets/syntaxes/02_Extra/syntax_test_man.man | 22 +++++++++++++++++++ .../highlighted/Manpage/select-2.man | 2 +- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/assets/syntaxes/02_Extra/Manpage.sublime-syntax b/assets/syntaxes/02_Extra/Manpage.sublime-syntax index 121f6ab0..ea0bcb3c 100644 --- a/assets/syntaxes/02_Extra/Manpage.sublime-syntax +++ b/assets/syntaxes/02_Extra/Manpage.sublime-syntax @@ -89,8 +89,9 @@ contexts: scope: entity.name.command-line-option.man - match: '(\[)(=)' captures: + 1: punctuation.section.brackets.begin.man 2: keyword.operator.man - push: expect-parameter + push: [command-line-option-or-pipe, expect-parameter] - match: '\[' push: - meta_scope: entity.name.command-line-option.man @@ -112,13 +113,23 @@ contexts: expect-parameter: - match: '[A-Za-z0-9-]+' scope: variable.parameter.man + - match: (?=\s+\|) + pop: true - match: \| scope: keyword.operator.logical.man + - match: '\[' + scope: punctuation.section.brackets.begin.man + push: + - match: '\]' + scope: punctuation.section.brackets.end.man + pop: true + - include: expect-parameter - match: '$|(?=[],]|{{command_line_option}})' pop: true synopsis: - #- include: scope:source.c + - match: '^(?=\s+(?:#include|/\*))' + push: scope:source.c - match: \[ scope: punctuation.section.brackets.begin.man push: command-line-option-or-pipe diff --git a/assets/syntaxes/02_Extra/syntax_test_man.man b/assets/syntaxes/02_Extra/syntax_test_man.man index 54c052a5..a4c8f91d 100644 --- a/assets/syntaxes/02_Extra/syntax_test_man.man +++ b/assets/syntaxes/02_Extra/syntax_test_man.man @@ -21,6 +21,22 @@ SYNOPSIS # ^ punctuation.section.brackets.begin # ^^^^^^^^^^^^^^^^ entity.name.command-line-option # ^ punctuation.section.brackets.end + [-u | --set-upstream] [-o | --push-option=] +# ^ punctuation.section.brackets.begin +# ^^ entity.name.command-line-option +# ^ keyword.operator.logical +# ^^^^^^^^^^^^^^ entity.name.command-line-option +# ^ punctuation.section.brackets.end +# ^^^^^^^^^^^^^ entity.name.command-line-option + [--force-with-lease[=[:]]] +# ^ punctuation.section.brackets.begin +# ^^^^^^^^^^^^^^^^^^ entity.name.command-line-option +# ^ punctuation.section.brackets.begin +# ^ keyword.operator +# ^^^^^^^ variable.parameter +# ^ punctuation.section.brackets.begin +# ^^^^^^ variable.parameter +# ^^^ punctuation.section.brackets.end example --system [options] # ^^^^^^^^ entity.name @@ -28,6 +44,12 @@ SYNOPSIS COMMON OPTIONS [--quiet] [--debug] [--help|-h] [--version] [--conf FILE] + /* According to POSIX.1-2001, POSIX.1-2008 */ +# ^^ source comment.block punctuation.definition.comment + #include +# ^^^^^^^^ source meta.preprocessor.include keyword.control.import.include + + DESCRIPTION example does something useful in relation to the command line options and configuration information in /etc/example.conf. diff --git a/tests/syntax-tests/highlighted/Manpage/select-2.man b/tests/syntax-tests/highlighted/Manpage/select-2.man index 5ca67908..e01db209 100644 --- a/tests/syntax-tests/highlighted/Manpage/select-2.man +++ b/tests/syntax-tests/highlighted/Manpage/select-2.man @@ -1,4 +1,4 @@ -SELECT(2) Linux Programmer's Manual SELECT(2) +SELECT(2) Linux Programmer's Manual SELECT(2) NAME  select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing