X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/cd48d21d944380129d7a2ce68617ea31bf939aab..7b30971d7b915f5d9f7bccd24ab5f5b0e18680e1:/tests/calc.at?ds=inline diff --git a/tests/calc.at b/tests/calc.at index 0ade5ff9..d4775f0f 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -1,6 +1,6 @@ # Simple calculator. -*- Autotest -*- -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -41,7 +41,7 @@ AT_DATA_GRAMMAR([calc.y], [[/* Infix notation calculator--calc */ ]$4 AT_SKEL_CC_IF( -[%define "global_tokens_and_yystype"])[ +[%define global_tokens_and_yystype])[ %{ #include @@ -162,7 +162,9 @@ int yyparse (AT_PARAM_IF([semantic_value *result, int *count])) { AT_NAME_PREFIX::parser parser[]AT_PARAM_IF([ (result, count)]); - parser.set_debug_level (!!YYDEBUG); +#if YYDEBUG + parser.set_debug_level (1); +#endif return parser.parse (); } ], @@ -334,7 +336,8 @@ main (int argc, const char **argv) ]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug], [ yydebug = 1;])])[ - status = yyparse (]AT_PARAM_IF([&result, &count])[); + status = yyparse (]AT_PARAM_IF([[&result, &count]])[); + fclose (input); if (global_result != result) abort (); if (global_count != count) @@ -410,11 +413,13 @@ sed '/^Starting/d /^Stack/d /^Reading/d /^Reducing/d +/^Return/d /^Shifting/d /^state/d /^Cleanup:/d /^Error:/d /^Next/d +/^Now/d /^Discarding/d / \$[[0-9$]]* = /d /^yydestructor:/d' stderr >at-stderr @@ -551,22 +556,24 @@ AT_CHECK_CALC_LALR() AT_CHECK_CALC_LALR([%defines]) AT_CHECK_CALC_LALR([%locations]) -AT_CHECK_CALC_LALR([%name-prefix="calc"]) +AT_CHECK_CALC_LALR([%name-prefix="calc"]) dnl test deprecated `=' AT_CHECK_CALC_LALR([%verbose]) AT_CHECK_CALC_LALR([%yacc]) AT_CHECK_CALC_LALR([%error-verbose]) AT_CHECK_CALC_LALR([%pure-parser %locations]) +AT_CHECK_CALC_LALR([%push-pull-parser %pure-parser %locations]) AT_CHECK_CALC_LALR([%error-verbose %locations]) -AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%debug]) -AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) +AT_CHECK_CALC_LALR([%push-pull-parser %pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_LALR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) # ----------------------- # @@ -587,7 +594,7 @@ AT_CHECK_CALC_GLR() AT_CHECK_CALC_GLR([%defines]) AT_CHECK_CALC_GLR([%locations]) -AT_CHECK_CALC_GLR([%name-prefix="calc"]) +AT_CHECK_CALC_GLR([%name-prefix "calc"]) AT_CHECK_CALC_GLR([%verbose]) AT_CHECK_CALC_GLR([%yacc]) AT_CHECK_CALC_GLR([%error-verbose]) @@ -595,14 +602,14 @@ AT_CHECK_CALC_GLR([%error-verbose]) AT_CHECK_CALC_GLR([%pure-parser %locations]) AT_CHECK_CALC_GLR([%error-verbose %locations]) -AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR([%debug]) -AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) # ----------------------------- # @@ -611,21 +618,24 @@ AT_CHECK_CALC_GLR([%pure-parser %error-verbose %debug %locations %defines %name- AT_BANNER([[Simple LALR(1) C++ Calculator.]]) +# First let's try using %skeleton +AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations]) + # 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([%skeleton "lalr1.cc" %defines %locations] $@)]) +[AT_CHECK_CALC([%language "C++" %defines %locations] $@)]) AT_CHECK_CALC_LALR1_CC([]) -AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) @@ -635,19 +645,22 @@ AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix="calc" % AT_BANNER([[Simple GLR C++ Calculator.]]) +# Again, we try also using %skeleton. +AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations]) + # 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([%skeleton "glr.cc" %defines %locations] $@)]) +[AT_CHECK_CALC([%language "C++" %glr-parser %defines %locations] $@)]) -#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]) -AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc]) +AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc]) -AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix="calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) +AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])