-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
## ---------------------------------------------------- ##
## Compile the grammar described in the documentation. ##
## ---------------------------------------------------- ##
## Compile the grammar described in the documentation. ##
yyparse (AT_PARAM_IF([semantic_value *result, int *count]))
{
AT_NAME_PREFIX::parser parser[]AT_PARAM_IF([ (result, count)]);
yyparse (AT_PARAM_IF([semantic_value *result, int *count]))
{
AT_NAME_PREFIX::parser parser[]AT_PARAM_IF([ (result, count)]);
]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug],
[ yydebug = 1;])])[
]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug],
[ yydebug = 1;])])[
# Some syntax errors.
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [15],
# Some syntax errors.
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [15],
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20],
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20],
_AT_CHECK_CALC_ERROR([$1], [1], [error], [5],
_AT_CHECK_CALC_ERROR([$1], [1], [error], [5],
_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [30],
_AT_CHECK_CALC_ERROR([$1], [1], [1 = 2 = 3], [30],
# Exercise error messages with EOF: work on an empty file.
_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4],
# Exercise error messages with EOF: work on an empty file.
_AT_CHECK_CALC_ERROR([$1], [1], [/dev/null], [4],
_AT_CHECK_CALC_ERROR([$1], [0],
[() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1],
[250],
_AT_CHECK_CALC_ERROR([$1], [0],
[() + (1 + 1 + 1 +) + (* * *) + (1 * 2 * *) = 1],
[250],
-[1.1: syntax error, unexpected ')', expecting number or '-' or '(' or '!'
-1.17: syntax error, unexpected ')', expecting number or '-' or '(' or '!'
-1.22: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
-1.40: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
+[1.2: syntax error, unexpected ')', expecting number or '-' or '(' or '!'
+1.18: syntax error, unexpected ')', expecting number or '-' or '(' or '!'
+1.23: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
+1.41: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
calc: error: 4444 != 1])
# The same, but this time exercising explicitly triggered syntax errors.
# POSIX says the lookahead causing the error should not be discarded.
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [102],
calc: error: 4444 != 1])
# The same, but this time exercising explicitly triggered syntax errors.
# POSIX says the lookahead causing the error should not be discarded.
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [102],
calc: error: 2222 != 1])
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113],
calc: error: 2222 != 1])
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113],
-[1.3: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
-1.11: syntax error, unexpected number
+[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
+1.12: syntax error, unexpected number
AT_CHECK_CALC_LALR([%verbose])
AT_CHECK_CALC_LALR([%yacc])
AT_CHECK_CALC_LALR([%error-verbose])
AT_CHECK_CALC_LALR([%verbose])
AT_CHECK_CALC_LALR([%yacc])
AT_CHECK_CALC_LALR([%error-verbose])
AT_CHECK_CALC_GLR([%verbose])
AT_CHECK_CALC_GLR([%yacc])
AT_CHECK_CALC_GLR([%error-verbose])
AT_CHECK_CALC_GLR([%verbose])
AT_CHECK_CALC_GLR([%yacc])
AT_CHECK_CALC_GLR([%error-verbose])
# AT_CHECK_CALC_LALR1_CC([BISON-OPTIONS])
# ---------------------------------------
# Start a testing chunk which compiles `calc' grammar with
# the C++ skeleton, and performs several tests over the parser.
m4_define([AT_CHECK_CALC_LALR1_CC],
# AT_CHECK_CALC_LALR1_CC([BISON-OPTIONS])
# ---------------------------------------
# Start a testing chunk which compiles `calc' grammar with
# the C++ skeleton, and performs several tests over the parser.
m4_define([AT_CHECK_CALC_LALR1_CC],
# AT_CHECK_CALC_GLR_CC([BISON-OPTIONS])
# -------------------------------------
# Start a testing chunk which compiles `calc' grammar with
# the GLR C++ skeleton, and performs several tests over the parser.
m4_define([AT_CHECK_CALC_GLR_CC],
# AT_CHECK_CALC_GLR_CC([BISON-OPTIONS])
# -------------------------------------
# Start a testing chunk which compiles `calc' grammar with
# the GLR C++ skeleton, and performs several tests over the parser.
m4_define([AT_CHECK_CALC_GLR_CC],
-#AT_CHECK_CALC_GLR_CC([])
-#AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix="calc" %verbose %yacc])
+AT_CHECK_CALC_GLR_CC([])
+AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
-# AT_CHECK_CALC_GLR_CC([%debug])
-#AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix="calc" %verbose %yacc])
+AT_CHECK_CALC_GLR_CC([%debug])
+AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])