From eb4d2643b570252fb183f69ca8677c81c351aabb Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Mon, 15 May 2023 22:17:56 +0800 Subject: [PATCH] more lenient param names, more info in function exception --- cozo-core/src/cozoscript.pest | 2 +- cozo-core/src/data/functions.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cozo-core/src/cozoscript.pest b/cozo-core/src/cozoscript.pest index 16a871eb..9d4a37ee 100644 --- a/cozo-core/src/cozoscript.pest +++ b/cozo-core/src/cozoscript.pest @@ -52,7 +52,7 @@ COMMENT = _{(BLOCK_COMMENT | LINE_COMMENT)} prog_entry = {"?"} var = @{(XID_START | "_") ~ (XID_CONTINUE | "_")*} -param = @{"$" ~ (XID_CONTINUE | "_")*} +param = @{"$" ~ (XID_CONTINUE | "_" | ".")+} ident = @{XID_START ~ ("_" | XID_CONTINUE)*} underscore_ident = @{("_" | XID_START) ~ ("_" | XID_CONTINUE)*} definitely_underscore_ident = @{"_" ~ XID_CONTINUE+} diff --git a/cozo-core/src/data/functions.rs b/cozo-core/src/data/functions.rs index e65a80bd..343bf1b2 100644 --- a/cozo-core/src/data/functions.rs +++ b/cozo-core/src/data/functions.rs @@ -1344,7 +1344,7 @@ define_op!(OP_TRIM_START, 1, false); pub(crate) fn op_trim_start(args: &[DataValue]) -> Result { match &args[0] { DataValue::Str(s) => Ok(DataValue::from(s.trim_start())), - _ => bail!("'trim_start' requires strings"), + v => bail!("'trim_start' requires strings, got {}", v), } }