@konomanoasa/tree-sitter-yaml 0.1.0

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/Cargo.toml ADDED
@@ -0,0 +1,36 @@
1
+ [package]
2
+ name = "konomanoasa-tree-sitter-yaml"
3
+ version = "0.1.0"
4
+ edition = "2024"
5
+ description = "Tree-sitter grammar for YAML."
6
+ readme = "README.md"
7
+ repository = "https://github.com/konomanoasa/tree-sitter-yaml"
8
+ license = "MIT"
9
+ build = "bindings/rust/build.rs"
10
+ links = "tree-sitter-yaml"
11
+ include = [
12
+ "/LICENSE",
13
+ "/README.md",
14
+ "/bindings/rust/*.rs",
15
+ "/queries/*.scm",
16
+ "/src/*.c",
17
+ "/src/node-types.json",
18
+ "/src/tree_sitter/*.h",
19
+ "/test/bindings.test.rs",
20
+ ]
21
+
22
+ [lib]
23
+ path = "bindings/rust/lib.rs"
24
+
25
+ [[test]]
26
+ name = "bindings"
27
+ path = "test/bindings.test.rs"
28
+
29
+ [dependencies]
30
+ tree-sitter-language = "0.1.8"
31
+
32
+ [dev-dependencies]
33
+ tree-sitter = "0.27.0"
34
+
35
+ [build-dependencies]
36
+ cc = "1.4"
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 konomanoasa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # tree-sitter-yaml
2
+
3
+ [![CI](https://github.com/konomanoasa/tree-sitter-yaml/actions/workflows/ci.yaml/badge.svg)](https://github.com/konomanoasa/tree-sitter-yaml/actions/workflows/ci.yaml)
4
+ [![crates.io](https://img.shields.io/crates/v/konomanoasa-tree-sitter-yaml)](https://crates.io/crates/konomanoasa-tree-sitter-yaml)
5
+ [![npm](https://img.shields.io/npm/v/@konomanoasa/tree-sitter-yaml)](https://www.npmjs.com/package/@konomanoasa/tree-sitter-yaml)
6
+
7
+ [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for
8
+ YAML Ain't Markup Language 1.2.2.
9
+
10
+ ## Installation
11
+
12
+ ```sh
13
+ npm install @konomanoasa/tree-sitter-yaml
14
+ ```
15
+
16
+ For Rust, add this dependency to your `Cargo.toml`:
17
+
18
+ ```toml
19
+ [dependencies]
20
+ konomanoasa-tree-sitter-yaml = "0.1.0"
21
+ ```
22
+
23
+ ## Development
24
+
25
+ Development uses Node.js 24 or later.
26
+
27
+ ```sh
28
+ npm install
29
+ npm run build
30
+ npm test
31
+ ```
32
+
33
+ ## Specification
34
+
35
+ [YAML 1.2.2 Specification](https://yaml.org/spec/1.2.2/)
36
+
37
+ ## License
38
+
39
+ [MIT](LICENSE)
@@ -0,0 +1,23 @@
1
+ use std::{env, path::Path};
2
+
3
+ fn main() {
4
+ let mut build = cc::Build::new();
5
+ build.std("c17");
6
+ if build.get_compiler().is_like_msvc() {
7
+ build.flag("-utf-8");
8
+ }
9
+ if env::var("TARGET").expect("Cargo must provide TARGET")
10
+ == "wasm32-unknown-unknown"
11
+ {
12
+ let headers = env::var_os("DEP_TREE_SITTER_LANGUAGE_WASM_HEADERS")
13
+ .expect("tree-sitter-language must provide WebAssembly headers");
14
+ build.include(&headers);
15
+ println!("cargo::rerun-if-changed={}", Path::new(&headers).display());
16
+ }
17
+
18
+ println!("cargo::rerun-if-changed=src");
19
+ build
20
+ .include("src")
21
+ .files(["src/parser.c", "src/scanner.c"])
22
+ .compile("tree-sitter-yaml");
23
+ }
@@ -0,0 +1,12 @@
1
+ use tree_sitter_language::LanguageFn;
2
+
3
+ unsafe extern "C" {
4
+ fn tree_sitter_yaml() -> *const ();
5
+ }
6
+
7
+ pub const LANGUAGE: LanguageFn =
8
+ unsafe { LanguageFn::from_raw(tree_sitter_yaml) };
9
+
10
+ pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
11
+
12
+ pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");