- 
                Notifications
    
You must be signed in to change notification settings  - Fork 39
 
Open
Description
Please also see nvim-treesitter/nvim-treesitter#6616.
The following code fails to properly parse:
module test();
generate
  for (unit = 0; unit < `UNITS; unit += 1) begin
    always_ff @(posedge clk) begin
      output_mem[unit][store_addr[unit]] <= store_data[unit];
      fetch_data[unit] <= output_mem[unit][fetch_addr[unit]];
      rnd_locval[unit] <= rnd_loc[rnd_addr + unit];
      rnd_weight[unit] <= rnd_mem[rnd_addr + unit];
      accum_input[unit] <= output_mem[unit][accum_in_addr];
    end
  end
endgenerate
always_comb begin
end
endmoduleRemoving any of the lines (or reordering) fixes it. But so does having and incomplete block ... (remove the always_ff line).
This is the syntax tree:
(ERROR ; [0, 0] - [18, 0]
  (module_header ; [0, 0] - [0, 11]
    (module_keyword) ; [0, 0] - [0, 6]
    (simple_identifier)) ; [0, 7] - [0, 11]
  (module_nonansi_header ; [0, 11] - [0, 13]
    (list_of_ports)) ; [0, 11] - [0, 13]
  (genvar_initialization ; [3, 7] - [3, 15]
    (genvar_identifier ; [3, 7] - [3, 11]
      (simple_identifier)) ; [3, 7] - [3, 11]
    (constant_expression ; [3, 14] - [3, 15]
      (constant_primary ; [3, 14] - [3, 15]
        (primary_literal ; [3, 14] - [3, 15]
          (integral_number ; [3, 14] - [3, 15]
            (decimal_number ; [3, 14] - [3, 15]
              (unsigned_number))))))) ; [3, 14] - [3, 15]
  (constant_expression ; [3, 17] - [3, 30]
    (constant_expression ; [3, 17] - [3, 21]
      (constant_primary ; [3, 17] - [3, 21]
        (parameter_identifier ; [3, 17] - [3, 21]
          (simple_identifier)))) ; [3, 17] - [3, 21]
    (constant_expression ; [3, 24] - [3, 30]
      (constant_primary ; [3, 24] - [3, 30]
        (primary_literal ; [3, 24] - [3, 30]
          (simple_text_macro_usage ; [3, 24] - [3, 30]
            (text_macro_identifier ; [3, 25] - [3, 30]
              (simple_identifier))))))) ; [3, 25] - [3, 30]
  (genvar_iteration ; [3, 32] - [3, 41]
    (genvar_identifier ; [3, 32] - [3, 36]
      (simple_identifier)) ; [3, 32] - [3, 36]
    (assignment_operator) ; [3, 37] - [3, 39]
    (constant_expression ; [3, 40] - [3, 41]
      (constant_primary ; [3, 40] - [3, 41]
        (primary_literal ; [3, 40] - [3, 41]
          (integral_number ; [3, 40] - [3, 41]
            (decimal_number ; [3, 40] - [3, 41]
              (unsigned_number))))))) ; [3, 40] - [3, 41]
  (always_keyword) ; [4, 4] - [4, 13]
  (event_control ; [4, 14] - [4, 28]
    (event_expression ; [4, 16] - [4, 27]
      (edge_identifier) ; [4, 16] - [4, 23]
      (expression ; [4, 24] - [4, 27]
        (primary ; [4, 24] - [4, 27]
          (simple_identifier))))) ; [4, 24] - [4, 27]
  (clockvar ; [5, 6] - [5, 16]
    (simple_identifier)) ; [5, 6] - [5, 16]
  (bit_select1 ; [5, 16] - [5, 22]
    (expression ; [5, 17] - [5, 21]
      (primary ; [5, 17] - [5, 21]
        (simple_identifier)))) ; [5, 17] - [5, 21]
  (expression ; [5, 23] - [6, 22]
    (expression ; [5, 23] - [5, 39]
      (primary ; [5, 23] - [5, 39]
        (simple_identifier) ; [5, 23] - [5, 33]
        (select1 ; [5, 33] - [5, 39]
          (bit_select1 ; [5, 33] - [5, 39]
            (expression ; [5, 34] - [5, 38]
              (primary ; [5, 34] - [5, 38]
                (simple_identifier))))))) ; [5, 34] - [5, 38]
    (ERROR) ; [5, 39] - [5, 40]
    (ERROR ; [5, 44] - [5, 61]
      (variable_lvalue ; [5, 44] - [5, 60]
        (simple_identifier) ; [5, 44] - [5, 54]
        (select1 ; [5, 54] - [5, 60]
          (bit_select1 ; [5, 54] - [5, 60]
            (expression ; [5, 55] - [5, 59]
              (primary ; [5, 55] - [5, 59]
                (simple_identifier))))))) ; [5, 55] - [5, 59]
    (expression ; [6, 6] - [6, 22]
      (primary ; [6, 6] - [6, 22]
        (simple_identifier) ; [6, 6] - [6, 16]
        (select1 ; [6, 16] - [6, 22]
          (bit_select1 ; [6, 16] - [6, 22]
            (expression ; [6, 17] - [6, 21]
              (primary ; [6, 17] - [6, 21]
                (simple_identifier)))))))) ; [6, 17] - [6, 21]
  (simple_identifier) ; [6, 26] - [6, 36]
  (constant_bit_select1 ; [6, 36] - [9, 58]
    (constant_expression ; [6, 37] - [6, 41]
      (constant_primary ; [6, 37] - [6, 41]
        (parameter_identifier ; [6, 37] - [6, 41]
          (simple_identifier)))) ; [6, 37] - [6, 41]
    (constant_expression ; [6, 43] - [6, 59]
      (constant_primary ; [6, 43] - [6, 59]
        (parameter_identifier ; [6, 43] - [6, 53]
          (simple_identifier)) ; [6, 43] - [6, 53]
        (constant_select1 ; [6, 53] - [6, 59]
          (constant_expression ; [6, 54] - [6, 58]
            (constant_primary ; [6, 54] - [6, 58]
              (parameter_identifier ; [6, 54] - [6, 58]
                (simple_identifier))))))) ; [6, 54] - [6, 58]
    (ERROR ; [6, 60] - [7, 16]
      (simple_identifier)) ; [7, 6] - [7, 16]
    (constant_expression ; [7, 17] - [7, 21]
      (constant_primary ; [7, 17] - [7, 21]
        (parameter_identifier ; [7, 17] - [7, 21]
          (simple_identifier)))) ; [7, 17] - [7, 21]
    (ERROR ; [7, 23] - [7, 33]
      (simple_identifier)) ; [7, 26] - [7, 33]
    (constant_expression ; [7, 34] - [7, 49]
      (constant_expression ; [7, 34] - [7, 42]
        (constant_primary ; [7, 34] - [7, 42]
          (parameter_identifier ; [7, 34] - [7, 42]
            (simple_identifier)))) ; [7, 34] - [7, 42]
      (constant_expression ; [7, 45] - [7, 49]
        (constant_primary ; [7, 45] - [7, 49]
          (parameter_identifier ; [7, 45] - [7, 49]
            (simple_identifier))))) ; [7, 45] - [7, 49]
    (ERROR ; [7, 50] - [8, 16]
      (simple_identifier)) ; [8, 6] - [8, 16]
    (constant_expression ; [8, 17] - [8, 21]
      (constant_primary ; [8, 17] - [8, 21]
        (parameter_identifier ; [8, 17] - [8, 21]
          (simple_identifier)))) ; [8, 17] - [8, 21]
    (ERROR ; [8, 23] - [8, 33]
      (simple_identifier)) ; [8, 26] - [8, 33]
    (constant_expression ; [8, 34] - [8, 49]
      (constant_expression ; [8, 34] - [8, 42]
        (constant_primary ; [8, 34] - [8, 42]
          (parameter_identifier ; [8, 34] - [8, 42]
            (simple_identifier)))) ; [8, 34] - [8, 42]
      (constant_expression ; [8, 45] - [8, 49]
        (constant_primary ; [8, 45] - [8, 49]
          (parameter_identifier ; [8, 45] - [8, 49]
            (simple_identifier))))) ; [8, 45] - [8, 49]
    (ERROR ; [8, 50] - [9, 17]
      (simple_identifier)) ; [9, 6] - [9, 17]
    (constant_expression ; [9, 18] - [9, 22]
      (constant_primary ; [9, 18] - [9, 22]
        (parameter_identifier ; [9, 18] - [9, 22]
          (simple_identifier)))) ; [9, 18] - [9, 22]
    (ERROR ; [9, 24] - [9, 37]
      (simple_identifier)) ; [9, 27] - [9, 37]
    (constant_expression ; [9, 38] - [9, 42]
      (constant_primary ; [9, 38] - [9, 42]
        (parameter_identifier ; [9, 38] - [9, 42]
          (simple_identifier)))) ; [9, 38] - [9, 42]
    (constant_expression ; [9, 44] - [9, 57]
      (constant_primary ; [9, 44] - [9, 57]
        (parameter_identifier ; [9, 44] - [9, 57]
          (simple_identifier)))))) ; [9, 44] - [9, 57]
The first error is for the last ] in this: output_mem[unit][store_addr[unit]]`.
Metadata
Metadata
Assignees
Labels
No labels