Commit 6ee558b6 by Zachary Snow

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
parent ff0c7b02
// pattern: unexpected packed range\(s\) applied to byte
module top;
byte [1:0] x;
endmodule
// pattern: const_const\.sv:3:11: Parse error: duplicate const modifier
module top;
const const logic x = 1'b1;
endmodule
// pattern: decl_binop_asgn\.sv:3:13: Parse error: unexpected binary assignment operator in declaration
module top;
logic x += 1;
endmodule
// pattern: decl_delay_asgn\.sv:3:13: Parse error: unexpected timing modifier in declaration
module top;
logic x = #1 1;
endmodule
// 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
// 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
// pattern: decl_delay_asgn_port\.sv:3:14: Parse error: unexpected timing modifier in declaration
module top(
output x = #1 1
);
endmodule
// pattern: decl_non_blocking_asgn\.sv:3:13: Parse error: unexpected non-blocking assignment operator in declaration
module top;
logic x <= 1;
endmodule
// pattern: unexpected signed applied to enum
module top;
enum {
A, B
} signed x;
endmodule
// pattern: instantiation_extra_comma\.sv:3:18: Parse error: expected instantiation before delimiter
module top;
example a(), , b();
endmodule
// pattern: instantiation_missing_ports\.sv:3:14: Parse error: expected port connections before delimiter
module top;
example a, c();
endmodule
// pattern: instantiation_no_label\.sv:3:13: Parse error: expected instantiation name
module top;
example ();
endmodule
// pattern: instantiation_no_module\.sv:3:5: Parse error: expected module or interface name at beginning of instantiation list
module top;
, ();
endmodule
// pattern: instantiation_not_ports\.sv:3:15: Parse error: expected port connections
module top;
example a b, c();
endmodule
// pattern: instantiation_not_range\.sv:3:15: Parse error: expected instantiation dimensions
module top;
example a b();
endmodule
// pattern: instantiation_trailing_comma\.sv:3:16: Parse error: unexpected end of instantiation list
module top;
example a(), ;
endmodule
// pattern: run_on_decl_item.sv:3:16: Parse error: unexpected comma-separated declarations
module top;
integer x, byte y;
endmodule
// pattern: run_on_decl_stmt.sv:4:20: Parse error: unexpected comma-separated declarations
module top;
initial begin
integer x, byte y;
end
endmodule
// pattern: unexpected packed range\(s\) applied to string
module top;
string [1:0] x;
endmodule
// pattern: unexpected signed applied to string
module top;
string signed x;
endmodule
// pattern: unexpected packed range\(s\) applied to type\(y\)
module top;
logic y;
var type(y) [1:0] x;
endmodule
// pattern: unexpected signed applied to type\(y\)
module top;
logic y;
var type(y) signed x;
endmodule
// pattern: var_var\.sv:3:9: Parse error: duplicate var modifier
module top;
var var x = 1'b1;
endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment