tree-sitter-sed 0.9.0 → 0.11.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 +1 -1
- package/bindings/rust/build.rs +38 -29
- package/bindings/rust/lib.rs +809 -497
- package/common/dsl.js +1 -1
- package/common/grammar.js +198 -224
- package/common/regex.js +69 -62
- package/common/scanner.h +204 -121
- package/grammar.js +2 -2
- package/package.json +17 -11
- package/queries/highlights.scm +23 -26
- package/sed_ere/grammar.js +2 -2
- package/sed_ere/queries/highlights.scm +23 -26
- package/sed_ere/src/grammar.json +2352 -1935
- package/sed_ere/src/node-types.json +166 -273
- package/sed_ere/src/parser.c +33641 -31408
- package/src/grammar.json +2348 -1921
- package/src/node-types.json +157 -260
- package/src/parser.c +32314 -29926
- package/tree-sitter.json +1 -1
package/Cargo.toml
CHANGED
package/bindings/rust/build.rs
CHANGED
|
@@ -1,40 +1,49 @@
|
|
|
1
1
|
use std::path::Path;
|
|
2
2
|
|
|
3
|
-
fn compile_parser(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
fn compile_parser(
|
|
4
|
+
source_dir: &Path,
|
|
5
|
+
library_name: &str,
|
|
6
|
+
wasm_headers: Option<&Path>,
|
|
7
|
+
) {
|
|
8
|
+
let parser_path = source_dir.join("parser.c");
|
|
9
|
+
let scanner_path = source_dir.join("scanner.c");
|
|
10
|
+
let mut c_config = cc::Build::new();
|
|
11
|
+
c_config.std("c17").include(source_dir);
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
#[cfg(target_env = "msvc")]
|
|
14
|
+
c_config.flag("-utf-8");
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
16
|
+
if let Some(headers) = wasm_headers {
|
|
17
|
+
c_config.include(headers);
|
|
18
|
+
println!("cargo:rerun-if-changed={}", headers.display());
|
|
19
|
+
}
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
c_config.file(&parser_path).file(&scanner_path);
|
|
22
|
+
c_config.compile(library_name);
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
println!("cargo:rerun-if-changed={}", parser_path.display());
|
|
25
|
+
println!("cargo:rerun-if-changed={}", scanner_path.display());
|
|
26
|
+
println!(
|
|
27
|
+
"cargo:rerun-if-changed={}",
|
|
28
|
+
source_dir.join("tree_sitter").display()
|
|
29
|
+
);
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
fn main() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
let target = std::env::var("TARGET").expect("Cargo must provide TARGET");
|
|
34
|
+
let wasm_headers = (target == "wasm32-unknown-unknown").then(|| {
|
|
35
|
+
std::env::var_os("DEP_TREE_SITTER_LANGUAGE_WASM_HEADERS")
|
|
36
|
+
.map(std::path::PathBuf::from)
|
|
37
|
+
.expect(
|
|
38
|
+
"tree-sitter-language must provide headers for wasm32-unknown-unknown",
|
|
39
|
+
)
|
|
40
|
+
});
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
compile_parser(Path::new("src"), "tree-sitter-sed", wasm_headers.as_deref());
|
|
43
|
+
compile_parser(
|
|
44
|
+
Path::new("sed_ere/src"),
|
|
45
|
+
"tree-sitter-sed-ere",
|
|
46
|
+
wasm_headers.as_deref(),
|
|
47
|
+
);
|
|
48
|
+
println!("cargo:rerun-if-changed=common/scanner.h");
|
|
40
49
|
}
|