Handle comments
Ignore C/C++ style comments, and also handle a few error cases a slight bit more elegently. Signed-off-by: Stephen Williams <steve@icarus.com>
This commit is contained in:
parent
79232f46d8
commit
ca10a6867a
|
|
@ -41,8 +41,19 @@ static int yywrap(void)
|
||||||
# define yylval sdflval
|
# define yylval sdflval
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%x CCOMMENT
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
/* Skip C++-style comments. */
|
||||||
|
"//".* { sdflloc.first_line += 1; }
|
||||||
|
|
||||||
|
/* Skip C-style comments. */
|
||||||
|
"/*" { BEGIN(CCOMMENT); }
|
||||||
|
<CCOMMENT>. { yymore(); }
|
||||||
|
<CCOMMENT>\n { sdflloc.first_line += 1; yymore(); }
|
||||||
|
<CCOMMENT>"*/" { BEGIN(0); }
|
||||||
|
|
||||||
[ \m\t] { /* Skip white space. */; }
|
[ \m\t] { /* Skip white space. */; }
|
||||||
|
|
||||||
/* Count lines so that the parser can assign line numbers. */
|
/* Count lines so that the parser can assign line numbers. */
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,10 @@ static char use_hchar = '.';
|
||||||
|
|
||||||
source_file
|
source_file
|
||||||
: '(' K_DELAYFILE sdf_header_list cell_list ')'
|
: '(' K_DELAYFILE sdf_header_list cell_list ')'
|
||||||
|
| '(' K_DELAYFILE error ')'
|
||||||
|
{ vpi_printf("%s:%d:SDF ERROR: Invalid DELAYFILE format\n",
|
||||||
|
sdf_parse_path, @2.first_line);
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
sdf_header_list
|
sdf_header_list
|
||||||
|
|
@ -304,5 +308,5 @@ signed_real_number
|
||||||
|
|
||||||
void yyerror(const char*msg)
|
void yyerror(const char*msg)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SDF ERROR: %s\n", msg);
|
vpi_printf("%s:SDF ERROR: Too many errors: %s\n", sdf_parse_path, msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue