mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(verilog)!: use systemverilog parser and queries (#7170)
This commit is contained in:
parent
596b16da17
commit
b139d21726
10 changed files with 500 additions and 897 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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((macro_text) @injection.content
|
||||
(#set! injection.language "systemverilog"))
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,84 +169,28 @@
|
|||
">>"
|
||||
"<<"
|
||||
"|="
|
||||
"|=>"
|
||||
"|->"
|
||||
">>>"
|
||||
"<<<"
|
||||
"->>"
|
||||
"->"
|
||||
"=>"
|
||||
"*>"
|
||||
".*"
|
||||
(unary_operator)
|
||||
(inc_or_dec_operator)
|
||||
"#"
|
||||
(queue_dimension)
|
||||
] @operator
|
||||
|
||||
(parameter_port_list
|
||||
"#" @constructor)
|
||||
|
||||
[
|
||||
"or"
|
||||
"and"
|
||||
] @keyword.operator
|
||||
|
||||
(cast
|
||||
[
|
||||
"'"
|
||||
"("
|
||||
")"
|
||||
] @operator)
|
||||
|
||||
(edge_identifier) @attribute
|
||||
|
||||
(port_direction) @keyword.modifier
|
||||
|
||||
(port_identifier
|
||||
(simple_identifier) @variable)
|
||||
|
||||
[
|
||||
(net_type)
|
||||
(integer_vector_type)
|
||||
(integer_atom_type)
|
||||
] @type.builtin
|
||||
|
||||
[
|
||||
"signed"
|
||||
"unsigned"
|
||||
"input"
|
||||
"output"
|
||||
] @keyword.modifier
|
||||
|
||||
(data_type
|
||||
(simple_identifier) @type)
|
||||
|
||||
(method_call_body
|
||||
(method_identifier) @variable.member)
|
||||
|
||||
(interface_identifier
|
||||
(simple_identifier) @type)
|
||||
|
||||
(modport_identifier
|
||||
(modport_identifier
|
||||
(simple_identifier) @variable.member))
|
||||
|
||||
(net_port_type1
|
||||
(simple_identifier) @type)
|
||||
|
||||
[
|
||||
(double_quoted_string)
|
||||
(string_literal)
|
||||
] @string
|
||||
|
||||
[
|
||||
(default_nettype_compiler_directive)
|
||||
(timescale_compiler_directive)
|
||||
] @keyword.directive
|
||||
|
||||
(include_compiler_directive) @keyword.import
|
||||
|
||||
; begin/end label
|
||||
(seq_block
|
||||
(simple_identifier) @comment)
|
||||
"#" @constructor
|
||||
|
||||
[
|
||||
";"
|
||||
"::"
|
||||
":"
|
||||
","
|
||||
"."
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
(conditional_expression
|
||||
|
|
@ -206,107 +199,6 @@
|
|||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(default_nettype_compiler_directive
|
||||
(default_nettype_value) @string)
|
||||
|
||||
(text_macro_identifier
|
||||
(simple_identifier) @constant)
|
||||
|
||||
(module_declaration
|
||||
(module_header
|
||||
(simple_identifier) @constructor))
|
||||
|
||||
(class_constructor_declaration
|
||||
"new" @constructor)
|
||||
|
||||
(parameter_identifier
|
||||
(simple_identifier) @variable.parameter)
|
||||
|
||||
[
|
||||
(integral_number)
|
||||
(unsigned_number)
|
||||
(unbased_unsized_literal)
|
||||
] @number
|
||||
|
||||
(time_unit) @type.builtin
|
||||
|
||||
(checker_instantiation
|
||||
(checker_identifier
|
||||
(simple_identifier) @constructor))
|
||||
|
||||
(module_instantiation
|
||||
(simple_identifier) @constructor)
|
||||
|
||||
(name_of_instance
|
||||
(instance_identifier
|
||||
(simple_identifier) @variable))
|
||||
|
||||
(interface_port_declaration
|
||||
(interface_identifier
|
||||
(simple_identifier) @type))
|
||||
|
||||
(net_declaration
|
||||
(simple_identifier) @type)
|
||||
|
||||
(lifetime) @keyword.modifier
|
||||
|
||||
(function_identifier
|
||||
(function_identifier
|
||||
(simple_identifier) @function))
|
||||
|
||||
(function_subroutine_call
|
||||
(subroutine_call
|
||||
(tf_call
|
||||
(simple_identifier) @function)))
|
||||
|
||||
(function_subroutine_call
|
||||
(subroutine_call
|
||||
(system_tf_call
|
||||
(system_tf_identifier) @function.builtin)))
|
||||
|
||||
(task_identifier
|
||||
(task_identifier
|
||||
(simple_identifier) @function.method))
|
||||
|
||||
;TODO: fixme
|
||||
;(assignment_pattern_expression
|
||||
;(assignment_pattern
|
||||
;(parameter_identifier) @variable.member))
|
||||
(type_declaration
|
||||
(data_type
|
||||
"packed" @keyword.modifier))
|
||||
|
||||
(enum_name_declaration
|
||||
(enum_identifier
|
||||
(simple_identifier) @constant))
|
||||
|
||||
(type_declaration
|
||||
(simple_identifier) @type)
|
||||
|
||||
[
|
||||
(integer_atom_type)
|
||||
(non_integer_type)
|
||||
"genvar"
|
||||
] @type.builtin
|
||||
|
||||
(struct_union_member
|
||||
(list_of_variable_decl_assignments
|
||||
(variable_decl_assignment
|
||||
(simple_identifier) @variable.member)))
|
||||
|
||||
(member_identifier
|
||||
(simple_identifier) @variable.member)
|
||||
|
||||
(struct_union_member
|
||||
(data_type_or_void
|
||||
(data_type
|
||||
(simple_identifier) @type)))
|
||||
|
||||
(type_declaration
|
||||
(simple_identifier) @type)
|
||||
|
||||
(generate_block_identifier) @comment
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
|
|
@ -316,3 +208,388 @@
|
|||
"}"
|
||||
"'{"
|
||||
] @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)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((macro_text) @injection.content
|
||||
(#set! injection.language "verilog"))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue