highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.3k stars 3.52k forks source link

Cloudwatch Query Language (pschorrql) #4039

Closed douglasg14b closed 2 months ago

douglasg14b commented 2 months ago

I have read the page on language requests, this is not a language request for the core team.

My intention here is to provide the details for this language that I can pick up when able, or someone else passionate about it can pick up with all the info they need. otherwise I fear it would be lost in the cracks, since it took a bit of work to even figure out what this is called, or what the language definition is.

Here is the language definition from https://github.com/nathanpeck/ecs-patterns-vitepress/blob/2ed8c33740a227e801425ceefc5dd45a4559b2bc/.vitepress/config.ts#L32

This appears to be called pschorrql in the monaco editor in Cloud Watch.

{
  "scopeName": "text.query",
  "fileTypes": [
    "query"
  ],
  "name": "CloudWatch Logs Insights Query",
  "patterns": [
    {
      "begin": "\"",
      "end": "\"",
      "name": "string.quoted.double"
    },
    {
      "begin": "'",
      "end": "'",
      "name": "string.quoted.single"
    },
    {
      "match": "\\b(?i:(display|fields|filter|limit|sort|stats|parse))\\b",
      "name": "keyword.control"
    },
    {
      "match": "\\b(?i:(and|as|asc|by|desc|group|in|like|not|or))\\b",
      "name": "keyword.operator"
    },
    {
      "match": "(\\@timestamp|@logStream|@message|@log)",
      "name": "support.variable"
    },
    {
      "match": "(abs|avg|bin|ceil|coalesce|concat|count|count_distinct|datefloor|dateceil|earliest|floor|fromMillis|greatest|isEmpty|isPresent|isBlank|isValidIp|isValidIpV4|isValidIpV6|isIpInSubnet|isIpv4InSubnet|isIpv6InSubnet|latest|least|log|ltrim|max|median|min|mod|pct|pow|replace|rtrim|sortsFirst|sortsLast|strcontains|strlen|sqrt|stddev|substr|sum|toMillis|toLower|toUpper|trim|unmask)",
      "name": "support.function"
    },
    {
      "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b",
      "name": "constant.numeric"
    }
  ],
  "uuid": "0DB90CBB-C53C-4730-80B0-D1E5F244EEAC"
}
joshgoebel commented 2 months ago

Anyone would be open to run with this as a 3rd party grammar, but it's not really an issue we can leave open - as there is nothing for us to do here. Happy to have the details live in issue history though if that's helpful to anyone.

douglasg14b commented 2 months ago

Yeah mainly the point of the issue was to capture the information so if someone comes searching there should be enough to get them started, and/or when/if I find a few hours to onboard to how to do this I can find the info here again.