Skip to content

Commit

Permalink
chore: tidy up for release
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Oct 3, 2023
1 parent 420558a commit 74dbaff
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 33 deletions.
22 changes: 12 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
[package]
name = "tree-sitter-html"
description = "html grammar for the tree-sitter parsing library"
description = "HTML grammar for tree-sitter"
version = "0.19.0"
authors = [
"Max Brunsfeld <maxbrunsfeld@gmail.com>",
"Amaan Qureshi <amaanq12@gmail.com>",
]
license = "MIT"
readme = "bindings/rust/README.md"
keywords = ["incremental", "parsing", "html"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-html"
edition = "2018"
edition = "2021"
autoexamples = false

build = "bindings/rust/build.rs"
include = [
"bindings/rust/*",
"grammar.js",
"queries/*",
"src/*",
]
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]

[lib]
path = "bindings/rust/lib.rs"

[dependencies]
tree-sitter = "0.19"
tree-sitter = "~0.20.10"

[build-dependencies]
cc = "1.0"
cc = "~1.0.83"
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
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][].

[tree-sitter]: https://github.com/tree-sitter/tree-sitter
HTML grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).

References

Expand Down
8 changes: 4 additions & 4 deletions bindings/node/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
try {
module.exports = require("../../build/Release/tree_sitter_html_binding");
module.exports = require('../../build/Release/tree_sitter_html_binding');
} catch (error1) {
if (error1.code !== 'MODULE_NOT_FOUND') {
throw error1;
}
try {
module.exports = require("../../build/Debug/tree_sitter_html_binding");
module.exports = require('../../build/Debug/tree_sitter_html_binding');
} catch (error2) {
if (error2.code !== 'MODULE_NOT_FOUND') {
throw error2;
}
throw error1
throw error1;
}
}

try {
module.exports.nodeTypeInfo = require("../../src/node-types.json");
module.exports.nodeTypeInfo = require('../../src/node-types.json');
} catch (_) {}
35 changes: 35 additions & 0 deletions bindings/rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# tree-sitter-html

This crate provides a HTML grammar for the [tree-sitter][] parsing library.
To use this crate, add it to the `[dependencies]` section of your `Cargo.toml`
file. (Note that you will probably also need to depend on the
[`tree-sitter`][tree-sitter crate] crate to use the parsed result in any useful
way.)

```toml
[dependencies]
tree-sitter = "0.20.10"
tree-sitter-html = "0.19.0"
```

Typically, you will use the [language][language func] function to add this
grammar to a tree-sitter [Parser][], and then use the parser to parse some code:

```rust
let code = r#"
def double(x):
return x * 2
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_html::language()).expect("Error loading HTML grammar");
let parsed = parser.parse(code, None);
```

If you have any questions, please reach out to us in the [tree-sitter
discussions] page.

[language func]: https://docs.rs/tree-sitter-html/*/tree_sitter_html/fn.language.html
[Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
[tree-sitter]: https://tree-sitter.github.io/
[tree-sitter crate]: https://crates.io/crates/tree-sitter
[tree-sitter discussions]: https://github.com/tree-sitter/tree-sitter/discussions
14 changes: 6 additions & 8 deletions bindings/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! This crate provides html language support for the [tree-sitter][] parsing library.
//! This crate provides HTML language support for the [tree-sitter][] parsing library.
//!
//! Typically, you will use the [language][language func] function to add this language to a
//! tree-sitter [Parser][], and then use the parser to parse some code:
//!
//! ```
//! let code = "";
//! let mut parser = tree_sitter::Parser::new();
//! parser.set_language(tree_sitter_html::language()).expect("Error loading html grammar");
//! parser.set_language(tree_sitter_html::language()).expect("Error loading HTML grammar");
//! let tree = parser.parse(code, None).unwrap();
//! ```
//!
Expand All @@ -31,12 +31,10 @@ pub fn language() -> Language {
/// The content of the [`node-types.json`][] file for this grammar.
///
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");

// Uncomment these to include any queries that this grammar contains

// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");

Expand All @@ -47,6 +45,6 @@ mod tests {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(super::language())
.expect("Error loading html language");
.expect("Error loading HTML grammar");
}
}
19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@
"parser",
"lexer"
],
"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": {
"eslint": "^8.43.0",
"eslint": "^8.50.0",
"eslint-config-google": "^0.14.0",
"tree-sitter-cli": "^0.20.8"
},
Expand All @@ -36,7 +41,13 @@
"file-types": [
"html"
],
"injection-regex": "html"
"injection-regex": "html",
"highlights": [
"queries/highlights.scm"
],
"injections": [
"queries/injections.scm"
]
}
]
}
1 change: 1 addition & 0 deletions src/scanner.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "tag.h"

#include <wctype.h>

enum TokenType {
Expand Down
File renamed without changes.

0 comments on commit 74dbaff

Please sign in to comment.