-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6e55f6
commit b247291
Showing
4 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-License-Identifier: MIT | ||
|
||
function is_leaf(node::JuliaSyntax.GreenNode) | ||
return !JuliaSyntax.haschildren(node) | ||
end | ||
|
||
function first_leaf(node::JuliaSyntax.GreenNode) | ||
if is_leaf(node) | ||
return node | ||
else | ||
return first_leaf(first(JuliaSyntax.children(node)::AbstractVector)) | ||
end | ||
end | ||
|
||
function last_leaf(node::JuliaSyntax.GreenNode) | ||
if is_leaf(node) | ||
return node | ||
else | ||
return last_leaf(last(JuliaSyntax.children(node)::AbstractVector)) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters