From 5770cc108e2e8dc33a868ae0d3527a175a1d4953 Mon Sep 17 00:00:00 2001 From: Clark McCauley Date: Mon, 29 May 2023 10:36:04 -0600 Subject: [PATCH] Fixed test and updated status badge --- README.md | 6 +++++- interpreter/src/duration.rs | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 831b167..2e08adb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Common Expression Language (Rust) +[![Rust](https://github.com/clarkmcc/cel-rust/actions/workflows/rust.yml/badge.svg)](https://github.com/clarkmcc/cel-rust/actions/workflows/rust.yml) + The Common Expression Language (CEL) is a non-Turing complete language designed for simplicity, speed, safety, and portability. CEL's C-like syntax looks nearly identical to equivalent expressions in C++, Go, Java, and TypeScript. CEL is ideal for lightweight expression evaluation when a fully sandboxed scripting language is too resource intensive. @@ -20,7 +22,9 @@ auth.claims.email_verified && resources.all(r, r.startsWith(auth.claims.email)) ``` ## Getting Started -This project includes a CEL-parser and an interpreter which means that it can be used to evaluate CEL-expressions. The library aims to be very simple to use, while still being fast, safe, and customizable. + +This project includes a CEL-parser and an interpreter which means that it can be used to evaluate CEL-expressions. The +library aims to be very simple to use, while still being fast, safe, and customizable. ```rust fn main() { diff --git a/interpreter/src/duration.rs b/interpreter/src/duration.rs index 437e4a8..041ad80 100644 --- a/interpreter/src/duration.rs +++ b/interpreter/src/duration.rs @@ -14,12 +14,12 @@ static NANOS_PER_MICRO: f64 = 1e3; /// Parses a duration string into a [`Duration`]. Duration strings support the /// following grammar: /// -/// DurationString -> Sign? Number Unit String? -/// Sign -> '-' -/// Number -> Digit+ ('.' Digit+)? -/// Digit -> '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' -/// Unit -> 'h' | 'm' | 's' | 'ms' | 'us' | 'ns' -/// String -> DurationString +/// DurationString -> Sign? Number Unit String? +/// Sign -> '-' +/// Number -> Digit+ ('.' Digit+)? +/// Digit -> '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' +/// Unit -> 'h' | 'm' | 's' | 'ms' | 'us' | 'ns' +/// String -> DurationString /// /// # Examples /// - `1h` parses as 1 hour