@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 +6 -2
- package/grammar.js +2 -4
- package/package.json +1 -1
- package/tree-sitter-html.wasm +0 -0
- package/tree-sitter.json +1 -1
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
|
|
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
|
|
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
|
-
//
|
|
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: _ => /[
|
|
137
|
+
text: _ => /[^<&\s]([^<&]*[^<&\s])?/,
|
|
140
138
|
},
|
|
141
139
|
});
|
package/package.json
CHANGED
package/tree-sitter-html.wasm
CHANGED
|
Binary file
|