mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 15:53:03 +00:00
Propagate i18n changes into glr.c.
* data/glr.c (yyreportSyntaxError): Use "switch" instead of
building the error message format dynamically.
* data/lalr1.java: Formatting changes.
(cherry picked from commit 2b008529ed)
Conflicts:
TODO
This commit is contained in:
committed by
Joel E. Denny
parent
70afaf2603
commit
bb57985c2e
@@ -1,3 +1,10 @@
|
|||||||
|
2008-12-11 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
Propagate i18n changes into glr.c.
|
||||||
|
* data/glr.c (yyreportSyntaxError): Use "switch" instead of
|
||||||
|
building the error message format dynamically.
|
||||||
|
* data/lalr1.java: Formatting changes.
|
||||||
|
|
||||||
2009-12-22 Joel E. Denny <jdenny@clemson.edu>
|
2009-12-22 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
Port small part of master's 11707b2b so future ports are easier.
|
Port small part of master's 11707b2b so future ports are easier.
|
||||||
|
|||||||
51
data/glr.c
51
data/glr.c
@@ -2102,18 +2102,10 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yybool yysize_overflow = yyfalse;
|
yybool yysize_overflow = yyfalse;
|
||||||
char* yymsg = NULL;
|
char* yymsg = NULL;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
|
/* Internationalized format string. */
|
||||||
|
const char *yyformat = 0;
|
||||||
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
int yyx;
|
|
||||||
char *yyfmt;
|
|
||||||
char const *yyf;
|
|
||||||
static char const yyunexpected[] = "syntax error, unexpected %s";
|
|
||||||
static char const yyexpecting[] = ", expecting %s";
|
|
||||||
static char const yyor[] = " or %s";
|
|
||||||
char yyformat[sizeof yyunexpected
|
|
||||||
+ sizeof yyexpecting - 1
|
|
||||||
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
|
|
||||||
* (sizeof yyor - 1))];
|
|
||||||
char const *yyprefix = yyexpecting;
|
|
||||||
|
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
YYCHECK. In other words, skip the first -YYN actions for this
|
YYCHECK. In other words, skip the first -YYN actions for this
|
||||||
@@ -2123,10 +2115,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
/* Stay within bounds of both yycheck and yytname. */
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
int yychecklim = YYLAST - yyn + 1;
|
int yychecklim = YYLAST - yyn + 1;
|
||||||
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
||||||
int yycount = 1;
|
|
||||||
|
|
||||||
yyarg[0] = yytokenName (yytoken);
|
/* Number of reported tokens (one for the "unexpected", one per
|
||||||
yyfmt = yystpcpy (yyformat, yyunexpected);
|
"expected"). */
|
||||||
|
int yycount = 0;
|
||||||
|
int yyx;
|
||||||
|
|
||||||
|
yyarg[yycount++] = yytokenName (yytoken);
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
||||||
@@ -2136,19 +2131,29 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yycount = 1;
|
yycount = 1;
|
||||||
yysize = yysize0;
|
yysize = yysize0;
|
||||||
yyformat[sizeof yyunexpected - 1] = '\0';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytokenName (yyx);
|
yyarg[yycount++] = yytokenName (yyx);
|
||||||
yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
|
yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
|
||||||
yysize_overflow |= yysize1 < yysize;
|
yysize_overflow |= yysize1 < yysize;
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
yyfmt = yystpcpy (yyfmt, yyprefix);
|
|
||||||
yyprefix = yyor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yyf = YY_(yyformat);
|
switch (yycount)
|
||||||
yysize1 = yysize + strlen (yyf);
|
{
|
||||||
|
#define YYCASE_(N, S) \
|
||||||
|
case N: \
|
||||||
|
yyformat = S; \
|
||||||
|
break
|
||||||
|
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
||||||
|
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
||||||
|
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
||||||
|
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
||||||
|
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
||||||
|
#undef YYCASE_
|
||||||
|
}
|
||||||
|
|
||||||
|
yysize1 = yysize + strlen (yyformat);
|
||||||
yysize_overflow |= yysize1 < yysize;
|
yysize_overflow |= yysize1 < yysize;
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
|
|
||||||
@@ -2159,17 +2164,17 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
char *yyp = yymsg;
|
char *yyp = yymsg;
|
||||||
int yyi = 0;
|
int yyi = 0;
|
||||||
while ((*yyp = *yyf))
|
while ((*yyp = *yyformat))
|
||||||
{
|
{
|
||||||
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
|
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
||||||
{
|
{
|
||||||
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
||||||
yyf += 2;
|
yyformat += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyp++;
|
yyp++;
|
||||||
yyf++;
|
yyformat++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yyerror (]b4_lyyerror_args[yymsg);
|
yyerror (]b4_lyyerror_args[yymsg);
|
||||||
|
|||||||
@@ -717,7 +717,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
res.append (yytnamerr_ (yytname_[x]));
|
res.append (yytnamerr_ (yytname_[x]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.toString ();
|
return res.toString ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user