a better coloring crate
fix {}
bendn 2023-09-16
parent 0af5816 · commit a2f89e2
-rw-r--r--Cargo.toml4
-rw-r--r--src/cfstr.rs5
-rw-r--r--src/lib.rs1
-rw-r--r--tests/basic.rs5
4 files changed, 13 insertions, 2 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 70aa946..e96ee94 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "comat"
-version = "0.1.0"
+version = "0.1.1"
edition = "2021"
authors = ["bendn <[email protected]>"]
license = "MIT"
@@ -13,4 +13,4 @@ proc_macro = true
[dependencies]
proc-macro2 = "1.0.67"
quote = "1.0.32"
-syn = { version = "2.0.15", features = ["full"] }
+syn = "2.0.15"
diff --git a/src/cfstr.rs b/src/cfstr.rs
index 96699ca..ef332db 100644
--- a/src/cfstr.rs
+++ b/src/cfstr.rs
@@ -72,6 +72,11 @@ impl Parse for CFStr {
out.push('{');
continue;
}
+ Some('}') => {
+ out.push('{');
+ out.push('}');
+ continue;
+ }
Some(ch) => temp.push(ch),
None => return Err(stream.error("unexpected eof")),
}
diff --git a/src/lib.rs b/src/lib.rs
index 2a852d9..0992332 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,6 +23,7 @@
//! ```
//! vs
//! ```
+//! # let thing = 0;
//! print!("\x1b[0;34;31m{thing}\x1b[0m.");
//! ```
//! vs
diff --git a/tests/basic.rs b/tests/basic.rs
index 594df32..37b809e 100644
--- a/tests/basic.rs
+++ b/tests/basic.rs
@@ -10,3 +10,8 @@ fn escapes() {
assert_eq!(comat!("{{ow}} {{red}}"), "{ow} {red}");
assert_eq!(comat!("{{{{"), "{{");
}
+
+#[test]
+fn take() {
+ assert_eq!(comat!("{}"), "{}");
+}