[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to get left hand side symbol in action
From: |
Derek Clegg |
Subject: |
Re: how to get left hand side symbol in action |
Date: |
Fri, 10 May 2019 06:57:44 -0700 |
On May 10, 2019, at 6:47 AM, Hans Åberg <address@hidden> wrote:
>
>
>> 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_.
I agree with this — this has been an annoyance for me for years.
Derek
- Re: how to get left hand side symbol in action, (continued)
- 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, 2019/05/10
- Re: how to get left hand side symbol in action,
Derek Clegg <=