Use consistent format for compiler parser error messages.

Always prefix with "error: " or "sorry: ". Capitalise the first word
of the main message unless it's a Verilog keyword.
This commit is contained in:
Martin Whitaker 2022-12-22 10:08:31 +00:00
parent 01378fbdb0
commit a56ccabf7f
12 changed files with 137 additions and 135 deletions

View File

@ -1,2 +1,2 @@
./ivltests/br1027a.v:1: error: missing task/function port direction. ./ivltests/br1027a.v:1: error: Missing task/function port direction.
./ivltests/br1027a.v:1: error: missing task/function port direction. ./ivltests/br1027a.v:1: error: Missing task/function port direction.

View File

@ -1 +1 @@
./ivltests/br1027c.v:1: error: missing task/function port direction. ./ivltests/br1027c.v:1: error: Missing task/function port direction.

View File

@ -1 +1 @@
./ivltests/br1027e.v:1: error: missing task/function port direction. ./ivltests/br1027e.v:1: error: Missing task/function port direction.

View File

@ -1,16 +1,16 @@
./ivltests/br_gh79.v:6: syntax error ./ivltests/br_gh79.v:6: syntax error
./ivltests/br_gh79.v:6: error: malformed statement ./ivltests/br_gh79.v:6: error: Malformed statement
./ivltests/br_gh79.v:7: syntax error ./ivltests/br_gh79.v:7: syntax error
./ivltests/br_gh79.v:7: error: malformed statement ./ivltests/br_gh79.v:7: error: Malformed statement
./ivltests/br_gh79.v:9: syntax error ./ivltests/br_gh79.v:9: syntax error
./ivltests/br_gh79.v:9: error: malformed statement ./ivltests/br_gh79.v:9: error: Malformed statement
./ivltests/br_gh79.v:10: syntax error ./ivltests/br_gh79.v:10: syntax error
./ivltests/br_gh79.v:10: error: malformed statement ./ivltests/br_gh79.v:10: error: Malformed statement
./ivltests/br_gh79.v:12: syntax error ./ivltests/br_gh79.v:12: syntax error
./ivltests/br_gh79.v:12: error: malformed statement ./ivltests/br_gh79.v:12: error: Malformed statement
./ivltests/br_gh79.v:13: syntax error ./ivltests/br_gh79.v:13: syntax error
./ivltests/br_gh79.v:13: error: malformed statement ./ivltests/br_gh79.v:13: error: Malformed statement
./ivltests/br_gh79.v:15: syntax error ./ivltests/br_gh79.v:15: syntax error
./ivltests/br_gh79.v:15: error: malformed statement ./ivltests/br_gh79.v:15: error: Malformed statement
./ivltests/br_gh79.v:16: syntax error ./ivltests/br_gh79.v:16: syntax error
./ivltests/br_gh79.v:16: error: malformed statement ./ivltests/br_gh79.v:16: error: Malformed statement

View File

@ -1,22 +1,22 @@
./ivltests/pr3366217d.v:3: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:3: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:4: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:4: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:5: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:5: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:6: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:6: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:6: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:6: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:7: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:7: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:8: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:8: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:9: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:9: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:10: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:10: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:10: error: undefined value used in enum name sequence. ./ivltests/pr3366217d.v:10: error: Undefined value used in enum name sequence.
./ivltests/pr3366217d.v:13: error: zero count used in enum name sequence. ./ivltests/pr3366217d.v:13: error: Zero count used in enum name sequence.
./ivltests/pr3366217d.v:14: error: zero count used in enum name sequence. ./ivltests/pr3366217d.v:14: error: Zero count used in enum name sequence.
./ivltests/pr3366217d.v:17: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:17: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:18: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:18: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:19: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:19: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:20: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:20: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:20: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:20: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:21: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:21: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:22: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:22: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:23: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:23: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:24: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:24: error: Negative value used in enum name sequence.
./ivltests/pr3366217d.v:24: error: negative value used in enum name sequence. ./ivltests/pr3366217d.v:24: error: Negative value used in enum name sequence.

View File

@ -1,8 +1,8 @@
./ivltests/struct_invalid_member.v:9: syntax error ./ivltests/struct_invalid_member.v:9: syntax error
./ivltests/struct_invalid_member.v:9: Error in struct/union member. ./ivltests/struct_invalid_member.v:9: error: Error in struct/union member.
./ivltests/struct_invalid_member.v:10: syntax error ./ivltests/struct_invalid_member.v:10: syntax error
./ivltests/struct_invalid_member.v:10: Error in struct/union member. ./ivltests/struct_invalid_member.v:10: error: Error in struct/union member.
./ivltests/struct_invalid_member.v:11: syntax error ./ivltests/struct_invalid_member.v:11: syntax error
./ivltests/struct_invalid_member.v:11: Error in struct/union member. ./ivltests/struct_invalid_member.v:11: error: Error in struct/union member.
./ivltests/struct_invalid_member.v:12: syntax error ./ivltests/struct_invalid_member.v:12: syntax error
./ivltests/struct_invalid_member.v:12: Error in struct/union member. ./ivltests/struct_invalid_member.v:12: error: Error in struct/union member.

View File

@ -1,3 +1,3 @@
./ivltests/sv_end_labels_unnamed.v:7: error: unnamed block must not have end label. ./ivltests/sv_end_labels_unnamed.v:7: error: Unnamed block must not have end label.
./ivltests/sv_end_labels_unnamed.v:11: error: unnamed block must not have end label. ./ivltests/sv_end_labels_unnamed.v:11: error: Unnamed block must not have end label.
./ivltests/sv_end_labels_unnamed.v:14: error: unnamed fork must not have end label. ./ivltests/sv_end_labels_unnamed.v:14: error: Unnamed fork must not have end label.

View File

@ -1,20 +1,20 @@
./ivltests/sv_timeunit_prec_fail1a.v:9: error: repeat timeunit does not match the initial timeunit for this scope. ./ivltests/sv_timeunit_prec_fail1a.v:9: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:10: error: repeat timeprecision does not match the initial timeprecision for this scope. ./ivltests/sv_timeunit_prec_fail1a.v:10: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:15: error: repeat timeunit does not match the initial timeunit for this scope. ./ivltests/sv_timeunit_prec_fail1a.v:15: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:21: error: repeat timeprecision does not match the initial timeprecision for this scope. ./ivltests/sv_timeunit_prec_fail1a.v:21: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail1a.v:27: error: repeat timeunit found and the initial timeunit for this scope is missing. ./ivltests/sv_timeunit_prec_fail1a.v:27: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:33: error: repeat timeprecision found and the initial timeprecision for this scope is missing. ./ivltests/sv_timeunit_prec_fail1a.v:33: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:40: error: repeat timeprecision found and the initial timeprecision for this scope is missing. ./ivltests/sv_timeunit_prec_fail1a.v:40: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:47: error: repeat timeunit found and the initial timeunit for this scope is missing. ./ivltests/sv_timeunit_prec_fail1a.v:47: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail1a.v:53: Invalid timeunit constant (1st digit). ./ivltests/sv_timeunit_prec_fail1a.v:53: error: Invalid timeunit constant (1st digit).
./ivltests/sv_timeunit_prec_fail1a.v:54: Invalid timeprecision constant (1st digit). ./ivltests/sv_timeunit_prec_fail1a.v:54: error: Invalid timeprecision constant (1st digit).
./ivltests/sv_timeunit_prec_fail1a.v:56: Invalid timeunit constant (number of zeros). ./ivltests/sv_timeunit_prec_fail1a.v:56: error: Invalid timeunit constant (number of zeros).
./ivltests/sv_timeunit_prec_fail1a.v:57: Invalid timeprecision constant (number of zeros). ./ivltests/sv_timeunit_prec_fail1a.v:57: error: Invalid timeprecision constant (number of zeros).
./ivltests/sv_timeunit_prec_fail1a.v:59: Invalid timeunit scale '2s'. ./ivltests/sv_timeunit_prec_fail1a.v:59: error: Invalid timeunit scale '2s'.
./ivltests/sv_timeunit_prec_fail1a.v:60: Invalid timeprecision scale '2s'. ./ivltests/sv_timeunit_prec_fail1a.v:60: error: Invalid timeprecision scale '2s'.
./ivltests/sv_timeunit_prec_fail1a.v:63: Invalid timeunit constant ('_' is not supported). ./ivltests/sv_timeunit_prec_fail1a.v:63: error: Invalid timeunit constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail1a.v:64: Invalid timeprecision constant ('_' is not supported). ./ivltests/sv_timeunit_prec_fail1a.v:64: error: Invalid timeprecision constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail1b.v:4: error: a timeprecision is missing or is too large! ./ivltests/sv_timeunit_prec_fail1b.v:4: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1c.v:4: error: a timeprecision is missing or is too large! ./ivltests/sv_timeunit_prec_fail1c.v:4: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1d.v:5: error: a timeprecision is missing or is too large! ./ivltests/sv_timeunit_prec_fail1d.v:5: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail1e.v:5: error: a timeprecision is missing or is too large! ./ivltests/sv_timeunit_prec_fail1e.v:5: error: A timeprecision is missing or is too large!

View File

@ -1,20 +1,20 @@
./ivltests/sv_timeunit_prec_fail2a.v:8: error: repeat timeunit does not match the initial timeunit for this scope. ./ivltests/sv_timeunit_prec_fail2a.v:8: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:8: error: repeat timeprecision does not match the initial timeprecision for this scope. ./ivltests/sv_timeunit_prec_fail2a.v:8: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:13: error: repeat timeunit does not match the initial timeunit for this scope. ./ivltests/sv_timeunit_prec_fail2a.v:13: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:13: error: repeat timeprecision does not match the initial timeprecision for this scope. ./ivltests/sv_timeunit_prec_fail2a.v:13: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:14: error: repeat timeunit does not match the initial timeunit for this scope. ./ivltests/sv_timeunit_prec_fail2a.v:14: error: Repeat timeunit does not match the initial timeunit for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:15: error: repeat timeprecision does not match the initial timeprecision for this scope. ./ivltests/sv_timeunit_prec_fail2a.v:15: error: Repeat timeprecision does not match the initial timeprecision for this scope.
./ivltests/sv_timeunit_prec_fail2a.v:21: error: repeat timeunit found and the initial timeunit for this scope is missing. ./ivltests/sv_timeunit_prec_fail2a.v:21: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:21: error: repeat timeprecision found and the initial timeprecision for this scope is missing. ./ivltests/sv_timeunit_prec_fail2a.v:21: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:27: error: repeat timeprecision found and the initial timeprecision for this scope is missing. ./ivltests/sv_timeunit_prec_fail2a.v:27: error: Repeat timeprecision found and the initial timeprecision for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:33: error: repeat timeunit found and the initial timeunit for this scope is missing. ./ivltests/sv_timeunit_prec_fail2a.v:33: error: Repeat timeunit found and the initial timeunit for this scope is missing.
./ivltests/sv_timeunit_prec_fail2a.v:39: Invalid timeunit constant (1st digit). ./ivltests/sv_timeunit_prec_fail2a.v:39: error: Invalid timeunit constant (1st digit).
./ivltests/sv_timeunit_prec_fail2a.v:39: Invalid timeprecision constant (1st digit). ./ivltests/sv_timeunit_prec_fail2a.v:39: error: Invalid timeprecision constant (1st digit).
./ivltests/sv_timeunit_prec_fail2a.v:41: Invalid timeunit constant (number of zeros). ./ivltests/sv_timeunit_prec_fail2a.v:41: error: Invalid timeunit constant (number of zeros).
./ivltests/sv_timeunit_prec_fail2a.v:41: Invalid timeprecision constant (number of zeros). ./ivltests/sv_timeunit_prec_fail2a.v:41: error: Invalid timeprecision constant (number of zeros).
./ivltests/sv_timeunit_prec_fail2a.v:43: Invalid timeunit scale '2s'. ./ivltests/sv_timeunit_prec_fail2a.v:43: error: Invalid timeunit scale '2s'.
./ivltests/sv_timeunit_prec_fail2a.v:43: Invalid timeprecision scale '2s'. ./ivltests/sv_timeunit_prec_fail2a.v:43: error: Invalid timeprecision scale '2s'.
./ivltests/sv_timeunit_prec_fail2a.v:46: Invalid timeunit constant ('_' is not supported). ./ivltests/sv_timeunit_prec_fail2a.v:46: error: Invalid timeunit constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail2a.v:46: Invalid timeprecision constant ('_' is not supported). ./ivltests/sv_timeunit_prec_fail2a.v:46: error: Invalid timeprecision constant ('_' is not supported).
./ivltests/sv_timeunit_prec_fail2b.v:4: error: a timeprecision is missing or is too large! ./ivltests/sv_timeunit_prec_fail2b.v:4: error: A timeprecision is missing or is too large!
./ivltests/sv_timeunit_prec_fail2c.v:5: error: a timeprecision is missing or is too large! ./ivltests/sv_timeunit_prec_fail2c.v:5: error: A timeprecision is missing or is too large!

50
parse.y
View File

@ -250,16 +250,16 @@ static long check_enum_seq_value(const YYLTYPE&loc, verinum *arg, bool zero_ok)
// We can never have an undefined value in an enumeration name // We can never have an undefined value in an enumeration name
// declaration sequence. // declaration sequence.
if (! arg->is_defined()) { if (! arg->is_defined()) {
yyerror(loc, "error: undefined value used in enum name sequence."); yyerror(loc, "error: Undefined value used in enum name sequence.");
// We can never have a negative value in an enumeration name // We can never have a negative value in an enumeration name
// declaration sequence. // declaration sequence.
} else if (arg->is_negative()) { } else if (arg->is_negative()) {
yyerror(loc, "error: negative value used in enum name sequence."); yyerror(loc, "error: Negative value used in enum name sequence.");
} else { } else {
value = arg->as_ulong(); value = arg->as_ulong();
// We cannot have a zero enumeration name declaration count. // We cannot have a zero enumeration name declaration count.
if (! zero_ok && (value == 0)) { if (! zero_ok && (value == 0)) {
yyerror(loc, "error: zero count used in enum name sequence."); yyerror(loc, "error: Zero count used in enum name sequence.");
value = 1; value = 1;
} }
} }
@ -273,7 +273,7 @@ static void check_end_label(const struct vlltype&loc, const char *type,
return; return;
if (!begin) if (!begin)
yyerror(loc, "error: unnamed %s must not have end label.", type); yyerror(loc, "error: Unnamed %s must not have end label.", type);
else if (strcmp(begin, end) != 0) else if (strcmp(begin, end) != 0)
yyerror(loc, "error: %s end label `%s` doesn't match %s name" yyerror(loc, "error: %s end label `%s` doesn't match %s name"
" `%s`.", type, end, type, begin); " `%s`.", type, end, type, begin);
@ -946,7 +946,7 @@ class_item /* IEEE1800-2005: A.1.8 */
| ';' | ';'
| error ';' | error ';'
{ yyerror(@2, "error: invalid class item."); { yyerror(@2, "error: Invalid class item.");
yyerrok; yyerrok;
} }
@ -1892,7 +1892,7 @@ modport_ports_list
pform_add_modport_port(@3, last_modport_port.direction, pform_add_modport_port(@3, last_modport_port.direction,
lex_strings.make($3), 0); lex_strings.make($3), 0);
} else if (last_modport_port.type != MP_TF) { } else if (last_modport_port.type != MP_TF) {
yyerror(@3, "error: list of identifiers not allowed here."); yyerror(@3, "error: List of identifiers not allowed here.");
} }
delete[] $3; delete[] $3;
} }
@ -2369,7 +2369,7 @@ tf_port_item /* IEEE1800-2005: A.2.7 */
list<pform_port_t>* port_list = make_port_list($4, $5, 0); list<pform_port_t>* port_list = make_port_list($4, $5, 0);
if (use_port_type == NetNet::PIMPLICIT) { if (use_port_type == NetNet::PIMPLICIT) {
yyerror(@1, "error: missing task/function port direction."); yyerror(@1, "error: Missing task/function port direction.");
use_port_type = NetNet::PINPUT; // for error recovery use_port_type = NetNet::PINPUT; // for error recovery
} }
if (($3 == 0) && ($1==NetNet::PIMPLICIT)) { if (($3 == 0) && ($1==NetNet::PIMPLICIT)) {
@ -2533,7 +2533,7 @@ variable_lifetime_opt
: lifetime : lifetime
{ if (pform_requires_sv(@1, "Overriding default variable lifetime") && { if (pform_requires_sv(@1, "Overriding default variable lifetime") &&
$1 != pform_peek_scope()->default_lifetime) { $1 != pform_peek_scope()->default_lifetime) {
yyerror(@1, "sorry: overriding the default variable lifetime " yyerror(@1, "sorry: Overriding the default variable lifetime "
"is not yet supported."); "is not yet supported.");
} }
var_lifetime = $1; var_lifetime = $1;
@ -2642,24 +2642,24 @@ block_item_decl
trailing semi-colon to resync the parser. */ trailing semi-colon to resync the parser. */
| K_var variable_lifetime_opt data_type_or_implicit error ';' | K_var variable_lifetime_opt data_type_or_implicit error ';'
{ yyerror(@1, "error: syntax error in variable list."); { yyerror(@1, "error: Syntax error in variable list.");
yyerrok; yyerrok;
} }
| variable_lifetime_opt data_type error ';' | variable_lifetime_opt data_type error ';'
{ yyerror(@1, "error: syntax error in variable list."); { yyerror(@1, "error: Syntax error in variable list.");
yyerrok; yyerrok;
} }
| K_event error ';' | K_event error ';'
{ yyerror(@1, "error: syntax error in event variable list."); { yyerror(@1, "error: Syntax error in event variable list.");
yyerrok; yyerrok;
} }
| parameter error ';' | parameter error ';'
{ yyerror(@1, "error: syntax error in parameter list."); { yyerror(@1, "error: Syntax error in parameter list.");
yyerrok; yyerrok;
} }
| localparam error ';' | localparam error ';'
{ yyerror(@1, "error: syntax error localparam list."); { yyerror(@1, "error: Syntax error localparam list.");
yyerrok; yyerrok;
} }
; ;
@ -2876,7 +2876,7 @@ struct_union_member /* IEEE 1800-2012 A.2.2.1 */
$$ = tmp; $$ = tmp;
} }
| error ';' | error ';'
{ yyerror(@2, "Error in struct/union member."); { yyerror(@2, "error: Error in struct/union member.");
yyerrok; yyerrok;
$$ = 0; $$ = 0;
} }
@ -4591,7 +4591,7 @@ lpvalue
} }
| streaming_concatenation | streaming_concatenation
{ yyerror(@1, "sorry: streaming concatenation not supported in l-values."); { yyerror(@1, "sorry: Streaming concatenation not supported in l-values.");
$$ = 0; $$ = 0;
} }
; ;
@ -4811,7 +4811,7 @@ module_item
} }
pform_set_data_type(@2, data_type, $5, $2, $1); pform_set_data_type(@2, data_type, $5, $2, $1);
if ($4 != 0) { if ($4 != 0) {
yyerror(@2, "sorry: net delays not supported."); yyerror(@2, "sorry: Net delays not supported.");
delete $4; delete $4;
} }
delete $1; delete $1;
@ -4821,7 +4821,7 @@ module_item
{ real_type_t*tmpt = new real_type_t(real_type_t::REAL); { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1); pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
if ($3 != 0) { if ($3 != 0) {
yyerror(@3, "sorry: net delays not supported."); yyerror(@3, "sorry: Net delays not supported.");
delete $3; delete $3;
} }
delete $1; delete $1;
@ -5183,7 +5183,7 @@ module_item
specify_item_list_opt K_endspecify specify_item_list_opt K_endspecify
| K_specify error K_endspecify | K_specify error K_endspecify
{ yyerror(@1, "error: syntax error in specify block"); { yyerror(@1, "error: Syntax error in specify block");
yyerrok; yyerrok;
} }
@ -5192,18 +5192,18 @@ module_item
reasonable error message can be produced. */ reasonable error message can be produced. */
| error ';' | error ';'
{ yyerror(@2, "error: invalid module item."); { yyerror(@2, "error: Invalid module item.");
yyerrok; yyerrok;
} }
| K_assign error '=' expression ';' | K_assign error '=' expression ';'
{ yyerror(@1, "error: syntax error in left side of " { yyerror(@1, "error: Syntax error in left side of "
"continuous assignment."); "continuous assignment.");
yyerrok; yyerrok;
} }
| K_assign error ';' | K_assign error ';'
{ yyerror(@1, "error: syntax error in continuous assignment"); { yyerror(@1, "error: Syntax error in continuous assignment");
yyerrok; yyerrok;
} }
@ -5548,7 +5548,7 @@ parameter_value_opt
$$ = lst; $$ = lst;
} }
| '#' error | '#' error
{ yyerror(@1, "error: syntax error in parameter value assignment list."); { yyerror(@1, "error: Syntax error in parameter value assignment list.");
$$ = 0; $$ = 0;
} }
| |
@ -5657,7 +5657,7 @@ port_name
$$ = tmp; $$ = tmp;
} }
| attribute_list_opt '.' IDENTIFIER '(' error ')' | attribute_list_opt '.' IDENTIFIER '(' error ')'
{ yyerror(@3, "error: invalid port connection expression."); { yyerror(@3, "error: Invalid port connection expression.");
named_pexpr_t*tmp = new named_pexpr_t; named_pexpr_t*tmp = new named_pexpr_t;
tmp->name = lex_strings.make($3); tmp->name = lex_strings.make($3);
tmp->parm = 0; tmp->parm = 0;
@ -5794,7 +5794,7 @@ port_reference
$$ = ptmp; $$ = ptmp;
} }
| IDENTIFIER '[' error ']' | IDENTIFIER '[' error ']'
{ yyerror(@1, "error: invalid port bit select"); { yyerror(@1, "error: Invalid port bit select");
Module::port_t*ptmp = new Module::port_t; Module::port_t*ptmp = new Module::port_t;
PEIdent*wtmp = new PEIdent(lex_strings.make($1)); PEIdent*wtmp = new PEIdent(lex_strings.make($1));
FILE_NAME(wtmp, @1); FILE_NAME(wtmp, @1);
@ -6679,7 +6679,7 @@ statement_item /* This is roughly statement_item in the LRM */
$$ = tmp; $$ = tmp;
} }
| error ';' | error ';'
{ yyerror(@2, "error: malformed statement"); { yyerror(@2, "error: Malformed statement");
yyerrok; yyerrok;
$$ = new PNoop; $$ = new PNoop;
} }

View File

@ -569,7 +569,7 @@ void pform_set_scope_timescale(const struct vlltype&loc)
if (gn_system_verilog() && (scope->time_unit < scope->time_precision)) { if (gn_system_verilog() && (scope->time_unit < scope->time_precision)) {
if (scope->time_unit_is_local || scope->time_prec_is_local) { if (scope->time_unit_is_local || scope->time_prec_is_local) {
VLerror("error: a timeprecision is missing or is too large!"); VLerror("error: A timeprecision is missing or is too large!");
} }
} else { } else {
assert(scope->time_unit >= scope->time_precision); assert(scope->time_unit >= scope->time_precision);
@ -1093,7 +1093,7 @@ bool get_time_unit(const char*cp, int &unit)
bool rc = true; bool rc = true;
if (strchr(cp, '_')) { if (strchr(cp, '_')) {
VLerror(yylloc, "Invalid timeunit constant ('_' is not " VLerror(yylloc, "error: Invalid timeunit constant ('_' is not "
"supported)."); "supported).");
return false; return false;
} }
@ -1118,7 +1118,7 @@ bool get_time_unit(const char*cp, int &unit)
rc = false; rc = false;
ostringstream msg; ostringstream msg;
msg << "Invalid timeunit scale '" << cp << "'."; msg << "error: Invalid timeunit scale '" << cp << "'.";
VLerror(msg.str().c_str()); VLerror(msg.str().c_str());
} }
@ -1134,11 +1134,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
/* We do not support a '_' in these time constants. */ /* We do not support a '_' in these time constants. */
if (strchr(cp, '_')) { if (strchr(cp, '_')) {
if (is_unit) { if (is_unit) {
VLerror(yylloc, "Invalid timeunit constant ('_' is not " VLerror(yylloc, "error: Invalid timeunit constant ('_' "
"supported)."); "is not supported).");
} else { } else {
VLerror(yylloc, "Invalid timeprecision constant ('_' is not " VLerror(yylloc, "error: Invalid timeprecision constant ('_' "
"supported)."); "is not supported).");
} }
return true; return true;
} }
@ -1146,9 +1146,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
/* Check for the 1 digit. */ /* Check for the 1 digit. */
if (*cp != '1') { if (*cp != '1') {
if (is_unit) { if (is_unit) {
VLerror(yylloc, "Invalid timeunit constant (1st digit)."); VLerror(yylloc, "error: Invalid timeunit constant "
"(1st digit).");
} else { } else {
VLerror(yylloc, "Invalid timeprecision constant (1st digit)."); VLerror(yylloc, "error: Invalid timeprecision constant "
"(1st digit).");
} }
return true; return true;
} }
@ -1158,11 +1160,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
res = strspn(cp, "0"); res = strspn(cp, "0");
if (res > 2) { if (res > 2) {
if (is_unit) { if (is_unit) {
VLerror(yylloc, "Invalid timeunit constant (number of " VLerror(yylloc, "error: Invalid timeunit constant "
"zeros)."); "(number of zeros).");
} else { } else {
VLerror(yylloc, "Invalid timeprecision constant (number of " VLerror(yylloc, "error: Invalid timeprecision constant "
"zeros)."); "(number of zeros).");
} }
return true; return true;
} }
@ -1196,7 +1198,7 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit)
} }
ostringstream msg; ostringstream msg;
msg << "Invalid "; msg << "error: Invalid ";
if (is_unit) msg << "timeunit"; if (is_unit) msg << "timeunit";
else msg << "timeprecision"; else msg << "timeprecision";
msg << " scale '" << cp << "'."; msg << " scale '" << cp << "'.";
@ -1220,10 +1222,10 @@ void pform_set_timeunit(const char*txt, bool initial_decl)
scope->time_unit_is_default = false; scope->time_unit_is_default = false;
allow_timeunit_decl = false; allow_timeunit_decl = false;
} else if (!scope->time_unit_is_local) { } else if (!scope->time_unit_is_local) {
VLerror(yylloc, "error: repeat timeunit found and the initial " VLerror(yylloc, "error: Repeat timeunit found and the initial "
"timeunit for this scope is missing."); "timeunit for this scope is missing.");
} else if (scope->time_unit != val) { } else if (scope->time_unit != val) {
VLerror(yylloc, "error: repeat timeunit does not match the " VLerror(yylloc, "error: Repeat timeunit does not match the "
"initial timeunit for this scope."); "initial timeunit for this scope.");
} }
} }
@ -1258,10 +1260,10 @@ void pform_set_timeprec(const char*txt, bool initial_decl)
scope->time_prec_is_default = false; scope->time_prec_is_default = false;
allow_timeprec_decl = false; allow_timeprec_decl = false;
} else if (!scope->time_prec_is_local) { } else if (!scope->time_prec_is_local) {
VLerror(yylloc, "error: repeat timeprecision found and the initial " VLerror(yylloc, "error: Repeat timeprecision found and the initial "
"timeprecision for this scope is missing."); "timeprecision for this scope is missing.");
} else if (scope->time_precision != val) { } else if (scope->time_precision != val) {
VLerror(yylloc, "error: repeat timeprecision does not match the " VLerror(yylloc, "error: Repeat timeprecision does not match the "
"initial timeprecision for this scope."); "initial timeprecision for this scope.");
} }
} }
@ -1458,7 +1460,7 @@ void pform_endmodule(const char*name, bool inside_celldefine,
perm_string tmp_name = tmp_module->mod_name(); perm_string tmp_name = tmp_module->mod_name();
pform_cur_module.pop_front(); pform_cur_module.pop_front();
ostringstream msg; ostringstream msg;
msg << "Module " << mod_name msg << "error: Module " << mod_name
<< " was nested within " << tmp_name << " was nested within " << tmp_name
<< " but broken."; << " but broken.";
VLerror(msg.str().c_str()); VLerror(msg.str().c_str());
@ -1492,7 +1494,7 @@ void pform_endmodule(const char*name, bool inside_celldefine,
if (test != use_module_map.end()) { if (test != use_module_map.end()) {
ostringstream msg; ostringstream msg;
msg << "Module " << name << " was already declared here: " msg << "error: Module " << name << " was already declared here: "
<< test->second->get_fileline() << endl; << test->second->get_fileline() << endl;
VLerror(msg.str().c_str()); VLerror(msg.str().c_str());
} else { } else {
@ -2127,7 +2129,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
// Put the primitive into the primitives table // Put the primitive into the primitives table
if (pform_primitives[name]) { if (pform_primitives[name]) {
VLerror("UDP primitive already exists."); VLerror("error: UDP primitive already exists.");
} else { } else {
PUdp*udp = new PUdp(name, pins.size()); PUdp*udp = new PUdp(name, pins.size());
@ -2210,7 +2212,7 @@ static void pform_makegate(PGBuiltin::Type type,
list<named_pexpr_t>*attr) list<named_pexpr_t>*attr)
{ {
if (info.parms_by_name) { if (info.parms_by_name) {
cerr << info.get_fileline() << ": Gates do not have port names." cerr << info.get_fileline() << ": error: Gates do not have port names."
<< endl; << endl;
error_count += 1; error_count += 1;
return; return;
@ -2515,7 +2517,7 @@ void pform_make_var_init(const struct vlltype&li,
perm_string name, PExpr*expr) perm_string name, PExpr*expr)
{ {
if (! pform_at_module_level() && !gn_system_verilog()) { if (! pform_at_module_level() && !gn_system_verilog()) {
VLerror(li, "error: variable declaration assignments are only " VLerror(li, "error: Variable declaration assignments are only "
"allowed at the module level."); "allowed at the module level.");
delete expr; delete expr;
return; return;
@ -2678,7 +2680,7 @@ void pform_makewire(const struct vlltype&li,
list<named_pexpr_t>*attr) list<named_pexpr_t>*attr)
{ {
if (is_compilation_unit(lexical_scope) && !gn_system_verilog()) { if (is_compilation_unit(lexical_scope) && !gn_system_verilog()) {
VLerror(li, "error: variable declarations must be contained within a module."); VLerror(li, "error: Variable declarations must be contained within a module.");
return; return;
} }
@ -2876,7 +2878,7 @@ void pform_set_attrib(perm_string name, perm_string key, char*value)
} else { } else {
delete[] value; delete[] value;
VLerror("Unable to match name for setting attribute."); VLerror("error: Unable to match name for setting attribute.");
} }
} }
@ -2890,7 +2892,7 @@ void pform_set_type_attrib(perm_string name, const string&key,
{ {
map<perm_string,PUdp*>::const_iterator udp = pform_primitives.find(name); map<perm_string,PUdp*>::const_iterator udp = pform_primitives.find(name);
if (udp == pform_primitives.end()) { if (udp == pform_primitives.end()) {
VLerror("type name is not (yet) defined."); VLerror("error: Type name is not (yet) defined.");
delete[] value; delete[] value;
return; return;
} }
@ -2923,7 +2925,7 @@ static void pform_set_type_parameter(const struct vlltype&loc, perm_string name,
pform_requires_sv(loc, "Type parameter"); pform_requires_sv(loc, "Type parameter");
if (value_range) if (value_range)
VLerror(loc, "error: type parameter must not have value range."); VLerror(loc, "error: Type parameter must not have value range.");
type_parameter_t *type = new type_parameter_t(name); type_parameter_t *type = new type_parameter_t(name);
pform_set_typedef(loc, name, type, 0); pform_set_typedef(loc, name, type, 0);

View File

@ -60,9 +60,9 @@ void pform_end_package_declaration(const struct vlltype&loc)
map<perm_string,PPackage*>::const_iterator test = packages_by_name.find(use_name); map<perm_string,PPackage*>::const_iterator test = packages_by_name.find(use_name);
if (test != packages_by_name.end()) { if (test != packages_by_name.end()) {
ostringstream msg; ostringstream msg;
msg << "Package " << use_name << " was already declared here: " msg << "error: Package " << use_name << " was already declared here: "
<< test->second->get_fileline() << ends; << test->second->get_fileline() << ends;
VLerror(msg.str().c_str()); VLerror(loc, msg.str().c_str());
} }