Page 1 of 1
Lexer properties: Log Files
Posted: 19.06.2021 21:29
by ertank
Hello,
I am using CudaText version 1.134.0.2 win64.
I wanted to change ISO8601 formatted date time text to be displayed in yellow color as whole. Currently only part of it is in yellow color as can be seen in attached picture.
I could not open settings for "Log files ^" lexer. I could not find it in lexer library. I could not open lexer styles mapping.
I mean I click mentioned menu options, but nothing comes up. No config file opens. Only lexer library display a dialog and others simply does nothing.
Is there any way I play with coloring options of "Log files ^" lexer?
Thanks & Regards,
Ertan
Posted: 19.06.2021 21:41
by uvviewsoft
Lexer is 'lite' so it is not in the LexerLibrary dialog. the file is here-- /home/user/.config/cudatext/data/lexliblite/Log files.cuda-litelexer
If you know the RegEx, you may try to adjust it.
Posted: 19.06.2021 22:28
by ertank
Below worked fine for me. It would be nice if it can be added as default
Code: Select all
"number": {
"regex": "\\b((\\d+[-/\\.\\:\\\\\\ \\T])+\\d+)\\b",
"style": "Id1"
}
Thanks.
Posted: 19.06.2021 22:55
by uvviewsoft
applied that patch. thanks.
Posted: 20.06.2021 09:23
by ertank
Thank you.
Posted: 20.06.2021 09:57
by ertank
I just wanted to add alternative coloring in "Log files.cuda-litelexer" This is something else than what already exists.
Json parsed OK when CudaText is loading. But, new coloring is not applied. My addition to that lexer file is as following
Code: Select all
"warning2": {
"regex": "^.*(TEST|ALİ|VELİ).*$",
"style": "LightBG4"
}
There are some Turkish national characters. I escaped them thinking UTF8 JSON string is not supported and still not working. Even, TEST is not working.
Do I need to modify some other file(s) in order to have "warning2" to work with this lexer?
Thanks & Regards,
Ertan
Posted: 20.06.2021 10:51
by uvviewsoft
Adding that lines is working, here is my file 'Log files.cuda-litelexer',
I placed your lines in the middle.
Code: Select all
{
"about": "Converted from Matthias030's lexer by Alexey Torgashin",
"files": "*.log",
"case_sens": false,
"consider_spaces": true,
"rules": {
"success": {
"regex": "^.*((?<!no )success|(?<!nicht )erfolgreich|(no|without( any)?) error|fehlerfrei|(ohne |kein(e)? )fehler|(?<!not )succeed|mit erfolg).*$",
"style": "LightBG3"
},
"error": {
"regex": "^.*(error|exception|fail|fatal|crash|(?<!be)fehl(geschlagen)?(er)?|(ohne|kein|nicht) erfolg|violat).*$",
"style": "LightBG1"
},
"warning": {
"regex": "^.*(warn|critical|kritisch|conflict|konflikt|ung(ü|ue)ltig|invalid|(nicht |un)zul(ä|ae)ssig|not ready|nicht bereit|not found|nicht gefunden|no success|not succeed|veraltet|out of date).*$",
"style": "LightBG2"
},
"warning2": {
"regex": "^.*(TEST|ALİ|VELİ).*$",
"style": "LightBG4"
},
"type": {
"regex": "\\(.*?\\)|\\[.*?\\]|\\{.*?\\}",
"style": "Id2"
},
"id": {
"regex": "[a-z_]\\w*",
"style": "Id"
},
"number": {
"regex": "\\b((\\d+[-/\\.:T])*\\d+)\\b",
"style": "Id1"
}
}
}
lines with 'TEST' word are hilighted in blue.
Posted: 20.06.2021 11:06
by ertank
Adding warning2 just below warning works.
Adding it to the last does not work.
Code: Select all
{
"about": "Converted from Matthias030's lexer by Alexey Torgashin",
"files": "*.log",
"case_sens": false,
"consider_spaces": true,
"rules": {
"success": {
"regex": "^.*((?<!no )success|(?<!nicht )erfolgreich|(no|without( any)?) error|fehlerfrei|(ohne |kein(e)? )fehler|(?<!not )succeed|mit erfolg).*$",
"style": "LightBG3"
},
"error": {
"regex": "^.*(error|exception|fail|fatal|crash|(?<!be)fehl(geschlagen)?(er)?|(ohne|kein|nicht) erfolg|violat).*$",
"style": "LightBG1"
},
"warning": {
"regex": "^.*(warn|critical|kritisch|conflict|konflikt|ung(ü|ue)ltig|invalid|(nicht |un)zul(ä|ae)ssig|not ready|nicht bereit|not found|nicht gefunden|no success|not succeed|veraltet|out of date).*$",
"style": "LightBG2"
},
"type": {
"regex": "\\(.*?\\)|\\[.*?\\]|\\{.*?\\}",
"style": "Id2"
},
"id": {
"regex": "[a-z_]\\w*",
"style": "Id"
},
"number": {
"regex": "\\b((\\d+[-/\\.:T])*\\d+)\\b",
"style": "Id1"
},
"warning2": {
"regex": "^.*(TEST|ALİ|VELİ).*$",
"style": "LightBG4"
}
}
}
This config does not highlight TEST lines for me.
Posted: 20.06.2021 11:35
by uvviewsoft
this is because order of rules matters. Rule above 'warning2' finds 'TEST' before it.
Posted: 20.06.2021 11:45
by ertank
It is clear now that rules works on "first match" logic.
Thanks for the explanation.