Skip to content

Commit

Permalink
Added "constant" and "generic" fields to constant and generic identif…
Browse files Browse the repository at this point in the history
…iers
  • Loading branch information
jpt13653903 committed Jul 7, 2024
1 parent cc8935b commit e3f4e9c
Show file tree
Hide file tree
Showing 10 changed files with 134,572 additions and 133,641 deletions.
Binary file modified examples/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/Screenshot.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ end package body interfaces;
--------------------------------------------------------------------------------

entity Processor is
generic(CLK_FREQ : integer);
port(
clk, rst : in std_logic;
adc_data : view streaming_slave;
Expand Down
36 changes: 32 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ module.exports = grammar({
),

constant_declaration: $ => seq(
alias($.CONSTANT, "constant"), $.identifier_list, ":", $.subtype_indication, optional($.initialiser), ";"
alias($.CONSTANT, "constant"), alias($.constant_identifier_list, $.identifier_list), ":", $.subtype_indication, optional($.initialiser), ";"
),

signal_declaration: $ => seq(
Expand Down Expand Up @@ -1539,6 +1539,26 @@ module.exports = grammar({
),

// Interface Declaration
generic_interface_list: $ => seq(
$._generic_interface_declaration, repeat(seq(";", $._generic_interface_declaration)), optional(";")
),

_generic_interface_declaration: $ => choice(
alias($.generic_interface_declaration, $.interface_declaration),
$.interface_constant_declaration,
$.interface_signal_declaration,
$.interface_variable_declaration,
$.interface_file_declaration,

$.interface_type_declaration,
$.interface_subprogram_declaration,
$.interface_package_declaration
),

generic_interface_declaration: $ => seq(
alias($.generic_identifier_list, $.identifier_list), ":", $._mode_indication
),

interface_list: $ => seq(
$._interface_declaration, repeat(seq(";", $._interface_declaration)), optional(";")
),
Expand All @@ -1560,7 +1580,7 @@ module.exports = grammar({
),

interface_constant_declaration: $ => seq(
alias($.CONSTANT, "constant"), $.identifier_list, ":", $._mode_indication
alias($.CONSTANT, "constant"), alias($.constant_identifier_list, $.identifier_list), ":", $._mode_indication
),

interface_signal_declaration: $ => seq(
Expand Down Expand Up @@ -1632,6 +1652,14 @@ module.exports = grammar({
$.operator_symbol
),

generic_identifier_list: $ => seq(
field("generic", $._identifier), repeat(seq(",", field("generic", $._identifier)))
),

constant_identifier_list: $ => seq(
field("constant", $._identifier), repeat(seq(",", field("constant", $._identifier)))
),

identifier_list: $ => seq(
$._identifier, repeat(seq(",", $._identifier))
),
Expand Down Expand Up @@ -1779,11 +1807,11 @@ module.exports = grammar({
),

generic_clause: $ => seq(
alias($.GENERIC, "generic"), "(", $.interface_list, ")", ";"
alias($.GENERIC, "generic"), "(", alias($.generic_interface_list, $.interface_list), ")", ";"
),

subprogram_header: $ => seq(
alias($.GENERIC, "generic"), "(", $.interface_list, ")", optional($.generic_map_aspect)
alias($.GENERIC, "generic"), "(", alias($.generic_interface_list, $.interface_list), ")", optional($.generic_map_aspect)
),

_subprogram_specification: $ => choice(
Expand Down
1 change: 1 addition & 0 deletions queries/Helix/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
(_ procedure: (_) @function.method)
(_ attribute: (_) @attribute)
(_ constant: (_) @constant)
(_ generic: (_) @variable.parameter)

(_ view: (name (_)) @type)
(_ type: (name (_)) @type)
Expand Down
1 change: 1 addition & 0 deletions queries/Neovim/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
(_ procedure: (_) @function.method)
(_ attribute: (_) @attribute)
(_ constant: (_) @constant)
(_ generic: (_) @variable.parameter)

(_ view: (name (_)) @type)
(_ type: (name (_)) @type)
Expand Down
203 changes: 195 additions & 8 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e3f4e9c

Please sign in to comment.