diff --git a/src/scanner/context.rs b/src/scanner/context.rs index 22ac9fe..dfe1dce 100644 --- a/src/scanner/context.rs +++ b/src/scanner/context.rs @@ -61,12 +61,18 @@ impl Context pub fn flow_increment(&mut self) -> Result { - self.flow.checked_add(1).ok_or(ScanError::IntOverflow) + let new = self.flow.checked_add(1).ok_or(ScanError::IntOverflow)?; + self.flow = new; + + Ok(new) } pub fn flow_decrement(&mut self) -> Result { - self.flow.checked_sub(1).ok_or(ScanError::IntOverflow) + let new = self.flow.checked_sub(1).ok_or(ScanError::IntOverflow)?; + self.flow = new; + + Ok(new) } /// Get the current indent level