mirror of
https://github.com/zachjs/sv2v.git
synced 2026-09-02 10:27:21 +02:00
initial pass improving decl parsing error messages
- all decl tokens are given an accurate starting position - key grammar productions return token positions to facilitate the above - helpers for standardized parse error generation - replaced annoying pattern-matching type argument restrictions - moving away from dumping raw decl tokens in error messages
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
// pattern: unexpected packed range\(s\) applied to byte
|
||||
module top;
|
||||
byte [1:0] x;
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: const_const\.sv:3:11: Parse error: duplicate const modifier
|
||||
module top;
|
||||
const const logic x = 1'b1;
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: decl_binop_asgn\.sv:3:13: Parse error: unexpected binary assignment operator in declaration
|
||||
module top;
|
||||
logic x += 1;
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: decl_delay_asgn\.sv:3:13: Parse error: unexpected timing modifier in declaration
|
||||
module top;
|
||||
logic x = #1 1;
|
||||
endmodule
|
||||
@@ -0,0 +1,6 @@
|
||||
// pattern: decl_delay_asgn_init\.sv:4:24: Parse error: unexpected timing modifier in declaration
|
||||
module top;
|
||||
initial
|
||||
for (integer x = #1 1; 1; x++)
|
||||
$display("Hi!");
|
||||
endmodule
|
||||
@@ -0,0 +1,7 @@
|
||||
// pattern: decl_delay_asgn_package\.sv:3:13: Parse error: unexpected timing modifier in declaration
|
||||
package P;
|
||||
logic x = #1 1;
|
||||
endpackage
|
||||
module top;
|
||||
import P::*;
|
||||
endmodule
|
||||
@@ -0,0 +1,5 @@
|
||||
// pattern: decl_delay_asgn_port\.sv:3:14: Parse error: unexpected timing modifier in declaration
|
||||
module top(
|
||||
output x = #1 1
|
||||
);
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: decl_non_blocking_asgn\.sv:3:13: Parse error: unexpected non-blocking assignment operator in declaration
|
||||
module top;
|
||||
logic x <= 1;
|
||||
endmodule
|
||||
@@ -0,0 +1,6 @@
|
||||
// pattern: unexpected signed applied to enum
|
||||
module top;
|
||||
enum {
|
||||
A, B
|
||||
} signed x;
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: instantiation_extra_comma\.sv:3:18: Parse error: expected instantiation before delimiter
|
||||
module top;
|
||||
example a(), , b();
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: instantiation_missing_ports\.sv:3:14: Parse error: expected port connections before delimiter
|
||||
module top;
|
||||
example a, c();
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: instantiation_no_label\.sv:3:13: Parse error: expected instantiation name
|
||||
module top;
|
||||
example ();
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: instantiation_no_module\.sv:3:5: Parse error: expected module or interface name at beginning of instantiation list
|
||||
module top;
|
||||
, ();
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: instantiation_not_ports\.sv:3:15: Parse error: expected port connections
|
||||
module top;
|
||||
example a b, c();
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: instantiation_not_range\.sv:3:15: Parse error: expected instantiation dimensions
|
||||
module top;
|
||||
example a b();
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: instantiation_trailing_comma\.sv:3:16: Parse error: unexpected end of instantiation list
|
||||
module top;
|
||||
example a(), ;
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: run_on_decl_item.sv:3:16: Parse error: unexpected comma-separated declarations
|
||||
module top;
|
||||
integer x, byte y;
|
||||
endmodule
|
||||
@@ -0,0 +1,6 @@
|
||||
// pattern: run_on_decl_stmt.sv:4:20: Parse error: unexpected comma-separated declarations
|
||||
module top;
|
||||
initial begin
|
||||
integer x, byte y;
|
||||
end
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: unexpected packed range\(s\) applied to string
|
||||
module top;
|
||||
string [1:0] x;
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: unexpected signed applied to string
|
||||
module top;
|
||||
string signed x;
|
||||
endmodule
|
||||
@@ -0,0 +1,5 @@
|
||||
// pattern: unexpected packed range\(s\) applied to type\(y\)
|
||||
module top;
|
||||
logic y;
|
||||
var type(y) [1:0] x;
|
||||
endmodule
|
||||
@@ -0,0 +1,5 @@
|
||||
// pattern: unexpected signed applied to type\(y\)
|
||||
module top;
|
||||
logic y;
|
||||
var type(y) signed x;
|
||||
endmodule
|
||||
@@ -0,0 +1,4 @@
|
||||
// pattern: var_var\.sv:3:9: Parse error: duplicate var modifier
|
||||
module top;
|
||||
var var x = 1'b1;
|
||||
endmodule
|
||||
Reference in New Issue
Block a user