{
  "$schema": "./tmLanguageSchema.json",
  "scopeName": "source.upsilon",
  "fileTypes": ["lua", "yup"],
  "patterns": [
    {
      "name": "keyword.control",
      "match": "\\b(if|while|for|return|in|end|local|true|false|not|then|elseif|break)\\b"
    },
    {
      "begin": "\\b(?:(local)\\s+)?(function)\\s*(?:\\s+([a-zA-Z_][a-zA-Z0-9_]*(?:([\\.:])[a-zA-Z_][a-zA-Z0-9_]*)?)\\s*)?(\\()",
      "beginCaptures": {
        "1": {
          "name": "storage.modifier.local"
        },
        "2": {
          "name": "keyword.control"
        },
        "3": {
          "name": "entity.name.function"
        },
        "4": {
          "name": "keyword.control"
        },
        "5": {
          "name": "keyword.control"
        }
      },
      "end": "\\)",
      "endCaptures": {
        "0": {
          "name": "keyword.control"
        }
      },
      "name": "meta.function",
      "patterns": [
        {
          "match": "[a-zA-Z_][a-zA-Z0-9_]*",
          "name": "variable.parameter"
        }
      ]
    },
    {
      "name": "keyword.operator",
      "match": "\\b(and|or|not|\\+|-|==|=)\\b"
    },
    {
      "name": "constant",
      "match": "\\bnil\\b"
    },
    {
      "name": "string.quoted.double",
      "begin": "\"",
      "end": "\"",
      "patterns": [
        {
          "name": "constant.character.escape",
          "match": "\\\\"
        }
      ]
    },
    {
      "name": "string.quoted.single",
      "begin": "'",
      "end": "'",
      "patterns": [
        {
          "name": "constant.character.escape",
          "match": "\\\\"
        }
      ]
    },
    {
      "match": "\\b([0-9]+(.[0-9])?)\\b",
      "name": "constant.numeric"
    },
    {
      "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
      "name": "variable"
    },
    {
      "match": "(--.*)",
      "name": "comment"
    }
  ]
}
