Skip to content

Commit

Permalink
Merge pull request tree-sitter#51 from abradd/fix-30-constant-express…
Browse files Browse the repository at this point in the history
…ion-parameter-first

Add tests for constant_expression with varying parameter locations
  • Loading branch information
drom authored Oct 4, 2021
2 parents 656a13b + 5018ebb commit 02a1247
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions corpus/assign.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,77 @@ endmodule
))
))


============================================
assign - constant_range expression (parameter first)
============================================

module mod ();
assign a = b[Param+1:0];
endmodule

----

(source_file (module_declaration
(module_header (module_keyword) (simple_identifier))
(module_nonansi_header (list_of_ports))
(module_or_generate_item (continuous_assign
(list_of_net_assignments (net_assignment
(net_lvalue (simple_identifier))
(expression (primary
(simple_identifier)
(select1
(constant_range
(constant_expression
(constant_expression (constant_primary (parameter_identifier (simple_identifier))))
(constant_expression
(constant_primary (primary_literal (integral_number (decimal_number (unsigned_number)))))
)
)
(constant_expression (constant_primary (primary_literal (integral_number (decimal_number (unsigned_number))))))
)
)
))
))
))
))


============================================
assign - constant_range expression (parameter first, LSB)
============================================

module mod ();
assign a = b[0:Param+1];
endmodule

----

(source_file (module_declaration
(module_header (module_keyword) (simple_identifier))
(module_nonansi_header (list_of_ports))
(module_or_generate_item (continuous_assign
(list_of_net_assignments (net_assignment
(net_lvalue (simple_identifier))
(expression (primary
(simple_identifier)
(select1
(constant_range
(constant_expression (constant_primary (primary_literal (integral_number (decimal_number (unsigned_number))))))
(constant_expression
(constant_expression (constant_primary (parameter_identifier (simple_identifier))))
(constant_expression
(constant_primary (primary_literal (integral_number (decimal_number (unsigned_number)))))
)
)
)
)
))
))
))
))


============================================
assign - precedence or, xor, and, eq
============================================
Expand Down

0 comments on commit 02a1247

Please sign in to comment.