[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 08:54:02 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter) |
| @@ -91,17 +178,26 @@ static void handle_dollar (braced_code_t
| char *cp, location_t location);
| static void handle_at (braced_code_t code_kind,
| char *cp, location_t location);
| +static int convert_ucn_to_byte (char const *hex_text);
|
| %}
| -%x SC_COMMENT
| +%x SC_COMMENT SC_LINE_COMMENT SC_YACC_COMMENT
I have not understood why you separated the Yacc and C comments. I
would never have paid attention to /\
\
\
\
* which , imho, do not deserve that we lose time on this issue and
complicate our parsers. Indeed, one should also have considered *??/
??/
??/
/, but you took care of saying we don't support these trigraphs. So
why being correct for \, and not for trigraphs? Did you ever see
anyone making use of this ``feature''?
Anyway, once you implemented support for these comments, why make it
different for C and Yacc?
| @@ -588,16 +728,14 @@ handle_action_dollar (char *text, locati
| "]b4_rhs_value([%d], [%d], [%s])[",
| rule_length, n, type_name);
| }
| - }
| - else
| - {
| - complain_at (location, _("%s is invalid"), quote (text));
| + else
| + complain_at (location, _("invalid value: %s"), text);
| }
Did you mean to remove the `quote' here?
| - complain_at (location, _("%s is invalid"), quote (text));
| + complain_at (location, _("%s is invalid"), quote_n (1, text));
There remains several flavors of error messages. I prefer `_("invalid
value: %s")', should we change them all?
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.
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 07:51:33 -0000
@@ -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;
@@ -896,7 +883,7 @@
code = code < sizeof table ? table[code] : -1;
}
#endif
-
+
return code;
}
- Bison scanner patch to fix POSIX incompatibilities, etc., Paul Eggert, 2002/11/03
- Re: Bison scanner patch to fix POSIX incompatibilities, etc.,
Akim Demaille <=
- 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