Skip to content

Commit

Permalink
feat: implement the string functions in the WDL standard library. (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhuene authored Nov 12, 2024
1 parent 3b5aec2 commit 71d4e77
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 15 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ path-clean = "1.0.1"
petgraph = "0.6.5"
pretty_assertions = "1.4.0"
rayon = "1.10.0"
regex = "1.11.1"
reqwest = { version = "0.12.5", default-features = false, features = ["rustls-tls", "http2", "charset"] }
rowan = "0.15.15"
serde = { version = "1", features = ["derive"] }
Expand Down
1 change: 1 addition & 0 deletions wdl-engine/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Implemented the string functions from the WDL standard library ([#252](https://github.com/stjude-rust-labs/wdl/pull/252)).
* Implemented call evaluation and the numeric functions from the WDL standard
library ([#251](https://github.com/stjude-rust-labs/wdl/pull/251)).
* Implemented WDL expression evaluation ([#249](https://github.com/stjude-rust-labs/wdl/pull/249)).
Expand Down
1 change: 1 addition & 0 deletions wdl-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ anyhow = { workspace = true }
ordered-float = { workspace = true }
indexmap = { workspace = true }
serde_json = { workspace = true }
regex = { workspace = true }

[dev-dependencies]
wdl-grammar = { version = "0.10.0", path = "../wdl-grammar" }
Expand Down
5 changes: 5 additions & 0 deletions wdl-engine/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,8 @@ pub fn exponentiation_requirement(span: Span) -> Diagnostic {
pub fn multiline_string_requirement(span: Span) -> Diagnostic {
Diagnostic::error("use of multi-line strings requires WDL version 1.2").with_highlight(span)
}

/// Creates an "invalid regular expression" diagnostic.
pub fn invalid_regex(error: &regex::Error, span: Span) -> Diagnostic {
Diagnostic::error(error.to_string()).with_highlight(span)
}
4 changes: 2 additions & 2 deletions wdl-engine/src/eval/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,12 +1064,12 @@ impl<'a, C: EvaluationContext> ExprEvaluator<'a, C> {
// Evaluate the argument expressions
let mut count = 0;
let mut types = [Type::Union; MAX_PARAMETERS];
let mut arguments = [const { Value::None }; MAX_PARAMETERS];
let mut arguments = [const { (Value::None, Span::new(0, 0)) }; MAX_PARAMETERS];
for arg in expr.arguments() {
if count < MAX_PARAMETERS {
let v = self.evaluate_expr(&arg)?;
types[count] = v.ty();
arguments[count] = v;
arguments[count] = (v, arg.span());
}

count += 1;
Expand Down
Loading

0 comments on commit 71d4e77

Please sign in to comment.