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:
Akim Demaille
2009-09-08 22:00:13 +02:00
parent 2966006237
commit ff60136654
4 changed files with 42 additions and 2 deletions

View File

@@ -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>