fix: don't add extraneous exports to the json and add missing rules to the schema
This commit is contained in:
parent
f349be529a
commit
993ee75d8c
2 changed files with 16 additions and 3 deletions
|
|
@ -385,7 +385,7 @@ function grammar(baseGrammar, options) {
|
|||
throw new Error("Grammar must have at least one rule.");
|
||||
}
|
||||
|
||||
return { name, word, rules, extras, conflicts, precedences, externals, inline, supertypes };
|
||||
return { grammar: { name, word, rules, extras, conflicts, precedences, externals, inline, supertypes } };
|
||||
}
|
||||
|
||||
function checkArguments(ruleCount, caller, callerName, suffix = '') {
|
||||
|
|
@ -419,4 +419,4 @@ global.grammar = grammar;
|
|||
global.field = field;
|
||||
|
||||
const result = require(process.env.TREE_SITTER_GRAMMAR_PATH);
|
||||
process.stdout.write(JSON.stringify(result, null, null));
|
||||
process.stdout.write(JSON.stringify(result.grammar, null, null));
|
||||
|
|
|
|||
|
|
@ -31,6 +31,16 @@
|
|||
}
|
||||
},
|
||||
|
||||
"precedences": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/rule"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"externals": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
@ -240,7 +250,10 @@
|
|||
"pattern": "^(PREC|PREC_LEFT|PREC_RIGHT|PREC_DYNAMIC)$"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer"
|
||||
"oneof": [
|
||||
{ "type": "integer" },
|
||||
{ "type": "string" }
|
||||
]
|
||||
},
|
||||
"content": {
|
||||
"$ref": "#/definitions/rule"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue