Best Practice: lexer error to silent parser abort
Simon Richter <[email protected]>
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, I'm wondering what would be the best way to communicate from the lexer to the parser that the lexer detected something it could not tokenize (in my case, characters outside the allowed character set). In this case, it is fairly obvious that we want to abort, without a call to yyerror, but properly destructing and deallocating any values still on the stack. The best way I can think of at the moment would be to define an additional token type that isn't used in any rule, return that from the lexer, and create a shortcut between lexer and parser that silences yyerror. Is there a better way to do this? Simon _______________________________________________ [email protected] https://lists.gnu.org/mailman/listinfo/help-bison
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEtjuqOJSXmNjSiX3Tfr04e7CZCBEFAlwr52MACgkQfr04e7CZ CBGt/QgAq2Y3/8/8Fcb+QqwqLJwo8GtbHxx5fpcvRAgQy2XKCIcoM+eWdELI5+wZ xOagUrKUdz6G/rXJlwjzy4gTwgrp1o/EqtHX6TwtNLtFW2iw/sHEPRXCgDvDc7pk YkNL176p0PnOs2xI9a4Eg+ZPTe+a3pB4p2mSSZW3UFtk5hbkcW6e7WkBQexxVhaQ S5Fg07htfQAW/9gB3sKk+3QTlKAAG8BfrAtScS0yITcNze7p7mxyHe+b1Oq78gol u48AWczUROS1F1gI7ipSmF/PwdJqRHeZdB3uxK6HuulBPx+qSZSC3Ak2bMKl8tCM zwZSF5PCCOqbFUbDPBRrejUnpGEuDA== =NRzw -----END PGP SIGNATURE-----