Skip to content

Commit

Permalink
feat(verilog): add queries (#678)
Browse files Browse the repository at this point in the history
NOTE: based on upstream parser switch in nvim-treesitter/nvim-treesitter@b139d21
  • Loading branch information
henrykvdb authored Oct 16, 2024
1 parent b91c98a commit 5d6069b
Showing 1 changed file with 43 additions and 12 deletions.
55 changes: 43 additions & 12 deletions queries/verilog/textobjects.scm
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
[
(loop_generate_construct)
(loop_statement)
] @loop.outer
(function_declaration
(function_body_declaration
(tf_port_list)
.
(_) @_start @_end
(_)? @_end
.
"endfunction"
(#make-range! "function.inner" @_start @_end))) @function.outer

[
(conditional_statement)
(case_item)
] @conditional.outer
(task_declaration
(task_body_declaration
(tf_port_list)
.
(_) @_start @_end
(_)? @_end
.
"endtask"
(#make-range! "function.inner" @_start @_end))) @function.outer

(comment) @comment.outer
[
(seq_block)
(generate_block)
] @block.outer

(function_declaration) @function.outer
(seq_block
"begin"
(simple_identifier)?
.
(_) @_start @_end
(#not-kind-eq? @_start "simple_identifier")
(_)? @_end
.
"end"
(#make-range! "block.inner" @_start @_end))

(always_construct) @block.outer
(generate_block
"begin"
(simple_identifier)?
.
(_) @_start @_end
(#not-kind-eq? @_start "simple_identifier")
(_)? @_end
.
"end"
(#make-range! "block.inner" @_start @_end))

(module_declaration) @class.outer
(comment) @comment.outer

0 comments on commit 5d6069b

Please sign in to comment.