diff options
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | lockfile.json | 5 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 13 | ||||
| -rw-r--r-- | queries/systemverilog/folds.scm | 23 | ||||
| -rw-r--r-- | queries/systemverilog/highlights.scm | 595 | ||||
| -rw-r--r-- | queries/systemverilog/injections.scm | 5 | ||||
| -rw-r--r-- | queries/verilog/folds.scm | 17 | ||||
| -rw-r--r-- | queries/verilog/highlights.scm | 599 | ||||
| -rw-r--r-- | queries/verilog/injections.scm | 3 | ||||
| -rw-r--r-- | queries/verilog/locals.scm | 60 |
10 files changed, 463 insertions, 860 deletions
@@ -423,7 +423,6 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [swift](https://github.com/alex-pinkus/tree-sitter-swift) (maintained by @alex-pinkus) - [x] [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) (maintained by @RaafatTurki) - [x] [systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) (maintained by @ok-ryoko) -- [x] [systemverilog](https://github.com/zhangwwpeng/tree-sitter-systemverilog) (maintained by @zhangwwpeng) - [x] [t32](https://gitlab.com/xasc/tree-sitter-t32.git) (maintained by @xasc) - [x] [tablegen](https://github.com/amaanq/tree-sitter-tablegen) (maintained by @amaanq) - [x] [tact](https://github.com/tact-lang/tree-sitter-tact) (maintained by @novusnota) @@ -454,7 +453,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [v](https://github.com/vlang/v-analyzer) (maintained by @kkharji, @amaanq) - [x] [vala](https://github.com/vala-lang/tree-sitter-vala) (maintained by @Prince781) - [x] [vento](https://github.com/ventojs/tree-sitter-vento) (maintained by @wrapperup, @oscarotero) -- [x] [verilog](https://github.com/tree-sitter/tree-sitter-verilog) (maintained by @zegervdv) +- [x] [verilog](https://github.com/gmlarumbe/tree-sitter-systemverilog) (maintained by @zhangwwpeng) - [x] [vhdl](https://github.com/jpt13653903/tree-sitter-vhdl) (maintained by @jpt13653903) - [x] [vhs](https://github.com/charmbracelet/tree-sitter-vhs) (maintained by @caarlos0) - [x] [vim](https://github.com/neovim/tree-sitter-vim) (maintained by @clason) diff --git a/lockfile.json b/lockfile.json index 2d53b1bf7..d8e71e7a1 100644 --- a/lockfile.json +++ b/lockfile.json @@ -749,9 +749,6 @@ "systemtap": { "revision": "f2b378a9af0b7e1192cff67a5fb45508c927205d" }, - "systemverilog": { - "revision": "4f897d5e3f0e38bf8fbb55e8f39dc97d2bc2229e" - }, "t32": { "revision": "6182836f4128725f1e74ce986840d7317021a015" }, @@ -843,7 +840,7 @@ "revision": "3321077d7446c1b3b017c294fd56ce028ed817fe" }, "verilog": { - "revision": "5a01c57fa8e3d8801953a67ae7c6b240e2284ee8" + "revision": "0dacb911daa9614a7c7e79a594d4cb9f478e6554" }, "vhdl": { "revision": "d6e8301999336b47d663052d43f983c3edeb01dd" diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9c85ae118..48beabd9b 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -11,6 +11,7 @@ for ft, lang in pairs { ["typescript.tsx"] = "tsx", ["terraform-vars"] = "terraform", ["html.handlebars"] = "glimmer", + systemverilog = "verilog", dosini = "ini", confini = "ini", svg = "xml", @@ -2171,14 +2172,6 @@ list.systemtap = { maintainers = { "@ok-ryoko" }, } -list.systemverilog = { - install_info = { - url = "https://github.com/zhangwwpeng/tree-sitter-systemverilog", - files = { "src/parser.c" }, - }, - maintainers = { "@zhangwwpeng" }, -} - list.t32 = { install_info = { url = "https://gitlab.com/xasc/tree-sitter-t32.git", @@ -2433,10 +2426,10 @@ list.vento = { list.verilog = { install_info = { - url = "https://github.com/tree-sitter/tree-sitter-verilog", + url = "https://github.com/gmlarumbe/tree-sitter-systemverilog", files = { "src/parser.c" }, }, - maintainers = { "@zegervdv" }, + maintainers = { "@zhangwwpeng" }, } list.vhdl = { diff --git a/queries/systemverilog/folds.scm b/queries/systemverilog/folds.scm deleted file mode 100644 index ea52476a4..000000000 --- a/queries/systemverilog/folds.scm +++ /dev/null @@ -1,23 +0,0 @@ -[ - (seq_block) - (function_body_declaration) - (task_body_declaration) - (generate_block) - (always_construct) - (property_declaration) - (checker_declaration) - (class_declaration) - (config_declaration) - (covergroup_declaration) - (clocking_declaration) - (interface_declaration) - (module_declaration) - (package_declaration) - (module_instantiation) - (program_declaration) - (specify_block) - (generate_region) - (package_import_declaration) - (text_macro_definition) - (include_compiler_directive)+ -] @fold diff --git a/queries/systemverilog/highlights.scm b/queries/systemverilog/highlights.scm deleted file mode 100644 index c8cff453f..000000000 --- a/queries/systemverilog/highlights.scm +++ /dev/null @@ -1,595 +0,0 @@ -; Keywords -[ - "begin" - "end" - "generate" - "endgenerate" - (module_keyword) - "endmodule" - "program" - "endprogram" - "package" - "endpackage" - "checker" - "endchecker" - "config" - "endconfig" - "pure" - "virtual" - "extends" - "implements" - "super" - (class_item_qualifier) - "parameter" - "localparam" - "defparam" - "assign" - "modport" - "fork" - "join" - "join_none" - "join_any" - "default" - "break" - "tagged" - "extern" - "alias" - "posedge" - "negedge" - "bind" - "expect" - "type" - "void" - "coverpoint" - "cross" - "nettype" - "export" - "force" - "release" - "timeunit" - "timeprecision" - "sequence" - "endsequence" - "property" - "endproperty" - "clocking" - "endclocking" - "covergroup" - "endgroup" - "specify" - "endspecify" - "primitive" - "endprimitive" - "wait" - "wait_order" - "const" - "constraint" - "unique" - "do" - "genvar" - "inside" - "rand" - "continue" - "randc" - "event" - "global" - "ref" - "initial" - (unique_priority) - (bins_keyword) - (always_keyword) -] @keyword - -[ - "class" - "endclass" - "interface" - "endinterface" - "enum" - "struct" - "union" - "typedef" -] @keyword.type - -[ - "function" - "endfunction" - "task" - "endtask" -] @keyword.function - -"return" @keyword.return - -[ - "for" - "foreach" - "repeat" - "forever" - "while" -] @keyword.repeat - -; for -(loop_generate_construct - (generate_block - [ - "begin" - "end" - ] @keyword.conditional)) - -; foreach -(loop_statement - (statement - (statement_item - (seq_block - [ - "begin" - "end" - ] @keyword.conditional)))) - -; repeat forever while -(loop_statement - (statement_or_null - (statement - (statement_item - (seq_block - [ - "begin" - "end" - ] @keyword.conditional))))) - -[ - "if" - "else" - "iff" - (case_keyword) - "endcase" -] @keyword.conditional - -[ - "=" - "-" - "+" - "/" - "*" - "^" - "&" - "|" - "&&" - "||" - "<=" - "==" - "!=" - "===" - "!==" - "-:" - "<" - ">" - ">=" - "%" - ">>" - "<<" - "|=" - "|=>" - "|->" - ">>>" - "<<<" - "->>" - "->" - "=>" - "*>" - ".*" - (unary_operator) - (inc_or_dec_operator) - (queue_dimension) -] @operator - -"#" @constructor - -[ - ";" - "::" - "," - "." - ":" -] @punctuation.delimiter - -(conditional_expression - [ - "?" - ":" - ] @keyword.conditional.ternary) - -[ - "[" - "]" - "(" - ")" - "{" - "}" - "'{" -] @punctuation.bracket - -[ - "or" - "and" -] @keyword.operator - -[ - "input" - "output" - "inout" - "signed" - "unsigned" - "assert" - "cover" - "assume" - "disable" - "automatic" - "static" - (dpi_function_import_property) - (dpi_task_import_property) -] @keyword.modifier - -[ - "include" - "import" - "directive_include" -] @keyword.import - -(comment) @comment @spell - -[ - "@" - (cycle_delay_range) - (delay_control) - (cycle_delay) - (attribute_instance) -] @attribute - -(attribute_instance - (attr_spec - (simple_identifier) @property)) - -[ - (integral_number) - (unbased_unsized_literal) - (fixed_point_number) - (unsigned_number) -] @number - -[ - (net_type) - (data_type) - (time_unit) -] @type.builtin - -; variable -(list_of_variable_decl_assignments - (variable_decl_assignment - name: (simple_identifier) @variable)) - -(hierarchical_identifier - (simple_identifier) @variable) - -(tf_port_item - (simple_identifier) @variable) - -port_name: (simple_identifier) @variable - -(port - (simple_identifier) @variable) - -(list_of_port_identifiers - (simple_identifier) @variable) - -(net_lvalue - (simple_identifier) @variable) - -(sequence_port_item - (simple_identifier) @variable) - -(property_port_item - (simple_identifier) @variable) - -(net_decl_assignment - (simple_identifier) @variable) - -(ERROR - (simple_identifier) @variable) - -; variable.member -(hierarchical_identifier - (simple_identifier) - (simple_identifier) @variable.member) - -(select - (simple_identifier) @variable.member) - -(named_port_connection - port_name: (simple_identifier) @variable.member) - -(ordered_port_connection - (expression - (primary - (hierarchical_identifier - (simple_identifier) @variable.member)))) - -(coverage_option - (simple_identifier) @variable.member) - -; variable.builtin -(method_call_body - arguments: (list_of_arguments - (expression) @variable.builtin - (#any-of? @variable.builtin "this"))) - -(implicit_class_handle) @variable.builtin - -; variable.parameter -(named_parameter_assignment - (simple_identifier) @variable.parameter) - -(parameter_declaration - (list_of_param_assignments - (param_assignment - (simple_identifier) @variable.parameter))) - -(local_parameter_declaration - (list_of_param_assignments - (param_assignment - (simple_identifier) @variable.parameter))) - -; function builtin -[ - (simulation_control_task) - (system_tf_identifier) - (severity_system_task) - (randomize_call) - (array_or_queue_method_name) - "new" -] @function.builtin - -; declaration -(task_body_declaration - . - name: (simple_identifier) @function - (simple_identifier)? @label) - -(function_body_declaration - . - name: (simple_identifier) @function - (simple_identifier)? @label) - -(function_body_declaration - . - (data_type_or_void) - name: (simple_identifier) @function - (simple_identifier)? @label) - -(clocking_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(sequence_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(property_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(class_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(interface_class_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(covergroup_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(package_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(checker_declaration - . - name: (simple_identifier) @constructor - (simple_identifier)? @label) - -(interface_declaration - . - [ - (simple_identifier) @constructor - (interface_nonansi_header - (simple_identifier) @constructor) - (interface_ansi_header - (simple_identifier) @constructor) - ] - (simple_identifier)? @label) - -(module_declaration - . - [ - (simple_identifier) @constructor - (module_nonansi_header - (simple_identifier) @constructor) - (module_ansi_header - (simple_identifier) @constructor) - ] - (simple_identifier)? @label) - -(program_declaration - . - [ - (simple_identifier) @constructor - (program_nonansi_header - (simple_identifier) @constructor) - (program_ansi_header - (simple_identifier) @constructor) - ] - (simple_identifier)? @label) - -; function.call -(method_call_body - name: (simple_identifier) @function.call) - -(tf_call - (hierarchical_identifier - (simple_identifier) @function.call)) - -; instance -(module_instantiation - instance_type: (simple_identifier) @constructor) - -(name_of_instance - instance_name: (simple_identifier) @module) - -(sequence_instance - (hierarchical_identifier - (simple_identifier) @module)) - -(udp_instantiation - (simple_identifier) @constructor) - -(ansi_port_declaration - (interface_port_header - interface_name: (simple_identifier) @variable - modport_name: (simple_identifier) @variable.member) - port_name: (simple_identifier) @variable) - -; bind -(bind_directive - (bind_target_scope - (simple_identifier) @constructor)) - -(bind_target_instance - (hierarchical_identifier - (simple_identifier) @module)) - -; assertion -(concurrent_assertion_item - (simple_identifier) @label) - -; converge -(cover_point - name: (simple_identifier) @label) - -(cover_cross - name: (simple_identifier) @module) - -(list_of_cross_items - (simple_identifier) @constructor) - -;package -(package_import_item - (simple_identifier) @constructor) - -; label -(seq_block - (simple_identifier) @label) - -(statement - block_name: (simple_identifier) @label) - -; dpi -(dpi_spec_string) @string - -c_name: (c_identifier) @function - -(dpi_import_export - name: (simple_identifier) @function) - -; type def -(class_type - (simple_identifier) @constructor) - -(class_type - (simple_identifier) - (simple_identifier) @type) - -(data_type - (class_scope - (class_type - (simple_identifier) @constructor))) - -(task_prototype - name: (simple_identifier) @function) - -(function_prototype - name: (simple_identifier) @function) - -(type_assignment - name: (simple_identifier) @type.definition) - -(interface_class_type - (simple_identifier) @type.definition) - -(package_scope - (simple_identifier) @constructor) - -(data_declaration - (type_declaration - type_name: (simple_identifier) @type.definition)) - -(net_declaration - (simple_identifier) @type) - -(constraint_declaration - (simple_identifier) @constructor) - -(method_call - (primary - (hierarchical_identifier - (simple_identifier) @constructor))) - -(string_literal - (quoted_string) @string) - -; include -(include_statement - (file_path_spec) @string.special.path) - -; directive -[ - "directive_define" - "directive_default_nettype" - "directive_resetall" - "directive_timescale" - "directive_undef" - "directive_undefineall" - "directive_ifdef" - "directive_elsif" - "directive_endif" - "directive_else" -] @keyword.directive.define - -(include_compiler_directive - (quoted_string) @string.special.path) - -(include_compiler_directive - (system_lib_string) @string) - -(default_nettype_compiler_directive - (default_nettype_value) @type.builtin) - -(text_macro_definition - (text_macro_name - (simple_identifier) @keyword.directive)) - -(text_macro_usage) @keyword.directive - -(ifdef_condition - (simple_identifier) @keyword.directive) - -(undefine_compiler_directive - (simple_identifier) @keyword.directive) diff --git a/queries/systemverilog/injections.scm b/queries/systemverilog/injections.scm deleted file mode 100644 index b6d2d4721..000000000 --- a/queries/systemverilog/injections.scm +++ /dev/null @@ -1,5 +0,0 @@ -((comment) @injection.content - (#set! injection.language "comment")) - -((macro_text) @injection.content - (#set! injection.language "systemverilog")) diff --git a/queries/verilog/folds.scm b/queries/verilog/folds.scm index efc0ac66b..ea52476a4 100644 --- a/queries/verilog/folds.scm +++ b/queries/verilog/folds.scm @@ -3,4 +3,21 @@ (function_body_declaration) (task_body_declaration) (generate_block) + (always_construct) + (property_declaration) + (checker_declaration) + (class_declaration) + (config_declaration) + (covergroup_declaration) + (clocking_declaration) + (interface_declaration) + (module_declaration) + (package_declaration) + (module_instantiation) + (program_declaration) + (specify_block) + (generate_region) + (package_import_declaration) + (text_macro_definition) + (include_compiler_directive)+ ] @fold diff --git a/queries/verilog/highlights.scm b/queries/verilog/highlights.scm index dd58c3829..c8cff453f 100644 --- a/queries/verilog/highlights.scm +++ b/queries/verilog/highlights.scm @@ -2,6 +2,8 @@ [ "begin" "end" + "generate" + "endgenerate" (module_keyword) "endmodule" "program" @@ -10,6 +12,8 @@ "endpackage" "checker" "endchecker" + "config" + "endconfig" "pure" "virtual" "extends" @@ -27,10 +31,53 @@ "join_any" "default" "break" - "assert" "tagged" "extern" + "alias" + "posedge" + "negedge" + "bind" + "expect" + "type" + "void" + "coverpoint" + "cross" + "nettype" + "export" + "force" + "release" + "timeunit" + "timeprecision" + "sequence" + "endsequence" + "property" + "endproperty" + "clocking" + "endclocking" + "covergroup" + "endgroup" + "specify" + "endspecify" + "primitive" + "endprimitive" + "wait" + "wait_order" + "const" + "constraint" + "unique" + "do" + "genvar" + "inside" + "rand" + "continue" + "randc" + "event" + "global" + "ref" + "initial" (unique_priority) + (bins_keyword) + (always_keyword) ] @keyword [ @@ -54,46 +101,50 @@ "return" @keyword.return [ - (always_keyword) - "generate" "for" "foreach" "repeat" "forever" - "initial" "while" ] @keyword.repeat +; for +(loop_generate_construct + (generate_block + [ + "begin" + "end" + ] @keyword.conditional)) + +; foreach +(loop_statement + (statement + (statement_item + (seq_block + [ + "begin" + "end" + ] @keyword.conditional)))) + +; repeat forever while +(loop_statement + (statement_or_null + (statement + (statement_item + (seq_block + [ + "begin" + "end" + ] @keyword.conditional))))) + [ "if" "else" + "iff" (case_keyword) "endcase" ] @keyword.conditional -(comment) @comment @spell - -(include_compiler_directive) @constant.macro - -(package_import_declaration - "import" @keyword.import) - -(package_import_declaration - (package_import_item - (package_identifier - (simple_identifier) @constant))) - -(text_macro_identifier - (simple_identifier) @constant.macro) - -(package_scope - (package_identifier - (simple_identifier) @constant)) - -(package_declaration - (package_identifier - (simple_identifier) @constant)) - [ "=" "-" @@ -106,8 +157,6 @@ "&&" "||" "<=" - "@" - "@*" "==" "!=" "===" @@ -120,199 +169,427 @@ ">>" "<<" "|=" + "|=>" + "|->" + ">>>" + "<<<" + "->>" + "->" + "=>" + "*>" + ".*" (unary_operator) (inc_or_dec_operator) - "#" + (queue_dimension) ] @operator -(parameter_port_list - "#" @constructor) +"#" @constructor + +[ + ";" + "::" + "," + "." + ":" +] @punctuation.delimiter + +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +[ + "[" + "]" + "(" + ")" + "{" + "}" + "'{" +] @punctuation.bracket [ "or" "and" ] @keyword.operator -(cast - [ - "'" - "(" - ")" - ] @operator) +[ + "input" + "output" + "inout" + "signed" + "unsigned" + "assert" + "cover" + "assume" + "disable" + "automatic" + "static" + (dpi_function_import_property) + (dpi_task_import_property) +] @keyword.modifier -(edge_identifier) @attribute +[ + "include" + "import" + "directive_include" +] @keyword.import -(port_direction) @keyword.modifier +(comment) @comment @spell -(port_identifier - (simple_identifier) @variable) +[ + "@" + (cycle_delay_range) + (delay_control) + (cycle_delay) + (attribute_instance) +] @attribute + +(attribute_instance + (attr_spec + (simple_identifier) @property)) + +[ + (integral_number) + (unbased_unsized_literal) + (fixed_point_number) + (unsigned_number) +] @number [ (net_type) - (integer_vector_type) - (integer_atom_type) + (data_type) + (time_unit) ] @type.builtin -[ - "signed" - "unsigned" - "input" - "output" -] @keyword.modifier +; variable +(list_of_variable_decl_assignments + (variable_decl_assignment + name: (simple_identifier) @variable)) -(data_type - (simple_identifier) @type) +(hierarchical_identifier + (simple_identifier) @variable) + +(tf_port_item + (simple_identifier) @variable) + +port_name: (simple_identifier) @variable + +(port + (simple_identifier) @variable) + +(list_of_port_identifiers + (simple_identifier) @variable) + +(net_lvalue + (simple_identifier) @variable) + +(sequence_port_item + (simple_identifier) @variable) + +(property_port_item + (simple_identifier) @variable) + +(net_decl_assignment + (simple_identifier) @variable) + +(ERROR + (simple_identifier) @variable) + +; variable.member +(hierarchical_identifier + (simple_identifier) + (simple_identifier) @variable.member) + +(select + (simple_identifier) @variable.member) + +(named_port_connection + port_name: (simple_identifier) @variable.member) +(ordered_port_connection + (expression + (primary + (hierarchical_identifier + (simple_identifier) @variable.member)))) + +(coverage_option + (simple_identifier) @variable.member) + +; variable.builtin (method_call_body - (method_identifier) @variable.member) + arguments: (list_of_arguments + (expression) @variable.builtin + (#any-of? @variable.builtin "this"))) -(interface_identifier - (simple_identifier) @type) +(implicit_class_handle) @variable.builtin -(modport_identifier - (modport_identifier - (simple_identifier) @variable.member)) +; variable.parameter +(named_parameter_assignment + (simple_identifier) @variable.parameter) -(net_port_type1 - (simple_identifier) @type) +(parameter_declaration + (list_of_param_assignments + (param_assignment + (simple_identifier) @variable.parameter))) -[ - (double_quoted_string) - (string_literal) -] @string +(local_parameter_declaration + (list_of_param_assignments + (param_assignment + (simple_identifier) @variable.parameter))) +; function builtin [ - (default_nettype_compiler_directive) - (timescale_compiler_directive) -] @keyword.directive + (simulation_control_task) + (system_tf_identifier) + (severity_system_task) + (randomize_call) + (array_or_queue_method_name) + "new" +] @function.builtin -(include_compiler_directive) @keyword.import +; declaration +(task_body_declaration + . + name: (simple_identifier) @function + (simple_identifier)? @label) -; begin/end label -(seq_block - (simple_identifier) @comment) +(function_body_declaration + . + name: (simple_identifier) @function + (simple_identifier)? @label) -[ - ";" - "::" - ":" - "," - "." -] @punctuation.delimiter +(function_body_declaration + . + (data_type_or_void) + name: (simple_identifier) @function + (simple_identifier)? @label) -(conditional_expression - [ - "?" - ":" - ] @keyword.conditional.ternary) +(clocking_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) -(default_nettype_compiler_directive - (default_nettype_value) @string) +(sequence_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) + +(property_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) + +(class_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) -(text_macro_identifier - (simple_identifier) @constant) +(interface_class_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) + +(covergroup_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) + +(package_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) + +(checker_declaration + . + name: (simple_identifier) @constructor + (simple_identifier)? @label) + +(interface_declaration + . + [ + (simple_identifier) @constructor + (interface_nonansi_header + (simple_identifier) @constructor) + (interface_ansi_header + (simple_identifier) @constructor) + ] + (simple_identifier)? @label) (module_declaration - (module_header - (simple_identifier) @constructor)) + . + [ + (simple_identifier) @constructor + (module_nonansi_header + (simple_identifier) @constructor) + (module_ansi_header + (simple_identifier) @constructor) + ] + (simple_identifier)? @label) -(class_constructor_declaration - "new" @constructor) +(program_declaration + . + [ + (simple_identifier) @constructor + (program_nonansi_header + (simple_identifier) @constructor) + (program_ansi_header + (simple_identifier) @constructor) + ] + (simple_identifier)? @label) -(parameter_identifier - (simple_identifier) @variable.parameter) +; function.call +(method_call_body + name: (simple_identifier) @function.call) -[ - (integral_number) - (unsigned_number) - (unbased_unsized_literal) -] @number +(tf_call + (hierarchical_identifier + (simple_identifier) @function.call)) -(time_unit) @type.builtin +; instance +(module_instantiation + instance_type: (simple_identifier) @constructor) -(checker_instantiation - (checker_identifier +(name_of_instance + instance_name: (simple_identifier) @module) + +(sequence_instance + (hierarchical_identifier + (simple_identifier) @module)) + +(udp_instantiation + (simple_identifier) @constructor) + +(ansi_port_declaration + (interface_port_header + interface_name: (simple_identifier) @variable + modport_name: (simple_identifier) @variable.member) + port_name: (simple_identifier) @variable) + +; bind +(bind_directive + (bind_target_scope (simple_identifier) @constructor)) -(module_instantiation +(bind_target_instance + (hierarchical_identifier + (simple_identifier) @module)) + +; assertion +(concurrent_assertion_item + (simple_identifier) @label) + +; converge +(cover_point + name: (simple_identifier) @label) + +(cover_cross + name: (simple_identifier) @module) + +(list_of_cross_items (simple_identifier) @constructor) -(name_of_instance - (instance_identifier - (simple_identifier) @variable)) +;package +(package_import_item + (simple_identifier) @constructor) -(interface_port_declaration - (interface_identifier - (simple_identifier) @type)) +; label +(seq_block + (simple_identifier) @label) -(net_declaration +(statement + block_name: (simple_identifier) @label) + +; dpi +(dpi_spec_string) @string + +c_name: (c_identifier) @function + +(dpi_import_export + name: (simple_identifier) @function) + +; type def +(class_type + (simple_identifier) @constructor) + +(class_type + (simple_identifier) (simple_identifier) @type) -(lifetime) @keyword.modifier +(data_type + (class_scope + (class_type + (simple_identifier) @constructor))) -(function_identifier - (function_identifier - (simple_identifier) @function)) +(task_prototype + name: (simple_identifier) @function) -(function_subroutine_call - (subroutine_call - (tf_call - (simple_identifier) @function))) +(function_prototype + name: (simple_identifier) @function) -(function_subroutine_call - (subroutine_call - (system_tf_call - (system_tf_identifier) @function.builtin))) +(type_assignment + name: (simple_identifier) @type.definition) -(task_identifier - (task_identifier - (simple_identifier) @function.method)) +(interface_class_type + (simple_identifier) @type.definition) -;TODO: fixme -;(assignment_pattern_expression -;(assignment_pattern -;(parameter_identifier) @variable.member)) -(type_declaration - (data_type - "packed" @keyword.modifier)) +(package_scope + (simple_identifier) @constructor) -(enum_name_declaration - (enum_identifier - (simple_identifier) @constant)) +(data_declaration + (type_declaration + type_name: (simple_identifier) @type.definition)) -(type_declaration +(net_declaration (simple_identifier) @type) +(constraint_declaration + (simple_identifier) @constructor) + +(method_call + (primary + (hierarchical_identifier + (simple_identifier) @constructor))) + +(string_literal + (quoted_string) @string) + +; include +(include_statement + (file_path_spec) @string.special.path) + +; directive [ - (integer_atom_type) - (non_integer_type) - "genvar" -] @type.builtin + "directive_define" + "directive_default_nettype" + "directive_resetall" + "directive_timescale" + "directive_undef" + "directive_undefineall" + "directive_ifdef" + "directive_elsif" + "directive_endif" + "directive_else" +] @keyword.directive.define -(struct_union_member - (list_of_variable_decl_assignments - (variable_decl_assignment - (simple_identifier) @variable.member))) +(include_compiler_directive + (quoted_string) @string.special.path) -(member_identifier - (simple_identifier) @variable.member) +(include_compiler_directive + (system_lib_string) @string) + +(default_nettype_compiler_directive + (default_nettype_value) @type.builtin) -(struct_union_member - (data_type_or_void - (data_type - (simple_identifier) @type))) +(text_macro_definition + (text_macro_name + (simple_identifier) @keyword.directive)) -(type_declaration - (simple_identifier) @type) +(text_macro_usage) @keyword.directive -(generate_block_identifier) @comment +(ifdef_condition + (simple_identifier) @keyword.directive) -[ - "[" - "]" - "(" - ")" - "{" - "}" - "'{" -] @punctuation.bracket +(undefine_compiler_directive + (simple_identifier) @keyword.directive) diff --git a/queries/verilog/injections.scm b/queries/verilog/injections.scm index 2f0e58eb6..05aa24d8f 100644 --- a/queries/verilog/injections.scm +++ b/queries/verilog/injections.scm @@ -1,2 +1,5 @@ ((comment) @injection.content (#set! injection.language "comment")) + +((macro_text) @injection.content + (#set! injection.language "verilog")) diff --git a/queries/verilog/locals.scm b/queries/verilog/locals.scm deleted file mode 100644 index e9ed89169..000000000 --- a/queries/verilog/locals.scm +++ /dev/null @@ -1,60 +0,0 @@ -[ - (loop_generate_construct) - (loop_statement) - (conditional_statement) - (case_item) - (function_declaration) - (always_construct) - (module_declaration) -] @local.scope - -(data_declaration - (list_of_variable_decl_assignments - (variable_decl_assignment - (simple_identifier) @local.definition.var))) - -(genvar_initialization - (genvar_identifier - (simple_identifier) @local.definition.var)) - -(for_initialization - (for_variable_declaration - (simple_identifier) @local.definition.var)) - -(net_declaration - (list_of_net_decl_assignments - (net_decl_assignment - (simple_identifier) @local.definition.var))) - -(ansi_port_declaration - (port_identifier - (simple_identifier) @local.definition.var)) - -(parameter_declaration - (list_of_param_assignments - (param_assignment - (parameter_identifier - (simple_identifier) @local.definition.parameter)))) - -(local_parameter_declaration - (list_of_param_assignments - (param_assignment - (parameter_identifier - (simple_identifier) @local.definition.parameter)))) - -; TODO: fixme -;(function_declaration -;(function_identifier -;(simple_identifier) @local.definition.function)) -(function_declaration - (function_body_declaration - (function_identifier - (function_identifier - (simple_identifier) @local.definition.function)))) - -(tf_port_item1 - (port_identifier - (simple_identifier) @local.definition.parameter)) - -; too broad, now includes types etc -(simple_identifier) @local.reference |
