vhdlpp: Handle 'severity' statements without using keywords.

This commit is contained in:
Maciej Suminski 2015-04-24 12:04:41 +02:00
parent 7c0a191626
commit bed5ee4529
2 changed files with 18 additions and 13 deletions

View File

@ -45,9 +45,7 @@ else, GN_KEYWORD_2008, K_else
elsif, GN_KEYWORD_2008, K_elsif
end, GN_KEYWORD_2008, K_end
entity, GN_KEYWORD_2008, K_entity
error, GN_KEYWORD_2008, K_error
exit, GN_KEYWORD_2008, K_exit
failure, GN_KEYWORD_2008, K_failure
fairness, GN_KEYWORD_2008, K_fairness
false, GN_KEYWORD_2008, K_false
file, GN_KEYWORD_2008, K_file
@ -76,7 +74,6 @@ new, GN_KEYWORD_2008, K_new
next, GN_KEYWORD_2008, K_next
nor, GN_KEYWORD_2008, K_nor
not, GN_KEYWORD_2008, K_not
note, GN_KEYWORD_2008, K_note
null, GN_KEYWORD_2008, K_null
of, GN_KEYWORD_2008, K_of
on, GN_KEYWORD_2008, K_on
@ -129,7 +126,6 @@ vmode, GN_KEYWORD_2008, K_vmode
vprop, GN_KEYWORD_2008, K_vprop
vunit, GN_KEYWORD_2008, K_vunit
wait, GN_KEYWORD_2008, K_wait
warning, GN_KEYWORD_2008, K_warning
when, GN_KEYWORD_2008, K_when
while, GN_KEYWORD_2008, K_while
with, GN_KEYWORD_2008, K_with

View File

@ -271,13 +271,13 @@ static void touchup_interface_for_functions(std::list<InterfacePort*>*ports)
%token K_begin K_block K_body K_buffer K_bus
%token K_case K_component K_configuration K_constant K_context K_cover
%token K_default K_disconnect K_downto
%token K_else K_elsif K_end K_entity K_error K_exit
%token K_failure K_fairness K_false K_file K_for K_force K_function
%token K_else K_elsif K_end K_entity K_exit
%token K_fairness K_false K_file K_for K_force K_function
%token K_generate K_generic K_group K_guarded
%token K_if K_impure K_in K_inertial K_inout K_is
%token K_label K_library K_linkage K_literal K_loop
%token K_map K_mod
%token K_nand K_new K_next K_nor K_not K_note K_null
%token K_nand K_new K_next K_nor K_not K_null
%token K_of K_on K_open K_or K_others K_out
%token K_package K_parameter K_port K_postponed K_procedure K_process
%token K_property K_protected K_pure
@ -288,7 +288,7 @@ static void touchup_interface_for_functions(std::list<InterfacePort*>*ports)
%token K_then K_to K_transport K_true K_type
%token K_unaffected K_units K_until K_use
%token K_variable K_vmode K_vprop K_vunit
%token K_wait K_warning K_when K_while K_with
%token K_wait K_when K_while K_with
%token K_xnor K_xor
/* Identifiers that are not keywords are identifiers. */
%token <text> IDENTIFIER
@ -2186,11 +2186,20 @@ sequential_statement
;
severity
: K_severity K_note { $$ = ReportStmt::NOTE; }
| K_severity K_warning { $$ = ReportStmt::WARNING; }
| K_severity K_error { $$ = ReportStmt::ERROR; }
| K_severity K_failure { $$ = ReportStmt::FAILURE; }
;
: K_severity IDENTIFIER
{ if(!strcasecmp($2, "NOTE"))
$$ = ReportStmt::NOTE;
else if(!strcasecmp($2, "WARNING"))
$$ = ReportStmt::WARNING;
else if(!strcasecmp($2, "ERROR"))
$$ = ReportStmt::ERROR;
else if(!strcasecmp($2, "FAILURE"))
$$ = ReportStmt::FAILURE;
else {
errormsg(@1, "Invalid severity level (possible values: NOTE, WARNING, ERROR, FAILURE).\n");
$$ = ReportStmt::UNSPECIFIED;
}
}
severity_opt
: severity { $$ = $1; }