{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "cursor": {
            "type": "object",
            "properties": {
                "row": {
                    "type": "integer",
                    "minimum": 1
                },
                "col": {
                    "type": "integer",
                    "minimum": 1
                }
            },
            "required": [
                "row",
                "col"
            ]
        },
        "range": {
            "type": "object",
            "properties": {
                "start": {
                    "$ref": "#/definitions/cursor"
                },
                "end": {
                    "$ref": "#/definitions/cursor"
                }
            },
            "required": [
                "start",
                "end"
            ]
        },
        "token": {
            "type": "object",
            "properties": {
                "lexeme": {
                    "type": "string"
                },
                "row": {
                    "type": "integer",
                    "minimum": 0
                },
                "col": {
                    "type": "integer",
                    "minimum": 0
                },
                "tokenClass": {
                    "type": "string"
                },
                "parent": {
                    "type": "null"
                },
                "children": {
                    "type": "null"
                },
                "keyword": {
                    "type": "boolean"
                }
            },
            "required": [
                "lexeme",
                "row",
                "col",
                "tokenClass",
                "parent",
                "children"
            ]
        },
        "name": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "token": {
                    "$ref": "#/definitions/token"
                },
                "name_type": {
                    "type": "string",
                    "enum": [
                        "label",
                        "variable",
                        "function",
                        "typedef",
                        "enum_const",
                        "member"
                    ]
                },
                "variable_type": {
                    "type": "string"
                },
                "parameter": {
                    "type": "boolean"
                },
                "function_type": {
                    "type": "string",
                    "enum": [
                        "regular",
                        "inline"
                    ]
                },
                "function_return_type": {
                    "type": "string"
                },
                "member_type": {
                    "type": "string"
                }
            },
            "require": [
                "name",
                "token",
                "name_type"
            ]
        },
        "namespace": {
            "type": "object",
            "properties": {
                "labels": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/name"
                    }
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string"
                            },
                            "token": {
                                "$ref": "#/definitions/token"
                            },
                            "name_type": {
                                "type": "string",
                                "enum": [
                                    "structure",
                                    "union",
                                    "enum"
                                ]
                            },
                            "members": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/definitions/name"
                                }
                            }
                        }
                    }
                },
                "ordinary_ids": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/name"
                    }
                }
            }
        }
    },
    "properties": {
        "scope_name": {
            "type": "string",
            "enum": [
                "file_scope",
                "function_scope",
                "block_scope"
            ]
        },
        "range": {
            "$ref": "#/definitions/range"
        },
        "scopes": {
            "type": "array",
            "items": {
                "$ref": "#"
            }
        },
        "namespace": {
            "$ref": "#/definitions/namespace"
        }
    }
}