tests: check custom error messages and push parsers

* tests/local.at (AT_LAC_IF): New.
* tests/calc.at: And also check the suppot for LAC.
This commit is contained in:
Akim Demaille
2020-01-25 09:15:46 +01:00
parent 0f792833c2
commit 0917f4dc76
2 changed files with 10 additions and 1 deletions

View File

@@ -726,7 +726,9 @@ _AT_CHECK_CALC_ERROR([$1], [1], [error],
_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], _AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3],
[[final: 0 0 1]], [[final: 0 0 1]],
[30], [30],
[[1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'])]]) [AT_LAC_IF(
[[1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'] ['\n'])]],
[[1.7: syntax error on token ['='] (expected: ['-'] ['+'] ['*'] ['/'] ['^'])]])])
_AT_CHECK_CALC_ERROR([$1], [1], _AT_CHECK_CALC_ERROR([$1], [1],
[ [
+1], +1],
@@ -844,6 +846,8 @@ AT_CHECK_CALC_LALR([%no-lines %define api.pure %define parse.error verbose %debu
AT_CHECK_CALC_LALR([%define parse.error custom]) AT_CHECK_CALC_LALR([%define parse.error custom])
AT_CHECK_CALC_LALR([%define parse.error custom %locations %define api.prefix {calc}]) AT_CHECK_CALC_LALR([%define parse.error custom %locations %define api.prefix {calc}])
AT_CHECK_CALC_LALR([%define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs}]) AT_CHECK_CALC_LALR([%define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs}])
AT_CHECK_CALC_LALR([%define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} %define api.push-pull both %define api.pure full])
AT_CHECK_CALC_LALR([%define parse.error custom %locations %define api.prefix {calc} %parse-param {semantic_value *result}{int *count}{int *nerrs} %define api.push-pull both %define api.pure full %define parse.lac full])
# ----------------------- # # ----------------------- #
# Simple GLR Calculator. # # Simple GLR Calculator. #
@@ -925,6 +929,8 @@ AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.location.file "my-locati
AT_CHECK_CALC_LALR1_CC([%no-lines %defines %locations %define api.location.file "my-location.hh"]) AT_CHECK_CALC_LALR1_CC([%no-lines %defines %locations %define api.location.file "my-location.hh"])
AT_CHECK_CALC_LALR1_CC([%locations %define parse.lac full %define parse.error verbose])
# --------------------------- # # --------------------------- #
# Simple GLR C++ Calculator. # # Simple GLR C++ Calculator. #

View File

@@ -235,6 +235,8 @@ m4_pushdef([AT_GLR_CC_IF],
# Using yacc.c? # Using yacc.c?
m4_pushdef([AT_YACC_IF], m4_pushdef([AT_YACC_IF],
[m4_bmatch([$3], [%language\|%glr-parser\|%skeleton], [$2], [$1])]) [m4_bmatch([$3], [%language\|%glr-parser\|%skeleton], [$2], [$1])])
m4_pushdef([AT_LAC_IF],
[m4_bmatch([$3], [%define parse.lac full], [$1], [$2])])
m4_pushdef([AT_LEXPARAM_IF], m4_pushdef([AT_LEXPARAM_IF],
[m4_bmatch([$3], [%lex-param], [$1], [$2])]) [m4_bmatch([$3], [%lex-param], [$1], [$2])])
m4_pushdef([AT_LOCATION_IF], m4_pushdef([AT_LOCATION_IF],
@@ -409,6 +411,7 @@ m4_popdef([AT_PUSH_IF])
m4_popdef([AT_PURE_IF]) m4_popdef([AT_PURE_IF])
m4_popdef([AT_PARAM_IF]) m4_popdef([AT_PARAM_IF])
m4_popdef([AT_LEXPARAM_IF]) m4_popdef([AT_LEXPARAM_IF])
m4_popdef([AT_LAC_IF])
m4_popdef([AT_YACC_IF]) m4_popdef([AT_YACC_IF])
m4_popdef([AT_GLR_IF]) m4_popdef([AT_GLR_IF])
m4_popdef([AT_CXX_IF]) m4_popdef([AT_CXX_IF])