diff --git a/src/nodes/from_str.rs b/src/nodes/from_str.rs index 8b6d819..57bf3e3 100644 --- a/src/nodes/from_str.rs +++ b/src/nodes/from_str.rs @@ -78,9 +78,13 @@ impl FromStr for Nodes { } else if c == ')' { nodes.push(Node::ParenthesisEnd); } else { - nodes.push(Node::Operator( - c.try_into().map_err(|()| Error::InvalidOperator(c))?, - )); + if matches!(nodes.last(), Some(Node::Operator(_)) | None) { + state = ParsingState::ReadingNumber(i); + } else { + nodes.push(Node::Operator( + c.try_into().map_err(|()| Error::InvalidOperator(c))?, + )); + } } } }