Add null coalescing operator.
This commit is contained in:
@@ -1917,8 +1917,8 @@ impl Engine {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ??? && ??? = rhs, ??? || ??? = rhs
|
||||
Expr::And(..) | Expr::Or(..) => Err(LexError::ImproperSymbol(
|
||||
// ??? && ??? = rhs, ??? || ??? = rhs, xxx ?? xxx = rhs
|
||||
Expr::And(..) | Expr::Or(..) | Expr::Coalesce(..) => Err(LexError::ImproperSymbol(
|
||||
"=".to_string(),
|
||||
"Possibly a typo of '=='?".to_string(),
|
||||
)
|
||||
@@ -2223,6 +2223,18 @@ impl Engine {
|
||||
pos,
|
||||
)
|
||||
}
|
||||
Token::DoubleQuestion => {
|
||||
let rhs = args.pop().unwrap();
|
||||
let current_lhs = args.pop().unwrap();
|
||||
Expr::Coalesce(
|
||||
BinaryExpr {
|
||||
lhs: current_lhs,
|
||||
rhs,
|
||||
}
|
||||
.into(),
|
||||
pos,
|
||||
)
|
||||
}
|
||||
Token::In => {
|
||||
// Swap the arguments
|
||||
let current_lhs = args.remove(0);
|
||||
|
Reference in New Issue
Block a user