Luce packages
LuceLuce BaseLuciaOS

dymokomi/luced

Source of release 0.4.1

0.4.1 / grammars / toml.tmLanguage.json

{
  "name": "TOML",
  "scopeName": "source.toml",
  "fileTypes": ["toml"],
  "patterns": [
    { "include": "#comment" },
    { "include": "#table" },
    { "include": "#key" },
    { "include": "#string" },
    { "include": "#constant" },
    { "include": "#number" }
  ],
  "repository": {
    "comment": { "match": "#.*$", "name": "comment.line.number-sign.toml" },
    "table": {
      "match": "^\\s*(\\[\\[?)([^\\]]*)(\\]\\]?)",
      "captures": {
        "1": { "name": "punctuation.definition.table.toml" },
        "2": { "name": "entity.name.type.table.toml" },
        "3": { "name": "punctuation.definition.table.toml" }
      }
    },
    "key": {
      "match": "(?:^\\s*|\\{\\s*|,\\s*)([A-Za-z0-9_.\\-\"']+)\\s*(?==)",
      "captures": { "1": { "name": "variable.other.key.toml" } }
    },
    "string": {
      "patterns": [
        { "begin": "\"\"\"", "end": "\"\"\"", "name": "string.quoted.triple.double.toml" },
        { "begin": "'''", "end": "'''", "name": "string.quoted.triple.single.toml" },
        { "begin": "\"", "end": "\"", "name": "string.quoted.double.toml", "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.toml" }] },
        { "begin": "'", "end": "'", "name": "string.quoted.single.toml" }
      ]
    },
    "constant": { "match": "(?<![\\w-])(?:true|false)(?![\\w-])", "name": "constant.language.boolean.toml" },
    "number": {
      "patterns": [
        { "match": "(?<![\\w-])\\d{4}-\\d{2}-\\d{2}(?:[Tt ]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:[Zz]|[+-]\\d{2}:\\d{2})?)?", "name": "constant.numeric.date.toml" },
        { "match": "(?<![\\w-])[+-]?(?:0[xob][0-9a-fA-F_]+|\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?|inf|nan)(?![\\w-])", "name": "constant.numeric.toml" }
      ]
    }
  }
}