[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to get left hand side symbol in action
From: |
Hans Åberg |
Subject: |
Re: how to get left hand side symbol in action |
Date: |
Fri, 10 May 2019 15:47:04 +0200 |
> On 10 May 2019, at 07:24, Akim Demaille <address@hidden> wrote:
>
> 1. there is a real and valid need for the feature, which I still need
> to be convinced of, especially because symbol names are technical
> details!
One can also write better error messages by using these internal yytname_ table
names:
If one checks on a lookup table whether the name has been already defined and
it is, then one can give information about that already present name. For
example:
“name” {
std::optional<std::pair<token_type, semantic_type> x0 =
my::symbol_table.find($x.text);
if (x0) {
throw syntax_error(@x, "Name " + $x.text + " already defined in this
scope as "
+ yytnamerr_(yytname_[x0->first - 255]));
}
…
}
Right now, all parts are internal and may change: the token translation
x0->first - 255, yytname_ lookup, and error message cleanup yytnamerr_.
- Re: how to get left hand side symbol in action, (continued)
- Re: how to get left hand side symbol in action, Derek Clegg, 2019/05/10
- Re: how to get left hand side symbol in action, Christian Schoenebeck, 2019/05/10
- Re: how to get left hand side symbol in action, Akim Demaille, 2019/05/10
- Re: how to get left hand side symbol in action, Derek Clegg, 2019/05/10
- Re: how to get left hand side symbol in action, Christian Schoenebeck, 2019/05/11
- Re: how to get left hand side symbol in action, Akim Demaille, 2019/05/19
- Re: how to get left hand side symbol in action, Christian Schoenebeck, 2019/05/20
- Re: how to get left hand side symbol in action, Christian Schoenebeck, 2019/05/10
- Re: how to get left hand side symbol in action, Akim Demaille, 2019/05/10
- Re: how to get left hand side symbol in action, Christian Schoenebeck, 2019/05/10
- Re: how to get left hand side symbol in action,
Hans Åberg <=
- Re: how to get left hand side symbol in action, Derek Clegg, 2019/05/10