diff --git a/README.md b/README.md index a580c6b..95f52a5 100644 --- a/README.md +++ b/README.md @@ -91,9 +91,6 @@ It's pretty fast and scales well. In my case, it usually runs in under 0.1ms. Th To see how fast it is, you can pass the `--debug` flag in CLI, or the `debug` argument to `eval()`. -## Errors -cpc returns `Result`s with basic strings as errors. Just to be safe, you may want to handle panics (You can do that using `std::panic::catch_unwind`). - ## Dev Instructions ### Get started diff --git a/src/lexer.rs b/src/lexer.rs index a11dba0..f6c6f5d 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -21,6 +21,10 @@ pub const fn is_alphabetic_extended(input: &char) -> bool { /// Lex an input string and return a [`TokenVector`] pub fn lex(input: &str, allow_trailing_operators: bool, default_degree: Unit) -> Result { + if input == "" { + return Err(format!("Input was empty")) + } + let mut input = input.replace(",", ""); // ignore commas input = input.to_lowercase();