diff --git a/src/nodes/from_str.rs b/src/nodes/from_str.rs index c606454..5904a80 100644 --- a/src/nodes/from_str.rs +++ b/src/nodes/from_str.rs @@ -61,6 +61,7 @@ impl FromStr for Nodes { let filtered_string: String = s.chars().filter(is_not_ignored_char).collect(); for (i, c) in filtered_string.char_indices() { + // check whether we're at the end of the bit we're parsing match state { ParsingState::Start => {} ParsingState::ReadingFunctionName(start_index) => { @@ -92,6 +93,7 @@ impl FromStr for Nodes { } } + // start parsing something new (if applicable) if state == ParsingState::Start { if is_number_char(c) { state = ParsingState::ReadingNumber(i); @@ -113,6 +115,7 @@ impl FromStr for Nodes { } } + // wrap up any unfinished parsing let i = filtered_string.len(); match state { ParsingState::Start => {}