2016-01-13 16:27:30 -08:00
{
2020-02-15 11:23:14 -05:00
"$schema" : "http://json-schema.org/draft-07/schema#" ,
"title" : "tree-sitter grammar specification" ,
2016-01-13 16:27:30 -08:00
"type" : "object" ,
2020-01-12 19:40:21 -05:00
"required" : [ "name" , "rules" ] ,
2016-01-13 16:27:30 -08:00
"additionalProperties" : false ,
"properties" : {
"name" : {
2020-02-15 11:23:14 -05:00
"description" : "the name of the grammar" ,
2016-01-13 16:27:30 -08:00
"type" : "string" ,
"pattern" : "^[a-zA-Z_]\\w*"
} ,
"rules" : {
"type" : "object" ,
"patternProperties" : {
"^[a-zA-Z_]\\w*$" : {
"$ref" : "#/definitions/rule"
}
} ,
"additionalProperties" : false
} ,
"extras" : {
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/rule"
}
} ,
2024-02-07 07:10:51 -05:00
"precedences" : {
"type" : "array" ,
"items" : {
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/rule"
}
}
} ,
2017-03-17 16:41:30 -07:00
"externals" : {
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/rule"
}
} ,
2017-07-14 10:46:33 -07:00
"inline" : {
"type" : "array" ,
"items" : {
"type" : "string" ,
"pattern" : "^[a-zA-Z_]\\w*$"
}
} ,
2016-01-13 16:27:30 -08:00
"conflicts" : {
"type" : "array" ,
"items" : {
"type" : "array" ,
"items" : {
"type" : "string" ,
"pattern" : "^[a-zA-Z_]\\w*$"
}
}
2018-06-15 13:32:41 -07:00
} ,
"word" : {
"type" : "string" ,
"pattern" : "^[a-zA-Z_]\\w*"
2020-02-15 11:23:14 -05:00
} ,
"supertypes" : {
2023-03-31 21:02:32 +02:00
"description" : "A list of hidden rule names that should be considered supertypes in the generated node types file. See https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types." ,
2020-02-15 11:23:14 -05:00
"type" : "array" ,
"items" : {
"description" : "the name of a rule in `rules` or `extras`" ,
"type" : "string"
}
2016-01-13 16:27:30 -08:00
}
} ,
"definitions" : {
"blank-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^BLANK$"
}
} ,
"required" : [ "type" ]
} ,
"string-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^STRING$"
} ,
"value" : {
"type" : "string"
}
} ,
"required" : [ "type" , "value" ]
} ,
"pattern-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^PATTERN$"
} ,
2020-01-12 19:40:21 -05:00
"value" : { "type" : "string" }
2016-01-13 16:27:30 -08:00
} ,
"required" : [ "type" , "value" ]
} ,
"symbol-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^SYMBOL$"
} ,
2020-01-12 19:40:21 -05:00
"name" : { "type" : "string" }
2016-01-13 16:27:30 -08:00
} ,
"required" : [ "type" , "name" ]
} ,
"seq-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^SEQ$"
} ,
"members" : {
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/rule"
}
}
} ,
"required" : [ "type" , "members" ]
} ,
"choice-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^CHOICE$"
} ,
"members" : {
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/rule"
}
}
} ,
"required" : [ "type" , "members" ]
} ,
2017-07-31 11:45:24 -07:00
"alias-rule" : {
2017-07-13 17:17:22 -07:00
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
2017-07-31 11:45:24 -07:00
"pattern" : "^ALIAS$"
2017-07-13 17:17:22 -07:00
} ,
"value" : {
"type" : "string"
} ,
2017-07-31 11:45:24 -07:00
"named" : {
"type" : "boolean"
} ,
2017-07-13 17:17:22 -07:00
"content" : {
"$ref" : "#/definitions/rule"
}
} ,
2017-07-31 11:45:24 -07:00
"required" : [ "type" , "named" , "content" , "value" ]
2017-07-13 17:17:22 -07:00
} ,
2016-01-13 16:27:30 -08:00
"repeat-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^REPEAT$"
} ,
"content" : {
"$ref" : "#/definitions/rule"
}
} ,
"required" : [ "type" , "content" ]
} ,
"repeat1-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
"pattern" : "^REPEAT1$"
} ,
"content" : {
"$ref" : "#/definitions/rule"
}
} ,
"required" : [ "type" , "content" ]
} ,
"token-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
2018-08-01 14:00:57 -07:00
"pattern" : "^(TOKEN|IMMEDIATE_TOKEN)$"
2016-01-13 16:27:30 -08:00
} ,
"content" : {
"$ref" : "#/definitions/rule"
}
} ,
"required" : [ "type" , "content" ]
} ,
2020-01-12 19:40:21 -05:00
"field-rule" : {
"properties" : {
"name" : { "type" : "string" } ,
"type" : {
"type" : "string" ,
"pattern" : "^FIELD$"
} ,
"content" : {
"$ref" : "#/definitions/rule"
}
} ,
"required" : [ "name" , "type" , "content" ]
} ,
2016-01-13 16:27:30 -08:00
"prec-rule" : {
"type" : "object" ,
"properties" : {
"type" : {
"type" : "string" ,
2017-07-06 15:51:03 -07:00
"pattern" : "^(PREC|PREC_LEFT|PREC_RIGHT|PREC_DYNAMIC)$"
2016-01-13 16:27:30 -08:00
} ,
"value" : {
2024-02-07 07:10:51 -05:00
"oneof" : [
{ "type" : "integer" } ,
{ "type" : "string" }
]
2016-01-13 16:27:30 -08:00
} ,
"content" : {
"$ref" : "#/definitions/rule"
}
} ,
"required" : [ "type" , "content" , "value" ]
} ,
"rule" : {
"oneOf" : [
2017-07-31 11:45:24 -07:00
{ "$ref" : "#/definitions/alias-rule" } ,
2016-01-13 16:27:30 -08:00
{ "$ref" : "#/definitions/blank-rule" } ,
{ "$ref" : "#/definitions/string-rule" } ,
{ "$ref" : "#/definitions/pattern-rule" } ,
{ "$ref" : "#/definitions/symbol-rule" } ,
{ "$ref" : "#/definitions/seq-rule" } ,
{ "$ref" : "#/definitions/choice-rule" } ,
{ "$ref" : "#/definitions/repeat1-rule" } ,
{ "$ref" : "#/definitions/repeat-rule" } ,
{ "$ref" : "#/definitions/token-rule" } ,
2020-01-12 19:40:21 -05:00
{ "$ref" : "#/definitions/field-rule" } ,
2017-07-06 15:51:03 -07:00
{ "$ref" : "#/definitions/prec-rule" }
2016-01-13 16:27:30 -08:00
]
}
}
}