Rust library crate to match Unicode open/close brackets
Source is generated by a Perl script (bin/matching.pl) to download and parse the following Unicode
database files.
- https://www.unicode.org/Public/UNIDATA/UnicodeData.txt
- https://www.unicode.org/Public/UNIDATA/BidiBrackets.txt
- https://www.unicode.org/Public/UNIDATA/BidiMirroring.txt
Original idea is from this StackOverflow thread and this comment.
Example
use FindMatching;
let close = close;
let open = open;
let s = "fn main() {\n println!(\"Hello!\");\n}";
// 000000000011 11111111222222 2222333 333 33
// 012345678901 23456789012345 6789012 345 67
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
let length = s.len;
let more = length + 1;
assert_eq!;
assert_eq!;
assert_eq!;