-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement regexp matching & bf_match
* Copy and wrap bindings for the crufty legacy C regexpr package from LambdaMOO. * Write a bf_match that uses it.
- Loading branch information
Showing
13 changed files
with
2,294 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
members = [ | ||
"moor-lib", | ||
"moor-bin", | ||
"regexpr-binding", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "regexpr-binding" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[build-dependencies] | ||
cc = { version = "1.0", features = ["parallel"] } | ||
bindgen = "0.65.1" | ||
|
||
[dependencies] | ||
once_cell = "1.17.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Copy/fork of and Rust bindings for the LambdaMOO regexp implementation, which | ||
itself is a fork of the old Python <1.3 regex implementation. There are various | ||
differences between modern regex and this implementation, so rather than try to | ||
rewrite the regex engine from scratch, and debug all the edge cases to get 100% | ||
compatibility for existing cores, I'm just going to wrap this. | ||
|
||
I will provide a separate builtin that uses modern regexp matching, and new code | ||
should use that. This is just for compatibility with existing cores. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
fn main() { | ||
// first compile the C library | ||
cc::Build::new() | ||
.file("c_src/regexpr.c") | ||
.include("c_src") | ||
.compile("regexpr"); | ||
|
||
// Then build the Rust bindings | ||
|
||
println!("cargo:rerun-if-changed=c_src/regexpr.h"); | ||
let bindings = bindgen::Builder::default() | ||
.header("c_src/regexpr.h") | ||
.parse_callbacks(Box::new(bindgen::CargoCallbacks)) | ||
.generate() | ||
.expect("Unable to generate bindings"); | ||
|
||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); | ||
bindings | ||
.write_to_file(out_path.join("bindings.rs")) | ||
.expect("Couldn't write bindings!"); | ||
} |
Oops, something went wrong.