Open etiennebacher opened 2 months ago
Don't know why not: kind: comment
doesn't work here
Seems like a bigger issue with negating a comment. In the last case, this should return 0 node:
library(astgrepr)
no_comment <- "foo"
# CORRECT
no_comment |>
tree_new() |>
tree_root() |>
node_find(ast_rule(kind = "comment"))
#> <List of 1 rule>
#> |--rule_1: 0 node
# CORRECT
no_comment |>
tree_new() |>
tree_root() |>
node_find(ast_rule(not = ast_rule(kind = "comment")))
#> <List of 1 rule>
#> |--rule_1: 1 node
is_comment <- "# foo"
# CORRECT
is_comment |>
tree_new() |>
tree_root() |>
node_find(ast_rule(kind = "comment"))
#> <List of 1 rule>
#> |--rule_1: 1 node
# WRONG
is_comment |>
tree_new() |>
tree_root() |>
node_find(ast_rule(not = ast_rule(kind = "comment")))
#> <List of 1 rule>
#> |--rule_1: 1 node