alamb commented on code in PR #2577:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2577#discussion_r4159149915


##########
src/ast/mod.rs:
##########
@@ -8115,14 +8117,9 @@ impl fmt::Display for FunctionArg {
 /// Whether `expr` renders with an operator character first. A prefix `-` or 
`!`
 /// must not abut one, since `--` starts a line comment and compound tokens
 /// like `!!` or `!~` alter the parsed AST or fail to parse.
-fn starts_with_operator_char(mut expr: &Expr) -> bool {
-    loop {
-        match expr {
-            Expr::UnaryOp { op, .. } => return !matches!(op, 
UnaryOperator::Not),
-            Expr::BinaryOp { left, .. } => expr = left,
-            _ => return false,
-        }
-    }
+fn starts_with_operator_char(expr: &Expr) -> bool {
+    const OPERATOR_CHARS: &str = "+-*/<>=~!@%#^&|";

Review Comment:
   I feel like this list may be elsewhere -- or maybe it should be a global 
constant to make it more discoverable in the future



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to