Slight cleanup of the c-family highlighters

* Extract raw strings to the C++ specific section
* Merge different documetnation comment formats in single regions
This commit is contained in:
Maxime Coste 2021-03-31 21:24:45 +11:00
parent 4be6df9d02
commit 212242cc60

View File

@ -199,11 +199,8 @@ evaluate-commands %sh{
add-highlighter shared/$ft regions add-highlighter shared/$ft regions
add-highlighter shared/$ft/code default-region group add-highlighter shared/$ft/code default-region group
add-highlighter shared/$ft/string region %{$maybe_at(?<!')(?<!'\\\\)"} %{(?<!\\\\)(?:\\\\\\\\)*"} fill string add-highlighter shared/$ft/string region %{$maybe_at(?<!')(?<!'\\\\)"} %{(?<!\\\\)(?:\\\\\\\\)*"} fill string
add-highlighter shared/$ft/raw_string region -match-capture %{R"([^(]*)\\(} %{\\)([^")]*)"} fill string add-highlighter shared/$ft/documentation_comment region /\*(\*[^/]|!) \*/ fill documentation
add-highlighter shared/$ft/javadoc region /\*\*[^/] \*/ fill documentation add-highlighter shared/$ft/line_documentation_comment region //[/!] $ fill documentation
add-highlighter shared/$ft/qtdoc region /\*! \*/ fill documentation
add-highlighter shared/$ft/inline_doc region /// $ fill documentation
add-highlighter shared/$ft/inline_qtdoc region //! $ fill documentation
add-highlighter shared/$ft/comment region /\\* \\*/ fill comment add-highlighter shared/$ft/comment region /\\* \\*/ fill comment
add-highlighter shared/$ft/line_comment region // (?<!\\\\)(?=\\n) fill comment add-highlighter shared/$ft/line_comment region // (?<!\\\\)(?=\\n) fill comment
add-highlighter shared/$ft/disabled region -recurse "#\\h*if(?:def)?" ^\\h*?#\\h*if\\h+(?:0|FALSE)\\b "#\\h*(?:else|elif|endif)" fill comment add-highlighter shared/$ft/disabled region -recurse "#\\h*if(?:def)?" ^\\h*?#\\h*if\\h+(?:0|FALSE)\\b "#\\h*(?:else|elif|endif)" fill comment
@ -287,6 +284,9 @@ evaluate-commands %sh{
# c++ specific # c++ specific
# raw strings
add-highlighter shared/cpp/raw_string region -match-capture %{R"([^(]*)\(} %{\)([^")]*)"} fill string
# integer literals # integer literals
add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b[1-9]('?\d+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b[1-9]('?\d+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value
add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0b[01]('?[01]+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0b[01]('?[01]+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value