Skip to content

Commit

Permalink
upgrade parser again; bump 0.4.34
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Sep 19, 2021
1 parent 1f6360e commit 074e12c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "calcit_runner"
version = "0.4.33"
version = "0.4.34"
authors = ["jiyinyiyong <jiyinyiyong@gmail.com>"]
edition = "2018"
license = "MIT"
Expand All @@ -21,8 +21,8 @@ exclude = [

[dependencies]
chrono = "0.4.19"
cirru_edn = "0.1.6"
cirru_parser = "0.1.2"
cirru_edn = "0.1.7"
cirru_parser = "0.1.3"
clap = "2.33.3"
dirs = "3.0.1"
im = "15.0.0"
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.4.33",
"version": "0.4.34",
"main": "./lib/calcit.procs.js",
"devDependencies": {
"@types/node": "^16.9.2",
Expand Down
4 changes: 2 additions & 2 deletions src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ pub fn handle_proc(name: &str, args: &CalcitItems) -> Result<Calcit, String> {
"&call-dylib:str-vec-str->tuple-str2" => ffi::call_dylib_str_vec_str_to_tuple_str2(args),
// external data format
"parse-cirru" => meta::parse_cirru(args),
"format-cirru" => meta::write_cirru(args),
"format-cirru" => meta::format_cirru(args),
"parse-cirru-edn" => meta::parse_cirru_edn(args),
"format-cirru-edn" => meta::write_cirru_edn(args),
"format-cirru-edn" => meta::format_cirru_edn(args),
"parse-json" => json::parse_json(args),
"stringify-json" => json::stringify_json(args),
// time
Expand Down
12 changes: 9 additions & 3 deletions src/builtins/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,18 @@ pub fn parse_cirru(xs: &CalcitItems) -> Result<Calcit, String> {
}
}

pub fn write_cirru(xs: &CalcitItems) -> Result<Calcit, String> {
pub fn format_cirru(xs: &CalcitItems) -> Result<Calcit, String> {
match xs.get(0) {
Some(a) => {
let options = cirru_parser::CirruWriterOptions { use_inline: false };
match cirru::calcit_data_to_cirru(a) {
Ok(v) => Ok(Calcit::Str(cirru_parser::format(&v, options)?)),
Ok(v) => {
if let Cirru::List(ys) = v {
Ok(Calcit::Str(cirru_parser::format(&ys, options)?))
} else {
Err(format!("expected vector for Cirru formatting: {}", v))
}
}
Err(e) => Err(format!("format-cirru failed, {}", e)),
}
}
Expand All @@ -172,7 +178,7 @@ pub fn parse_cirru_edn(xs: &CalcitItems) -> Result<Calcit, String> {
}
}

pub fn write_cirru_edn(xs: &CalcitItems) -> Result<Calcit, String> {
pub fn format_cirru_edn(xs: &CalcitItems) -> Result<Calcit, String> {
match xs.get(0) {
Some(a) => Ok(Calcit::Str(cirru_edn::format(&edn::calcit_to_edn(a)?, true)?)),
None => Err(String::from("format-cirru-edn expected 1 argument")),
Expand Down
2 changes: 1 addition & 1 deletion ts-src/calcit.procs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// CALCIT VERSION
export const calcit_version = "0.4.33";
export const calcit_version = "0.4.34";

import { overwriteComparator, initTernaryTreeMap } from "@calcit/ternary-tree";
import { parse } from "@cirru/parser.ts";
Expand Down

0 comments on commit 074e12c

Please sign in to comment.