nvim-treesitter/queries/verilog/highlights.scm

313 lines
4.4 KiB
Scheme
Raw Normal View History

2020-08-28 18:11:10 +02:00
; Keywords
[
2023-02-23 20:30:36 +01:00
; block delimiters
(module_keyword)
2020-08-28 18:11:10 +02:00
"endmodule"
"program"
"endprogram"
2020-08-28 18:11:10 +02:00
"class"
"endclass"
2020-11-18 21:38:22 +01:00
"interface"
"endinterface"
2020-11-18 21:38:58 +01:00
"package"
"endpackage"
"checker"
"endchecker"
"config"
"endconfig"
"pure"
"virtual"
"extends"
"implements"
"super"
(class_item_qualifier)
"parameter"
"localparam"
"defparam"
"assign"
"typedef"
"modport"
2020-11-18 21:38:58 +01:00
"fork"
"join"
"join_none"
"join_any"
"default"
"break"
2020-11-18 21:38:58 +01:00
"assert"
"tagged"
"extern"
2022-10-28 17:08:00 +03:00
(unique_priority)
2020-08-28 18:11:10 +02:00
] @keyword
[
"function"
"endfunction"
"task"
"endtask"
] @keyword.function
"return" @keyword.return
2020-11-18 21:38:58 +01:00
[
"begin"
"end"
] @label
2020-08-28 18:11:10 +02:00
[
(always_keyword)
"generate"
"for"
"foreach"
"repeat"
"forever"
2020-11-18 21:38:58 +01:00
"initial"
2020-08-28 18:11:10 +02:00
"while"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.repeat
2020-08-28 18:11:10 +02:00
[
"if"
"else"
(case_keyword)
"endcase"
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.conditional
2020-08-28 18:11:10 +02:00
2022-09-26 10:19:02 +01:00
(comment) @comment @spell
2020-08-28 18:11:10 +02:00
(include_compiler_directive) @constant.macro
2024-01-06 15:05:50 +09:00
2020-08-28 18:11:10 +02:00
(package_import_declaration
2024-01-06 15:05:50 +09:00
"import" @keyword.import)
2020-08-28 18:11:10 +02:00
(package_import_declaration
2024-01-06 15:05:50 +09:00
(package_import_item
(package_identifier
(simple_identifier) @constant)))
2020-08-28 18:11:10 +02:00
(text_macro_identifier
2024-01-06 15:05:50 +09:00
(simple_identifier) @constant.macro)
2020-08-28 18:11:10 +02:00
(package_scope
2024-01-06 15:05:50 +09:00
(package_identifier
(simple_identifier) @constant))
2020-08-28 18:11:10 +02:00
2020-11-18 21:38:58 +01:00
(package_declaration
2024-01-06 15:05:50 +09:00
(package_identifier
(simple_identifier) @constant))
2020-11-18 21:38:58 +01:00
(parameter_port_list
2024-01-06 15:05:50 +09:00
"#" @constructor)
2020-08-28 18:11:10 +02:00
[
"="
"-"
"+"
"/"
"*"
"^"
"&"
"|"
"&&"
"||"
":"
"{"
"}"
"'{"
"<="
"@"
"=="
"!="
"==="
"!=="
"-:"
"<"
">"
">="
"%"
">>"
"<<"
"|="
2022-10-28 17:08:00 +03:00
(unary_operator)
(inc_or_dec_operator)
2020-08-28 18:11:10 +02:00
] @operator
2022-10-28 17:08:00 +03:00
[
"or"
"and"
] @keyword.operator
2020-08-28 18:11:10 +02:00
(cast
2024-01-06 15:05:50 +09:00
[
"'"
"("
")"
] @operator)
2020-08-28 18:11:10 +02:00
(edge_identifier) @attribute
(port_direction) @label
2024-01-06 15:05:50 +09:00
2020-08-28 18:11:10 +02:00
(port_identifier
2024-01-06 15:05:50 +09:00
(simple_identifier) @variable)
2020-08-28 18:11:10 +02:00
[
(net_type)
(integer_vector_type)
(integer_atom_type)
] @type.builtin
[
"signed"
"unsigned"
2022-10-28 17:08:00 +03:00
] @type.qualifier
2020-08-28 18:11:10 +02:00
(data_type
2024-01-06 15:05:50 +09:00
(simple_identifier) @type)
2020-08-28 18:11:10 +02:00
(method_call_body
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(method_identifier) @variable.member)
2020-08-28 18:11:10 +02:00
(interface_identifier
2024-01-06 15:05:50 +09:00
(simple_identifier) @type)
(modport_identifier
2024-01-06 15:05:50 +09:00
(modport_identifier
(simple_identifier) @variable.member))
(net_port_type1
2024-01-06 15:05:50 +09:00
(simple_identifier) @type)
2020-11-18 21:38:58 +01:00
[
(double_quoted_string)
(string_literal)
] @string
2020-08-28 18:11:10 +02:00
[
(default_nettype_compiler_directive)
(timescale_compiler_directive)
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
] @keyword.directive
2022-10-28 17:08:00 +03:00
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(include_compiler_directive) @keyword.import
2020-08-28 18:11:10 +02:00
; begin/end label
2020-08-28 18:11:10 +02:00
(seq_block
2024-01-06 15:05:50 +09:00
(simple_identifier) @comment)
2020-08-28 18:11:10 +02:00
[
2024-01-06 15:05:50 +09:00
";"
"::"
","
"."
2020-08-28 18:11:10 +02:00
] @punctuation.delimiter
2020-08-28 18:11:10 +02:00
(default_nettype_compiler_directive
2024-01-06 15:05:50 +09:00
(default_nettype_value) @string)
2020-08-28 18:11:10 +02:00
(text_macro_identifier
2024-01-06 15:05:50 +09:00
(simple_identifier) @constant)
2020-08-28 18:11:10 +02:00
(module_declaration
2024-01-06 15:05:50 +09:00
(module_header
(simple_identifier) @constructor))
2020-08-28 18:11:10 +02:00
(class_constructor_declaration
2024-01-06 15:05:50 +09:00
"new" @constructor)
2020-08-28 18:11:10 +02:00
(parameter_identifier
2024-01-06 15:05:50 +09:00
(simple_identifier) @variable.parameter)
2020-08-28 18:11:10 +02:00
[
(integral_number)
(unsigned_number)
(unbased_unsized_literal)
] @number
(time_unit) @attribute
(checker_instantiation
2024-01-06 15:05:50 +09:00
(checker_identifier
(simple_identifier) @constructor))
2020-08-28 18:11:10 +02:00
(module_instantiation
2024-01-06 15:05:50 +09:00
(simple_identifier) @constructor)
2020-08-28 18:11:10 +02:00
(name_of_instance
2024-01-06 15:05:50 +09:00
(instance_identifier
(simple_identifier) @variable))
2020-08-28 18:11:10 +02:00
(interface_port_declaration
2024-01-06 15:05:50 +09:00
(interface_identifier
(simple_identifier) @type))
2020-08-28 18:11:10 +02:00
(net_declaration
2024-01-06 15:05:50 +09:00
(simple_identifier) @type)
2020-08-28 18:11:10 +02:00
(lifetime) @label
2024-01-06 15:05:50 +09:00
(function_identifier
(function_identifier
(simple_identifier) @function))
2020-08-28 18:11:10 +02:00
2024-01-06 15:05:50 +09:00
(function_subroutine_call
(subroutine_call
(tf_call
(simple_identifier) @function)))
2020-08-28 18:11:10 +02:00
2024-01-06 15:05:50 +09:00
(function_subroutine_call
(subroutine_call
(system_tf_call
(system_tf_identifier) @function.builtin)))
2020-08-28 18:11:10 +02:00
(task_identifier
2024-01-06 15:05:50 +09:00
(task_identifier
(simple_identifier) @function.method))
2024-01-06 15:05:50 +09:00
;TODO: fixme
2021-03-10 12:00:02 +01:00
;(assignment_pattern_expression
2024-01-06 15:05:50 +09:00
;(assignment_pattern
;(parameter_identifier) @variable.member))
2020-08-28 18:11:10 +02:00
(type_declaration
2024-01-06 15:05:50 +09:00
(data_type
"packed" @type.qualifier))
2020-08-28 18:11:10 +02:00
(struct_union) @type
2024-01-06 15:05:50 +09:00
"enum" @type
2020-11-18 21:38:58 +01:00
(enum_name_declaration
2024-01-06 15:05:50 +09:00
(enum_identifier
(simple_identifier) @constant))
2020-11-18 21:38:58 +01:00
2020-08-28 18:11:10 +02:00
(type_declaration
2024-01-06 15:05:50 +09:00
(simple_identifier) @type)
2020-08-28 18:11:10 +02:00
[
(integer_atom_type)
(non_integer_type)
"genvar"
2020-08-28 18:11:10 +02:00
] @type.builtin
(struct_union_member
2024-01-06 15:05:50 +09:00
(list_of_variable_decl_assignments
(variable_decl_assignment
(simple_identifier) @variable.member)))
2020-08-28 18:11:10 +02:00
(member_identifier
2024-01-06 15:05:50 +09:00
(simple_identifier) @variable.member)
2020-08-28 18:11:10 +02:00
(struct_union_member
2024-01-06 15:05:50 +09:00
(data_type_or_void
(data_type
(simple_identifier) @type)))
2020-08-28 18:11:10 +02:00
(type_declaration
2024-01-06 15:05:50 +09:00
(simple_identifier) @type)
(generate_block_identifier) @comment
[
"["
"]"
"("
")"
] @punctuation.bracket