diff --git a/src/nodes/from_str.rs b/src/nodes/from_str.rs index 4608e48..c606454 100644 --- a/src/nodes/from_str.rs +++ b/src/nodes/from_str.rs @@ -6,8 +6,8 @@ use crate::nodes::{Node, Nodes, PREC}; #[derive(Clone, Debug, thiserror::Error)] pub enum Error { - #[error("invalid function: {0}")] - InvalidFunction(String), + #[error("unrecognized function/constant: {0}")] + UnrecognizedName(String), #[error("invalid operator: {0}")] InvalidOperator(char), #[error("failed to parse number '{0}': {1}")] @@ -66,7 +66,9 @@ impl FromStr for Nodes { ParsingState::ReadingFunctionName(start_index) => { if !c.is_alphabetic() { nodes.push(Node::from_name(&filtered_string[start_index..i]).map_err( - |()| Error::InvalidFunction(filtered_string[start_index..i].to_owned()), + |()| { + Error::UnrecognizedName(filtered_string[start_index..i].to_owned()) + }, )?); state = ParsingState::Start; @@ -117,7 +119,7 @@ impl FromStr for Nodes { ParsingState::ReadingFunctionName(start_index) => { nodes.push( Node::from_name(&filtered_string[start_index..i]).map_err(|()| { - Error::InvalidFunction(filtered_string[start_index..i].to_owned()) + Error::UnrecognizedName(filtered_string[start_index..i].to_owned()) })?, ); }