tree-sitter-html
Advanced tools
Comparing version 0.19.0 to 0.20.0
try { | ||
module.exports = require("../../build/Release/tree_sitter_html_binding"); | ||
module.exports = require('../../build/Release/tree_sitter_html_binding'); | ||
} catch (error1) { | ||
@@ -8,3 +8,3 @@ if (error1.code !== 'MODULE_NOT_FOUND') { | ||
try { | ||
module.exports = require("../../build/Debug/tree_sitter_html_binding"); | ||
module.exports = require('../../build/Debug/tree_sitter_html_binding'); | ||
} catch (error2) { | ||
@@ -14,3 +14,3 @@ if (error2.code !== 'MODULE_NOT_FOUND') { | ||
} | ||
throw error1 | ||
throw error1; | ||
} | ||
@@ -20,3 +20,3 @@ } | ||
try { | ||
module.exports.nodeTypeInfo = require("../../src/node-types.json"); | ||
module.exports.nodeTypeInfo = require('../../src/node-types.json'); | ||
} catch (_) {} |
@@ -0,1 +1,13 @@ | ||
/** | ||
* @file HTML grammar for tree-sitter | ||
* @author Max Brunsfeld | ||
* @license MIT | ||
*/ | ||
/* eslint-disable arrow-parens */ | ||
/* eslint-disable camelcase */ | ||
/* eslint-disable-next-line spaced-comment */ | ||
/// <reference types="tree-sitter-cli/dsl" /> | ||
// @ts-check | ||
module.exports = grammar({ | ||
@@ -28,9 +40,10 @@ name: 'html', | ||
/[^>]+/, | ||
'>' | ||
'>', | ||
), | ||
_doctype: $ => /[Dd][Oo][Cc][Tt][Yy][Pp][Ee]/, | ||
_doctype: _ => /[Dd][Oo][Cc][Tt][Yy][Pp][Ee]/, | ||
_node: $ => choice( | ||
$.doctype, | ||
$.entity, | ||
$.text, | ||
@@ -40,3 +53,3 @@ $.element, | ||
$.style_element, | ||
$.erroneous_end_tag | ||
$.erroneous_end_tag, | ||
), | ||
@@ -48,5 +61,5 @@ | ||
repeat($._node), | ||
choice($.end_tag, $._implicit_end_tag) | ||
choice($.end_tag, $._implicit_end_tag), | ||
), | ||
$.self_closing_tag | ||
$.self_closing_tag, | ||
), | ||
@@ -57,3 +70,3 @@ | ||
optional($.raw_text), | ||
$.end_tag | ||
$.end_tag, | ||
), | ||
@@ -64,3 +77,3 @@ | ||
optional($.raw_text), | ||
$.end_tag | ||
$.end_tag, | ||
), | ||
@@ -72,3 +85,3 @@ | ||
repeat($.attribute), | ||
'>' | ||
'>', | ||
), | ||
@@ -80,3 +93,3 @@ | ||
repeat($.attribute), | ||
'>' | ||
'>', | ||
), | ||
@@ -88,3 +101,3 @@ | ||
repeat($.attribute), | ||
'>' | ||
'>', | ||
), | ||
@@ -96,3 +109,3 @@ | ||
repeat($.attribute), | ||
'/>' | ||
'/>', | ||
), | ||
@@ -103,3 +116,3 @@ | ||
alias($._end_tag_name, $.tag_name), | ||
'>' | ||
'>', | ||
), | ||
@@ -110,3 +123,3 @@ | ||
$.erroneous_end_tag_name, | ||
'>' | ||
'>', | ||
), | ||
@@ -120,18 +133,23 @@ | ||
$.attribute_value, | ||
$.quoted_attribute_value | ||
) | ||
)) | ||
$.quoted_attribute_value, | ||
), | ||
)), | ||
), | ||
attribute_name: $ => /[^<>"'/=\s]+/, | ||
attribute_name: _ => /[^<>"'/=\s]+/, | ||
attribute_value: $ => /[^<>"'=\s]+/, | ||
attribute_value: _ => /[^<>"'=\s]+/, | ||
// An entity can be named, numeric (decimal), or numeric (hexacecimal). The | ||
// longest entity name is 29 characters long, and the HTML spec says that | ||
// no more will ever be added. | ||
entity: _ => /&(#([xX][0-9a-fA-F]{1,6}|[0-9]{1,5})|[A-Za-z]{1,30});/, | ||
quoted_attribute_value: $ => choice( | ||
seq("'", optional(alias(/[^']+/, $.attribute_value)), "'"), | ||
seq('"', optional(alias(/[^"]+/, $.attribute_value)), '"') | ||
seq('\'', optional(alias(/[^']+/, $.attribute_value)), '\''), | ||
seq('"', optional(alias(/[^"]+/, $.attribute_value)), '"'), | ||
), | ||
text: $ => /[^<>]+/ | ||
} | ||
text: _ => /[^<>&\s]([^<>&]*[^<>&\s])?/, | ||
}, | ||
}); |
{ | ||
"name": "tree-sitter-html", | ||
"version": "0.19.0", | ||
"version": "0.20.0", | ||
"description": "HTML grammar for tree-sitter", | ||
@@ -10,14 +10,27 @@ "main": "bindings/node", | ||
], | ||
"homepage": "https://github.com/tree-sitter/tree-sitter-html", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tree-sitter/tree-sitter-html.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/tree-sitter/tree-sitter-html/issues" | ||
}, | ||
"authors": [ | ||
"Max Brunsfeld <maxbrunsfeld@gmail.com>", | ||
"Ashi Krishnan <queerviolet@github.com>" | ||
"Ashi Krishnan <queerviolet@github.com>", | ||
"Amaan Qureshi <amaanq12@gmail.com>" | ||
], | ||
"license": "MIT", | ||
"dependencies": { | ||
"nan": "^2.14.0" | ||
"nan": "^2.18.0" | ||
}, | ||
"devDependencies": { | ||
"tree-sitter-cli": "^0.19.1" | ||
"eslint": "^8.50.0", | ||
"eslint-config-google": "^0.14.0", | ||
"tree-sitter-cli": "^0.20.8" | ||
}, | ||
"scripts": { | ||
"build": "tree-sitter generate && node-gyp build", | ||
"lint": "eslint grammar.js", | ||
"test": "tree-sitter test && tree-sitter parse examples/*.html --quiet --time", | ||
@@ -32,5 +45,11 @@ "test-windows": "tree-sitter test" | ||
], | ||
"injection-regex": "html" | ||
"injection-regex": "html", | ||
"highlights": [ | ||
"queries/highlights.scm" | ||
], | ||
"injections": [ | ||
"queries/injections.scm" | ||
] | ||
} | ||
] | ||
} |
@@ -1,13 +0,9 @@ | ||
tree-sitter-html | ||
================ | ||
# tree-sitter-html | ||
[![Build Status](https://travis-ci.org/tree-sitter/tree-sitter-html.svg?branch=master)](https://travis-ci.org/tree-sitter/tree-sitter-html) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/bv1i8f3yi2aoyonx/branch/master?svg=true)](https://ci.appveyor.com/project/maxbrunsfeld/tree-sitter-html/branch/master) | ||
[![build](https://github.com/tree-sitter/tree-sitter-html/actions/workflows/ci.yml/badge.svg)](https://github.com/tree-sitter/tree-sitter-html/actions/workflows/ci.yml) | ||
HTML grammar for [tree-sitter][]. | ||
HTML grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). | ||
[tree-sitter]: https://github.com/tree-sitter/tree-sitter | ||
References | ||
* [The HTML5 Spec](https://www.w3.org/TR/html5/syntax.html) |
@@ -50,2 +50,6 @@ { | ||
"type": "SYMBOL", | ||
"name": "entity" | ||
}, | ||
{ | ||
"type": "SYMBOL", | ||
"name": "text" | ||
@@ -371,2 +375,6 @@ }, | ||
}, | ||
"entity": { | ||
"type": "PATTERN", | ||
"value": "&(#([xX][0-9a-fA-F]{1,6}|[0-9]{1,5})|[A-Za-z]{1,30});" | ||
}, | ||
"quoted_attribute_value": { | ||
@@ -439,3 +447,3 @@ "type": "CHOICE", | ||
"type": "PATTERN", | ||
"value": "[^<>]+" | ||
"value": "[^<>&\\s]([^<>&]*[^<>&\\s])?" | ||
} | ||
@@ -442,0 +450,0 @@ }, |
@@ -51,2 +51,6 @@ [ | ||
{ | ||
"type": "entity", | ||
"named": true | ||
}, | ||
{ | ||
"type": "erroneous_end_tag", | ||
@@ -125,2 +129,6 @@ "named": true | ||
{ | ||
"type": "entity", | ||
"named": true | ||
}, | ||
{ | ||
"type": "erroneous_end_tag", | ||
@@ -292,2 +300,6 @@ "named": true | ||
{ | ||
"type": "entity", | ||
"named": true | ||
}, | ||
{ | ||
"type": "erroneous_end_tag_name", | ||
@@ -294,0 +306,0 @@ "named": true |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
135382
36
974
1
1
0
3
10
Updatednan@^2.18.0