From c5ca259d09788dd4fed37e4c312d5dcbacf99208 Mon Sep 17 00:00:00 2001 From: Steven Kalt Date: Sat, 15 Feb 2020 11:23:14 -0500 Subject: [PATCH 1/2] feat(cli): documented optional supertypes Array in grammar-schema.json --- cli/src/generate/grammar-schema.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cli/src/generate/grammar-schema.json b/cli/src/generate/grammar-schema.json index a46a433f..be7a12eb 100644 --- a/cli/src/generate/grammar-schema.json +++ b/cli/src/generate/grammar-schema.json @@ -1,4 +1,6 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "tree-sitter grammar specification", "type": "object", "required": ["name", "rules"], @@ -7,6 +9,7 @@ "properties": { "name": { + "description": "the name of the grammar", "type": "string", "pattern": "^[a-zA-Z_]\\w*" }, @@ -57,6 +60,15 @@ "word": { "type": "string", "pattern": "^[a-zA-Z_]\\w*" + }, + + "supertypes": { + "description": "each supertype instructs the parser to replace a set of subtypes in the `types` list with a single supertype.", + "type": "array", + "items": { + "description": "the name of a rule in `rules` or `extras`", + "type": "string" + } } }, From d82ee739e94db1673a761e1bf94462c85c2183bc Mon Sep 17 00:00:00 2001 From: Steven Kalt Date: Mon, 24 Feb 2020 18:13:38 -0500 Subject: [PATCH 2/2] Update cli/src/generate/grammar-schema.json Co-Authored-By: Max Brunsfeld --- cli/src/generate/grammar-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/src/generate/grammar-schema.json b/cli/src/generate/grammar-schema.json index be7a12eb..5ca35370 100644 --- a/cli/src/generate/grammar-schema.json +++ b/cli/src/generate/grammar-schema.json @@ -63,7 +63,7 @@ }, "supertypes": { - "description": "each supertype instructs the parser to replace a set of subtypes in the `types` list with a single supertype.", + "description": "A list of hidden rule names that should be considered supertypes in the generated node types file. See http://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types.", "type": "array", "items": { "description": "the name of a rule in `rules` or `extras`",