How to customize "Log files.cuda-litelexer" ?

All questions regarding lexer highlighting schemes are discussed here...
Post Reply
caclp
Posts: 4
Joined: 16.07.2022 09:06

How to customize "Log files.cuda-litelexer" ?

Post by caclp »

It's first time for me to use CudaText, could I customize the configuration file for "Log file" lexer?

Log files.cuda-litelexer. I added the last part "TextBlod", but it couldn't work, how to modify?
Thank you! ;)

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"
    },
    "TextBlod": {                                                                    <<==== NEW ADD
      "regex": "[:space:][a-z]*@[a-z0-9-]*:.*>",
      "style": "LightBG3"
    }
  }
}
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Post by main Alexey »

Regex engine don't support [:space:] so you need to write '\\s' with double slash.
With \\s it highlights this line

Code: Select all

  aaaa@wefsdf: sdf > sdfsdf
caclp
Posts: 4
Joined: 16.07.2022 09:06

Post by caclp »

OK, thanks a lot. It's working :lol:
caclp
Posts: 4
Joined: 16.07.2022 09:06

Post by caclp »

Code: Select all

{
  "about": "Converted from Matthias030's lexer by Alexey Torgashin",
  "files": "*.log",
  "case_sens": false,
  "consider_spaces": true,
  "rules": {
    "success": {
      "regex": "(success|Succ|succeed|ok|Running|START|true|COMPLETE)\\w*",
      "style": "LightBG3"
    },
    "error": {
      "regex": "(error|exception|fail|fatal|crash|violat|unsuccess)\\w*",
      "style": "LightBG1"
    },
    "warning": {
      "regex": "(warn|critical|conflict|no success|not succeed|out of date|false)\\w*",
      "style": "LightBG2"
    },
    "keyword": {
      "regex": "\\b(kubectl|node|worker|director|patch|sts|get|pod)\\b",
      "style": "IdKeyword"
    },
    "number": {
      "regex": "\\b((\\d+[-/\\.:T])*\\d+)\\b",
      "style": "Id1"
    },
    "prompt1": {
      "regex": "\\s[a-zA-Z0-9]*@[a-zA-Z0-9_-]*:.*[\\#>]",
      "style": "IdVar"                         <<== Can we find a list contains all styles ? and include definition. Looks like THEMES just contain a little part.
    }
  }
}
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Post by main Alexey »

>Can we find a list contains all styles ? and include definition. Looks like THEMES just contain a little part.

Top menu: Options / Settings-theme-syntax. OK?
caclp
Posts: 4
Joined: 16.07.2022 09:06

Post by caclp »

OK. Look like STYLEs have two sources:
1. Top menu: Options / Settings-theme-syntax
2. Themes

:P :P :P
Thanks, man
Post Reply