mirror of
https://github.com/tstack/lnav.git
synced 2024-09-11 13:05:51 +03:00
[highlight] turn off nesting for some builtin highlighters
This commit is contained in:
parent
e0ecbdff10
commit
f1deeb5b74
@ -385,12 +385,15 @@ setup_highlights(highlight_map_t& hm)
|
||||
.with_role(role_t::VCR_FILE);
|
||||
hm[{highlight_source_t::INTERNAL, "1.stringd"}]
|
||||
= highlighter(xpcre_compile(R"("(?:\\.|[^"])*")"))
|
||||
.with_nestable(false)
|
||||
.with_role(role_t::VCR_STRING);
|
||||
hm[{highlight_source_t::INTERNAL, "1.strings"}]
|
||||
= highlighter(xpcre_compile(R"((?<![A-WY-Za-qstv-z])'(?:\\.|[^'])*')"))
|
||||
.with_nestable(false)
|
||||
.with_role(role_t::VCR_STRING);
|
||||
hm[{highlight_source_t::INTERNAL, "1.stringb"}]
|
||||
= highlighter(xpcre_compile("`(?:\\\\.|[^`])*`"))
|
||||
.with_nestable(false)
|
||||
.with_role(role_t::VCR_STRING);
|
||||
hm[{highlight_source_t::INTERNAL, "diffp"}]
|
||||
= highlighter(xpcre_compile("^\\+.*")).with_role(role_t::VCR_DIFF_ADD);
|
||||
@ -403,7 +406,8 @@ setup_highlights(highlight_map_t& hm)
|
||||
hm[{highlight_source_t::INTERNAL, "0.comment"}]
|
||||
= highlighter(
|
||||
xpcre_compile(
|
||||
R"((?<=[\s;])//.*|/\*.*\*/|\(\*.*\*\)|^#.*|\s+#.*|dnl.*)"))
|
||||
R"((?<=[\s;])//.*|/\*.*\*/|\(\*.*\*\)|^#\s*(?!include|if|ifndef|elif|else|endif|error|pragma|define|undef).*|\s+#.*|dnl.*)"))
|
||||
.with_nestable(false)
|
||||
.with_role(role_t::VCR_COMMENT);
|
||||
hm[{highlight_source_t::INTERNAL, "javadoc"}]
|
||||
= highlighter(
|
||||
@ -435,6 +439,14 @@ setup_highlights(highlight_map_t& hm)
|
||||
.with_text_format(text_format_t::TF_C_LIKE)
|
||||
.with_text_format(text_format_t::TF_JAVA)
|
||||
.with_role(role_t::VCR_SYMBOL);
|
||||
hm[{highlight_source_t::INTERNAL, "cpp"}]
|
||||
= highlighter(
|
||||
xpcre_compile(
|
||||
R"(^#\s*(?:include|ifdef|ifndef|if|else|elif|error|endif|define|undef|pragma))"))
|
||||
.with_nestable(false)
|
||||
.with_text_format(text_format_t::TF_C_LIKE)
|
||||
.with_text_format(text_format_t::TF_JAVA)
|
||||
.with_role(role_t::VCR_KEYWORD);
|
||||
hm[{highlight_source_t::INTERNAL, "num"}]
|
||||
= highlighter(xpcre_compile(R"(\b-?(?:\d+|0x[a-zA-Z0-9]+)\b)"))
|
||||
.with_nestable(false)
|
||||
|
@ -1,11 +1,11 @@
|
||||
[35m''[0m
|
||||
''
|
||||
[35m{[0m
|
||||
[35m "fo[0m[35mo bar" : [0m[35mnull,[0m
|
||||
[35m [0m[35m "array" : [[0m
|
||||
[35m [0m[35m 1[0m[35m,[0m
|
||||
[35m [0m[35m 2[0m[35m,[0m
|
||||
[35m [0m[35m 3[0m
|
||||
[35m ][0m,
|
||||
[35m "fo[0mo bar" : [35mnull,[0m
|
||||
[35m [0m "array" : [
|
||||
[35m [0m 1[35m,[0m
|
||||
[35m [0m 2[35m,[0m
|
||||
[35m [0m 3
|
||||
],
|
||||
"obj" : {
|
||||
"one" : 1,
|
||||
"two" : true
|
||||
|
@ -4,5 +4,5 @@
|
||||
[35m select Id from Ac[0m[4m[35mco[0m[35munt [0m[4m[35mwher[0m[35me id = $sfid[0m
|
||||
[35m ^[0m
|
||||
[35m ERROR at Row:1:Column:34[0m
|
||||
[35m line 1:34 no viable alternative at character '$[0m[35m'[0m
|
||||
[35m"[0m[35m"[0m}]}
|
||||
[35m line 1:34 no viable alternative at character '$'[0m
|
||||
[35m""[0m}]}
|
||||
|
@ -10,8 +10,8 @@
|
||||
▌[8] - https://snapcraft.io/lnav
|
||||
|
||||
[4m<img[0m
|
||||
[4msrc[0m[4m=[0m[4m[35m"https://assets-global.website-files.com/6257adef93867e50d84d30e2/62594fddd654fc29fcc07359_cb48d2a8d4991281d7a6a95d2f58195e.svg"[0m
|
||||
[4mheight[0m[4m=[0m[4m[35m"20"[0m[4m/>[1][0m
|
||||
[4msrc[0m[4m="https://assets-global.website-files.com/6257adef93867e50d84d30e2/62594fddd654fc29fcc07359_cb48d2a8d4991281d7a6a95d2f58195e.svg"[0m
|
||||
[4mheight[0m[4m="20"/>[1][0m
|
||||
|
||||
▌[1] - https://discord.gg/erBPnKwz7R
|
||||
|
||||
|
@ -27,11 +27,11 @@
|
||||
* [1mSOFTWARE[0m, [1mEVEN[0m [1mIF[0m [1mADVISED[0m [1mOF[0m [1mTHE[0m [1mPOSSIBILITY[0m [1mOF[0m [1mSUCH[0m [1mDAMAGE[0m.
|
||||
*/
|
||||
|
||||
[32m#include [0m[32m"log_level.hh"[0m
|
||||
[1m[36m#include[0m [35m"log_level.hh"[0m
|
||||
|
||||
[32m#include <[0m[32mctype.h[0m[32m>[0m
|
||||
[1m[36m#include[0m <ctype.h>
|
||||
|
||||
[32m#include [0m[32m"config.h"[0m
|
||||
[1m[36m#include[0m [35m"config.h"[0m
|
||||
|
||||
[1m[36mconst[0m [1m[36mchar[0m* level_names[[1mLEVEL__MAX[0m + [1m1[0m] = {
|
||||
[35m"unknown"[0m,
|
||||
|
Loading…
Reference in New Issue
Block a user