Skip to content

Commit b2faf8a

Browse files
committed
chore: tidy up for release
1 parent 94085df commit b2faf8a

File tree

8 files changed

+76
-33
lines changed

8 files changed

+76
-33
lines changed

Cargo.toml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
[package]
22
name = "tree-sitter-html"
3-
description = "html grammar for the tree-sitter parsing library"
3+
description = "HTML grammar for tree-sitter"
44
version = "0.19.0"
5+
authors = [
6+
"Max Brunsfeld <[email protected]>",
7+
"Amaan Qureshi <[email protected]>",
8+
]
9+
license = "MIT"
10+
readme = "bindings/rust/README.md"
511
keywords = ["incremental", "parsing", "html"]
612
categories = ["parsing", "text-editors"]
713
repository = "https://github.com/tree-sitter/tree-sitter-html"
8-
edition = "2018"
14+
edition = "2021"
15+
autoexamples = false
916

1017
build = "bindings/rust/build.rs"
11-
include = [
12-
"bindings/rust/*",
13-
"grammar.js",
14-
"queries/*",
15-
"src/*",
16-
]
18+
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
1719

1820
[lib]
1921
path = "bindings/rust/lib.rs"
2022

2123
[dependencies]
22-
tree-sitter = "0.19"
24+
tree-sitter = "~0.20.10"
2325

2426
[build-dependencies]
25-
cc = "1.0"
27+
cc = "~1.0.83"

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
tree-sitter-html
2-
================
1+
# tree-sitter-html
32

4-
[![Build Status](https://travis-ci.org/tree-sitter/tree-sitter-html.svg?branch=master)](https://travis-ci.org/tree-sitter/tree-sitter-html)
5-
[![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)
3+
[![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)
64

7-
HTML grammar for [tree-sitter][].
8-
9-
[tree-sitter]: https://github.com/tree-sitter/tree-sitter
5+
HTML grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
106

117
References
128

bindings/node/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
try {
2-
module.exports = require("../../build/Release/tree_sitter_html_binding");
2+
module.exports = require('../../build/Release/tree_sitter_html_binding');
33
} catch (error1) {
44
if (error1.code !== 'MODULE_NOT_FOUND') {
55
throw error1;
66
}
77
try {
8-
module.exports = require("../../build/Debug/tree_sitter_html_binding");
8+
module.exports = require('../../build/Debug/tree_sitter_html_binding');
99
} catch (error2) {
1010
if (error2.code !== 'MODULE_NOT_FOUND') {
1111
throw error2;
1212
}
13-
throw error1
13+
throw error1;
1414
}
1515
}
1616

1717
try {
18-
module.exports.nodeTypeInfo = require("../../src/node-types.json");
18+
module.exports.nodeTypeInfo = require('../../src/node-types.json');
1919
} catch (_) {}

bindings/rust/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# tree-sitter-html
2+
3+
This crate provides a HTML grammar for the [tree-sitter][] parsing library.
4+
To use this crate, add it to the `[dependencies]` section of your `Cargo.toml`
5+
file. (Note that you will probably also need to depend on the
6+
[`tree-sitter`][tree-sitter crate] crate to use the parsed result in any useful
7+
way.)
8+
9+
```toml
10+
[dependencies]
11+
tree-sitter = "0.20.10"
12+
tree-sitter-html = "0.19.0"
13+
```
14+
15+
Typically, you will use the [language][language func] function to add this
16+
grammar to a tree-sitter [Parser][], and then use the parser to parse some code:
17+
18+
```rust
19+
let code = r#"
20+
def double(x):
21+
return x * 2
22+
"#;
23+
let mut parser = Parser::new();
24+
parser.set_language(tree_sitter_html::language()).expect("Error loading HTML grammar");
25+
let parsed = parser.parse(code, None);
26+
```
27+
28+
If you have any questions, please reach out to us in the [tree-sitter
29+
discussions] page.
30+
31+
[language func]: https://docs.rs/tree-sitter-html/*/tree_sitter_html/fn.language.html
32+
[Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
33+
[tree-sitter]: https://tree-sitter.github.io/
34+
[tree-sitter crate]: https://crates.io/crates/tree-sitter
35+
[tree-sitter discussions]: https://github.com/tree-sitter/tree-sitter/discussions

bindings/rust/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
//! This crate provides html language support for the [tree-sitter][] parsing library.
1+
//! This crate provides HTML language support for the [tree-sitter][] parsing library.
22
//!
33
//! Typically, you will use the [language][language func] function to add this language to a
44
//! tree-sitter [Parser][], and then use the parser to parse some code:
55
//!
66
//! ```
77
//! let code = "";
88
//! let mut parser = tree_sitter::Parser::new();
9-
//! parser.set_language(tree_sitter_html::language()).expect("Error loading html grammar");
9+
//! parser.set_language(tree_sitter_html::language()).expect("Error loading HTML grammar");
1010
//! let tree = parser.parse(code, None).unwrap();
1111
//! ```
1212
//!
@@ -31,12 +31,10 @@ pub fn language() -> Language {
3131
/// The content of the [`node-types.json`][] file for this grammar.
3232
///
3333
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
34-
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
34+
pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
3535

36-
// Uncomment these to include any queries that this grammar contains
37-
38-
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
39-
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
36+
pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
37+
pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
4038
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
4139
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
4240

@@ -47,6 +45,6 @@ mod tests {
4745
let mut parser = tree_sitter::Parser::new();
4846
parser
4947
.set_language(super::language())
50-
.expect("Error loading html language");
48+
.expect("Error loading HTML grammar");
5149
}
5250
}

package.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,25 @@
77
"parser",
88
"lexer"
99
],
10+
"homepage": "https://github.com/tree-sitter/tree-sitter-html",
1011
"repository": {
1112
"type": "git",
1213
"url": "https://github.com/tree-sitter/tree-sitter-html.git"
1314
},
15+
"bugs": {
16+
"url": "https://github.com/tree-sitter/tree-sitter-html/issues"
17+
},
1418
"authors": [
1519
"Max Brunsfeld <[email protected]>",
16-
"Ashi Krishnan <[email protected]>"
20+
"Ashi Krishnan <[email protected]>",
21+
"Amaan Qureshi <[email protected]>"
1722
],
1823
"license": "MIT",
1924
"dependencies": {
20-
"nan": "^2.14.0"
25+
"nan": "^2.18.0"
2126
},
2227
"devDependencies": {
23-
"eslint": "^8.43.0",
28+
"eslint": "^8.50.0",
2429
"eslint-config-google": "^0.14.0",
2530
"tree-sitter-cli": "^0.20.8"
2631
},
@@ -36,7 +41,13 @@
3641
"file-types": [
3742
"html"
3843
],
39-
"injection-regex": "html"
44+
"injection-regex": "html",
45+
"highlights": [
46+
"queries/highlights.scm"
47+
],
48+
"injections": [
49+
"queries/injections.scm"
50+
]
4051
}
4152
]
4253
}

src/scanner.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "tag.h"
2+
23
#include <wctype.h>
34

45
enum TokenType {
File renamed without changes.

0 commit comments

Comments
 (0)