Skip to content

Commit d9ee3e2

Browse files
committed
chore: expression types names consolidating
1 parent 6795971 commit d9ee3e2

File tree

4 files changed

+29
-31
lines changed

4 files changed

+29
-31
lines changed

src/ast/expression/mod.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,29 @@ pub enum Expression {
4646
CollateExpression(CollateExpression),
4747

4848
/// Like, e.g. $expression LIKE $expression [ESCAPE $expression]
49-
LikeExpression(LikeExpressionType),
49+
LikeExpression(LikeExpression),
5050

5151
/// Glob, e.g. $expression GLOB $expression
5252
GlobExpression(GlobExpression),
5353

5454
/// Regexp, e.g. $expression REGEXP $expression
55-
RegexpExpression(RegexpMatchingExpression),
55+
RegexpExpression(RegexpExpression),
5656

5757
/// Match, e.g. $expression MATCH $expression
5858
MatchExpression(MatchExpression),
5959

6060
/// Is, e.g. $expression IS $expression
61-
IsExpression(AnIsExpression),
61+
IsExpression(IsExpression),
62+
63+
/// In, e.g. $expression IN $expression
64+
InExpression(InExpression),
6265

6366
/// Is Null, e.g. $expression IS NULL
6467
IsNull(Box<Expression>),
6568

6669
/// Is Not Null, e.g. $expression IS NOT NULL
6770
IsNotNull(Box<Expression>),
6871

69-
/// In, e.g. $expression IN $expression
70-
InExpression(InExpression),
71-
7272
/// Between
7373
BetweenExpression(BetweenExpression),
7474

@@ -135,7 +135,7 @@ pub enum DataType {
135135

136136
/// A like expression type
137137
#[derive(Debug, PartialEq, Clone)]
138-
pub struct LikeExpressionType {
138+
pub struct LikeExpression {
139139
/// An expression
140140
pub expression: Box<Expression>,
141141

@@ -149,8 +149,8 @@ pub struct LikeExpressionType {
149149
pub escape_expression: Option<Box<Expression>>,
150150
}
151151

152-
impl From<LikeExpressionType> for Expression {
153-
fn from(like_expr: LikeExpressionType) -> Self {
152+
impl From<LikeExpression> for Expression {
153+
fn from(like_expr: LikeExpression) -> Self {
154154
Expression::LikeExpression(like_expr)
155155
}
156156
}
@@ -171,16 +171,16 @@ impl From<GlobExpression> for Expression {
171171
}
172172

173173
#[derive(Debug, PartialEq, Clone)]
174-
pub struct RegexpMatchingExpression {
174+
pub struct RegexpExpression {
175175
pub expression: Box<Expression>,
176176

177177
pub not: bool,
178178

179179
pub pattern: Box<Expression>,
180180
}
181181

182-
impl From<RegexpMatchingExpression> for Expression {
183-
fn from(regexp_expr: RegexpMatchingExpression) -> Self {
182+
impl From<RegexpExpression> for Expression {
183+
fn from(regexp_expr: RegexpExpression) -> Self {
184184
Expression::RegexpExpression(regexp_expr)
185185
}
186186
}
@@ -202,7 +202,7 @@ impl From<MatchExpression> for Expression {
202202

203203
/// An IS expression
204204
#[derive(Debug, PartialEq, Clone)]
205-
pub struct AnIsExpression {
205+
pub struct IsExpression {
206206
/// The expression
207207
pub expression: Box<Expression>,
208208

@@ -216,8 +216,8 @@ pub struct AnIsExpression {
216216
pub matching_expression: Box<Expression>,
217217
}
218218

219-
impl From<AnIsExpression> for Expression {
220-
fn from(is_expr: AnIsExpression) -> Self {
219+
impl From<IsExpression> for Expression {
220+
fn from(is_expr: IsExpression) -> Self {
221221
Expression::IsExpression(is_expr)
222222
}
223223
}

src/parser/expression/is_expr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::parser::errors::ParsingError;
2-
use crate::{AnIsExpression, Expression, Keyword, Parser};
2+
use crate::{Expression, IsExpression, Keyword, Parser};
33

44
use super::ExpressionParser;
55

@@ -22,7 +22,7 @@ impl IsExpressionParser for Parser<'_> {
2222
self.consume_as_keyword(Keyword::From)?;
2323
}
2424

25-
let is_expression = AnIsExpression {
25+
let is_expression = IsExpression {
2626
expression: Box::new(expression),
2727
not: is_not,
2828
distinct,
@@ -37,7 +37,7 @@ impl IsExpressionParser for Parser<'_> {
3737
mod is_expression_tests {
3838
use crate::parser::test_utils::run_sunny_day_test;
3939
use crate::select::test_utils::select_expr;
40-
use crate::{AnIsExpression, Expression};
40+
use crate::{Expression, IsExpression};
4141

4242
use crate::parser::expression::test_utils::*;
4343

@@ -47,7 +47,7 @@ mod is_expression_tests {
4747
distinct: bool,
4848
is_not: bool,
4949
) -> Expression {
50-
Expression::IsExpression(AnIsExpression {
50+
Expression::IsExpression(IsExpression {
5151
expression: Box::new(expression),
5252
distinct,
5353
not: is_not,

src/parser/expression/like_expr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::parser::errors::ParsingError;
2-
use crate::{Expression, Keyword, LikeExpressionType, Parser};
2+
use crate::{Expression, Keyword, LikeExpression, Parser};
33

44
use super::ExpressionParser;
55

@@ -26,7 +26,7 @@ impl LikeExpressionParser for Parser<'_> {
2626
escape_expression = Some(Box::new(self.parse_expression()?));
2727
}
2828

29-
let like_expression = LikeExpressionType {
29+
let like_expression = LikeExpression {
3030
expression: Box::new(expression),
3131
not: is_not,
3232
like_expression: Box::new(pattern),
@@ -41,12 +41,12 @@ impl LikeExpressionParser for Parser<'_> {
4141
mod like_expression_tests {
4242
use crate::parser::test_utils::run_sunny_day_test;
4343
use crate::select::test_utils::select_expr;
44-
use crate::{Expression, LikeExpressionType};
44+
use crate::{Expression, LikeExpression};
4545

4646
use crate::parser::expression::test_utils::*;
4747

48-
fn like_expr(expr: Expression, like_expr: Expression) -> LikeExpressionType {
49-
LikeExpressionType {
48+
fn like_expr(expr: Expression, like_expr: Expression) -> LikeExpression {
49+
LikeExpression {
5050
expression: Box::new(expr),
5151
not: false,
5252
like_expression: Box::new(like_expr),

src/parser/expression/regexp_match_expr.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
use crate::parser::errors::ParsingError;
2-
use crate::{
3-
Expression, GlobExpression, Keyword, MatchExpression, Parser, RegexpMatchingExpression,
4-
};
2+
use crate::{Expression, GlobExpression, Keyword, MatchExpression, Parser, RegexpExpression};
53

64
use super::ExpressionParser;
75

@@ -37,7 +35,7 @@ impl RegexpMatchExpressionParser for Parser<'_> {
3735
not: is_not,
3836
pattern: Box::new(pattern),
3937
}),
40-
Keyword::Regexp => Expression::RegexpExpression(RegexpMatchingExpression {
38+
Keyword::Regexp => Expression::RegexpExpression(RegexpExpression {
4139
expression: Box::new(expression),
4240
not: is_not,
4341
pattern: Box::new(pattern),
@@ -58,7 +56,7 @@ impl RegexpMatchExpressionParser for Parser<'_> {
5856
mod regexp_match_expression_tests {
5957
use crate::parser::test_utils::run_sunny_day_test;
6058
use crate::select::test_utils::select_expr;
61-
use crate::{Expression, GlobExpression, MatchExpression, RegexpMatchingExpression};
59+
use crate::{Expression, GlobExpression, MatchExpression, RegexpExpression};
6260

6361
use crate::parser::expression::test_utils::*;
6462

@@ -70,8 +68,8 @@ mod regexp_match_expression_tests {
7068
}
7169
}
7270

73-
fn regexp_expr(expression: Expression, pattern: Expression) -> RegexpMatchingExpression {
74-
RegexpMatchingExpression {
71+
fn regexp_expr(expression: Expression, pattern: Expression) -> RegexpExpression {
72+
RegexpExpression {
7573
expression: Box::new(expression),
7674
not: false,
7775
pattern: Box::new(pattern),

0 commit comments

Comments
 (0)