mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 05:30:19 +00:00
set: allow negative ident values (#495)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
This commit is contained in:
parent
85e0e5fd39
commit
74f92079ac
2 changed files with 37 additions and 0 deletions
|
@ -3287,6 +3287,16 @@ impl<'a> Parser<'a> {
|
|||
let value = match (self.parse_value(), token) {
|
||||
(Ok(value), _) => SetVariableValue::Literal(value),
|
||||
(Err(_), Token::Word(ident)) => SetVariableValue::Ident(ident.to_ident()),
|
||||
(Err(_), Token::Minus) => {
|
||||
let next_token = self.next_token();
|
||||
match next_token {
|
||||
Token::Word(ident) => SetVariableValue::Ident(Ident {
|
||||
quote_style: ident.quote_style,
|
||||
value: format!("-{}", ident.value),
|
||||
}),
|
||||
_ => self.expected("word", next_token)?,
|
||||
}
|
||||
}
|
||||
(Err(_), unexpected) => self.expected("variable value", unexpected)?,
|
||||
};
|
||||
values.push(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue