fix: empty variables are allowed

This commit is contained in:
Levy A.
2025-08-21 14:57:57 -03:00
parent 8f10f2f240
commit 40fce89238

View File

@@ -574,14 +574,8 @@ impl<'a> Lexer<'a> {
match tok {
b'?' => {
let start_digit = self.offset;
self.eat_while(|b| b.is_some() && b.unwrap().is_ascii_digit());
// empty variable name
if start_digit == self.offset {
return Err(Error::BadVariableName((start, self.offset - start).into()));
}
Ok(Token {
value: &self.input[start + 1..self.offset], // do not include '? in the value
token_type: Some(TokenType::TK_VARIABLE),