yacc.c: tests: check detailed error messages

* tests/local.at (AT_ERROR_DETAILED_IF): New.
(AT_ERROR_SIMPLE_IF): Adjust.
* tests/calc.at: Check parse.error=detailed.
This commit is contained in:
Akim Demaille
2020-01-18 07:25:58 +01:00
parent f443673450
commit 91247f50d7
2 changed files with 14 additions and 9 deletions

View File

@@ -798,24 +798,26 @@ AT_CHECK_CALC_LALR([%locations %define api.location.type {Span}])
AT_CHECK_CALC_LALR([%name-prefix "calc"]) AT_CHECK_CALC_LALR([%name-prefix "calc"])
AT_CHECK_CALC_LALR([%verbose]) AT_CHECK_CALC_LALR([%verbose])
AT_CHECK_CALC_LALR([%yacc]) AT_CHECK_CALC_LALR([%yacc])
AT_CHECK_CALC_LALR([%define parse.error detailed])
AT_CHECK_CALC_LALR([%define parse.error verbose]) AT_CHECK_CALC_LALR([%define parse.error verbose])
AT_CHECK_CALC_LALR([%define api.pure full %locations]) AT_CHECK_CALC_LALR([%define api.pure full %locations])
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %locations]) AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %locations])
AT_CHECK_CALC_LALR([%define parse.error verbose %locations]) AT_CHECK_CALC_LALR([%define parse.error detailed %locations])
AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %define api.prefix {calc} %verbose %yacc]) AT_CHECK_CALC_LALR([%define parse.error detailed %locations %defines %define api.prefix {calc} %verbose %yacc])
AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc]) AT_CHECK_CALC_LALR([%define parse.error detailed %locations %defines %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
AT_CHECK_CALC_LALR([%debug]) AT_CHECK_CALC_LALR([%debug])
AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc]) AT_CHECK_CALC_LALR([%define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure full %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define api.pure full %define parse.error detailed %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc]) AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}]) AT_CHECK_CALC_LALR([%define api.pure %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error detailed %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])
AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}]) AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}{int *count}{int *nerrs}])

View File

@@ -206,10 +206,12 @@ m4_pushdef([AT_DEBUG_IF],
[m4_bmatch([$3], [%debug\|%define parse.trace], [$1], [$2])]) [m4_bmatch([$3], [%debug\|%define parse.trace], [$1], [$2])])
m4_pushdef([AT_ERROR_CUSTOM_IF], m4_pushdef([AT_ERROR_CUSTOM_IF],
[m4_bmatch([$3], [%define parse\.error custom], [$1], [$2])]) [m4_bmatch([$3], [%define parse\.error custom], [$1], [$2])])
m4_pushdef([AT_ERROR_DETAILED_IF],
[m4_bmatch([$3], [%define parse\.error detailed], [$1], [$2])])
m4_pushdef([AT_ERROR_VERBOSE_IF], m4_pushdef([AT_ERROR_VERBOSE_IF],
[m4_bmatch([$3], [%define parse\.error verbose], [$1], [$2])]) [m4_bmatch([$3], [%define parse\.error verbose], [$1], [$2])])
m4_pushdef([AT_ERROR_SIMPLE_IF], m4_pushdef([AT_ERROR_SIMPLE_IF],
[AT_ERROR_CUSTOM_IF([$2], [AT_ERROR_VERBOSE_IF([$2], [$1])], [$1])]) [AT_ERROR_CUSTOM_IF([$2], [AT_ERROR_DETAILED_IF([$2], [AT_ERROR_VERBOSE_IF([$2], [$1])], [$1])], [$1])])
m4_pushdef([AT_CXX_IF], m4_pushdef([AT_CXX_IF],
[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])]) [m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])])
m4_pushdef([AT_D_IF], m4_pushdef([AT_D_IF],
@@ -417,6 +419,7 @@ m4_popdef([AT_GLR_CC_IF])
m4_popdef([AT_LALR1_CC_IF]) m4_popdef([AT_LALR1_CC_IF])
m4_popdef([AT_ERROR_SIMPLE_IF]) m4_popdef([AT_ERROR_SIMPLE_IF])
m4_popdef([AT_ERROR_VERBOSE_IF]) m4_popdef([AT_ERROR_VERBOSE_IF])
m4_popdef([AT_ERROR_DETAILED_IF])
m4_popdef([AT_ERROR_CUSTOM_IF]) m4_popdef([AT_ERROR_CUSTOM_IF])
m4_popdef([AT_DEBUG_IF]) m4_popdef([AT_DEBUG_IF])
m4_popdef([AT_DEFINES_IF]) m4_popdef([AT_DEFINES_IF])