[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SPAM] Re: [updated PATCH] %language declaration
From: |
Joel E. Denny |
Subject: |
Re: [SPAM] Re: [updated PATCH] %language declaration |
Date: |
Sat, 6 Jan 2007 22:19:20 -0500 (EST) |
On Sat, 6 Jan 2007, Joel E. Denny wrote:
> +2007-01-05 Joel E. Denny <address@hidden>
> + Provide warn, complain, and fatal function callbacks to the skeletons.
> + This provides more flexibility than m4_fatal, improves the error
> + message format, and captures messages for translation. Discussed
> + starting at
> + <http://lists.gnu.org/archive/html/bison-patches/2006-12/msg00063.html>.
I committed the following to add the _at forms.
Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1650
diff -p -u -r1.1650 ChangeLog
--- ChangeLog 6 Jan 2007 23:12:25 -0000 1.1650
+++ ChangeLog 7 Jan 2007 03:14:01 -0000
@@ -1,5 +1,39 @@
2007-01-06 Joel E. Denny <address@hidden>
+ Provide warn_at, complain_at, and fatal_at function callbacks to the
+ skeletons, and use this for %code qualifier complaints.
+ * data/bison.m4 (b4_error_at): New, invoked by...
+ (b4_warn_at, b4_complain_at, b4_fatal_at): ... these new macros to wrap
+ the skeleton scanner's new @warn_at(...@), @complain_at(...@), and
+ @fatal_at(...@) directives.
+ (b4_check_percent_code_qualifiers): Rewrite to expect locations for
+ qualifiers in b4_used_percent_code_qualifiers and to use
+ b4_complain_at.
+ * src/location.c, src/location.h (boundary_set_from_string): New global
+ function.
+ * src/muscle_tab.c, src/muscle_tab.h (muscle_boundary_grow): New global
+ function.
+ * src/parse-gram.y (grammar_declaration): Add locations for qualifiers
+ to b4_used_percent_code_qualifiers.
+ * src/scan-skel.l (fail_for_at_directive_too_few_args): New static
+ function.
+ (AT_DIRECTIVE_ARGC_MAX): Increase for boundary arguments.
+ (lineno): Rename to...
+ (out_lineno): ... this so I don't misunderstand it again.
+ (SC_AT_DIRECTIVE_SKIP_WS): Don't increment out_lineno for newlines
+ here; these newlines are in the input but not the output file.
+ (SC_AT_DIRECTIVE_ARG): Likewise. Extract directive execution to...
+ (at_directive_perform): ... this new static function, and add handling
+ of new @warn_at(...@), @complain_at(...@), and @fatal_at(...@)
+ directives.
+ * tests/input.at (Reject bad %code qualifiers): Update test output with
+ locations and extend.
+
+ * tests/output.at (Output file name: [, Output file name: ]): Remove
+ bogus comment about these tests failing.
+
+2007-01-06 Joel E. Denny <address@hidden>
+
Clean up b4_check_percent_code_qualifiers a little.
* data/bison.m4 (b4_check_percent_code_qualifiers): Expect qualifiers
in b4_used_percent_code_qualifiers to be double-M4-quoted. Rewrite
Index: data/bison.m4
===================================================================
RCS file: /sources/bison/bison/data/bison.m4,v
retrieving revision 1.7
diff -p -u -r1.7 bison.m4
--- data/bison.m4 6 Jan 2007 23:12:25 -0000 1.7
+++ data/bison.m4 7 Jan 2007 03:14:01 -0000
@@ -66,7 +66,7 @@ version 2.2 of Bison.])])
## ---------------- ##
# b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
-# ---------------------------------------------------------------
+# -----------------------------------------------------
# Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
m4_define([b4_error],
[m4_divert_push(0)address@hidden(]$2[]m4_if([$#], [2], [],
@@ -74,8 +74,17 @@ m4_define([b4_error],
m4_dquote(m4_shift(m4_shift($@))),
[[@,]b4_arg])])[@)]m4_divert_pop(0)])
+# b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
+# -----------------------------------------------------------------
+# Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
+m4_define([b4_error_at],
+[m4_divert_push(0)address@hidden(]$2[@,]$3[@,]$4[]m4_if([$#], [4], [],
+[m4_foreach([b4_arg],
+ m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
+ [[@,]b4_arg])])[@)]m4_divert_pop(0)])
+
# b4_warn(FORMAT, [ARG1], [ARG2], ...)
-# --------------------------------------------------------
+# -----------------------------------------------------
# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
#
# As a simple test suite, this:
@@ -89,8 +98,6 @@ m4_define([b4_error],
# m4_divert(0)
# b4_warn([asdf), asdf], [fsa), fsa], [fdsa), fdsa])
# m4_divert(0)
-# b4_warn
-# m4_divert(0)
# b4_warn()
# m4_divert(0)
# b4_warn(1)
@@ -103,28 +110,45 @@ m4_define([b4_error],
# @warn(asdf), asdf@,fsa), fsa@,fdsa), fdsa@)
# @warn(ASDF), ASDF@,FSA), FSA@,FDSA), FDSA@)
# @warn(@)
-# @warn(@)
# @warn(1@)
# @warn(1@,2@)
m4_define([b4_warn],
[b4_error([[warn]], $@)])
+# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# -----------------------------------------------------------------
+# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
+m4_define([b4_warn_at],
+[b4_error_at([[warn]], $@)])
+
# b4_complain(FORMAT, [ARG1], [ARG2], ...)
-# ------------------------------------------------------------
+# ---------------------------------------------------------
# Write @complain(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
#
# See the test suite for b4_warn above.
m4_define([b4_complain],
[b4_error([[complain]], $@)])
+# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# ---------------------------------------------------------------------
+# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
+m4_define([b4_complain_at],
+[b4_error_at([[complain]], $@)])
+
# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
-# ---------------------------------------------------------
+# ------------------------------------------------------
# Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
#
# See the test suite for b4_warn above.
m4_define([b4_fatal],
[b4_error([[fatal]], $@)])
+# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# ------------------------------------------------------------------
+# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
+m4_define([b4_fatal_at],
+[b4_error_at([[fatal]], $@)])
+
## ---------------- ##
## Default values. ##
@@ -264,17 +288,19 @@ b4_define_user_code([stype])
# Complain if any %code qualifier used in the grammar is not a valid qualifier.
#
# If no %code qualifiers are used in the grammar,
-# b4_used_percent_code_qualifiers must be undefined or expand to the empty
-# string. Otherwise, it must expand to a comma-delimited list specifying all
-# %code qualifiers used in the grammar. Each item in the list must expand to
-# text that expands to one of those qualifiers. For example, to define
-# b4_used_percent_code_qualifiers with two qualifiers with correct quoting:
+# b4_used_percent_code_qualifiers must be undefined or must expand to the empty
+# string. Otherwise, it must expand to a list specifying all occurrences of
+# all %code qualifiers used in the grammar. Each item in the list is a
+# triplet specifying one occurrence: qualifier, start boundary, and end
+# boundary. For example, to define b4_used_percent_code_qualifiers with three
+# qualifier occurrences with correct quoting:
#
# m4_define([b4_used_percent_code_qualifiers],
-# [[[[requires]], [[provides]]]])
+# [[[[[[requires]], [[parser.y:1.7]], [[parser.y:1.16]]]],
+# [[[[provides]], [[parser.y:5.7]], [[parser.y:5.16]]]],
+# [[[[provides]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
#
-# Multiple occurrences of the same qualifier are fine. Empty string qualifiers
-# are fine.
+# Empty string qualifiers are fine.
#
# Each VALID_QUALIFIER must expand to a valid qualifier. For example,
# b4_check_percent_code_qualifiers might be invoked with:
@@ -292,13 +318,22 @@ b4_define_user_code([stype])
# Qualifiers and valid qualifiers must not contain the character `,'.
m4_define([b4_check_percent_code_qualifiers],
[m4_ifdef([b4_used_percent_code_qualifiers], [
-m4_foreach([b4_qualifier],
+m4_foreach([b4_occurrence],
b4_used_percent_code_qualifiers,
- [m4_if(m4_index(m4_if($#, 0, [], [[,]m4_quote($*)[,]]),
+ [m4_pushdef([b4_occurrence], b4_occurrence)
+ m4_pushdef([b4_qualifier], m4_car(b4_occurrence))
+ m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))
+ m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))
+ m4_if(m4_index(m4_if($#, 0, [], [[,]m4_quote($*)[,]]),
[,]b4_qualifier[,]),
[-1],
- [b4_complain([[`%s' is not a recognized %%code qualifier]],
- [b4_qualifier])
+ [b4_complain_at([b4_start], [b4_end],
+ [[`%s' is not a recognized %%code
qualifier]],
+ [b4_qualifier])
])
+ m4_popdef([b4_occurrence])
+ m4_popdef([b4_qualifier])
+ m4_popdef([b4_start])
+ m4_popdef([b4_end])
])
])])
Index: src/location.c
===================================================================
RCS file: /sources/bison/bison/src/location.c,v
retrieving revision 1.11
diff -p -u -r1.11 location.c
--- src/location.c 2 Jan 2007 23:31:14 -0000 1.11
+++ src/location.c 7 Jan 2007 03:14:01 -0000
@@ -116,3 +116,19 @@ location_print (FILE *out, location loc)
else if (loc.start.column < end_col)
fprintf (out, "-%d", end_col);
}
+
+void
+boundary_set_from_string (boundary *bound, char *loc_str)
+{
+ /* Must search in reverse since the file name field may
+ * contain `.' or `:'. */
+ char *delim = strrchr (loc_str, '.');
+ aver (delim);
+ *delim = '\0';
+ bound->column = atoi (delim+1);
+ delim = strrchr (loc_str, ':');
+ aver (delim);
+ *delim = '\0';
+ bound->line = atoi (delim+1);
+ bound->file = uniqstr_new (loc_str);
+}
Index: src/location.h
===================================================================
RCS file: /sources/bison/bison/src/location.h,v
retrieving revision 1.21
diff -p -u -r1.21 location.h
--- src/location.h 2 Jan 2007 23:31:14 -0000 1.21
+++ src/location.h 7 Jan 2007 03:14:01 -0000
@@ -81,4 +81,7 @@ void location_compute (location *loc,
void location_print (FILE *out, location loc);
+/* LOC_STR must be formatted as `file:line.column', it will be modified. */
+void boundary_set_from_string (boundary *bound, char *loc_str);
+
#endif /* ! defined LOCATION_H_ */
Index: src/muscle_tab.c
===================================================================
RCS file: /sources/bison/bison/src/muscle_tab.c,v
retrieving revision 1.41
diff -p -u -r1.41 muscle_tab.c
--- src/muscle_tab.c 9 Nov 2006 18:17:05 -0000 1.41
+++ src/muscle_tab.c 7 Jan 2007 03:14:01 -0000
@@ -261,3 +261,18 @@ muscles_m4_output (FILE *out)
{
hash_do_for_each (muscle_table, muscle_m4_output_processor, out);
}
+
+void
+muscle_boundary_grow (char const *key, boundary bound)
+{
+ char *extension;
+ MUSCLE_OBSTACK_SGROW (&muscle_obstack, bound.file);
+ obstack_1grow (&muscle_obstack, ':');
+ obstack_fgrow1 (&muscle_obstack, "%d", bound.line);
+ obstack_1grow (&muscle_obstack, '.');
+ obstack_fgrow1 (&muscle_obstack, "%d", bound.column);
+ obstack_1grow (&muscle_obstack, '\0');
+ extension = obstack_finish (&muscle_obstack);
+ muscle_grow (key, extension, "");
+ obstack_free (&muscle_obstack, extension);
+}
Index: src/muscle_tab.h
===================================================================
RCS file: /sources/bison/bison/src/muscle_tab.h,v
retrieving revision 1.19
diff -p -u -r1.19 muscle_tab.h
--- src/muscle_tab.h 12 Dec 2006 06:47:39 -0000 1.19
+++ src/muscle_tab.h 7 Jan 2007 03:14:01 -0000
@@ -112,4 +112,8 @@ void muscle_pair_list_grow (const char *
void muscles_m4_output (FILE *out);
+/* In the format `file_name:line.column', append BOUND to MUSCLE. Use digraphs
+ for special characters in the file name. */
+void muscle_boundary_grow (char const *key, boundary bound);
+
#endif /* not MUSCLE_TAB_H_ */
Index: src/parse-gram.y
===================================================================
RCS file: /sources/bison/bison/src/parse-gram.y,v
retrieving revision 1.107
diff -p -u -r1.107 parse-gram.y
--- src/parse-gram.y 6 Jan 2007 23:12:25 -0000 1.107
+++ src/parse-gram.y 7 Jan 2007 03:14:02 -0000
@@ -323,9 +323,13 @@ grammar_declaration:
muscle_code_grow (uniqstr_new (name), $3, @3);
free (name);
code_scanner_last_string_free ();
- muscle_grow ("used_percent_code_qualifiers", "[[", ",");
+ muscle_grow ("used_percent_code_qualifiers", "[[[[", ",");
muscle_grow ("used_percent_code_qualifiers", $2, "");
- muscle_grow ("used_percent_code_qualifiers", "]]", "");
+ muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
+ muscle_boundary_grow ("used_percent_code_qualifiers", @2.start);
+ muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
+ muscle_boundary_grow ("used_percent_code_qualifiers", @2.end);
+ muscle_grow ("used_percent_code_qualifiers", "]]]]", "");
}
;
Index: src/scan-skel.l
===================================================================
RCS file: /sources/bison/bison/src/scan-skel.l,v
retrieving revision 1.45
diff -p -u -r1.45 scan-skel.l
--- src/scan-skel.l 6 Jan 2007 06:14:04 -0000 1.45
+++ src/scan-skel.l 7 Jan 2007 03:14:02 -0000
@@ -47,15 +47,18 @@ YY_DECL;
#define QPUTS(String) \
fputs (quotearg_style (c_quoting_style, String), yyout)
+static void at_directive_perform (char **outnamep, int *out_linenop);
static void fail_for_at_directive_too_many_args (void);
+static void fail_for_at_directive_too_few_args (void);
static void fail_for_invalid_at (char const *at);
/* In SC_AT_DIRECTIVE_ARG context, the name of the directive. */
static char *at_directive_name;
-/* Currently, only the @warn, @complain, and @fatal directives take multiple
- arguments, and they already can't take more than 5. */
-#define AT_DIRECTIVE_ARGC_MAX 5
+/* Currently, only the @warn, @complain, @fatal, @warn_at, @complain_at, and
+ @fatal_at directives take multiple arguments, and the last three already
+ can't take more than 7. */
+#define AT_DIRECTIVE_ARGC_MAX 7
static int at_directive_argc = 0;
static char *at_directive_argv[AT_DIRECTIVE_ARGC_MAX];
%}
@@ -66,7 +69,7 @@ static char *at_directive_argv[AT_DIRECT
%%
%{
- int lineno IF_LINT (= 0);
+ int out_lineno IF_LINT (= 0);
char *outname = NULL;
%}
@@ -74,7 +77,7 @@ static char *at_directive_argv[AT_DIRECT
"@{" fputc ('[', yyout);
"@}" fputc (']', yyout);
-"@oline@" fprintf (yyout, "%d", lineno + 1);
+"@oline@" fprintf (yyout, "%d", out_lineno + 1);
"@ofile@" QPUTS (outname);
"@dir_prefix@" QPUTS (dir_prefix);
@@ -86,7 +89,7 @@ static char *at_directive_argv[AT_DIRECT
/* This pattern must not match more than the previous @ patterns. */
@address@hidden(\n]* fail_for_invalid_at (yytext);
-\n lineno++; ECHO;
+\n out_lineno++; ECHO;
address@hidden ECHO;
<INITIAL><<EOF>> {
@@ -99,8 +102,7 @@ static char *at_directive_argv[AT_DIRECT
}
<SC_AT_DIRECTIVE_ARG>{
- address@hidden { STRING_GROW; }
- \n { ++lineno; STRING_GROW; }
+ address@hidden { STRING_GROW; }
"@@" { obstack_1grow (&obstack_for_string, '@'); }
"@{" { obstack_1grow (&obstack_for_string, '['); }
@@ -121,67 +123,7 @@ static char *at_directive_argv[AT_DIRECT
BEGIN SC_AT_DIRECTIVE_SKIP_WS;
else
{
- if (0 == strcmp (at_directive_name, "@basename"))
- {
- if (at_directive_argc > 1)
- fail_for_at_directive_too_many_args ();
- fputs (last_component (at_directive_argv[0]), yyout);
- }
- else if (0 == strcmp (at_directive_name, "@warn")
- || 0 == strcmp (at_directive_name, "@complain")
- || 0 == strcmp (at_directive_name, "@fatal"))
- {
- void (*func)(char const *, ...);
- switch (at_directive_name[1])
- {
- case 'w': func = warn; break;
- case 'c': func = complain; break;
- case 'f': func = fatal; break;
- default: aver (false); func = NULL; break;
- }
- switch (at_directive_argc)
- {
- case 1:
- func (_(at_directive_argv[0]));
- break;
- case 2:
- func (_(at_directive_argv[0]), at_directive_argv[1]);
- break;
- case 3:
- func (_(at_directive_argv[0]), at_directive_argv[1],
- at_directive_argv[2]);
- break;
- case 4:
- func (_(at_directive_argv[0]), at_directive_argv[1],
- at_directive_argv[2], at_directive_argv[3]);
- break;
- case 5:
- func (_(at_directive_argv[0]), at_directive_argv[1],
- at_directive_argv[2], at_directive_argv[3],
- at_directive_argv[4]);
- break;
- default:
- fail_for_at_directive_too_many_args ();
- break;
- }
- }
- else if (0 == strcmp (at_directive_name, "@output"))
- {
- if (at_directive_argc > 1)
- fail_for_at_directive_too_many_args ();
- if (outname)
- {
- free (outname);
- xfclose (yyout);
- }
- outname = xstrdup (at_directive_argv[0]);
- output_file_name_check (outname);
- yyout = xfopen (outname, "w");
- lineno = 1;
- }
- else
- fail_for_invalid_at (at_directive_name);
-
+ at_directive_perform (&outname, &out_lineno);
obstack_free (&obstack_for_string, at_directive_argv[0]);
at_directive_argc = 0;
free (at_directive_name);
@@ -193,8 +135,7 @@ static char *at_directive_argv[AT_DIRECT
}
<SC_AT_DIRECTIVE_SKIP_WS>{
- [ \t\r]
- \n { ++lineno; }
+ [ \t\r\n]
. { yyless (0); BEGIN SC_AT_DIRECTIVE_ARG; }
}
@@ -226,6 +167,127 @@ scan_skel (FILE *in)
yylex_destroy ();
}
+void
+skel_scanner_free (void)
+{
+ obstack_free (&obstack_for_string, 0);
+}
+
+static
+void at_directive_perform (char **outnamep, int *out_linenop)
+{
+ if (0 == strcmp (at_directive_name, "@basename"))
+ {
+ if (at_directive_argc > 1)
+ fail_for_at_directive_too_many_args ();
+ fputs (last_component (at_directive_argv[0]), yyout);
+ }
+ else if (0 == strcmp (at_directive_name, "@warn")
+ || 0 == strcmp (at_directive_name, "@complain")
+ || 0 == strcmp (at_directive_name, "@fatal"))
+ {
+ void (*func)(char const *, ...);
+ switch (at_directive_name[1])
+ {
+ case 'w': func = warn; break;
+ case 'c': func = complain; break;
+ case 'f': func = fatal; break;
+ default: aver (false); func = NULL; break;
+ }
+ switch (at_directive_argc)
+ {
+ case 1:
+ func (_(at_directive_argv[0]));
+ break;
+ case 2:
+ func (_(at_directive_argv[0]), at_directive_argv[1]);
+ break;
+ case 3:
+ func (_(at_directive_argv[0]), at_directive_argv[1],
+ at_directive_argv[2]);
+ break;
+ case 4:
+ func (_(at_directive_argv[0]), at_directive_argv[1],
+ at_directive_argv[2], at_directive_argv[3]);
+ break;
+ case 5:
+ func (_(at_directive_argv[0]), at_directive_argv[1],
+ at_directive_argv[2], at_directive_argv[3],
+ at_directive_argv[4]);
+ break;
+ default:
+ fail_for_at_directive_too_many_args ();
+ break;
+ }
+ }
+ else if (0 == strcmp (at_directive_name, "@warn_at")
+ || 0 == strcmp (at_directive_name, "@complain_at")
+ || 0 == strcmp (at_directive_name, "@fatal_at"))
+ {
+ void (*func)(location, char const *, ...);
+ location loc;
+ if (at_directive_argc < 3)
+ fail_for_at_directive_too_few_args ();
+ switch (at_directive_name[1])
+ {
+ case 'w': func = warn_at; break;
+ case 'c': func = complain_at; break;
+ case 'f': func = fatal_at; break;
+ default: aver (false); func = NULL; break;
+ }
+ boundary_set_from_string (&loc.start, at_directive_argv[0]);
+ boundary_set_from_string (&loc.end, at_directive_argv[1]);
+ switch (at_directive_argc)
+ {
+ case 3:
+ func (loc, _(at_directive_argv[2]));
+ break;
+ case 4:
+ func (loc, _(at_directive_argv[2]), at_directive_argv[3]);
+ break;
+ case 5:
+ func (loc, _(at_directive_argv[2]), at_directive_argv[3],
+ at_directive_argv[4]);
+ break;
+ case 6:
+ func (loc, _(at_directive_argv[2]), at_directive_argv[3],
+ at_directive_argv[4], at_directive_argv[5]);
+ break;
+ case 7:
+ func (loc, _(at_directive_argv[2]), at_directive_argv[3],
+ at_directive_argv[4], at_directive_argv[5],
+ at_directive_argv[6]);
+ break;
+ default:
+ fail_for_at_directive_too_many_args ();
+ break;
+ }
+ }
+ else if (0 == strcmp (at_directive_name, "@output"))
+ {
+ if (at_directive_argc > 1)
+ fail_for_at_directive_too_many_args ();
+ if (*outnamep)
+ {
+ free (*outnamep);
+ xfclose (yyout);
+ }
+ *outnamep = xstrdup (at_directive_argv[0]);
+ output_file_name_check (*outnamep);
+ yyout = xfopen (*outnamep, "w");
+ *out_linenop = 1;
+ }
+ else
+ fail_for_invalid_at (at_directive_name);
+}
+
+static void
+fail_for_at_directive_too_few_args (void)
+{
+ fatal (_("too few arguments for %s directive in skeleton"),
+ at_directive_name);
+}
+
static void
fail_for_at_directive_too_many_args (void)
{
@@ -238,9 +300,3 @@ fail_for_invalid_at (char const *at)
{
fatal ("invalid @ in skeleton: %s", at);
}
-
-void
-skel_scanner_free (void)
-{
- obstack_free (&obstack_for_string, 0);
-}
Index: tests/input.at
===================================================================
RCS file: /sources/bison/bison/tests/input.at,v
retrieving revision 1.69
diff -p -u -r1.69 input.at
--- tests/input.at 6 Jan 2007 06:14:04 -0000 1.69
+++ tests/input.at 7 Jan 2007 03:14:02 -0000
@@ -711,38 +711,80 @@ AT_SETUP([Reject bad %code qualifiers])
AT_DATA([input-c.y],
[[%code "" {}
+%code "bad" {}
+%code "bad" {}
%%
start: ;
]])
AT_CHECK([[bison input-c.y]], [1], [],
-[[input-c.y: `' is not a recognized %code qualifier
+[[input-c.y:1.7-8: `' is not a recognized %code qualifier
+input-c.y:2.7-11: `bad' is not a recognized %code qualifier
+input-c.y:3.7-11: `bad' is not a recognized %code qualifier
]])
AT_DATA([input-c-glr.y],
-[[%code "bad" {}
+[[%code "" {}
+%code "bad" {}
+ %code "bad" {}
%%
start: ;
]])
AT_CHECK([[bison input-c-glr.y]], [1], [],
-[[input-c-glr.y: `bad' is not a recognized %code qualifier
+[[input-c-glr.y:1.7-8: `' is not a recognized %code qualifier
+input-c-glr.y:2.7-11: `bad' is not a recognized %code qualifier
+input-c-glr.y:3.8-12: `bad' is not a recognized %code qualifier
]])
AT_DATA([input-c++.y],
-[[%code "bad" {}
+[[%code "" {}
+%code "bad" {}
+ %code "" {}
%%
start: ;
]])
AT_CHECK([[bison input-c++.y]], [1], [],
-[[input-c++.y: `bad' is not a recognized %code qualifier
+[[input-c++.y:1.7-8: `' is not a recognized %code qualifier
+input-c++.y:2.7-11: `bad' is not a recognized %code qualifier
+input-c++.y:3.8-9: `' is not a recognized %code qualifier
]])
AT_DATA([input-c++-glr.y],
[[%code "bad" {}
+%code "" {}
+%code "" {}
%%
start: ;
]])
AT_CHECK([[bison input-c++-glr.y]], [1], [],
-[[input-c++-glr.y: `bad' is not a recognized %code qualifier
+[[input-c++-glr.y:1.7-11: `bad' is not a recognized %code qualifier
+input-c++-glr.y:2.7-8: `' is not a recognized %code qualifier
+input-c++-glr.y:3.7-8: `' is not a recognized %code qualifier
+]])
+
+AT_DATA([special-char-@@.y],
+[[%code "bad" {}
+%code "" {}
+%code "" {}
+%%
+start: ;
+]])
+AT_CHECK([[bison special-char-@@.y]], [1], [],
+[[special-char-@@.y:1.7-11: `bad' is not a recognized %code qualifier
+special-char-@@.y:2.7-8: `' is not a recognized %code qualifier
+special-char-@@.y:3.7-8: `' is not a recognized %code qualifier
+]])
+
+AT_DATA([special-char-@:>@.y],
+[[%code "bad" {}
+%code "" {}
+%code "" {}
+%%
+start: ;
+]])
+AT_CHECK([[bison special-char-@:>@.y]], [1], [],
+[[special-char-@:>@.y:1.7-11: `bad' is not a recognized %code qualifier
+special-char-@:>@.y:2.7-8: `' is not a recognized %code qualifier
+special-char-@:>@.y:3.7-8: `' is not a recognized %code qualifier
]])
AT_CLEANUP
Index: tests/output.at
===================================================================
RCS file: /sources/bison/bison/tests/output.at,v
retrieving revision 1.14
diff -p -u -r1.14 output.at
--- tests/output.at 12 Dec 2006 06:47:39 -0000 1.14
+++ tests/output.at 7 Jan 2007 03:14:02 -0000
@@ -193,8 +193,5 @@ AT_CHECK_OUTPUT_FILE_NAME([[#]])
AT_CHECK_OUTPUT_FILE_NAME([[@@]])
AT_CHECK_OUTPUT_FILE_NAME(address@hidden)
AT_CHECK_OUTPUT_FILE_NAME(address@hidden)
-
-# Bison isn't M4-quoting file names before inserting them into muscles, so
-# these tests currently fail.
AT_CHECK_OUTPUT_FILE_NAME([[@<:@]])
AT_CHECK_OUTPUT_FILE_NAME([[@:>@]])