mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
ldgram.y tidies
I've been tripped up before thinking the "end" rule was the "END" token. Let's use a better name. The formatting changes are for consistency within rules, and making it a little easier to visually separate tokens from mid-rule actions. * ldgram.y (separator): Rename from "end". Update uses. (statement): Formatting. Move ';' match to beginning. (paren_script_name): Formatting. Simplify. (must_be_exp, section): Formatting.
This commit is contained in:
96
ld/ldgram.y
96
ld/ldgram.y
@ -422,7 +422,7 @@ sec_or_group_p1:
|
|||||||
statement_anywhere:
|
statement_anywhere:
|
||||||
ENTRY '(' NAME ')'
|
ENTRY '(' NAME ')'
|
||||||
{ lang_add_entry ($3, false); }
|
{ lang_add_entry ($3, false); }
|
||||||
| assignment end
|
| assignment separator
|
||||||
| ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')'
|
| ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')'
|
||||||
{ ldlex_popstate ();
|
{ ldlex_popstate ();
|
||||||
lang_add_assignment (exp_assert ($4, $6)); }
|
lang_add_assignment (exp_assert ($4, $6)); }
|
||||||
@ -663,16 +663,15 @@ input_section_spec:
|
|||||||
;
|
;
|
||||||
|
|
||||||
statement:
|
statement:
|
||||||
assignment end
|
';'
|
||||||
| CREATE_OBJECT_SYMBOLS
|
| assignment separator
|
||||||
|
| CREATE_OBJECT_SYMBOLS
|
||||||
{
|
{
|
||||||
lang_add_attribute(lang_object_symbols_statement_enum);
|
lang_add_attribute (lang_object_symbols_statement_enum);
|
||||||
}
|
}
|
||||||
| ';'
|
| CONSTRUCTORS
|
||||||
| CONSTRUCTORS
|
|
||||||
{
|
{
|
||||||
|
lang_add_attribute (lang_constructors_statement_enum);
|
||||||
lang_add_attribute(lang_constructors_statement_enum);
|
|
||||||
}
|
}
|
||||||
| SORT_BY_NAME '(' CONSTRUCTORS ')'
|
| SORT_BY_NAME '(' CONSTRUCTORS ')'
|
||||||
{
|
{
|
||||||
@ -689,12 +688,19 @@ statement:
|
|||||||
{
|
{
|
||||||
lang_add_fill ($3);
|
lang_add_fill ($3);
|
||||||
}
|
}
|
||||||
| ASSERT_K {ldlex_expression ();} '(' exp ',' NAME ')' end
|
| ASSERT_K
|
||||||
{ ldlex_popstate ();
|
{ ldlex_expression (); }
|
||||||
lang_add_assignment (exp_assert ($4, $6)); }
|
'(' exp ',' NAME ')' separator
|
||||||
|
{
|
||||||
|
ldlex_popstate ();
|
||||||
|
lang_add_assignment (exp_assert ($4, $6));
|
||||||
|
}
|
||||||
| INCLUDE filename
|
| INCLUDE filename
|
||||||
{ ldlex_script (); ldfile_open_command_file($2); }
|
{
|
||||||
statement_list_opt END
|
ldlex_script ();
|
||||||
|
ldfile_open_command_file ($2);
|
||||||
|
}
|
||||||
|
statement_list_opt END
|
||||||
{ ldlex_popstate (); }
|
{ ldlex_popstate (); }
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -754,7 +760,7 @@ assign_op:
|
|||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
end: ';' | ','
|
separator: ';' | ','
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -905,13 +911,13 @@ nocrossref_list:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
paren_script_name:
|
paren_script_name: { ldlex_script (); }
|
||||||
{ ldlex_script (); } '(' NAME { ldlex_popstate (); } ')'
|
'(' NAME ')'
|
||||||
{ $$ = $3; }
|
{ ldlex_popstate (); $$ = $3; }
|
||||||
|
|
||||||
mustbe_exp: { ldlex_expression (); }
|
mustbe_exp: { ldlex_expression (); }
|
||||||
exp
|
exp
|
||||||
{ ldlex_popstate (); $$=$2;}
|
{ ldlex_popstate (); $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp :
|
exp :
|
||||||
@ -1056,31 +1062,35 @@ sect_constraint:
|
|||||||
| { $$ = 0; }
|
| { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
section: NAME { ldlex_expression(); }
|
section: NAME
|
||||||
|
{ ldlex_expression(); }
|
||||||
opt_exp_with_type
|
opt_exp_with_type
|
||||||
opt_at
|
opt_at
|
||||||
opt_align
|
opt_align
|
||||||
opt_align_with_input
|
opt_align_with_input
|
||||||
opt_subalign { ldlex_popstate (); ldlex_script (); }
|
opt_subalign
|
||||||
|
{ ldlex_popstate (); ldlex_script (); }
|
||||||
sect_constraint
|
sect_constraint
|
||||||
'{'
|
'{'
|
||||||
{
|
{
|
||||||
lang_enter_output_section_statement($1, $3,
|
lang_enter_output_section_statement($1, $3, sectype,
|
||||||
sectype,
|
$5, $7, $4,
|
||||||
$5, $7, $4, $9, $6);
|
$9, $6);
|
||||||
}
|
}
|
||||||
statement_list_opt
|
statement_list_opt
|
||||||
'}' { ldlex_popstate (); ldlex_expression (); }
|
'}'
|
||||||
|
{ ldlex_popstate (); ldlex_expression (); }
|
||||||
memspec_opt memspec_at_opt phdr_opt fill_opt
|
memspec_opt memspec_at_opt phdr_opt fill_opt
|
||||||
{
|
{
|
||||||
if (yychar == NAME)
|
if (yychar == NAME)
|
||||||
{
|
{
|
||||||
yyclearin;
|
yyclearin;
|
||||||
ldlex_backup ();
|
ldlex_backup ();
|
||||||
}
|
}
|
||||||
ldlex_popstate ();
|
ldlex_popstate ();
|
||||||
lang_leave_output_section_statement ($18, $15, $17, $16);
|
lang_leave_output_section_statement ($18, $15,
|
||||||
}
|
$17, $16);
|
||||||
|
}
|
||||||
opt_comma
|
opt_comma
|
||||||
| OVERLAY
|
| OVERLAY
|
||||||
{ ldlex_expression (); }
|
{ ldlex_expression (); }
|
||||||
@ -1109,17 +1119,21 @@ section: NAME { ldlex_expression(); }
|
|||||||
svr3.ifile script. It is not intended to be full
|
svr3.ifile script. It is not intended to be full
|
||||||
support. I'm not even sure what GROUP is supposed
|
support. I'm not even sure what GROUP is supposed
|
||||||
to mean. */
|
to mean. */
|
||||||
GROUP { ldlex_expression (); }
|
GROUP
|
||||||
|
{ ldlex_expression (); }
|
||||||
opt_exp_with_type
|
opt_exp_with_type
|
||||||
{
|
{
|
||||||
ldlex_popstate ();
|
ldlex_popstate ();
|
||||||
lang_add_assignment (exp_assign (".", $3, false));
|
lang_add_assignment (exp_assign (".", $3, false));
|
||||||
}
|
}
|
||||||
'{' sec_or_group_p1 '}'
|
'{' sec_or_group_p1 '}'
|
||||||
| INCLUDE filename
|
| INCLUDE filename
|
||||||
{ ldlex_script (); ldfile_open_command_file($2); }
|
{
|
||||||
|
ldlex_script ();
|
||||||
|
ldfile_open_command_file ($2);
|
||||||
|
}
|
||||||
sec_or_group_p1 END
|
sec_or_group_p1 END
|
||||||
{ ldlex_popstate (); }
|
{ ldlex_popstate (); }
|
||||||
;
|
;
|
||||||
|
|
||||||
type:
|
type:
|
||||||
|
Reference in New Issue
Block a user