Merge remote-tracking branch 'origin/maint'

* origin/maint: (22 commits)
  tests: ignore code coverage/profiling failure messages
  doc: fix some invalid @ref.
  build: fix previous commit.
  install-pdf: fix.
  NEWS: Update.
  %printer: support both yyo and yyoutput.
  doc: mfcalc: demonstrate %printer.
  tests: style changes.
  build: require Flex.
  build: flex.m4: check for Flex.
  build: flex.m4: quote properly.
  build: flex.m4.
  build: autoconf: update.
  glr: eliminate last bits of unwanted locations.
  NEWS: 2.6 will drop K&R.
  TODO: remove dead items.
  TODO: import from master.
  gnulib: update.
  maint: update NEWS.
  doc: fix index.
  doc: fix documentation of YYERROR.
  c++: more YY_NULL

Conflicts:
	TODO
	bootstrap
	data/c.m4
	data/glr.c
	data/lalr1.cc
	doc/bison.texinfo
This commit is contained in:
Akim Demaille
2012-05-04 14:38:53 +02:00
11 changed files with 242 additions and 105 deletions

100
NEWS
View File

@@ -71,28 +71,25 @@ Bison News
* Changes in version 2.5.1 (????-??-??): * Changes in version 2.5.1 (????-??-??):
** Several portability problems in the test suite have been fixed: ** Future changes:
This includes warnings with some compilers, unexpected behavior of The next major release will drop support for K&R C.
tools such as diff, warning messages from the test suite itself,
etc.
__attribute__ is not longer disabled when __STRICT_ANSI__ is defined ** yacc.c: YYBACKUP works as expected.
** glr.c improvements:
*** Location support is eliminated when not requested:
GLR parsers used to include location-related code even when
locations were not requested, and therefore not even usable.
*** __attribute__ is preserved:
__attribute__ is no longer disabled when __STRICT_ANSI__ is defined
(i.e., when -std is passed to GCC). (i.e., when -std is passed to GCC).
** Warnings during the build procedure have been eliminated. ** lalr1.java: several fixes:
** Many minor improvements have been made to the manual:
The layout for grammar has changed to a more compact scheme. Named
references are motivated. The description of the automaton
description file is updated.
** YYBACKUP works as expected.
** liby is no longer asking for "rpl_fprintf" on some platforms.
** Several Java fixes:
The Java parser no longer throws ArrayIndexOutOfBoundsException if The Java parser no longer throws ArrayIndexOutOfBoundsException if
the first token leads to a syntax error. Some minor clean ups. the first token leads to a syntax error. Some minor clean ups.
@@ -108,6 +105,42 @@ Bison News
methods) accept new arguments for line and column. Several issues methods) accept new arguments for line and column. Several issues
in the documentation were fixed. in the documentation were fixed.
** liby is no longer asking for "rpl_fprintf" on some platforms.
** Changes in the manual:
*** %printer is documented
The %printer directive, supported since at least Bison 1.50, is
finally documented. The %mfcalc example is extended to demonstrate
its use of printer.
The C++ parsers now also support yyoutput (as an alias to
debug_stream ()) for consistency with the C skeletons.
*** Several improvements have been made:
The layout for grammar excerpts was changed to a more compact
scheme. Named references are motivated. The description of the
automaton description file (*.output) is updated to the current
format. Incorrect index entries were fixed. Some other errors were
fixed.
** Changes to the build system:
*** Warnings during the build procedure have been eliminated.
*** Several portability problems in the test suite have been fixed:
This includes warnings with some compilers, unexpected behavior of
tools such as diff, warning messages from the test suite itself,
etc.
*** The install-pdf target work properly:
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no
longer halts in the middle of its course.
* Changes in version 2.5 (2011-05-14): * Changes in version 2.5 (2011-05-14):
** Grammar symbol names can now contain non-initial dashes: ** Grammar symbol names can now contain non-initial dashes:
@@ -1511,7 +1544,7 @@ Bison News
** The output file does not define const, as this caused problems when used ** The output file does not define const, as this caused problems when used
with common autoconfiguration schemes. If you still use ancient compilers with common autoconfiguration schemes. If you still use ancient compilers
that lack const, compile with the equivalent of the C compiler option that lack const, compile with the equivalent of the C compiler option
`-Dconst='. autoconf's AC_C_CONST macro provides one way to do this. `-Dconst='. Autoconf's AC_C_CONST macro provides one way to do this.
** Added `-g' and `--graph'. ** Added `-g' and `--graph'.
@@ -1558,7 +1591,7 @@ Bison News
* Changes in version 1.26: * Changes in version 1.26:
** Bison now uses automake. ** Bison now uses Automake.
** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>. ** New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
@@ -1580,7 +1613,7 @@ the grammar file, and reports all the errors found in it.
** Tokens can now be specified as multiple-character strings: for ** Tokens can now be specified as multiple-character strings: for
example, you could use "<=" for a token which looks like <=, instead example, you could use "<=" for a token which looks like <=, instead
of chosing a name like LESSEQ. of choosing a name like LESSEQ.
** The %token_table declaration says to write a table of tokens (names ** The %token_table declaration says to write a table of tokens (names
and numbers) into the parser file. The yylex function can use this and numbers) into the parser file. The yylex function can use this
@@ -1615,10 +1648,6 @@ Line numbers in output file corrected.
Output file does not redefine const for C++. Output file does not redefine const for C++.
Local Variables:
mode: outline
End:
----- -----
Copyright (C) 1995-2012 Free Software Foundation, Inc. Copyright (C) 1995-2012 Free Software Foundation, Inc.
@@ -1637,3 +1666,24 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
LocalWords: yacc YYBACKUP glr GCC lalr ArrayIndexOutOfBoundsException nullptr
LocalWords: cplusplus liby rpl fprintf mfcalc Wyacc stmt cond expr mk sym lr
LocalWords: IELR ielr Lookahead YYERROR nonassoc LALR's api lookaheads yychar
LocalWords: destructor lookahead YYRHSLOC YYLLOC Rhs ifndef YYFAIL cpp sr rr
LocalWords: preprocessor initializer Wno Wnone Werror FreeBSD prec livelocks
LocalWords: Solaris AIX UX RHEL Tru LHS gcc's Wundef YYENABLE NLS YYLTYPE VCG
LocalWords: yyerror cpp's Wunused yylval yylloc prepend yyparse yylex yypush
LocalWords: Graphviz xml nonterminals midrule destructor's YYSTYPE typedef ly
LocalWords: CHR chr printf stdout namespace preprocessing enum pre include's
LocalWords: YYRECOVERING nonfree destructors YYABORT YYACCEPT params enums de
LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
LocalWords: Automake TMPDIR LESSEQ
Local Variables:
mode: outline
End:

34
TODO
View File

@@ -136,11 +136,6 @@ Do some people use YYPURE, YYLSP_NEEDED like we do in the test suite?
They should not: it is not documented. But if they need to, let's They should not: it is not documented. But if they need to, let's
find something clean (not like YYLSP_NEEDED...). find something clean (not like YYLSP_NEEDED...).
* Documentation
Before releasing, make sure the documentation ("Understanding your
parser") refers to the current `output' format.
* Report * Report
** Figures ** Figures
@@ -237,12 +232,6 @@ this issue. Does anybody have it?
Some history of Bison and some bibliography would be most welcome. Some history of Bison and some bibliography would be most welcome.
Are there any Texinfo standards for bibliography? Are there any Texinfo standards for bibliography?
** %printer
Wow, %printer is not documented. Clearly mark YYPRINT as obsolete.
* Java, Fortran, etc.
* Coding system independence * Coding system independence
Paul notes: Paul notes:
@@ -268,29 +257,6 @@ Show reductions.
** Skeleton strategy ** Skeleton strategy
Must we keep %token-table? Must we keep %token-table?
* BTYacc
See if we can integrate backtracking in Bison. Charles-Henri de
Boysson <de-boy_c@epita.fr> has been working on this, but never gave
the results.
Vadim Maslow, the maintainer of BTYacc was once contacted. Adjusting
the Bison grammar parser will be needed to support some extra BTYacc
features. This is less urgent.
** Keeping the conflicted actions
First, analyze the differences between byacc and btyacc (I'm referring
to the executables). Find where the conflicts are preserved.
** Compare with the GLR tables
See how isomorphic the way BTYacc and the way the GLR adjustments in
Bison are compatible. *As much as possible* one should try to use the
same implementation in the Bison executables. I insist: it should be
very feasible to use the very same conflict tables.
** Adjust the skeletons
Import the skeletons for C and C++.
* Precedence * Precedence
** Partial order ** Partial order

View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2012-01-18.21; # UTC scriptversion=2012-04-16.16; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
@@ -423,7 +423,7 @@ check_versions() {
$use_git || continue $use_git || continue
fi fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.) # Honor $APP variables ($TAR, $AUTOCONF, etc.)
appvar=`echo $app | tr '[a-z]-' '[A-Z]_'` appvar=`echo $app | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
test "$appvar" = TAR && appvar=AMTAR test "$appvar" = TAR && appvar=AMTAR
case $appvar in case $appvar in
GZIP) ;; # Do not use $GZIP: it contains gzip options. GZIP) ;; # Do not use $GZIP: it contains gzip options.
@@ -604,7 +604,7 @@ if $bootstrap_sync; then
fi fi
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit <$gnulib_tool || exit $?
# Get translations. # Get translations.
@@ -807,7 +807,8 @@ for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file || exit symlink_to_dir "$GNULIB_SRCDIR" $file || exit
done done
bootstrap_post_import_hook bootstrap_post_import_hook \
|| { echo >&2 "$me: bootstrap_post_import_hook failed"; exit 1; }
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to fail. # gnulib-populated directories. Such .m4 files would cause aclocal to fail.
@@ -862,6 +863,8 @@ if test $with_gettext = yes; then
} }
' po/Makevars.template >po/Makevars || exit 1 ' po/Makevars.template >po/Makevars || exit 1
cat $GNULIB_SRCDIR/build-aux/po/Makefile.in.in > po/Makefile.in.in || exit 1
if test -d runtime-po; then if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same. # Similarly for runtime-po/Makevars, but not quite the same.
rm -f runtime-po/Makevars rm -f runtime-po/Makevars

View File

@@ -85,4 +85,4 @@ bootstrap_epilogue()
# the bootstrap entry from the file .x-update-copyright, and add any # the bootstrap entry from the file .x-update-copyright, and add any
# needed copyright years to the copyright statement in the bootstrap # needed copyright years to the copyright statement in the bootstrap
# script. # script.
# FIXME: temporary bootstrap_sync=true bootstrap_sync=true

View File

@@ -116,6 +116,9 @@ AC_SUBST([YACC_LIBRARY])
# Checks for programs. # Checks for programs.
AC_PROG_LEX AC_PROG_LEX
if test "$FLEX" != yes; then
AC_MSG_ERROR([Flex is required])
fi
AC_PROG_YACC AC_PROG_YACC
AC_PROG_RANLIB AC_PROG_RANLIB
AC_PROG_GNU_M4 AC_PROG_GNU_M4

View File

@@ -215,23 +215,19 @@ b4_token_enums(b4_tokens)
[[typedef int YYSTYPE; [[typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1]])])[ # define YYSTYPE_IS_TRIVIAL 1]])])[
#endif #endif
]b4_locations_if([[
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE typedef struct YYLTYPE
{ {
]b4_locations_if([
int first_line; int first_line;
int first_column; int first_column;
int last_line; int last_line;
int last_column; int last_column;
],[
char yydummy;
])[
} YYLTYPE; } YYLTYPE;
# define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1 # define YYLTYPE_IS_TRIVIAL 1
#endif #endif
]])[
]b4_percent_code_get([[provides]])[]dnl ]b4_percent_code_get([[provides]])[]dnl
]) ])
@@ -511,9 +507,8 @@ m4_if(b4_prefix[], [yy], [],
#define b4_prefix[]char yychar #define b4_prefix[]char yychar
#define b4_prefix[]lval yylval #define b4_prefix[]lval yylval
#define b4_prefix[]lloc yylloc])], #define b4_prefix[]lloc yylloc])],
[YYSTYPE yylval; [YYSTYPE yylval;]b4_locations_if([[
YYLTYPE yylloc;]])[
YYLTYPE yylloc;
int yynerrs; int yynerrs;
int yychar;])[ int yychar;])[
@@ -716,9 +711,9 @@ struct yyGLRState {
yySemanticOption* yyfirstVal; yySemanticOption* yyfirstVal;
/** Semantic value for this state. */ /** Semantic value for this state. */
YYSTYPE yysval; YYSTYPE yysval;
} yysemantics; } yysemantics;]b4_locations_if([[
/** Source location for this state. */ /** Source location for this state. */
YYLTYPE yyloc; YYLTYPE yyloc;]])[
}; };
struct yyGLRStateSet { struct yyGLRStateSet {
@@ -740,8 +735,8 @@ struct yySemanticOption {
yyGLRState* yystate; yyGLRState* yystate;
/** The lookahead for this reduction. */ /** The lookahead for this reduction. */
int yyrawchar; int yyrawchar;
YYSTYPE yyval; YYSTYPE yyval;]b4_locations_if([[
YYLTYPE yyloc; YYLTYPE yyloc;]])[
/** Next sibling in chain of options. To facilitate merging, /** Next sibling in chain of options. To facilitate merging,
* options are chained in decreasing order by address. */ * options are chained in decreasing order by address. */
yySemanticOption* yynext; yySemanticOption* yynext;
@@ -762,8 +757,8 @@ struct yyGLRStack {
[ [
int yyerrcnt; int yyerrcnt;
int yyrawchar; int yyrawchar;
YYSTYPE yyval; YYSTYPE yyval;]b4_locations_if([[
YYLTYPE yyloc; YYLTYPE yyloc;]])[
])[ ])[
YYJMP_BUF yyexception_buffer; YYJMP_BUF yyexception_buffer;
yyGLRStackItem* yyitems; yyGLRStackItem* yyitems;
@@ -829,8 +824,8 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
else else
/* The effect of using yysval or yyloc (in an immediate rule) is /* The effect of using yysval or yyloc (in an immediate rule) is
* undefined. */ * undefined. */
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL; yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[
yyvsp[i].yystate.yyloc = s->yyloc; yyvsp[i].yystate.yyloc = s->yyloc;]])[
s = yyvsp[i].yystate.yypred = s->yypred; s = yyvsp[i].yystate.yypred = s->yypred;
} }
} }

View File

@@ -6006,7 +6006,7 @@ This function is available if either the @samp{%define api.push-pull push} or
@samp{%define api.push-pull both} declaration is used. @samp{%define api.push-pull both} declaration is used.
@xref{Push Decl, ,A Push Parser}. @xref{Push Decl, ,A Push Parser}.
@deftypefun yypstate *yypstate_new (void) @deftypefun {yypstate*} yypstate_new (void)
The function will return a valid parser instance if there was memory available The function will return a valid parser instance if there was memory available
or 0 if no memory was available. or 0 if no memory was available.
In impure mode, it will also return 0 if a parser instance is currently In impure mode, it will also return 0 if a parser instance is currently
@@ -6439,17 +6439,17 @@ union specified by the @code{%union} declaration.
@xref{Action Types, ,Data Types of Values in Actions}. @xref{Action Types, ,Data Types of Values in Actions}.
@end deffn @end deffn
@deffn {Macro} YYABORT; @deffn {Macro} YYABORT @code{;}
Return immediately from @code{yyparse}, indicating failure. Return immediately from @code{yyparse}, indicating failure.
@xref{Parser Function, ,The Parser Function @code{yyparse}}. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
@end deffn @end deffn
@deffn {Macro} YYACCEPT; @deffn {Macro} YYACCEPT @code{;}
Return immediately from @code{yyparse}, indicating success. Return immediately from @code{yyparse}, indicating success.
@xref{Parser Function, ,The Parser Function @code{yyparse}}. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
@end deffn @end deffn
@deffn {Macro} YYBACKUP (@var{token}, @var{value}); @deffn {Macro} YYBACKUP (@var{token}, @var{value})@code{;}
@findex YYBACKUP @findex YYBACKUP
Unshift a token. This macro is allowed only for rules that reduce Unshift a token. This macro is allowed only for rules that reduce
a single value, and only when there is no lookahead token. a single value, and only when there is no lookahead token.
@@ -6467,18 +6467,15 @@ In either case, the rest of the action is not executed.
@end deffn @end deffn
@deffn {Macro} YYEMPTY @deffn {Macro} YYEMPTY
@vindex YYEMPTY
Value stored in @code{yychar} when there is no lookahead token. Value stored in @code{yychar} when there is no lookahead token.
@end deffn @end deffn
@deffn {Macro} YYEOF @deffn {Macro} YYEOF
@vindex YYEOF
Value stored in @code{yychar} when the lookahead is the end of the input Value stored in @code{yychar} when the lookahead is the end of the input
stream. stream.
@end deffn @end deffn
@deffn {Macro} YYERROR; @deffn {Macro} YYERROR @code{;}
@findex YYERROR
Cause an immediate syntax error. This statement initiates error Cause an immediate syntax error. This statement initiates error
recovery just as if the parser itself had detected an error; however, it recovery just as if the parser itself had detected an error; however, it
does not call @code{yyerror}, and does not print any message. If you does not call @code{yyerror}, and does not print any message. If you
@@ -6502,7 +6499,7 @@ Actions}).
@xref{Lookahead, ,Lookahead Tokens}. @xref{Lookahead, ,Lookahead Tokens}.
@end deffn @end deffn
@deffn {Macro} yyclearin; @deffn {Macro} yyclearin @code{;}
Discard the current lookahead token. This is useful primarily in Discard the current lookahead token. This is useful primarily in
error rules. error rules.
Do not invoke @code{yyclearin} in a deferred semantic action (@pxref{GLR Do not invoke @code{yyclearin} in a deferred semantic action (@pxref{GLR
@@ -6510,7 +6507,7 @@ Semantic Actions}).
@xref{Error Recovery}. @xref{Error Recovery}.
@end deffn @end deffn
@deffn {Macro} yyerrok; @deffn {Macro} yyerrok @code{;}
Resume generating error messages immediately for subsequent syntax Resume generating error messages immediately for subsequent syntax
errors. This is useful primarily in error rules. errors. This is useful primarily in error rules.
@xref{Error Recovery}. @xref{Error Recovery}.
@@ -10827,20 +10824,20 @@ The location information of the grouping made by the current rule.
@xref{Java Location Values}. @xref{Java Location Values}.
@end defvar @end defvar
@deffn {Statement} {return YYABORT;} @deftypefn {Statement} return YYABORT @code{;}
Return immediately from the parser, indicating failure. Return immediately from the parser, indicating failure.
@xref{Java Parser Interface}. @xref{Java Parser Interface}.
@end deffn @end deftypefn
@deffn {Statement} {return YYACCEPT;} @deftypefn {Statement} return YYACCEPT @code{;}
Return immediately from the parser, indicating success. Return immediately from the parser, indicating success.
@xref{Java Parser Interface}. @xref{Java Parser Interface}.
@end deffn @end deftypefn
@deffn {Statement} {return YYERROR;} @deftypefn {Statement} {return} YYERROR @code{;}
Start error recovery without printing an error message. Start error recovery (without printing an error message).
@xref{Error Recovery}. @xref{Error Recovery}.
@end deffn @end deftypefn
@deftypefn {Function} {boolean} recovering () @deftypefn {Function} {boolean} recovering ()
Return whether error recovery is being done. In this state, the parser Return whether error recovery is being done. In this state, the parser
@@ -11856,10 +11853,11 @@ after a syntax error. @xref{Error Recovery}.
@end deffn @end deffn
@deffn {Macro} YYERROR @deffn {Macro} YYERROR
Macro to pretend that a syntax error has just been detected: call Cause an immediate syntax error. This statement initiates error
@code{yyerror} and then perform normal error recovery if possible recovery just as if the parser itself had detected an error; however, it
(@pxref{Error Recovery}), or (if recovery is impossible) make does not call @code{yyerror}, and does not print any message. If you
@code{yyparse} return 1. @xref{Error Recovery}. want to print an error message, call @code{yyerror} explicitly before
the @samp{YYERROR;} statement. @xref{Error Recovery}.
For Java parsers, this functionality is invoked using @code{return YYERROR;} For Java parsers, this functionality is invoked using @code{return YYERROR;}
instead. instead.

2
gnulib

Submodule gnulib updated: 0e9d9267fa...1a0e0aefd4

113
m4/flex.m4 Normal file
View File

@@ -0,0 +1,113 @@
# flex.m4 serial 1
# Copyright (C) 2012 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AC_PROG_LEX
# -----------
# Look for flex or lex. Set its associated library to LEXLIB.
# Check if lex declares yytext as a char * by default, not a char[].
AN_MAKEVAR([LEX], [AC_PROG_LEX])
AN_PROGRAM([lex], [AC_PROG_LEX])
AN_PROGRAM([flex], [AC_PROG_LEX])
AC_DEFUN_ONCE([AC_PROG_LEX],
[AC_CHECK_PROGS([LEX], [flex lex], [:])
if test "x$LEX" != "x:"; then
_AC_PROG_LEX_YYTEXT_DECL
fi])
# _AC_PROG_LEX_YYTEXT_DECL
# ------------------------
# Check whether this is Flex, for the Lex output root, the Lex library,
# and whether Lex declares yytext as a char * by default.
m4_define([_AC_PROG_LEX_YYTEXT_DECL],
[AC_CACHE_CHECK([whether lex is flex],
[ac_cv_prog_flex],
[cat >conftest.l <<_ACEOF[
%option debug nodefault noinput nounput noyywrap never-interactive
%x SC_CONF_TEST
%%
a { BEGIN SC_CONF_TEST; }
]_ACEOF
if _AC_DO_VAR([LEX conftest.l]); then
ac_cv_prog_flex=yes
else
ac_cv_prog_flex=no
fi
])
FLEX=
if test $ac_cv_prog_flex = yes; then
AC_SUBST([FLEX], [yes])dnl
fi
cat >conftest.l <<_ACEOF[
%%
a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */
yyless ((input () != 0)); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
#ifdef YYTEXT_POINTER
extern char *yytext;
#endif
int
main (void)
{
return ! yylex () + ! yywrap ();
}
]_ACEOF
_AC_DO_VAR([LEX conftest.l])
AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [
if test -f lex.yy.c; then
ac_cv_prog_lex_root=lex.yy
elif test -f lexyy.c; then
ac_cv_prog_lex_root=lexyy
else
AC_MSG_ERROR([cannot find output from $LEX; giving up])
fi])
AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
if test -z "${LEXLIB+set}"; then
AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [
ac_save_LIBS=$LIBS
ac_cv_lib_lex='none needed'
for ac_lib in '' -lfl -ll; do
LIBS="$ac_lib $ac_save_LIBS"
AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED[`cat $LEX_OUTPUT_ROOT.c`]],
[ac_cv_lib_lex=$ac_lib])
test "$ac_cv_lib_lex" != 'none needed' && break
done
LIBS=$ac_save_LIBS
])
test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
fi
AC_SUBST([LEXLIB])
AC_CACHE_CHECK([whether yytext is a pointer],
[ac_cv_prog_lex_yytext_pointer],
[# POSIX says lex can declare yytext either as a pointer or an array; the
# default is implementation-dependent. Figure out which it is, since
# not all implementations provide the %pointer and %array declarations.
ac_cv_prog_lex_yytext_pointer=no
ac_save_LIBS=$LIBS
LIBS="$LEXLIB $ac_save_LIBS"
AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED
[#define YYTEXT_POINTER 1
`cat $LEX_OUTPUT_ROOT.c`]],
[ac_cv_prog_lex_yytext_pointer=yes])
LIBS=$ac_save_LIBS
])
dnl
if test $ac_cv_prog_lex_yytext_pointer = yes; then
AC_DEFINE([YYTEXT_POINTER], [1],
[Define to 1 if `lex' declares `yytext' as a `char *' by default,
not a `char[]'.])
fi
rm -f conftest.l $LEX_OUTPUT_ROOT.c
])# _AC_PROG_LEX_YYTEXT_DECL

View File

@@ -466,17 +466,26 @@ m4_define([AT_FULL_COMPILE], [
## Running a generated parser. ## ## Running a generated parser. ##
## ---------------------------- ## ## ---------------------------- ##
# AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) # AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE])
# ------------------------------------------------------------ # ------------------------------------------------------------
# So that we can run `./testsuite PREPARSER='valgrind -q' for instance. # So that we can run `./testsuite PREPARSER='valgrind -q' for instance.
#
# Get rid of spurious messages when compiled with --coverage:
# +profiling:/[...]/lib/fprintf.gcda:Merge mismatch for summaries
m4_define([AT_PARSER_CHECK], m4_define([AT_PARSER_CHECK],
[AT_CHECK([$5 $PREPARSER $1], [$2], [$3], [$4])]) [AT_CHECK([$5 $PREPARSER $1], [$2], [$3], [stderr])
AT_CHECK([sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr],
[0], [], [$4])
])
# AT_JAVA_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) # AT_JAVA_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE])
# ----------------------------------------------------------------- # -----------------------------------------------------------------
m4_define([AT_JAVA_PARSER_CHECK], m4_define([AT_JAVA_PARSER_CHECK],
[AT_CHECK([$5[ $SHELL ../../../javaexec.sh ]$1], [$2], [$3], [$4])]) [AT_CHECK([$5[ $SHELL ../../../javaexec.sh ]$1], [$2], [$3], [$4])])
# AT_TEST_TABLES_AND_PARSE(TITLE, COND-VALUE, TEST-SPEC, # AT_TEST_TABLES_AND_PARSE(TITLE, COND-VALUE, TEST-SPEC,
# DECLS, GRAMMAR, INPUT, # DECLS, GRAMMAR, INPUT,
# BISON-STDERR, TABLES-OR-LAST-STATE, # BISON-STDERR, TABLES-OR-LAST-STATE,