Skip to content

Commit ce2f679

Browse files
refactor: rename to any_identifier
1 parent d82f7b3 commit ce2f679

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

crates/pgt_treesitter/src/context/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ impl<'a> TreesitterContext<'a> {
620620
/// Verifies whether the node_under_cursor has the passed in ancestors in the right order.
621621
/// Note that you need to pass in the ancestors in the order as they would appear in the tree:
622622
///
623-
/// If the tree shows `relation > object_reference > identifier` and the "any_identifier" is a leaf node,
623+
/// If the tree shows `relation > object_reference > any_any_identifier` and the "any_any_identifier" is a leaf node,
624624
/// you need to pass `&["relation", "object_reference"]`.
625625
pub fn matches_ancestor_history(&self, expected_ancestors: &[&'static str]) -> bool {
626626
self.node_under_cursor.as_ref().is_some_and(|node| {
@@ -642,7 +642,7 @@ impl<'a> TreesitterContext<'a> {
642642
/// Verifies whether the node_under_cursor has the passed in ancestors in the right order.
643643
/// Note that you need to pass in the ancestors in the order as they would appear in the tree:
644644
///
645-
/// If the tree shows `relation > object_reference > identifier` and the "any_identifier" is a leaf node,
645+
/// If the tree shows `relation > object_reference > any_any_identifier` and the "any_any_identifier" is a leaf node,
646646
/// you need to pass `&["relation", "object_reference"]`.
647647
pub fn matches_one_of_ancestors(&self, expected_ancestors: &[&'static str]) -> bool {
648648
self.node_under_cursor.as_ref().is_some_and(|node| {
@@ -663,9 +663,9 @@ impl<'a> TreesitterContext<'a> {
663663
/// * keyword_from [9..13] 'from'
664664
/// * relation [14..28] '"auth"."users"'
665665
/// * object_reference [14..28] '"auth"."users"'
666-
/// * identifier [14..20] '"auth"'
666+
/// * any_any_identifier [14..20] '"auth"'
667667
/// * . [20..21] '.'
668-
/// * identifier [21..28] '"users"'
668+
/// * any_any_identifier [21..28] '"users"'
669669
/// */
670670
///
671671
/// if node_under_cursor_is_nth_child(1) {
@@ -1132,13 +1132,13 @@ mod tests {
11321132
keyword_where [29..34] 'where'
11331133
binary_expression [35..43] 'id = @id'
11341134
field [35..37] 'id'
1135-
identifier [35..37] 'id'
1135+
any_identifier [35..37] 'id'
11361136
= [38..39] '='
11371137
field [40..43] '@id'
1138-
identifier [40..43] '@id'
1138+
any_identifier [40..43] '@id'
11391139
@ [40..41] '@'
11401140
1141-
You can see that the '@' is a child of the "any_identifier" but has a range smaller than its parent's.
1141+
You can see that the '@' is a child of the "any_any_identifier" but has a range smaller than its parent's.
11421142
This would crash our context parsing because, at position 42, we weren't at the leaf node but also couldn't
11431143
go to a child on that position.
11441144
*/

crates/pgt_treesitter/src/queries/parameters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1111
[
1212
(field
1313
(field_qualifier)?
14-
(identifier)
14+
(any_identifier)
1515
) @reference
1616
1717
(parameter) @parameter

crates/pgt_treesitter/src/queries/relations.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1111
(relation
1212
(object_reference
1313
.
14-
(identifier) @schema_or_table
14+
(any_identifier) @schema_or_table
1515
"."?
16-
(identifier)? @table
16+
(any_identifier)? @table
1717
)+
1818
)
1919
(insert
2020
(object_reference
2121
.
22-
(identifier) @schema_or_table
22+
(any_identifier) @schema_or_table
2323
"."?
24-
(identifier)? @table
24+
(any_identifier)? @table
2525
)+
2626
)
2727
(alter_table
2828
(keyword_alter)
2929
(keyword_table)
3030
(object_reference
3131
.
32-
(identifier) @schema_or_table
32+
(any_identifier) @schema_or_table
3333
"."?
34-
(identifier)? @table
34+
(any_identifier)? @table
3535
)+
3636
)
3737
"#;

crates/pgt_treesitter/src/queries/select_columns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1414
(object_reference) @alias
1515
"."
1616
)?
17-
(identifier) @column
17+
(any_identifier) @column
1818
)
1919
)
2020
","?

crates/pgt_treesitter/src/queries/table_aliases.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1010
(relation
1111
(object_reference
1212
.
13-
(identifier) @schema_or_table
13+
(any_identifier) @schema_or_table
1414
"."?
15-
(identifier)? @table
15+
(any_identifier)? @table
1616
)
1717
(keyword_as)?
18-
(identifier) @alias
18+
(any_identifier) @alias
1919
)
2020
"#;
2121
tree_sitter::Query::new(&pgt_treesitter_grammar::LANGUAGE.into(), QUERY_STR)

crates/pgt_treesitter/src/queries/where_columns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
1616
(object_reference) @alias
1717
"."
1818
)?
19-
(identifier) @column
19+
(any_identifier) @column
2020
)
2121
)
2222
)

0 commit comments

Comments
 (0)