@konomanoasa/tree-sitter-posix-awk 0.15.0 → 0.17.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 CHANGED
@@ -1,28 +1,36 @@
1
1
  [package]
2
- authors = [ "konomanoasa" ]
3
- autoexamples = false
4
- categories = [ "parser-implementations", "parsing", "text-editors" ]
5
- description = "Tree-sitter grammar for POSIX awk."
2
+ name = "konomanoasa-tree-sitter-posix-awk"
3
+ version = "0.17.0"
6
4
  edition = "2024"
7
- keywords = [ "incremental", "parsing", "tree-sitter", "posix-awk" ]
8
- license = "MIT"
9
- name = "tree-sitter-posix-awk"
5
+ description = "Tree-sitter grammar for POSIX awk."
10
6
  readme = "README.md"
11
7
  repository = "https://github.com/konomanoasa/tree-sitter-posix-awk"
12
- version = "0.15.0"
13
-
8
+ license = "MIT"
14
9
  build = "bindings/rust/build.rs"
15
10
  links = "tree-sitter-posix-awk"
16
- include = [ "/bindings/rust/*.rs", "/grammar.js", "/queries/*.scm", "/src/*.c", "/src/*.json", "/src/tree_sitter/*.h", "/tree-sitter.json", "/LICENSE", "/README.md" ]
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
+ ]
17
21
 
18
22
  [lib]
19
23
  path = "bindings/rust/lib.rs"
20
24
 
21
- [dependencies]
22
- tree-sitter-language = "0.1"
25
+ [[test]]
26
+ name = "bindings"
27
+ path = "test/bindings.test.rs"
23
28
 
24
- [build-dependencies]
25
- cc = "1.2"
29
+ [dependencies]
30
+ tree-sitter-language = "0.1.8"
26
31
 
27
32
  [dev-dependencies]
28
33
  tree-sitter = "0.27.0"
34
+
35
+ [build-dependencies]
36
+ cc = "1.4"
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # tree-sitter-posix-awk
2
2
 
3
- [![CI](https://github.com/konomanoasa/tree-sitter-posix-awk/actions/workflows/ci.yml/badge.svg)](https://github.com/konomanoasa/tree-sitter-posix-awk/actions/workflows/ci.yml)
3
+ [![CI](https://github.com/konomanoasa/tree-sitter-posix-awk/actions/workflows/ci.yaml/badge.svg)](https://github.com/konomanoasa/tree-sitter-posix-awk/actions/workflows/ci.yaml)
4
+ [![crates.io](https://img.shields.io/crates/v/konomanoasa-tree-sitter-posix-awk)](https://crates.io/crates/konomanoasa-tree-sitter-posix-awk)
4
5
  [![npm](https://img.shields.io/npm/v/@konomanoasa/tree-sitter-posix-awk)](https://www.npmjs.com/package/@konomanoasa/tree-sitter-posix-awk)
5
6
 
6
7
  [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for
7
- POSIX.1-2024 `awk`.
8
+ POSIX.1-2024 AWK.
8
9
 
9
10
  ## Installation
10
11
 
@@ -14,14 +15,17 @@ npm install @konomanoasa/tree-sitter-posix-awk
14
15
 
15
16
  ## Development
16
17
 
18
+ Development uses Node.js 24 or later.
19
+
17
20
  ```sh
18
21
  npm install
19
- npm run parse -- script.awk
22
+ npm run build
23
+ npm test
20
24
  ```
21
25
 
22
26
  ## Specifications
23
27
 
24
- - [POSIX.1-2024 `awk`](https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/awk.html)
28
+ - [POSIX.1-2024 AWK](https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/awk.html)
25
29
  - [POSIX.1-2024 extended regular expressions](https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/basedefs/V1_chap09.html#tag_09_04)
26
30
 
27
31
  ## License
@@ -1,53 +1,23 @@
1
- fn main() {
2
- let src_dir = std::path::Path::new("src");
3
-
4
- let mut c_config = cc::Build::new();
5
- c_config.std("c17").include(src_dir);
1
+ use std::{env, path::Path};
6
2
 
7
- if c_config.get_compiler().is_like_msvc() {
8
- c_config.flag("-utf-8");
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");
9
8
  }
10
-
11
- if std::env::var("TARGET").unwrap() == "wasm32-unknown-unknown" {
12
- let Ok(wasm_headers) =
13
- std::env::var("DEP_TREE_SITTER_LANGUAGE_WASM_HEADERS")
14
- else {
15
- panic!(
16
- "Environment variable DEP_TREE_SITTER_LANGUAGE_WASM_HEADERS must be set by the language crate"
17
- );
18
- };
19
-
20
- c_config.include(&wasm_headers);
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());
21
16
  }
22
17
 
23
- let parser_path = src_dir.join("parser.c");
24
- c_config.file(&parser_path);
25
- println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
26
-
27
- let scanner_path = src_dir.join("scanner.c");
28
- if scanner_path.exists() {
29
- c_config.file(&scanner_path);
30
- println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
31
- }
32
- println!("cargo:rerun-if-changed=src/tree_sitter");
33
- println!("cargo:rerun-if-changed=queries");
34
-
35
- c_config.compile("tree-sitter-posix-awk");
36
-
37
- println!("cargo:rustc-check-cfg=cfg(with_highlights_query)");
38
- if std::path::Path::new("queries/highlights.scm").exists() {
39
- println!("cargo:rustc-cfg=with_highlights_query");
40
- }
41
- println!("cargo:rustc-check-cfg=cfg(with_injections_query)");
42
- if std::path::Path::new("queries/injections.scm").exists() {
43
- println!("cargo:rustc-cfg=with_injections_query");
44
- }
45
- println!("cargo:rustc-check-cfg=cfg(with_locals_query)");
46
- if std::path::Path::new("queries/locals.scm").exists() {
47
- println!("cargo:rustc-cfg=with_locals_query");
48
- }
49
- println!("cargo:rustc-check-cfg=cfg(with_tags_query)");
50
- if std::path::Path::new("queries/tags.scm").exists() {
51
- println!("cargo:rustc-cfg=with_tags_query");
52
- }
18
+ println!("cargo::rerun-if-changed=src");
19
+ build
20
+ .include("src")
21
+ .files(["src/parser.c", "src/scanner.c"])
22
+ .compile("tree-sitter-posix-awk");
53
23
  }