[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison scanner patch to fix POSIX incompatibilities, etc.
From: |
Akim Demaille |
Subject: |
Re: Bison scanner patch to fix POSIX incompatibilities, etc. |
Date: |
04 Nov 2002 09:07:41 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter) |
| I'm installing this:
|
| Index: ChangeLog
| from Akim Demaille <address@hidden>
|
| * src/scan-gram.l: Use [\'] instead of ['] to pacify
| font-lock-mode.
| Use complain_at.
Well, nope, I'm installing this one:
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/location.h (LOCATION_PRINT): Use quotearg slot 3 to avoid
clashes.
* src/scan-gram.l: Use [\'] instead of ['] to pacify
font-lock-mode.
Use complain_at.
Use quote, not quote_n since LOCATION_PRINT no longer uses the
slot 0.
Index: src/location.h
===================================================================
RCS file: /cvsroot/bison/bison/src/location.h,v
retrieving revision 1.4
diff -u -u -r1.4 location.h
--- src/location.h 3 Nov 2002 08:41:08 -0000 1.4
+++ src/location.h 4 Nov 2002 08:05:13 -0000
@@ -49,11 +49,12 @@
} while (0)
-/* Output LOC on the stream OUT. */
+/* Output LOC on the stream OUT.
+ Warning: it uses quotearg's slot 3. */
# define LOCATION_PRINT(Out, Loc) \
do { \
- fprintf (stderr, "%s:", quotearg_style (escape_quoting_style, \
- (Loc).file)); \
+ fprintf (stderr, "%s:", quotearg_n_style (3, escape_quoting_style, \
+ (Loc).file)); \
if ((Loc).first_line != (Loc).last_line) \
fprintf (Out, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
Index: src/scan-gram.l
===================================================================
RCS file: /cvsroot/bison/bison/src/scan-gram.l,v
retrieving revision 1.30
diff -u -u -r1.30 scan-gram.l
--- src/scan-gram.l 3 Nov 2002 08:42:32 -0000 1.30
+++ src/scan-gram.l 4 Nov 2002 08:05:13 -0000
@@ -267,7 +267,7 @@
num = strtoul (yytext, 0, 10);
if (INT_MAX < num || errno)
{
- complain_at (*yylloc, _("%s is invalid"), yytext);
+ complain_at (*yylloc, _("invalid value: %s"), quote (yytext));
num = INT_MAX;
}
yylval->integer = num;
@@ -306,8 +306,7 @@
}
. {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": invalid character: `%c'\n"), *yytext);
+ complain_at (*yylloc, _("invalid character: %s"), quote (yytext));
YY_STEP;
}
}
@@ -340,8 +339,7 @@
[^*]+|"*" ;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a comment\n"));
+ complain_at (*yylloc, _("unexpected end of file in a comment"));
BEGIN INITIAL;
}
}
@@ -357,8 +355,7 @@
[^*\[\]]+|"*" YY_OBS_GROW;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a comment\n"));
+ complain_at (*yylloc, _("unexpected end of file in a comment"));
yy_pop_state ();
}
}
@@ -396,8 +393,7 @@
[^\"\\]+ YY_OBS_GROW;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a string\n"));
+ complain_at (*yylloc, _("unexpected end of file in a string"));
assert (yy_top_state () == INITIAL);
YY_OBS_FINISH;
yylval->string = last_string;
@@ -429,11 +425,10 @@
}
}
- [^'\\]+ YY_OBS_GROW;
+ [^\'\\]+ YY_OBS_GROW;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a character\n"));
+ complain_at (*yylloc, _("unexpected end of file in a character"));
assert (yy_top_state () == INITIAL);
YY_OBS_FINISH;
yylval->string = last_string;
@@ -453,8 +448,7 @@
unsigned long c = strtoul (yytext + 1, 0, 8);
if (UCHAR_MAX < c)
{
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));
+ complain_at (*yylloc, _("invalid escape: %s"), quote (yytext));
YY_STEP;
}
else
@@ -467,8 +461,7 @@
c = strtoul (yytext + 2, 0, 16);
if (UCHAR_MAX < c || errno)
{
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));
+ complain_at (*yylloc, _("invalid escape: %s"), quote (yytext));
YY_STEP;
}
else
@@ -482,21 +475,19 @@
\\r obstack_1grow (&string_obstack, '\r');
\\t obstack_1grow (&string_obstack, '\t');
\\v obstack_1grow (&string_obstack, '\v');
- \\[\"'?\\] obstack_1grow (&string_obstack, yytext[1]);
+ \\[\"\'?\\] obstack_1grow (&string_obstack, yytext[1]);
\\(u|U[0-9a-fA-F]{4})[0-9a-fA-F]{4} {
int c = convert_ucn_to_byte (yytext);
if (c < 0)
{
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));
+ complain_at (*yylloc, _("invalid escape: %s"), quote (yytext));
YY_STEP;
}
else
obstack_1grow (&string_obstack, c);
}
\\(.|\n) {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unrecognized escape: %s\n"), quote (yytext));
+ complain_at (*yylloc, _("unrecognized escape: %s"), quote (yytext));
YY_OBS_GROW;
}
/* FLex wants this rule, in case of a `\<<EOF>>'. */
@@ -524,8 +515,7 @@
\\ YY_OBS_GROW;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a character\n"));
+ complain_at (*yylloc, _("unexpected end of file in a character"));
assert (yy_top_state () != INITIAL);
yy_pop_state ();
}
@@ -552,8 +542,7 @@
\\ YY_OBS_GROW;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a string\n"));
+ complain_at (*yylloc, _("unexpected end of file in a string"));
assert (yy_top_state () != INITIAL);
yy_pop_state ();
}
@@ -607,14 +596,13 @@
"@"(-?[0-9]+|"$") { handle_at (current_braced_code,
yytext, *yylloc); }
- address@hidden/'\"\{\}]+ YY_OBS_GROW;
+ address@hidden/\'\"\{\}]+ YY_OBS_GROW;
/* A stray $, or /, or etc. */
. YY_OBS_GROW;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a braced code\n"));
+ complain_at (*yylloc, _("unexpected end of file in a braced code"));
yy_pop_state ();
YY_OBS_FINISH;
yylval->string = last_string;
@@ -637,12 +625,11 @@
return PROLOGUE;
}
- [^%\[\]/'\"]+ YY_OBS_GROW;
+ [^%\[\]/\'\"]+ YY_OBS_GROW;
"%" YY_OBS_GROW;
<<EOF>> {
- LOCATION_PRINT (stderr, *yylloc);
- fprintf (stderr, _(": unexpected end of file in a prologue\n"));
+ complain_at (*yylloc, _("unexpected end of file in a prologue"));
yy_pop_state ();
YY_OBS_FINISH;
yylval->string = last_string;
@@ -729,7 +716,7 @@
rule_length, n, type_name);
}
else
- complain_at (location, _("invalid value: %s"), text);
+ complain_at (location, _("invalid value: %s"), quote (text));
}
}
@@ -746,7 +733,7 @@
if (*cp == '$')
obstack_sgrow (&string_obstack, "]b4_dollar_dollar[");
else
- complain_at (location, _("%s is invalid"), quote_n (1, text));
+ complain_at (location, _("invalid value: %s"), quote (text));
}
@@ -801,7 +788,7 @@
rule_length, n);
}
else
- complain_at (location, _("invalid value: %s"), text);
+ complain_at (location, _("invalid value: %s"), quote (text));
}
}
@@ -818,7 +805,7 @@
if (*cp == '$')
obstack_sgrow (&string_obstack, "]b4_at_dollar[");
else
- complain_at (location, _("%s is invalid"), quote_n (1, text));
+ complain_at (location, _("invalid value: %s"), quote (text));
}
@@ -896,7 +883,7 @@
code = code < sizeof table ? table[code] : -1;
}
#endif
-
+
return code;
}
Index: tests/input.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/input.at,v
retrieving revision 1.14
diff -u -u -r1.14 input.at
--- tests/input.at 4 Nov 2002 06:07:09 -0000 1.14
+++ tests/input.at 4 Nov 2002 08:05:13 -0000
@@ -33,7 +33,7 @@
]])
AT_CHECK([bison input.y], [1], [],
-[[input.y:2.6-14: invalid value: $1
+[[input.y:2.6-14: invalid value: `$1'
]])
AT_CLEANUP
@@ -51,7 +51,7 @@
]])
AT_CHECK([bison input.y], [1], [],
-[[input.y:2.6-14: invalid value: @1
+[[input.y:2.6-14: invalid value: address@hidden'
]])
AT_CLEANUP
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., (continued)
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Paul Eggert, 2002/11/04
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Akim Demaille, 2002/11/05
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Paul Eggert, 2002/11/05
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Akim Demaille, 2002/11/06
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Paul Eggert, 2002/11/06
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Akim Demaille, 2002/11/07
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Paul Eggert, 2002/11/05
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Paul Eggert, 2002/11/06
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Akim Demaille, 2002/11/06
- Re: Bison scanner patch to fix POSIX incompatibilities, etc., Paul Eggert, 2002/11/07
Re: Bison scanner patch to fix POSIX incompatibilities, etc.,
Akim Demaille <=