Skip to content

Commit

Permalink
handle ckj displaying; tag 0.8.59
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Jun 26, 2024
1 parent 486e6c8 commit a4f4d56
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 9 deletions.
31 changes: 28 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "calcit"
version = "0.8.58"
version = "0.8.59"
authors = ["jiyinyiyong <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -20,7 +20,7 @@ exclude = [
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cirru_edn = "0.6.10"
cirru_edn = "0.6.11"
# cirru_edn = { path = "/Users/chenyong/repo/cirru/edn.rs" }
cirru_parser = "0.1.31"
# cirru_parser = { path = "/Users/chenyong/repo/cirru/parser.rs" }
Expand Down
2 changes: 2 additions & 0 deletions calcit/test-string.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@
assert= (str-spaced nil nil |c 12) "|c 12"
assert= (str-spaced |a nil |c 12 nil) "|a c 12"
assert= (str 1 2 3) |123
assert= "|(:: :a |世界 \"|海 洋\")"
str $ :: :a |世界 "|海 洋"
assert=
type-of $ &str 1
, :string
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@calcit/procs",
"version": "0.8.58",
"version": "0.8.59",
"main": "./lib/calcit.procs.mjs",
"devDependencies": {
"@types/node": "^20.11.28",
Expand Down
13 changes: 11 additions & 2 deletions src/calcit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,16 @@ impl fmt::Display for Calcit {
if is_simple_str(s) {
write!(f, "|{s}")
} else {
write!(f, "\"|{}\"", s.escape_default())
// write!(f, "\"|{}\"", s.escape_default())
write!(f, "\"|")?;
for c in s.chars() {
if cirru_edn::is_simple_char(c) {
write!(f, "{}", c)?;
} else {
write!(f, "{}", c.escape_default())?;
}
}
write!(f, "\"")
}
} // TODO, escaping choices
Calcit::Thunk(thunk) => match thunk {
Expand Down Expand Up @@ -281,7 +290,7 @@ impl fmt::Display for Calcit {

fn is_simple_str(tok: &str) -> bool {
for c in tok.chars() {
if !matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '-' | '?' | '!' | '|') {
if !cirru_edn::is_simple_char(c) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ts-src/js-tuple.mts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class CalcitTuple {
if (i > 0) {
content += " ";
}
content += toString(args[i], false, disableJsDataWarning);
content += toString(args[i], true, disableJsDataWarning);
}
if (this.klass instanceof CalcitRecord) {
return `(%:: ${content} (:class ${this.klass.name.value}))`;
Expand Down

0 comments on commit a4f4d56

Please sign in to comment.