Pass command line location to skeleton_arg and language_argmatch.

* src/getargs.h, src/getargs.c (skeleton_arg, language_argmatch):
	The location argument is now mandatory.
	Adjust all dependencies.
	(getargs): Use command_line_location.
This commit is contained in:
Akim Demaille
2008-07-29 13:30:02 +02:00
committed by Joel E. Denny
parent e14c68313b
commit e186a28486
5 changed files with 25 additions and 18 deletions

View File

@@ -1,3 +1,11 @@
2008-11-07 Akim Demaille <demaille@gostai.com>
Pass command line location to skeleton_arg and language_argmatch.
* src/getargs.h, src/getargs.c (skeleton_arg, language_argmatch):
The location argument is now mandatory.
Adjust all dependencies.
(getargs): Use command_line_location.
2008-11-07 Akim Demaille <demaille@gostai.com> 2008-11-07 Akim Demaille <demaille@gostai.com>
-D, --define. -D, --define.

View File

@@ -361,7 +361,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
`--------------------------------------*/ `--------------------------------------*/
void void
skeleton_arg (char const *arg, int prio, location const *loc) skeleton_arg (char const *arg, int prio, location loc)
{ {
if (prio < skeleton_prio) if (prio < skeleton_prio)
{ {
@@ -372,15 +372,12 @@ skeleton_arg (char const *arg, int prio, location const *loc)
{ {
char const *msg = char const *msg =
_("multiple skeleton declarations are invalid"); _("multiple skeleton declarations are invalid");
if (loc) complain_at (loc, msg);
complain_at (*loc, msg);
else
complain (msg);
} }
} }
void void
language_argmatch (char const *arg, int prio, location const *loc) language_argmatch (char const *arg, int prio, location loc)
{ {
char const *msg; char const *msg;
@@ -401,10 +398,7 @@ language_argmatch (char const *arg, int prio, location const *loc)
else else
return; return;
if (loc) complain_at (loc, msg, arg);
complain_at (*loc, msg, arg);
else
complain (msg, arg);
} }
/*----------------------. /*----------------------.
@@ -546,11 +540,13 @@ getargs (int argc, char *argv[])
break; break;
case 'L': case 'L':
language_argmatch (optarg, command_line_prio, NULL); language_argmatch (optarg, command_line_prio,
command_line_location ());
break; break;
case 'S': case 'S':
skeleton_arg (AS_FILE_NAME (optarg), command_line_prio, NULL); skeleton_arg (AS_FILE_NAME (optarg), command_line_prio,
command_line_location ());
break; break;
case 'T': case 'T':

View File

@@ -135,7 +135,7 @@ extern int warnings_flag;
void getargs (int argc, char *argv[]); void getargs (int argc, char *argv[]);
/* Used by parse-gram.y. */ /* Used by parse-gram.y. */
void language_argmatch (char const *arg, int prio, location const *loc); void language_argmatch (char const *arg, int prio, location loc);
void skeleton_arg (const char *arg, int prio, location const *loc); void skeleton_arg (const char *arg, int prio, location loc);
#endif /* !GETARGS_H_ */ #endif /* !GETARGS_H_ */

View File

@@ -1994,7 +1994,10 @@ yyreduce:
/* Line 1455 of yacc.c */ /* Line 1455 of yacc.c */
#line 257 "parse-gram.y" #line 257 "parse-gram.y"
{ language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, &(yylsp[(1) - (2)])); } { language_argmatch ((yyvsp[(2) - (2)].chars), grammar_prio, (yylsp[(1) - (2)])); }
/* Line 1457 of yacc.c */
#line 2036 "../../../src/parse-gram.c"
break; break;
case 19: case 19:
@@ -2110,7 +2113,7 @@ yyreduce:
skeleton_user = uniqstr_new (skeleton_build); skeleton_user = uniqstr_new (skeleton_build);
free (skeleton_build); free (skeleton_build);
} }
skeleton_arg (skeleton_user, grammar_prio, &(yylsp[(1) - (2)])); skeleton_arg (skeleton_user, grammar_prio, (yylsp[(1) - (2)]));
} }
break; break;

View File

@@ -254,7 +254,7 @@ prologue_declaration:
muscle_code_grow ("initial_action", action.code, @2); muscle_code_grow ("initial_action", action.code, @2);
code_scanner_last_string_free (); code_scanner_last_string_free ();
} }
| "%language" STRING { language_argmatch ($2, grammar_prio, &@1); } | "%language" STRING { language_argmatch ($2, grammar_prio, @1); }
| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); } | "%lex-param" "{...}" { add_param ("lex_param", $2, @2); }
| "%locations" { locations_flag = true; } | "%locations" { locations_flag = true; }
| "%name-prefix" STRING { spec_name_prefix = $2; } | "%name-prefix" STRING { spec_name_prefix = $2; }
@@ -300,7 +300,7 @@ prologue_declaration:
skeleton_user = uniqstr_new (skeleton_build); skeleton_user = uniqstr_new (skeleton_build);
free (skeleton_build); free (skeleton_build);
} }
skeleton_arg (skeleton_user, grammar_prio, &@1); skeleton_arg (skeleton_user, grammar_prio, @1);
} }
| "%token-table" { token_table_flag = true; } | "%token-table" { token_table_flag = true; }
| "%verbose" { report_flag |= report_states; } | "%verbose" { report_flag |= report_states; }