alemuller / tree-sitter-vhdl

VHDL grammar for tree-sitter
MIT License
29 stars 9 forks source link

Missing some comments #4

Closed qarlosalberto closed 1 year ago

qarlosalberto commented 1 year ago
use ieee.std_logic_1164.all;

entity test_entity_name is
generic (
    a : integer;
    b : std_logic := '1';
    c, d : std_logic_vector(1 downto 0)
  );
port(
  --! over comment 0
  x: in std_logic;
  y: out std_logic; --! inline comment 0
  z: inout std_logic;
  --! over comment 1
  m: in std_logic_vector(31 downto 0); --! inline comment
  b: in std_logic_vector(31 downto 0) := "0010";
  --! over comment 2
  c,d : in std_logic := '1' --! inline comment 2
);
end test_entity_name;  

architecture e_arch of test_entity_name is
  --! test signal
  signal a : integer;
  signal b,c : std_logic_vector(1 downto 0);

  constant d : integer;
  constant e,f : integer := 0;

  function counter(minutes : integer := 0; seconds : integer := 0) 
    return integer is variable total_seconds : integer;
  begin
  end function;

  type state_0 is (INIT, END);

  begin 

--! test process
label_0: process begin
end process; 

label_1: process (clk0, reset) begin
end process;

process begin
end process;
  uut_0 : half_adder port map (a => a, b => b);
  half_adder port map (a => a, b => b);
end e_arch;```

The comment "--! test signal" is missing in the syntax tree

bpadalino commented 1 year ago

I just tested this and I don't see the issue. Attached is the output of tree-sitter parse. Note the comment on line 22 (0 based indexing for line numbers). If I add (comment) @comment to the highlights, it shows up highlighted as a comment in tree-sitter highlight.

syntax-tree.txt

qarlosalberto commented 1 year ago

You are right.