@willbooster/tree-sitter-html 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,13 +10,17 @@ HTML grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), fork
10
10
  [tree-sitter/tree-sitter-html](https://github.com/tree-sitter/tree-sitter-html). We are grateful
11
11
  to its authors and contributors. This is not an official release of that project.
12
12
 
13
- This fork keeps the grammar and the external scanner of upstream's version 0.23.2 and generates the parser with the
13
+ This fork is based on upstream's version 0.23.2 grammar and external scanner and generates the parser with the
14
14
  [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI
15
15
  number, so it loads only with the WillBooster runtime, version 2.0.0 or later
16
16
  ([willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter),
17
17
  [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter)); upstream's runtime rejects
18
18
  it. Input that contains NUL characters can parse to a different tree than with upstream's 0.23.2 parser, because the
19
- lexers that generator emits treat a NUL character as an ordinary character; other input parses to the same tree.
19
+ lexers that generator emits treat a NUL character as an ordinary character. This grammar also accepts literal `>`
20
+ characters in text nodes, which upstream 0.23.2 rejects. Its scanner requires an HTML tag-name boundary after
21
+ `</script` and `</style`, so longer names and overlapping prefixes remain raw text. Closing-name comparisons
22
+ fold only ASCII letters, and embedded NUL characters remain part of raw-text content. Incomplete elements
23
+ retain their existing recovery behavior.
20
24
 
21
25
  ## Usage
22
26
 
package/grammar.js CHANGED
@@ -126,9 +126,7 @@ module.exports = grammar({
126
126
 
127
127
  attribute_value: _ => /[^<>"'=\s]+/,
128
128
 
129
- // An entity can be named, numeric (decimal), or numeric (hexacecimal). The
130
- // longest entity name is 29 characters long, and the HTML spec says that
131
- // no more will ever be added.
129
+ // HTML fixes the named-reference set: https://html.spec.whatwg.org/multipage/named-characters.html
132
130
  entity: _ => /&(#([xX][0-9a-fA-F]{1,6}|[0-9]{1,5})|[A-Za-z]{1,30});?/,
133
131
 
134
132
  quoted_attribute_value: $ => choice(
@@ -136,6 +134,6 @@ module.exports = grammar({
136
134
  seq('"', optional(alias(/[^"]+/, $.attribute_value)), '"'),
137
135
  ),
138
136
 
139
- text: _ => /[^<>&\s]([^<>&]*[^<>&\s])?/,
137
+ text: _ => /[^<&\s]([^<&]*[^<&\s])?/,
140
138
  },
141
139
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-html",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "HTML grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -18,7 +18,7 @@
18
18
  }
19
19
  ],
20
20
  "metadata": {
21
- "version": "1.0.0",
21
+ "version": "1.0.2",
22
22
  "license": "MIT",
23
23
  "description": "HTML grammar for tree-sitter",
24
24
  "authors": [