Skip to content

Commit 11046f6

Browse files
authored
Correct typo: indexs to indexes (#492)
1 parent dd805e9 commit 11046f6

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/ast/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ pub enum Expr {
371371
/// An array index expression e.g. `(ARRAY[1, 2])[1]` or `(current_schemas(FALSE))[1]`
372372
ArrayIndex {
373373
obj: Box<Expr>,
374-
indexs: Vec<Expr>,
374+
indexes: Vec<Expr>,
375375
},
376376
/// An array expression e.g. `ARRAY[1, 2]`
377377
Array(Array),
@@ -553,9 +553,9 @@ impl fmt::Display for Expr {
553553
Expr::Tuple(exprs) => {
554554
write!(f, "({})", display_comma_separated(exprs))
555555
}
556-
Expr::ArrayIndex { obj, indexs } => {
556+
Expr::ArrayIndex { obj, indexes } => {
557557
write!(f, "{}", obj)?;
558-
for i in indexs {
558+
for i in indexes {
559559
write!(f, "[{}]", i)?;
560560
}
561561
Ok(())

src/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,15 +1234,15 @@ impl<'a> Parser<'a> {
12341234
pub fn parse_array_index(&mut self, expr: Expr) -> Result<Expr, ParserError> {
12351235
let index = self.parse_expr()?;
12361236
self.expect_token(&Token::RBracket)?;
1237-
let mut indexs: Vec<Expr> = vec![index];
1237+
let mut indexes: Vec<Expr> = vec![index];
12381238
while self.consume_token(&Token::LBracket) {
12391239
let index = self.parse_expr()?;
12401240
self.expect_token(&Token::RBracket)?;
1241-
indexs.push(index);
1241+
indexes.push(index);
12421242
}
12431243
Ok(Expr::ArrayIndex {
12441244
obj: Box::new(expr),
1245-
indexs,
1245+
indexes,
12461246
})
12471247
}
12481248

tests/sqlparser_postgres.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ fn parse_array_index_expr() {
11731173
assert_eq!(
11741174
&Expr::ArrayIndex {
11751175
obj: Box::new(Expr::Identifier(Ident::new("foo"))),
1176-
indexs: vec![num[0].clone()],
1176+
indexes: vec![num[0].clone()],
11771177
},
11781178
expr_from_projection(only(&select.projection)),
11791179
);
@@ -1183,7 +1183,7 @@ fn parse_array_index_expr() {
11831183
assert_eq!(
11841184
&Expr::ArrayIndex {
11851185
obj: Box::new(Expr::Identifier(Ident::new("foo"))),
1186-
indexs: vec![num[0].clone(), num[0].clone()],
1186+
indexes: vec![num[0].clone(), num[0].clone()],
11871187
},
11881188
expr_from_projection(only(&select.projection)),
11891189
);
@@ -1193,7 +1193,7 @@ fn parse_array_index_expr() {
11931193
assert_eq!(
11941194
&Expr::ArrayIndex {
11951195
obj: Box::new(Expr::Identifier(Ident::new("bar"))),
1196-
indexs: vec![
1196+
indexes: vec![
11971197
num[0].clone(),
11981198
Expr::Identifier(Ident {
11991199
value: "baz".to_string(),
@@ -1224,7 +1224,7 @@ fn parse_array_index_expr() {
12241224
None
12251225
)))))
12261226
}))),
1227-
indexs: vec![num[1].clone(), num[2].clone()],
1227+
indexes: vec![num[1].clone(), num[2].clone()],
12281228
},
12291229
expr_from_projection(only(&select.projection)),
12301230
);

0 commit comments

Comments
 (0)