|
3 | 3 | module CategorizeLines |
4 | 4 | export LineCategories, LineCategory, Blank, Code, Docstring, Comment, categorize_lines! |
5 | 5 |
|
6 | | -using JuliaSyntax: haschildren, children, SourceFile, kind, @K_str, source_line |
| 6 | +using JuliaSyntax: JuliaSyntax, children, SourceFile, kind, @K_str, source_line |
7 | 7 |
|
8 | 8 | # Every line will have a single category. This way the total number across all categories |
9 | 9 | # equals the total number of lines. This is useful for debugging and is reassuring to users. |
@@ -32,7 +32,7 @@ Currently: |
32 | 32 | @enum LineCategory Blank Code Comment Docstring |
33 | 33 |
|
34 | 34 | # We will store the categories assigned to each line in a file with the following structure. |
35 | | -# This keeps the `SourceFile` to facillitate printing. |
| 35 | +# This keeps the `SourceFile` to facilitate printing. |
36 | 36 | """ |
37 | 37 | LineCategories(path) |
38 | 38 |
|
@@ -84,11 +84,11 @@ function categorize_lines!(d::LineCategories, node, source, nesting=0, pos=1, pa |
84 | 84 | k = kind(node) |
85 | 85 |
|
86 | 86 | # Recurse over children |
87 | | - is_leaf = !haschildren(node) |
| 87 | + is_leaf = JuliaSyntax.is_leaf(node) |
88 | 88 | if !is_leaf |
89 | 89 | new_nesting = nesting + 1 |
90 | 90 | p = pos |
91 | | - for x in children(node) |
| 91 | + for x in something(children(node), ()) |
92 | 92 | categorize_lines!(d, x, source, new_nesting, p, k) |
93 | 93 | p += x.span |
94 | 94 | end |
|
0 commit comments