Skip to content

Commit feaa13c

Browse files
max-sixtyalamb
andauthored
feat: Add custom operator (apache#868)
* feat: Add custom operator From apache#863 - It doesn't parse anything — I'm not sure how to parse ` SELECT 'a' REGEXP '^[a-d]';` with `REGEXP` as the operator... (but fine for my narrow purpose) - If we need tests, where would I add them? * Update src/ast/operator.rs --------- Co-authored-by: Andrew Lamb <[email protected]>
1 parent 4559d87 commit feaa13c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ast/operator.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ pub enum BinaryOperator {
8585
BitwiseOr,
8686
BitwiseAnd,
8787
BitwiseXor,
88+
/// Support for custom operators (built by parsers outside this crate)
89+
Custom(String),
8890
PGBitwiseXor,
8991
PGBitwiseShiftLeft,
9092
PGBitwiseShiftRight,
@@ -122,6 +124,7 @@ impl fmt::Display for BinaryOperator {
122124
BinaryOperator::BitwiseOr => f.write_str("|"),
123125
BinaryOperator::BitwiseAnd => f.write_str("&"),
124126
BinaryOperator::BitwiseXor => f.write_str("^"),
127+
BinaryOperator::Custom(s) => f.write_str(s),
125128
BinaryOperator::PGBitwiseXor => f.write_str("#"),
126129
BinaryOperator::PGBitwiseShiftLeft => f.write_str("<<"),
127130
BinaryOperator::PGBitwiseShiftRight => f.write_str(">>"),

0 commit comments

Comments
 (0)