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 CHANGED
@@ -10,7 +10,7 @@ name = "tree-sitter-sed"
10
10
  publish = false
11
11
  readme = "README.md"
12
12
  repository = "https://github.com/konomanoasa/tree-sitter-sed"
13
- version = "0.9.0"
13
+ version = "0.11.0"
14
14
 
15
15
  build = "bindings/rust/build.rs"
16
16
  include = [
@@ -1,40 +1,49 @@
1
1
  use std::path::Path;
2
2
 
3
- fn compile_parser(source_dir: &Path, library_name: &str, wasm_headers: Option<&Path>) {
4
- let parser_path = source_dir.join("parser.c");
5
- let scanner_path = source_dir.join("scanner.c");
6
- let mut c_config = cc::Build::new();
7
- c_config.std("c11").include(source_dir);
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
- #[cfg(target_env = "msvc")]
10
- c_config.flag("-utf-8");
13
+ #[cfg(target_env = "msvc")]
14
+ c_config.flag("-utf-8");
11
15
 
12
- if let Some(headers) = wasm_headers {
13
- c_config.include(headers);
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
- c_config.file(&parser_path).file(&scanner_path);
17
- c_config.compile(library_name);
21
+ c_config.file(&parser_path).file(&scanner_path);
22
+ c_config.compile(library_name);
18
23
 
19
- println!("cargo:rerun-if-changed={}", parser_path.display());
20
- println!("cargo:rerun-if-changed={}", scanner_path.display());
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
- let target = std::env::var("TARGET").expect("Cargo must provide TARGET");
25
- let wasm_headers = (target == "wasm32-unknown-unknown").then(|| {
26
- std::env::var_os("DEP_TREE_SITTER_LANGUAGE_WASM_HEADERS")
27
- .map(std::path::PathBuf::from)
28
- .expect(
29
- "tree-sitter-language must provide its headers when compiling for wasm32-unknown-unknown",
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
- compile_parser(Path::new("src"), "tree-sitter-sed", wasm_headers.as_deref());
34
- compile_parser(
35
- Path::new("sed_ere/src"),
36
- "tree-sitter-sed-ere",
37
- wasm_headers.as_deref(),
38
- );
39
- println!("cargo:rerun-if-changed=common/scanner.h");
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
  }