-
As suggested in an issue I opened in tree-sitter-java, to differentiate between regular block comments and JavaDoc documentation comments, I should write my own custom queries. Here's what I tried in the playground: Code: class Main {
// this is a line comment
/* this is a documentation comment */
/** this is a documentation comment */
} Query: (block_comment) @capture (.match? @capture "^/**") However, this does not seem to match any of the block comment nodes in the body. I also tried escaping the pattern as |
Beta Was this translation helpful? Give feedback.
Answered by
dabico
Sep 19, 2023
Replies: 1 comment
-
Never mind, I think I understand what I did wrong. The escapes need to be doubled. The correct query that matches documentation comments is: Query: ((block_comment) @capture (.match? @capture "^/\\*\\*")) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dabico
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Never mind, I think I understand what I did wrong. The escapes need to be doubled. The correct query that matches documentation comments is:
Query:
((block_comment) @capture (.match? @capture "^/\\*\\*"))