Currently, glr.cc testing is limited in calc.at because of a couple of bugs in glr.cc itself. These bugs are due to glr.cc's nature of thin wrapper around glr.c.

First, glr.cc sets YY_ERROR_VERBOSE to 0 and glr.c interprets it as a request to *have* verbose errors, thanks to these directives:

#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# ...
#endif

This can be considered a bug in glr.c actually, and the same bug is also there in yacc.c (if you want, the same glr.c hunk applies to yacc.c as well). This patch fixes it using some preprocessor magic.

Second, yy::parser::set_debug_level is never defined unless %debug is specified. This because it just sets "::yydebug" to its argument, and the variable is not defined in glr.c unless YYDEBUG is defined. This patch also fixes it by making the function do nothing unless %debug is specified.

Unluckily, the testsuite changes enabled by this patch are tangled in my %language work, and I'd rather wait for the copyright assignment. In the meanwhile, these are bug fixes (albeit glr.cc is undocumented) that could be applied as uncopyrightable.

Tested with no regressions.

Paolo


Reply via email to