Clean up indentation in compiler parse.y.
Convert the remaining old-style indentation to the new style.
This commit is contained in:
parent
32f66511e0
commit
01378fbdb0
185
parse.y
185
parse.y
|
|
@ -1958,7 +1958,8 @@ non_integer_type /* IEEE1800-2005: A.2.2.1 */
|
|||
| K_shortreal { $$ = real_type_t::SHORTREAL; }
|
||||
;
|
||||
|
||||
number : BASED_NUMBER
|
||||
number
|
||||
: BASED_NUMBER
|
||||
{ $$ = $1; based_size = 0;}
|
||||
| DEC_NUMBER
|
||||
{ $$ = $1; based_size = 0;}
|
||||
|
|
@ -1968,8 +1969,7 @@ number : BASED_NUMBER
|
|||
| UNBASED_NUMBER
|
||||
{ $$ = $1; based_size = 0;}
|
||||
| DEC_NUMBER UNBASED_NUMBER
|
||||
{ yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
|
||||
"a size.");
|
||||
{ yyerror(@1, "error: Unbased SystemVerilog literal cannot have a size.");
|
||||
$$ = $1; based_size = 0;}
|
||||
;
|
||||
|
||||
|
|
@ -3046,8 +3046,7 @@ delay_value_simple
|
|||
if ($1 == 0 || !get_time_unit($1, unit))
|
||||
yyerror(@1, "internal error: time literal delay.");
|
||||
else {
|
||||
double p = pow(10.0,
|
||||
(double)(unit - pform_get_timeunit()));
|
||||
double p = pow(10.0, (double)(unit - pform_get_timeunit()));
|
||||
double time = atof($1) * p;
|
||||
|
||||
verireal *v = new verireal(time);
|
||||
|
|
@ -3189,8 +3188,10 @@ drive_strength
|
|||
;
|
||||
|
||||
drive_strength_opt
|
||||
: drive_strength { $$ = $1; }
|
||||
| { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
|
||||
: drive_strength
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
|
||||
;
|
||||
|
||||
dr_strength0
|
||||
|
|
@ -3592,8 +3593,10 @@ expression_list_with_nuls
|
|||
* an argument list in parenthesis or with just the task/function name by
|
||||
* itself. When an argument list is used it might be empty. */
|
||||
argument_list_parens_opt
|
||||
: '(' expression_list_with_nuls ')' { $$ = $2; }
|
||||
| { $$ = new std::list<PExpr*>; }
|
||||
: '(' expression_list_with_nuls ')'
|
||||
{ $$ = $2; }
|
||||
|
|
||||
{ $$ = new std::list<PExpr*>; }
|
||||
|
||||
expression_list_proper
|
||||
: expression_list_proper ',' expression
|
||||
|
|
@ -4050,8 +4053,10 @@ expr_primary
|
|||
declarations of ports. We check later to make sure there are no
|
||||
output or inout ports actually used for functions. */
|
||||
tf_item_list_opt /* IEEE1800-2017: A.2.7 */
|
||||
: tf_item_list { $$ = $1; }
|
||||
| { $$ = 0; }
|
||||
: tf_item_list
|
||||
{ $$ = $1; }
|
||||
|
|
||||
{ $$ = 0; }
|
||||
;
|
||||
|
||||
tf_item_list /* IEEE1800-2017: A.2.7 */
|
||||
|
|
@ -4326,8 +4331,7 @@ list_of_variable_port_identifiers
|
|||
|
||||
list_of_ports
|
||||
: port_opt
|
||||
{ std::vector<Module::port_t*>*tmp
|
||||
= new std::vector<Module::port_t*>(1);
|
||||
{ std::vector<Module::port_t*>*tmp = new std::vector<Module::port_t*>(1);
|
||||
(*tmp)[0] = $1;
|
||||
$$ = tmp;
|
||||
}
|
||||
|
|
@ -4340,8 +4344,7 @@ list_of_ports
|
|||
|
||||
list_of_port_declarations
|
||||
: port_declaration
|
||||
{ std::vector<Module::port_t*>*tmp
|
||||
= new std::vector<Module::port_t*>(1);
|
||||
{ std::vector<Module::port_t*>*tmp = new std::vector<Module::port_t*>(1);
|
||||
(*tmp)[0] = $1;
|
||||
$$ = tmp;
|
||||
}
|
||||
|
|
@ -4385,14 +4388,9 @@ list_of_port_declarations
|
|||
$$ = tmp;
|
||||
}
|
||||
| list_of_port_declarations ','
|
||||
{
|
||||
yyerror(@2, "error: Superfluous comma in port declaration list.");
|
||||
}
|
||||
{ yyerror(@2, "error: Superfluous comma in port declaration list."); }
|
||||
| list_of_port_declarations ';'
|
||||
{
|
||||
yyerror(@2, "error: ';' is an invalid port declaration "
|
||||
"separator.");
|
||||
}
|
||||
{ yyerror(@2, "error: ';' is an invalid port declaration separator."); }
|
||||
;
|
||||
|
||||
port_declaration
|
||||
|
|
@ -4735,9 +4733,12 @@ module_attribute_foreign
|
|||
;
|
||||
|
||||
module_port_list_opt
|
||||
: '(' list_of_ports ')' { $$ = $2; }
|
||||
| '(' list_of_port_declarations ')' { $$ = $2; }
|
||||
| { $$ = 0; }
|
||||
: '(' list_of_ports ')'
|
||||
{ $$ = $2; }
|
||||
| '(' list_of_port_declarations ')'
|
||||
{ $$ = $2; }
|
||||
|
|
||||
{ $$ = 0; }
|
||||
| '(' error ')'
|
||||
{ yyerror(@2, "Errors in port declarations.");
|
||||
yyerrok;
|
||||
|
|
@ -4780,9 +4781,7 @@ module_parameter_port_list
|
|||
"list");
|
||||
}
|
||||
| type_param
|
||||
{
|
||||
param_is_local = false;
|
||||
}
|
||||
{ param_is_local = false; }
|
||||
parameter_assign
|
||||
| module_parameter_port_list ',' module_parameter
|
||||
| module_parameter_port_list ',' data_type_opt
|
||||
|
|
@ -5282,7 +5281,10 @@ module_item_list_opt
|
|||
|
|
||||
;
|
||||
|
||||
generate_if : K_if '(' expression ')' { pform_start_generate_if(@1, $3); } ;
|
||||
generate_if
|
||||
: K_if '(' expression ')'
|
||||
{ pform_start_generate_if(@1, $3); }
|
||||
;
|
||||
|
||||
generate_case_items
|
||||
: generate_case_items generate_case_item
|
||||
|
|
@ -5290,9 +5292,13 @@ generate_case_items
|
|||
;
|
||||
|
||||
generate_case_item
|
||||
: expression_list_proper ':' { pform_generate_case_item(@1, $1); } generate_block
|
||||
: expression_list_proper ':'
|
||||
{ pform_generate_case_item(@1, $1); }
|
||||
generate_block
|
||||
{ pform_endgenerate(false); }
|
||||
| K_default ':' { pform_generate_case_item(@1, 0); } generate_block
|
||||
| K_default ':'
|
||||
{ pform_generate_case_item(@1, 0); }
|
||||
generate_block
|
||||
{ pform_endgenerate(false); }
|
||||
;
|
||||
|
||||
|
|
@ -5306,9 +5312,9 @@ generate_item
|
|||
cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
|
||||
}
|
||||
}
|
||||
| K_begin ':' IDENTIFIER {
|
||||
pform_start_generate_nblock(@1, $3);
|
||||
} generate_item_list_opt K_end
|
||||
| K_begin ':' IDENTIFIER
|
||||
{ pform_start_generate_nblock(@1, $3); }
|
||||
generate_item_list_opt K_end
|
||||
{ /* Detect and warn about anachronistic named begin/end use */
|
||||
if (generation_flag > GN_VER2001 && warn_anachronisms) {
|
||||
warn_count += 1;
|
||||
|
|
@ -5324,7 +5330,8 @@ generate_item_list
|
|||
;
|
||||
|
||||
generate_item_list_opt
|
||||
: { pform_generate_single_item = false; } generate_item_list
|
||||
: { pform_generate_single_item = false; }
|
||||
generate_item_list
|
||||
|
|
||||
;
|
||||
|
||||
|
|
@ -5421,8 +5428,15 @@ param_type
|
|||
}
|
||||
| type_param
|
||||
|
||||
parameter : K_parameter { param_is_local = false; };
|
||||
localparam : K_localparam { param_is_local = true; };
|
||||
parameter
|
||||
: K_parameter
|
||||
{ param_is_local = false; }
|
||||
;
|
||||
|
||||
localparam
|
||||
: K_localparam
|
||||
{ param_is_local = true; }
|
||||
;
|
||||
|
||||
parameter_declaration
|
||||
: parameter_or_localparam param_type parameter_assign_list ';'
|
||||
|
|
@ -5534,8 +5548,7 @@ parameter_value_opt
|
|||
$$ = lst;
|
||||
}
|
||||
| '#' error
|
||||
{ yyerror(@1, "error: syntax error in parameter value "
|
||||
"assignment list.");
|
||||
{ yyerror(@1, "error: syntax error in parameter value assignment list.");
|
||||
$$ = 0;
|
||||
}
|
||||
|
|
||||
|
|
@ -5728,7 +5741,6 @@ port_conn_expression_list_with_nuls
|
|||
port_t object to pass it up to the module declaration code. */
|
||||
|
||||
port_reference
|
||||
|
||||
: IDENTIFIER
|
||||
{ Module::port_t*ptmp;
|
||||
perm_string name = lex_strings.make($1);
|
||||
|
|
@ -5736,7 +5748,6 @@ port_reference
|
|||
delete[]$1;
|
||||
$$ = ptmp;
|
||||
}
|
||||
|
||||
| IDENTIFIER '[' expression ':' expression ']'
|
||||
{ index_component_t itmp;
|
||||
itmp.sel = index_component_t::SEL_PART;
|
||||
|
|
@ -5760,7 +5771,6 @@ port_reference
|
|||
delete[]$1;
|
||||
$$ = ptmp;
|
||||
}
|
||||
|
||||
| IDENTIFIER '[' expression ']'
|
||||
{ index_component_t itmp;
|
||||
itmp.sel = index_component_t::SEL_BIT;
|
||||
|
|
@ -5783,7 +5793,6 @@ port_reference
|
|||
delete[]$1;
|
||||
$$ = ptmp;
|
||||
}
|
||||
|
||||
| IDENTIFIER '[' error ']'
|
||||
{ yyerror(@1, "error: invalid port bit select");
|
||||
Module::port_t*ptmp = new Module::port_t;
|
||||
|
|
@ -5868,11 +5877,9 @@ event_variable_list
|
|||
specify_item
|
||||
: K_specparam specparam_decl ';'
|
||||
| specify_simple_path_decl ';'
|
||||
{ pform_module_specify_path($1);
|
||||
}
|
||||
{ pform_module_specify_path($1); }
|
||||
| specify_edge_path_decl ';'
|
||||
{ pform_module_specify_path($1);
|
||||
}
|
||||
{ pform_module_specify_path($1); }
|
||||
| K_if '(' expression ')' specify_simple_path_decl ';'
|
||||
{ PSpecPath*tmp = $5;
|
||||
if (tmp) {
|
||||
|
|
@ -5898,8 +5905,7 @@ specify_item
|
|||
pform_module_specify_path(tmp);
|
||||
}
|
||||
| K_ifnone specify_edge_path_decl ';'
|
||||
{ yywarn(@1, "Sorry: ifnone with an edge-sensitive path is "
|
||||
"not supported.");
|
||||
{ yywarn(@1, "Sorry: ifnone with an edge-sensitive path is not supported.");
|
||||
yyerrok;
|
||||
}
|
||||
| K_Sfullskew '(' spec_reference_event ',' spec_reference_event
|
||||
|
|
@ -5993,25 +5999,32 @@ specify_edge_path_decl
|
|||
}
|
||||
;
|
||||
|
||||
edge_operator : K_posedge { $$ = true; } | K_negedge { $$ = false; } ;
|
||||
edge_operator
|
||||
: K_posedge { $$ = true; }
|
||||
| K_negedge { $$ = false; }
|
||||
;
|
||||
|
||||
specify_edge_path
|
||||
: '(' specify_path_identifiers spec_polarity
|
||||
K_EG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
||||
{ int edge_flag = 0;
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8);
|
||||
}
|
||||
| '(' edge_operator specify_path_identifiers spec_polarity
|
||||
K_EG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
||||
{ int edge_flag = $2? 1 : -1;
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);
|
||||
}
|
||||
| '(' specify_path_identifiers spec_polarity
|
||||
K_SG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
||||
{ int edge_flag = 0;
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8);
|
||||
}
|
||||
| '(' edge_operator specify_path_identifiers spec_polarity
|
||||
K_SG '(' specify_path_identifiers polarity_operator expression ')' ')'
|
||||
{ int edge_flag = $2? 1 : -1;
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
|
||||
$$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9);
|
||||
}
|
||||
;
|
||||
|
||||
polarity_operator
|
||||
|
|
@ -6036,11 +6049,9 @@ specify_simple_path_decl
|
|||
;
|
||||
|
||||
specify_simple_path
|
||||
: '(' specify_path_identifiers spec_polarity
|
||||
K_EG specify_path_identifiers ')'
|
||||
: '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')'
|
||||
{ $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
|
||||
| '(' specify_path_identifiers spec_polarity
|
||||
K_SG specify_path_identifiers ')'
|
||||
| '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')'
|
||||
{ $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
|
||||
| '(' error ')'
|
||||
{ yyerror(@1, "Invalid simple path");
|
||||
|
|
@ -6110,8 +6121,7 @@ specify_path_identifiers
|
|||
specparam
|
||||
: IDENTIFIER '=' expression
|
||||
{ PExpr*tmp = $3;
|
||||
pform_set_specparam(@1, lex_strings.make($1),
|
||||
specparam_active_range, tmp);
|
||||
pform_set_specparam(@1, lex_strings.make($1), specparam_active_range, tmp);
|
||||
delete[]$1;
|
||||
}
|
||||
| IDENTIFIER '=' expression ':' expression ':' expression
|
||||
|
|
@ -6149,8 +6159,7 @@ specparam
|
|||
cerr << " expression." << endl;
|
||||
min_typ_max_warn -= 1;
|
||||
}
|
||||
pform_set_specparam(@1, lex_strings.make($1),
|
||||
specparam_active_range, tmp);
|
||||
pform_set_specparam(@1, lex_strings.make($1), specparam_active_range, tmp);
|
||||
delete[]$1;
|
||||
}
|
||||
| PATHPULSE_IDENTIFIER '=' expression
|
||||
|
|
@ -6239,7 +6248,8 @@ spec_notifier
|
|||
"and delayed signal \"" << *$3
|
||||
<< "\" will not be driven." << endl;
|
||||
}
|
||||
delete $3; }
|
||||
delete $3;
|
||||
}
|
||||
/* How do we match this path? */
|
||||
| IDENTIFIER
|
||||
{ args_after_notifier = 0; delete[]$1; }
|
||||
|
|
@ -6443,11 +6453,14 @@ statement_item /* This is roughly statement_item in the LRM */
|
|||
yywarn(@1, "Sorry: ->> with repeat event control is not currently supported.");
|
||||
}
|
||||
|
||||
| procedural_assertion_statement { $$ = $1; }
|
||||
| procedural_assertion_statement
|
||||
{ $$ = $1; }
|
||||
|
||||
| loop_statement { $$ = $1; }
|
||||
| loop_statement
|
||||
{ $$ = $1; }
|
||||
|
||||
| jump_statement { $$ = $1; }
|
||||
| jump_statement
|
||||
{ $$ = $1; }
|
||||
|
||||
| unique_priority K_case '(' expression ')' case_items K_endcase
|
||||
{ PCase*tmp = new PCase($1, NetCase::EQ, $4, $6);
|
||||
|
|
@ -6695,7 +6708,6 @@ compressed_statement
|
|||
}
|
||||
;
|
||||
|
||||
|
||||
statement_or_null_list_opt
|
||||
: statement_or_null_list
|
||||
{ $$ = $1; }
|
||||
|
|
@ -6875,7 +6887,10 @@ udp_input_sym
|
|||
| 'q' { $$ = 'q'; }
|
||||
| '_' { $$ = '_'; }
|
||||
| '+' { $$ = '+'; }
|
||||
| DEC_NUMBER { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
|
||||
| DEC_NUMBER
|
||||
{ yyerror(@1, "internal error: Input digits parse as decimal number!");
|
||||
$$ = '0';
|
||||
}
|
||||
;
|
||||
|
||||
udp_output_sym
|
||||
|
|
@ -6883,7 +6898,10 @@ udp_output_sym
|
|||
| '1' { $$ = '1'; }
|
||||
| 'x' { $$ = 'x'; }
|
||||
| '-' { $$ = '-'; }
|
||||
| DEC_NUMBER { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
|
||||
| DEC_NUMBER
|
||||
{ yyerror(@1, "internal error: Output digits parse as decimal number!");
|
||||
$$ = '0';
|
||||
}
|
||||
;
|
||||
|
||||
/* Port declarations create wires for the inputs and the output. The
|
||||
|
|
@ -6947,7 +6965,9 @@ udp_port_list
|
|||
}
|
||||
;
|
||||
|
||||
udp_reg_opt: K_reg { $$ = true; } | { $$ = false; };
|
||||
udp_reg_opt
|
||||
: K_reg { $$ = true; }
|
||||
| { $$ = false; };
|
||||
|
||||
udp_input_declaration_list
|
||||
: K_input IDENTIFIER
|
||||
|
|
@ -6974,7 +6994,6 @@ udp_primitive
|
|||
udp_init_opt
|
||||
udp_body
|
||||
K_endprimitive label_opt
|
||||
|
||||
{ perm_string tmp2 = lex_strings.make($2);
|
||||
pform_make_udp(@2, tmp2, $4, $7, $9, $8);
|
||||
check_end_label(@11, "primitive", $2, $11);
|
||||
|
|
@ -6989,7 +7008,6 @@ udp_primitive
|
|||
udp_input_declaration_list ')' ';'
|
||||
udp_body
|
||||
K_endprimitive label_opt
|
||||
|
||||
{ perm_string tmp2 = lex_strings.make($2);
|
||||
perm_string tmp6 = lex_strings.make($6);
|
||||
pform_make_udp(@2, tmp2, $5, tmp6, $7, $9, $12);
|
||||
|
|
@ -7010,7 +7028,22 @@ unique_priority
|
|||
presence is significant. This is a fairly common pattern so
|
||||
collect those rules here. */
|
||||
|
||||
K_genvar_opt : K_genvar { $$ = true; } | { $$ = false; } ;
|
||||
K_static_opt : K_static { $$ = true; } | { $$ = false; } ;
|
||||
K_virtual_opt : K_virtual { $$ = true; } | { $$ = false; } ;
|
||||
K_var_opt : K_var | ;
|
||||
K_genvar_opt
|
||||
: K_genvar { $$ = true; }
|
||||
| { $$ = false; }
|
||||
;
|
||||
|
||||
K_static_opt
|
||||
: K_static { $$ = true; }
|
||||
| { $$ = false; }
|
||||
;
|
||||
|
||||
K_virtual_opt
|
||||
: K_virtual { $$ = true; }
|
||||
| { $$ = false; }
|
||||
;
|
||||
|
||||
K_var_opt
|
||||
: K_var
|
||||
|
|
||||
;
|
||||
|
|
|
|||
Loading…
Reference in New Issue