Skip to content

Commit c8b6e7f

Browse files
authored
feat: comments for all operators (#917)
1 parent d6ebb58 commit c8b6e7f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/ast/operator.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ use super::display_separated;
2828
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
2929
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
3030
pub enum UnaryOperator {
31+
/// Plus, e.g. `+9`
3132
Plus,
33+
/// Minus, e.g. `-9`
3234
Minus,
35+
/// Not, e.g. `NOT(true)`
3336
Not,
3437
/// Bitwise Not, e.g. `~9` (PostgreSQL-specific)
3538
PGBitwiseNot,
@@ -66,39 +69,67 @@ impl fmt::Display for UnaryOperator {
6669
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
6770
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
6871
pub enum BinaryOperator {
72+
/// Plus, e.g. `a + b`
6973
Plus,
74+
/// Minus, e.g. `a - b`
7075
Minus,
76+
/// Multiply, e.g. `a * b`
7177
Multiply,
78+
/// Divide, e.g. `a / b`
7279
Divide,
80+
/// Modulo, e.g. `a % b`
7381
Modulo,
82+
/// String/Array Concat operator, e.g. `a || b`
7483
StringConcat,
84+
/// Greater than, e.g. `a > b`
7585
Gt,
86+
/// Less than, e.g. `a < b`
7687
Lt,
88+
/// Greater equal, e.g. `a >= b`
7789
GtEq,
90+
/// Less equal, e.g. `a <= b`
7891
LtEq,
92+
/// Spaceship, e.g. `a <=> b`
7993
Spaceship,
94+
/// Equal, e.g. `a = b`
8095
Eq,
96+
/// Not equal, e.g. `a <> b`
8197
NotEq,
98+
/// And, e.g. `a AND b`
8299
And,
100+
/// Or, e.g. `a OR b`
83101
Or,
102+
/// XOR, e.g. `a XOR b`
84103
Xor,
104+
/// Bitwise or, e.g. `a | b`
85105
BitwiseOr,
106+
/// Bitwise and, e.g. `a & b`
86107
BitwiseAnd,
108+
/// Bitwise XOR, e.g. `a ^ b`
87109
BitwiseXor,
88110
/// Integer division operator `//` in DuckDB
89111
DuckIntegerDivide,
90112
/// MySQL [`DIV`](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html) integer division
91113
MyIntegerDivide,
92114
/// Support for custom operators (built by parsers outside this crate)
93115
Custom(String),
116+
/// Bitwise XOR, e.g. `a # b` (PostgreSQL-specific)
94117
PGBitwiseXor,
118+
/// Bitwise shift left, e.g. `a << b` (PostgreSQL-specific)
95119
PGBitwiseShiftLeft,
120+
/// Bitwise shift right, e.g. `a >> b` (PostgreSQL-specific)
96121
PGBitwiseShiftRight,
122+
/// Exponent, e.g. `a ^ b` (PostgreSQL-specific)
97123
PGExp,
124+
/// Overlap operator, e.g. `a && b` (PostgreSQL-specific)
98125
PGOverlap,
126+
/// String matches regular expression (case sensitively), e.g. `a ~ b` (PostgreSQL-specific)
99127
PGRegexMatch,
128+
/// String matches regular expression (case insensitively), e.g. `a ~* b` (PostgreSQL-specific)
100129
PGRegexIMatch,
130+
/// String does not match regular expression (case sensitively), e.g. `a !~ b` (PostgreSQL-specific)
101131
PGRegexNotMatch,
132+
/// String does not match regular expression (case insensitively), e.g. `a !~* b` (PostgreSQL-specific)
102133
PGRegexNotIMatch,
103134
/// PostgreSQL-specific custom operator.
104135
///

0 commit comments

Comments
 (0)