Better error message around repeat concatenation syntax.

This commit is contained in:
steve 2007-02-27 06:10:16 +00:00
parent 0946f40c7b
commit bb02da0319
2 changed files with 17 additions and 9 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_net.cc,v 1.199 2007/02/26 19:49:48 steve Exp $"
#ident "$Id: elab_net.cc,v 1.200 2007/02/27 06:10:16 steve Exp $"
#endif
# include "config.h"
@ -1417,7 +1417,7 @@ NetNet* PEConcat::elaborate_net(Design*des, NetScope*scope,
NetEConst*erep = dynamic_cast<NetEConst*>(etmp);
if (erep == 0) {
cerr << get_line() << ": internal error: Unable to "
cerr << get_line() << ": error: Unable to "
<< "evaluate constant repeat expression." << endl;
des->errors += 1;
return 0;
@ -2909,6 +2909,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
/*
* $Log: elab_net.cc,v $
* Revision 1.200 2007/02/27 06:10:16 steve
* Better error message around repeat concatenation syntax.
*
* Revision 1.199 2007/02/26 19:49:48 steve
* Spelling fixes (larry doolittle)
*

19
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.227 2007/02/13 04:39:25 steve Exp $"
#ident "$Id: parse.y,v 1.228 2007/02/27 06:10:16 steve Exp $"
#endif
# include "config.h"
@ -1092,18 +1092,23 @@ expr_primary
}
| '{' expression '{' expression_list '}' '}'
{ PExpr*rep = $2;
if (!pform_expression_is_constant($2)) {
yyerror(@2, "error: Repeat expression "
"must be constant.");
delete rep;
rep = 0;
}
PEConcat*tmp = new PEConcat(*$4, rep);
tmp->set_file(@1.text);
tmp->set_lineno(@1.first_line);
delete $4;
$$ = tmp;
}
| '{' expression '{' expression_list '}' error '}'
{ PExpr*rep = $2;
PEConcat*tmp = new PEConcat(*$4, rep);
tmp->set_file(@1.text);
tmp->set_lineno(@1.first_line);
delete $4;
$$ = tmp;
yyerror(@5, "error: Syntax error between internal '}' "
"and closing '}' of repeat concatenation.");
yyerrok;
}
;
/* A function_item is either a block item (i.e. a reg or integer