@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 +11 -16
- package/README.md +13 -4
- package/bindings/rust/build.rs +18 -48
- package/bindings/rust/lib.rs +0 -708
- package/grammar.js +166 -125
- package/package.json +8 -6
- package/queries/highlights.scm +0 -24
- package/src/grammar.json +428 -59
- package/src/node-types.json +2 -1
- package/src/parser.c +91670 -89081
- package/src/scanner.c +125 -295
- package/test/bindings.test.rs +983 -0
- package/tree-sitter.json +1 -6
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
7
|
+
publish = false
|
|
17
8
|
|
|
18
9
|
[lib]
|
|
19
10
|
path = "bindings/rust/lib.rs"
|
|
20
11
|
|
|
21
|
-
[
|
|
22
|
-
|
|
12
|
+
[[test]]
|
|
13
|
+
name = "bindings"
|
|
14
|
+
path = "test/bindings.test.rs"
|
|
23
15
|
|
|
24
|
-
[
|
|
25
|
-
|
|
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
|
-
[](https://github.com/konomanoasa/tree-sitter-posix-awk/actions/workflows/ci.yaml)
|
|
4
4
|
[](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
|
|
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
|
|
27
|
+
npm run build
|
|
28
|
+
npm test
|
|
20
29
|
```
|
|
21
30
|
|
|
22
31
|
## Specifications
|
|
23
32
|
|
|
24
|
-
- [POSIX.1-2024
|
|
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
|
package/bindings/rust/build.rs
CHANGED
|
@@ -1,53 +1,23 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
}
|