Page 1 of 1

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

Posted: 16.07.2022 09:13
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"
    }
  }
}

Posted: 16.07.2022 10:39
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

Posted: 16.07.2022 13:36
by caclp
OK, thanks a lot. It's working :lol:

Posted: 16.07.2022 14:44
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.
    }
  }
}

Posted: 16.07.2022 15:00
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?

Posted: 16.07.2022 15:20
by caclp
OK. Look like STYLEs have two sources:
1. Top menu: Options / Settings-theme-syntax
2. Themes

:P :P :P
Thanks, man