pub enum CaretOperator {
Unsupported,
Exponent,
BitwiseXor,
}Expand description
What the always-lexed ^ operator token means in a dialect — the operator-meaning
analog of PipeOperator/DoubleAmpersand.
The ^ byte is a single-character self token that always tokenizes; this decides what
an infix ^ binds to. PostgreSQL/DuckDB read it as arithmetic exponentiation, MySQL as
bitwise XOR, and ANSI/SQLite give it no infix meaning at all. The three readings are
mutually exclusive per dialect — one byte, one meaning — so a single meaning-enum makes
the invalid “both power and XOR” state unrepresentable (conflict-exempt: the both-state is
unrepresentable by construction, so no GrammarConflict registry variant governs the
exclusion). It folds together what used to
be an exponent_operator bool and a Caret-XOR spelling that prose alone kept apart.
The precedence follows from the mapped BinaryOperator via the dialect’s
BindingPowerTable (exponent at its own tier tighter than *; Caret XOR at the
bitwise-XOR rank), so there is no separate override here.
Bitwise XOR’s other spelling # (PostgreSQL) rides a different byte on its own axis,
FeatureSet::hash_bitwise_xor; ^ and # never share this enum.
Variants§
Unsupported
^ is not an infix operator (ANSI/SQLite): it still lexes, but the parser ends the
expression rather than binding it.
Exponent
^ is arithmetic exponentiation (BinaryOperator::Exponent, PostgreSQL/DuckDB) —
its own precedence tier, tighter than *.
BitwiseXor
^ is bitwise XOR (BinaryOperator::BitwiseXor under the
Caret spelling, MySQL).
Implementations§
Source§impl CaretOperator
impl CaretOperator
Sourcepub const fn binary_operator(self) -> Option<BinaryOperator>
pub const fn binary_operator(self) -> Option<BinaryOperator>
The canonical binary operator ^ maps to under this dialect, or None when the
dialect gives ^ no infix meaning.
Trait Implementations§
Source§impl Clone for CaretOperator
impl Clone for CaretOperator
Source§fn clone(&self) -> CaretOperator
fn clone(&self) -> CaretOperator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more