mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-19 06:01:36 +03:00
22 lines
561 B
Go
22 lines
561 B
Go
|
package ast
|
||
|
|
||
|
// OperatorNode is a leaf node in an expression representing an operator such as ">" or "==".
|
||
|
type OperatorNode struct {
|
||
|
baseNode
|
||
|
}
|
||
|
|
||
|
// String returns a log/debug-friendly representation.
|
||
|
func (n *OperatorNode) String() string {
|
||
|
return nodeString(n)
|
||
|
}
|
||
|
|
||
|
// isOperator returns true if the supplied string is a recognized operator, e.g. "!=" or ">".
|
||
|
func isOperator(text string) bool {
|
||
|
switch text {
|
||
|
case "-", "+", "~", "!", "||", "*", "/", "%", "<<", ">>", "&", "<", "<=", ">", ">=", "==", "!=", "&&":
|
||
|
return true
|
||
|
default:
|
||
|
return false
|
||
|
}
|
||
|
}
|