[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compiling Reverse Polish Calculator Example
From: |
Akim Demaille |
Subject: |
Re: Compiling Reverse Polish Calculator Example |
Date: |
Mon, 29 Oct 2012 18:22:21 +0100 |
[Paul, this is about quotearg]
Hi Marc,
This message is not related directly to your complaint
(Hans explained well your issue). This message is about
Bison not issuing the right message.
Le 26 oct. 2012 à 23:13, Marc Mendiola a écrit :
> rpcalc.y:1.1: invalid character: `\377'
> rpcalc.y:1.2: invalid character: `\376'
This is good.
> rpcalc.y:1.4: invalid character: `'
> rpcalc.y:1.5: invalid character: `'
> rpcalc.y:1.6: invalid character: `'
> rpcalc.y:1.7: invalid character: `'
> rpcalc.y:1.8: invalid character: `'
These last five are wrong: they should read
invalid character: `\0'
or something like that. There are several occurrences of
calls to quote (yytext) in the scanner, where there could
be the NUL character, so we should rather use some
quote_* (yytext, yyleng) function. But Paul, I could not
find a natural means to use one of quotearg's own buffer to
do that. The difficulty is that I want quote_quoting_style
to be used, to be consistent with the other message, but I
didn't find one which was then using the predefined slots.
Btw, the comment here is wrong:
/* Equivalent to quotearg_alloc (ARG, ARGSIZE, NULL, O). */
char *
quotearg_alloc (char const *arg, size_t argsize,
struct quoting_options const *o)
{
return quotearg_alloc_mem (arg, argsize, NULL, o);
}
it should be about quotearg_alloc_mem.
I could use that one, but that's not nice to have to free here.
What would you recommend? I think that quote.h should also have
quote_mem and quote_n_mem, WDYT?
Thanks!
{directive} {
complain_at (*loc, _("invalid directive: %s"), quote (yytext));
}
{int}{id} {
complain_at (*loc, _("invalid identifier: %s"), quote (yytext));
}
. {
complain_at (*loc, _("invalid character: %s"), quote (yytext));
}
{id} {
if (bracketed_id_str)
{
complain_at (*loc, _("unexpected identifier in bracketed name: %s"),
quote (yytext));
}
. {
complain_at (*loc, _("invalid character in bracketed name: %s"),
quote (yytext));
}
FWIW, we have a different treatment for invalid characters
after a \.
\\(.|\n) {
char const *p = yytext + 1;
/* Quote only if escaping won't make the character visible. */
if (c_isspace ((unsigned char) *p) && c_isprint ((unsigned char) *p))
p = quote (p);
else
p = quotearg_style_mem (escape_quoting_style, p, 1);
complain_at (*loc, _("invalid character after \\-escape: %s"), p);
}
- Compiling Reverse Polish Calculator Example, Marc Mendiola, 2012/10/26
- Re: Compiling Reverse Polish Calculator Example, Hans Aberg, 2012/10/26
- Re: Compiling Reverse Polish Calculator Example, Quick Silver, 2012/10/28
- Re: Compiling Reverse Polish Calculator Example,
Akim Demaille <=
- Re: Compiling Reverse Polish Calculator Example, Akim Demaille, 2012/10/31
- Re: Compiling Reverse Polish Calculator Example, Hans Aberg, 2012/10/31
- Re: Compiling Reverse Polish Calculator Example, Paul Eggert, 2012/10/31
- Re: Compiling Reverse Polish Calculator Example, Akim Demaille, 2012/10/31
- Re: Compiling Reverse Polish Calculator Example, Paul Eggert, 2012/10/31
- Re: Compiling Reverse Polish Calculator Example, Akim Demaille, 2012/10/31