mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
lalr1.cc: syntax_error as exceptions.
It is common to use sort of factories in the user actions. These factories may check some "syntactic" constraints that are not enforced by the grammar itself. This is possible using YYERROR within the action itself. Provide the user with a means to throw a syntax_error exception. * data/c++.m4 (b4_public_types_declare, b4_public_types_define): Declare and define yy::parser::syntax_error. * data/lalr1.cc: Include stdexcept. (yy::parser::parse): Wrap the user action within a try/catch. * data/glr.cc: Include stdexcept.
This commit is contained in:
@@ -224,6 +224,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||
|
||||
]b4_percent_code_get([[requires]])[
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user