diff --git a/index.js b/index.js index 3635612..4da1230 100644 --- a/index.js +++ b/index.js @@ -7,3 +7,7 @@ try { throw error } } + +try { + module.exports.nodeTypeInfo = require("./src/node-types.json"); +} catch (_) {} diff --git a/package.json b/package.json index 7c6faef..4114cda 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "nan": "^2.10.0" }, "devDependencies": { - "tree-sitter-cli": "^0.14.4" + "tree-sitter-cli": "^0.15.3" }, "scripts": { "build": "tree-sitter generate && node-gyp build", @@ -26,7 +26,9 @@ "tree-sitter": [ { "scope": "text.html.basic", - "file-types": ["html"], + "file-types": [ + "html" + ], "highlights": "src/highlights.json", "injection-regex": "html" } diff --git a/src/grammar.json b/src/grammar.json index 3cc5672..fb4c6ac 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -486,5 +486,7 @@ "name": "comment" } ], - "inline": [] + "inline": [], + "supertypes": [] } + diff --git a/src/node-types.json b/src/node-types.json new file mode 100644 index 0000000..2af8137 --- /dev/null +++ b/src/node-types.json @@ -0,0 +1,101 @@ +[ + { + "type": "attribute", + "named": true, + "fields": {} + }, + { + "type": "doctype", + "named": true, + "fields": {} + }, + { + "type": "element", + "named": true, + "fields": {} + }, + { + "type": "end_tag", + "named": true, + "fields": {} + }, + { + "type": "erroneous_end_tag", + "named": true, + "fields": {} + }, + { + "type": "fragment", + "named": true, + "fields": {} + }, + { + "type": "quoted_attribute_value", + "named": true, + "fields": {} + }, + { + "type": "script_element", + "named": true, + "fields": {} + }, + { + "type": "self_closing_tag", + "named": true, + "fields": {} + }, + { + "type": "start_tag", + "named": true, + "fields": {} + }, + { + "type": "style_element", + "named": true, + "fields": {} + }, + { + "type": "", + "named": false + }, + { + "type": "<", + "named": false + }, + { + "type": "/>", + "named": false + }, + { + "type": "