diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-04-23 05:57:45 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-04-23 05:57:45 +0000 |
commit | 0c8de5b03c61eb9097b89cb41e9180db6d606de1 (patch) | |
tree | 9b52c7ad1105b009106bdfb7a55d9470e3fa5826 /contrib/byacc/error.c | |
parent | 66b8205e11fd90ed1ae9547217f3f839b6acc8a3 (diff) | |
parent | 4ecea33a988c00caa98cacf934e61e361d94e8af (diff) | |
download | src-test2-0c8de5b03c61eb9097b89cb41e9180db6d606de1.tar.gz src-test2-0c8de5b03c61eb9097b89cb41e9180db6d606de1.zip |
Notes
Diffstat (limited to 'contrib/byacc/error.c')
-rw-r--r-- | contrib/byacc/error.c | 120 |
1 files changed, 117 insertions, 3 deletions
diff --git a/contrib/byacc/error.c b/contrib/byacc/error.c index 3bab31b8addc..a042aec71e73 100644 --- a/contrib/byacc/error.c +++ b/contrib/byacc/error.c @@ -1,4 +1,4 @@ -/* $Id: error.c,v 1.9 2011/09/05 23:27:43 tom Exp $ */ +/* $Id: error.c,v 1.11 2014/04/07 22:22:49 tom Exp $ */ /* routines for printing error messages */ @@ -42,9 +42,9 @@ unexpected_EOF(void) } static void -print_pos(char *st_line, char *st_cptr) +print_pos(const char *st_line, const char *st_cptr) { - char *s; + const char *s; if (st_line == 0) return; @@ -286,3 +286,117 @@ undefined_symbol_warning(char *s) { fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s); } + +#if ! defined(YYBTYACC) +void +unsupported_flag_warning(const char *flag, const char *details) +{ + fprintf(stderr, "%s: w - %s flag unsupported, %s\n", + myname, flag, details); +} +#endif + +#if defined(YYBTYACC) +void +at_warning(int a_lineno, int i) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", @%d references beyond the \ +end of the current rule\n", myname, a_lineno, input_file_name, i); +} + +void +at_error(int a_lineno, char *a_line, char *a_cptr) +{ + fprintf(stderr, + "%s: e - line %d of \"%s\", illegal @$ or @N reference\n", + myname, a_lineno, input_file_name); + print_pos(a_line, a_cptr); + done(1); +} + +void +unterminated_arglist(int a_lineno, char *a_line, char *a_cptr) +{ + fprintf(stderr, + "%s: e - line %d of \"%s\", unterminated argument list\n", + myname, a_lineno, input_file_name); + print_pos(a_line, a_cptr); + done(1); +} + +void +arg_number_disagree_warning(int a_lineno, char *a_name) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", number of arguments of %s " + "doesn't agree with previous declaration\n", + myname, a_lineno, input_file_name, a_name); +} + +void +bad_formals(void) +{ + fprintf(stderr, "%s: e - line %d of \"%s\", bad formal argument list\n", + myname, lineno, input_file_name); + print_pos(line, cptr); + done(1); +} + +void +arg_type_disagree_warning(int a_lineno, int i, char *a_name) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", type of argument %d " + "to %s doesn't agree with previous declaration\n", + myname, a_lineno, input_file_name, i, a_name); +} + +void +unknown_arg_warning(int d_lineno, const char *dlr_opt, const char *d_arg, const char + *d_line, const char *d_cptr) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", unknown argument %s%s\n", + myname, d_lineno, input_file_name, dlr_opt, d_arg); + print_pos(d_line, d_cptr); +} + +void +untyped_arg_warning(int a_lineno, const char *dlr_opt, const char *a_name) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", untyped argument %s%s\n", + myname, a_lineno, input_file_name, dlr_opt, a_name); +} + +void +wrong_number_args_warning(const char *which, const char *a_name) +{ + fprintf(stderr, + "%s: w - line %d of \"%s\", wrong number of %sarguments for %s\n", + myname, lineno, input_file_name, which, a_name); + print_pos(line, cptr); +} + +void +wrong_type_for_arg_warning(int i, char *a_name) +{ + fprintf(stderr, + "%s: w - line %d of \"%s\", wrong type for default argument %d to %s\n", + myname, lineno, input_file_name, i, a_name); + print_pos(line, cptr); +} + +void +start_requires_args(char *a_name) +{ + fprintf(stderr, + "%s: w - line %d of \"%s\", start symbol %s requires arguments\n", + myname, 0, input_file_name, a_name); + +} + +void +destructor_redeclared_warning(int a_lineno, char *a_line, char *a_cptr) +{ + fprintf(stderr, "%s: w - line %d of \"%s\", destructor redeclared\n", + myname, a_lineno, input_file_name); + print_pos(a_line, a_cptr); +} +#endif |