Skip to content

Commit

Permalink
fix(whitespaces): do not strip whitespaces when removing previous token
Browse files Browse the repository at this point in the history
  • Loading branch information
pinbraerts committed Dec 15, 2024
1 parent b4d1806 commit fb14c7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl Parser {
return result;
}
let mut tokens = vec![Token::new(lexem, std::mem::take(&mut self.whitespace))];
while let Some(token) = tokens.pop() {
while let Some(mut token) = tokens.pop() {
match validate(
self.states.last().cloned().unwrap_or_default(),
token.lexem.clone(),
Expand Down Expand Up @@ -164,8 +164,9 @@ impl Parser {
Validate::DropBefore => {
self.states.pop();
if let Some(t) = std::mem::take(&mut self.delay) {
self.whitespace = t.whitespace_before + &self.whitespace;
token.whitespace_before = t.whitespace_before + &token.whitespace_before;
}
tokens.push(token);
continue;
}
};
Expand Down

0 comments on commit fb14c7c

Please sign in to comment.