Skip to content

Commit 4a72a3b

Browse files
authored
Remove: opt_select_limit, opt_sort_clause (#17)
* change(tree-sitter module): remove opt_select_limit * change(tree-sitter module): remove opt_sort_clause
1 parent f08d52a commit 4a72a3b

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

  • crates/postgresql-cst-parser/src/tree_sitter

crates/postgresql-cst-parser/src/tree_sitter/convert.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ fn walk_and_build(
191191
| SyntaxKind::select_no_parens
192192
| SyntaxKind::simple_select
193193
| SyntaxKind::select_clause
194-
| SyntaxKind::opt_target_list => {
194+
| SyntaxKind::opt_select_limit
195+
| SyntaxKind::opt_target_list
196+
| SyntaxKind::opt_sort_clause => {
195197
// [Node: Removal]
196198
//
197199
// Ignore current node, and continue building its children.
@@ -279,6 +281,26 @@ FROM
279281
let (new_root, _) = get_ts_tree_and_range_map(input, &root);
280282
assert_not_exists(&new_root, SyntaxKind::opt_target_list);
281283
}
284+
285+
#[test]
286+
fn no_opt_select_limit() {
287+
let input = "select a from t for update limit 5 offset 5;";
288+
let root = cst::parse(input).unwrap();
289+
assert_exists(&root, SyntaxKind::opt_select_limit);
290+
291+
let (new_root, _) = get_ts_tree_and_range_map(input, &root);
292+
assert_not_exists(&new_root, SyntaxKind::opt_select_limit);
293+
}
294+
295+
#[test]
296+
fn no_opt_sort_clause() {
297+
let input = "select a from t order by a desc limit 5;";
298+
let root = cst::parse(input).unwrap();
299+
assert_exists(&root, SyntaxKind::opt_sort_clause);
300+
301+
let (new_root, _) = get_ts_tree_and_range_map(input, &root);
302+
assert_not_exists(&new_root, SyntaxKind::opt_sort_clause);
303+
}
282304
}
283305

284306
mod flatten {

0 commit comments

Comments
 (0)