@konomanoasa/tree-sitter-posix-awk 0.15.0 → 0.16.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,23 @@
1
1
  [package]
2
- authors = [ "konomanoasa" ]
3
- autoexamples = false
4
- categories = [ "parser-implementations", "parsing", "text-editors" ]
5
- description = "Tree-sitter grammar for POSIX awk."
6
- edition = "2024"
7
- keywords = [ "incremental", "parsing", "tree-sitter", "posix-awk" ]
8
- license = "MIT"
9
2
  name = "tree-sitter-posix-awk"
10
- readme = "README.md"
11
- repository = "https://github.com/konomanoasa/tree-sitter-posix-awk"
12
- version = "0.15.0"
13
-
3
+ version = "0.16.0"
4
+ edition = "2024"
14
5
  build = "bindings/rust/build.rs"
15
6
  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" ]
7
+ publish = false
17
8
 
18
9
  [lib]
19
10
  path = "bindings/rust/lib.rs"
20
11
 
21
- [dependencies]
22
- tree-sitter-language = "0.1"
12
+ [[test]]
13
+ name = "bindings"
14
+ path = "test/bindings.test.rs"
23
15
 
24
- [build-dependencies]
25
- cc = "1.2"
16
+ [dependencies]
17
+ tree-sitter-language = "0.1.8"
26
18
 
27
19
  [dev-dependencies]
28
20
  tree-sitter = "0.27.0"
21
+
22
+ [build-dependencies]
23
+ cc = "1.4"
package/README.md CHANGED
@@ -1,10 +1,10 @@
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
4
  [![npm](https://img.shields.io/npm/v/@konomanoasa/tree-sitter-posix-awk)](https://www.npmjs.com/package/@konomanoasa/tree-sitter-posix-awk)
5
5
 
6
6
  [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) grammar for
7
- POSIX.1-2024 `awk`.
7
+ POSIX.1-2024 AWK.
8
8
 
9
9
  ## Installation
10
10
 
@@ -12,16 +12,25 @@ POSIX.1-2024 `awk`.
12
12
  npm install @konomanoasa/tree-sitter-posix-awk
13
13
  ```
14
14
 
15
+ ## Grammar
16
+
17
+ | Grammar | Description | Rust constant |
18
+ | --- | --- | --- |
19
+ | `posix_awk` | POSIX.1-2024 AWK | `LANGUAGE` |
20
+
15
21
  ## Development
16
22
 
23
+ Development requires Node.js 24.2.0 or later.
24
+
17
25
  ```sh
18
26
  npm install
19
- npm run parse -- script.awk
27
+ npm run build
28
+ npm test
20
29
  ```
21
30
 
22
31
  ## Specifications
23
32
 
24
- - [POSIX.1-2024 `awk`](https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/awk.html)
33
+ - [POSIX.1-2024 AWK](https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/awk.html)
25
34
  - [POSIX.1-2024 extended regular expressions](https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/basedefs/V1_chap09.html#tag_09_04)
26
35
 
27
36
  ## 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
  }