Skip to main content

limbo_sqlite3_parser/parser/ast/
unaryoperator_traits.rs

1//! # `UnaryOperator` - Trait Implementations
2//!
3//! This module contains trait implementations for `UnaryOperator`.
4//!
5//! ## Implemented Traits
6//!
7//! - `From`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use crate::dialect::TokenType::*;
12use crate::parser::parse::YYCODETYPE;
13
14use super::types_10::UnaryOperator;
15
16impl From<YYCODETYPE> for UnaryOperator {
17    fn from(token_type: YYCODETYPE) -> Self {
18        match token_type {
19            x if x == TK_BITNOT as YYCODETYPE => Self::BitwiseNot,
20            x if x == TK_MINUS as YYCODETYPE => Self::Negative,
21            x if x == TK_NOT as YYCODETYPE => Self::Not,
22            x if x == TK_PLUS as YYCODETYPE => Self::Positive,
23            _ => unreachable!(),
24        }
25    }
26}