Re: Why token are numbered from 258?
Christian Schoenebeck <[email protected]>
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <3717591.nRFnjk5pzV@silver> |
On Donnerstag, 7. Februar 2019 13:39:42 CET Peng Yu wrote: > > It's been a while, but as far as I can remember those extra 2 are always > > automatically used for the special built-in terminals YYEOF and YYEMPTY. > > No. They are not. > > y.tab.c > 1249:#define YYEMPTY (-2) > y.tab.c > 1250:#define YYEOF 0 Yep, sorry, like Akim already said they are actually 256==error and 257==undefined. You can also check the individual mapping by manually reading yytname[ yytranslate[tokenNumber] ] for 256 you should get the string "error", and for 257 the string "$undefined". Likewise you can do the same for your own tokens. Best regards, Christian Schoenebeck _______________________________________________ [email protected] https://lists.gnu.org/mailman/listinfo/help-bison