fix combined array declarations (resolves #34)

This commit is contained in:
Zachary Snow 2019-09-11 18:54:51 +02:00
parent a0068f60f2
commit 46242aac5d
3 changed files with 34 additions and 0 deletions

View File

@ -314,6 +314,10 @@ tripLookahead l0 =
-- know we must have a valid triplet ahead
else if null l1 || asgn /= Nothing then
True
-- if there is an ident followed by some number of ranges, and that's it,
-- then there is a trailing declaration of an array ahead
else if (not $ null l1) && (null l2) then
True
-- if there is a comma after the identifier (and optional ranges and
-- assignment) that we're looking at, then we know this identifier is not a
-- type name, as type names must be followed by a first identifier before a

View File

@ -0,0 +1,19 @@
module top;
typedef struct packed {
logic f1;
logic f2;
} T;
T a[1:0];
T b[1:0];
T c[1:0], d[1:0];
T e[1:0], f[1:0], g;
T h, i[1:0];
T j;
struct packed {
logic f1;
logic f2;
} k;
endmodule

View File

@ -0,0 +1,11 @@
module top;
reg [1:0] a[1:0];
reg [1:0] b[1:0];
reg [1:0] c[1:0], d[1:0];
reg [1:0] e[1:0], f[1:0], g;
reg [1:0] h, i[1:0];
reg [1:0] j;
reg [1:0] k;
endmodule