[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Token value in custom error reporting
From: |
Akim Demaille |
Subject: |
Re: Token value in custom error reporting |
Date: |
Thu, 18 Jun 2020 18:56:14 +0200 |
> Le 18 juin 2020 à 14:54, Hans Åberg <haberg-1@telia.com> a écrit :
>
> In my C++ parser, the lexer has rule
> . { return my_parser::token::token_error; }
>
> When it is triggers, I get the error:
> <file>:21.1: error: syntax error, unexpected token error
>
> It might be nicer to actually write out this token, though.
I have already explained what I don't think this is a good idea.
https://lists.gnu.org/r/help-bison/2020-06/msg00017.html
I also have explained that scanner errors should be handled
by the scanner. For instance, in the bistro, you can read:
int
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
{
int c;
[...]
switch (c)
{
[...]
// Stray characters.
default:
yyerror (yylloc, "syntax error: invalid character: %c", c);
return TOK_YYerror;
}
}
Cheers!
- Token value in custom error reporting, Daniele Nicolodi, 2020/06/17
- Re: Token value in custom error reporting, Akim Demaille, 2020/06/18
- Re: Token value in custom error reporting, Daniele Nicolodi, 2020/06/18
- Re: Token value in custom error reporting, Akim Demaille, 2020/06/18
- Re: Token value in custom error reporting, Daniele Nicolodi, 2020/06/18
- Re: Token value in custom error reporting, Adrian Vogelsgesang, 2020/06/18
- Re: Token value in custom error reporting, Akim Demaille, 2020/06/18
- Re: Token value in custom error reporting, Adrian Vogelsgesang, 2020/06/18
- Re: Token value in custom error reporting, Hans Åberg, 2020/06/18
- Re: Token value in custom error reporting,
Akim Demaille <=
- Re: Token value in custom error reporting, Hans Åberg, 2020/06/18
- Re: Token value in custom error reporting, Akim Demaille, 2020/06/18
- Re: Token value in custom error reporting, Hans Åberg, 2020/06/18
- Re: Token value in custom error reporting, Akim Demaille, 2020/06/19
- Re: Token value in custom error reporting, Hans Åberg, 2020/06/19
- Re: Token value in custom error reporting, Akim Demaille, 2020/06/18