{
  "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  "name": "Ruchy",
  "patterns": [
    { "include": "#comments" },
    { "include": "#keywords" },
    { "include": "#strings" },
    { "include": "#numbers" },
    { "include": "#functions" },
    { "include": "#types" },
    { "include": "#operators" }
  ],
  "repository": {
    "comments": {
      "patterns": [
        {
          "name": "comment.line.double-slash.ruchy",
          "match": "//.*$"
        },
        {
          "name": "comment.block.ruchy",
          "begin": "/\\*",
          "end": "\\*/"
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "name": "keyword.control.ruchy",
          "match": "\\b(if|else|for|while|match|break|continue|return)\\b"
        },
        {
          "name": "keyword.other.ruchy",
          "match": "\\b(fn|let|const|var|struct|enum|impl|trait|pub|mod|use|as|in)\\b"
        },
        {
          "name": "keyword.operator.ruchy",
          "match": "\\b(and|or|not)\\b"
        },
        {
          "name": "constant.language.ruchy",
          "match": "\\b(true|false|null|nil)\\b"
        }
      ]
    },
    "strings": {
      "patterns": [
        {
          "name": "string.quoted.double.ruchy",
          "begin": "\"",
          "end": "\"",
          "patterns": [
            {
              "name": "constant.character.escape.ruchy",
              "match": "\\\\."
            }
          ]
        },
        {
          "name": "string.quoted.single.ruchy",
          "begin": "'",
          "end": "'",
          "patterns": [
            {
              "name": "constant.character.escape.ruchy",
              "match": "\\\\."
            }
          ]
        },
        {
          "name": "string.interpolated.ruchy",
          "begin": "f\"",
          "end": "\"",
          "patterns": [
            {
              "name": "constant.character.escape.ruchy",
              "match": "\\\\."
            },
            {
              "name": "variable.other.interpolated.ruchy",
              "begin": "\\{",
              "end": "\\}"
            }
          ]
        }
      ]
    },
    "numbers": {
      "patterns": [
        {
          "name": "constant.numeric.float.ruchy",
          "match": "\\b[0-9]+\\.[0-9]+\\b"
        },
        {
          "name": "constant.numeric.integer.ruchy",
          "match": "\\b[0-9]+\\b"
        },
        {
          "name": "constant.numeric.hex.ruchy",
          "match": "\\b0x[0-9a-fA-F]+\\b"
        },
        {
          "name": "constant.numeric.binary.ruchy",
          "match": "\\b0b[01]+\\b"
        }
      ]
    },
    "functions": {
      "patterns": [
        {
          "name": "entity.name.function.ruchy",
          "match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b",
          "captures": {
            "1": { "name": "keyword.other.fn.ruchy" },
            "2": { "name": "entity.name.function.ruchy" }
          }
        },
        {
          "name": "support.function.builtin.ruchy",
          "match": "\\b(println|print|assert|len|type|to_string)\\b"
        }
      ]
    },
    "types": {
      "patterns": [
        {
          "name": "entity.name.type.ruchy",
          "match": "\\b[A-Z][a-zA-Z0-9_]*\\b"
        },
        {
          "name": "support.type.primitive.ruchy",
          "match": "\\b(i8|i16|i32|i64|i128|u8|u16|u32|u64|u128|f32|f64|bool|char|str|String)\\b"
        }
      ]
    },
    "operators": {
      "patterns": [
        {
          "name": "keyword.operator.arithmetic.ruchy",
          "match": "[+\\-*/%]"
        },
        {
          "name": "keyword.operator.comparison.ruchy",
          "match": "(==|!=|<=|>=|<|>)"
        },
        {
          "name": "keyword.operator.assignment.ruchy",
          "match": "(=|\\+=|\\-=|\\*=|/=|%=)"
        },
        {
          "name": "keyword.operator.logical.ruchy",
          "match": "(&&|\\|\\||!)"
        },
        {
          "name": "keyword.operator.pipeline.ruchy",
          "match": "\\|>"
        }
      ]
    }
  },
  "scopeName": "source.ruchy"
}