fix(ast): SelfInc use wrong way to recognize

This commit is contained in:
2026-06-12 11:38:28 +08:00
parent ef3dcb41aa
commit daae12d695
3 changed files with 51 additions and 57 deletions
+18 -2
View File
@@ -269,8 +269,24 @@ fn parse_puncuation(
};
let c = str_iter.peek().ok_or(LexParseError::NotMatched)?;
let token_value = match c {
'+' => TokenValue::Plus,
'-' => TokenValue::Minus,
'+' => {
str_iter.advance(1);
if let Some('+') = str_iter.peek() {
TokenValue::PlusPlus
} else {
str_iter.back(1);
TokenValue::Plus
}
},
'-' => {
str_iter.advance(1);
if let Some('-') = str_iter.peek() {
TokenValue::MinusMinus
} else {
str_iter.back(1);
TokenValue::Minus
}
},
'*' => TokenValue::Star,
'/' => TokenValue::Slash,
'%' => TokenValue::Percent,