Hello Hans,
this could work if we pass the current token, using
%parse-param (char * yytext)
tehn use a wrapper for the current yyerror function.
If we get this specific error we we can do the checks on the passed yytext.
The problem here:
How do we know that the error message "Unexpected %s" occured? A string
compare against all the translated texts (all 5 versions) looks stupid
and brake if the message is ever changed.
In this case we better would add a post-conversion hook via sed in the
makefile adding a function call after
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
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_
}
--> adding here: check_unused_reserved(yytext);
Do I missed the point? Are there other options to consider?
Simon
Am 26.04.2016 um 23:52 schrieb Hans Åberg:
>
>> On 26 Apr 2016, at 21:39, Simon Sobisch <[email protected]> wrote:
>
>> If the unexpected %s is not in the reserved words list currently active
>> because of the compiler configuration but is in the global one we add
>> another line to the warning, something like "%s not supported with std %s".
>>
>> How can this be achieved?
>
> Perhaps you might add an argument with additional info using %parse-param,
> affecting both yyparse and yyerror; see the manual, sec. 4.1, "The Parser
> Function yyparse".
>
>
>
>
_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison