Support the string concat operator (#178)

The selected precedence is based on BigQuery documentation, where it is equal to `*` and `/`:

https://cloud.google.com/bigquery/docs/reference/standard-sql/operators
This commit is contained in:
Daniël Heres 2020-06-02 20:24:30 +02:00 committed by GitHub
parent 5f3c1bda01
commit 00dc490f72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 1 deletions

View file

@ -577,6 +577,7 @@ impl Parser {
Token::Minus => Some(BinaryOperator::Minus),
Token::Mult => Some(BinaryOperator::Multiply),
Token::Mod => Some(BinaryOperator::Modulus),
Token::StringConcat => Some(BinaryOperator::StringConcat),
Token::Div => Some(BinaryOperator::Divide),
Token::Word(ref k) => match k.keyword.as_ref() {
"AND" => Some(BinaryOperator::And),
@ -708,7 +709,7 @@ impl Parser {
Ok(20)
}
Token::Plus | Token::Minus => Ok(Self::PLUS_MINUS_PREC),
Token::Mult | Token::Div | Token::Mod => Ok(40),
Token::Mult | Token::Div | Token::Mod | Token::StringConcat => Ok(40),
Token::DoubleColon => Ok(50),
_ => Ok(0),
}