-
Notifications
You must be signed in to change notification settings - Fork 7
feat: remove make-range, support quantified captures
#44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,52 +1,44 @@ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ;; inherits: python | ||||||||||||||||||||||
| ;; extends | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ; vanilla script, without separator | ||||||||||||||||||||||
| (module | ||||||||||||||||||||||
| . | ||||||||||||||||||||||
| (_) @_nonseparator @_start @_end | ||||||||||||||||||||||
| . | ||||||||||||||||||||||
| (_)* @_nonseparator @_end | ||||||||||||||||||||||
| (_)+ @cell | ||||||||||||||||||||||
| . | ||||||||||||||||||||||
| (#match-cell-content? @_nonseparator) | ||||||||||||||||||||||
| (#make-range! "cell" @_start @_end) | ||||||||||||||||||||||
| (#match-cell-content? @cell) | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ; first cell, follow a separator | ||||||||||||||||||||||
| (module | ||||||||||||||||||||||
| . | ||||||||||||||||||||||
| (_) @_nonseparator @_start @_end | ||||||||||||||||||||||
| . | ||||||||||||||||||||||
| (_)* @_nonseparator @_end | ||||||||||||||||||||||
| _+ @cell | ||||||||||||||||||||||
|
||||||||||||||||||||||
| _+ @cell | |
| (_)+ @cell |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation in this query pattern is inconsistent with the rest of the file. Lines 25-29 use 4 spaces of indentation, while other patterns in the file (lines 6-11, 14-21, 34-42) use 2 spaces. This should be adjusted to 2 spaces for consistency.
| (comment) @_cellseparator @cell | |
| (_)* @_cellcontent @cell | |
| (comment) @_cellseparator | |
| (#match-cell-content? @_cellcontent) | |
| (#match-percent-separator? @_cellseparator) | |
| (comment) @_cellseparator @cell | |
| (_)* @_cellcontent @cell | |
| (comment) @_cellseparator | |
| (#match-cell-content? @_cellcontent) | |
| (#match-percent-separator? @_cellseparator) |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pattern change appears to alter the semantic meaning. Previously, this pattern matched the separator followed by content nodes, creating a range from the separator to the last content node. Now, it captures both the separator and content nodes together as @cell. However, the predicate #match-cell-content? is still applied to @_cellcontent instead of @cell, which may not work as intended since @_cellcontent uses the * quantifier and could match zero nodes. Consider whether the predicate should be applied to @cell or if the pattern needs adjustment.
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the "cell between two separator" pattern, this pattern applies #match-cell-content? to @_cellcontent which uses the * quantifier and could match zero nodes. The predicate should likely be applied to @cell or the pattern needs adjustment to ensure content nodes exist. Also, the extra parentheses grouping on lines 35-41 is inconsistent with other patterns in the file and may not be necessary.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,50 +4,40 @@ | |
| ; vanilla script, without separator | ||
| (module | ||
| . | ||
| (_) @_nonseparator @_start @_end | ||
| (_)+ @cellcontent | ||
| . | ||
| (_)* @_nonseparator @_end | ||
| . | ||
| (#match-cell-content? @_nonseparator) | ||
| (#make-range! "cellcontent" @_start @_end) | ||
| (#match-cell-content? @cellcontent) | ||
| ) | ||
|
|
||
| ; first cell, follow a separator | ||
| (module | ||
| . | ||
| (_) @_nonseparator @_start @_end | ||
| . | ||
| (_)* @_nonseparator @_end | ||
| _+ @cellcontent | ||
|
||
| . | ||
| (comment) @_cellseparator | ||
| (#match-cell-content? @_nonseparator) | ||
| (#match-cell-content? @cellcontent) | ||
| (#match-percent-separator? @_cellseparator) | ||
| (#make-range! "cellcontent" @_start @_end) | ||
| ) | ||
|
|
||
| ; cell between two separator | ||
| (module | ||
| (comment) @_cellseparator | ||
| . | ||
| (_) @_nonseparator @_start @_end | ||
| (_)* @_nonseparator @_end | ||
| (_)+ @cellcontent | ||
| . | ||
| (comment) @_cellseparator | ||
| (#match-cell-content? @_nonseparator) | ||
| (#match-cell-content? @cellcontent) | ||
| (#match-percent-separator? @_cellseparator) | ||
| (#make-range! "cellcontent" @_start @_end) | ||
| ) | ||
|
|
||
|
|
||
| ; latest cell after separator | ||
| (module | ||
| (comment) @_cellseparator | ||
| . | ||
| (_) @_nonseparator @_start @_end | ||
| (_)* @_nonseparator @_end | ||
| _+ @cellcontent | ||
|
||
| . | ||
| (#match-cell-content? @_nonseparator) | ||
| (#match-cell-content? @cellcontent) | ||
| (#match-percent-separator? @_cellseparator) | ||
| (#make-range! "cellcontent" @_start @_end) | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file now starts with an unnecessary blank line. For consistency with other query files in the codebase, this blank line should be removed.