bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RIP: c++: merge symbol_type and token


From: Akim Demaille
Subject: Re: RIP: c++: merge symbol_type and token
Date: Sun, 23 Dec 2018 22:15:50 +0100


> Le 23 déc. 2018 à 17:13, Akim Demaille <address@hidden> a écrit :
> 
>> Would it help if Bison (internally) generates enum values for the
>> chars used, such as "TOK_46 = '.'" (with some non-conflicting
>> prefix), so token_type would cover all valid values and could be
>> used as the parameter type? (This might also be required for the
>> stricter type-checking of an enum class.)
> 
> Yes, we can do that.  However, I don't think there's a real
> value for it: the user cannot guess the name, she would have
> to read the code, and it's of course fragile, that number can
> change easily.

And now I see that you already know that, since you propose
TOK_46 for '.', whose ascii code is 46.

Sorry for not having understood earlier...

We could mix both approaches: clear names when there is
one, then numbers for the others (e.g. those above 128).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]