mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-16 22:25:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c982974f33 | ||
|
|
dc2a3578b7 | ||
|
|
9661b2fcbc | ||
|
|
d9a9b054ae | ||
|
|
cb9f4cb543 | ||
|
|
b86dcaf40b | ||
|
|
0fafbbdefb | ||
|
|
4b85b969d0 | ||
|
|
7727693711 | ||
|
|
ce27796b74 | ||
|
|
6135fdc152 | ||
|
|
f1497356e8 | ||
|
|
1429569362 | ||
|
|
506c368ab2 | ||
|
|
4f9dc3bdc1 | ||
|
|
0d81be2dc7 | ||
|
|
32f44f4bfb | ||
|
|
38a8287813 | ||
|
|
df752784c2 | ||
|
|
292409e91e | ||
|
|
eea56d70d9 | ||
|
|
6e2de439e6 | ||
|
|
e33cd4b824 | ||
|
|
0669780ff8 | ||
|
|
160df220b1 | ||
|
|
da5c072a62 | ||
|
|
73ac8ff409 |
+1
-1
@@ -1 +1 @@
|
|||||||
3.5.91
|
3.5.93
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.5.94 (2020-05-06) [beta]
|
||||||
|
|
||||||
|
Portability issues.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.5.93 (2020-05-03) [beta]
|
||||||
|
|
||||||
|
Portability issues.
|
||||||
|
|
||||||
* Noteworthy changes in release 3.5.92 (2020-05-03) [beta]
|
* Noteworthy changes in release 3.5.92 (2020-05-03) [beta]
|
||||||
|
|
||||||
Portability issues.
|
Portability issues.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
* Bison 3.6
|
* Bison 3.6
|
||||||
|
** Doc
|
||||||
|
*** api.header.include
|
||||||
|
|
||||||
** Questions
|
** Questions
|
||||||
*** Java
|
*** Java
|
||||||
- Should i18n be part of the Lexer? Currently it's a static method of
|
- Should i18n be part of the Lexer? Currently it's a static method of
|
||||||
@@ -192,10 +195,10 @@ define it to the same type as the C ptrdiff_t type.
|
|||||||
* Completion
|
* Completion
|
||||||
Several features are not available in all the backends.
|
Several features are not available in all the backends.
|
||||||
|
|
||||||
- push parsers: glr.c, glr.cc, lalr1.cc
|
- lac: D, Java (easy)
|
||||||
- lac: D, Java
|
- push parsers: glr.c, glr.cc, lalr1.cc (not very difficult)
|
||||||
- glr: D, Java
|
- token constructors: Java, C, D (a bit difficult)
|
||||||
- token constructors: Java, C, D
|
- glr: D, Java (super difficult)
|
||||||
|
|
||||||
* Bugs
|
* Bugs
|
||||||
** Autotest has quotation issues
|
** Autotest has quotation issues
|
||||||
|
|||||||
+9
-1
@@ -262,7 +262,8 @@ if ! "$LEX_IS_FLEX" || test "X$LEX" = X:; then
|
|||||||
LEX=:
|
LEX=:
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT])
|
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT])
|
||||||
AM_CONDITIONAL([FLEX_CXX_WORKS], [$LEX_WORKS && test $bison_cv_cxx_works = yes])
|
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||||
|
[$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT && test $bison_cv_cxx_works = yes])
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_M4
|
||||||
@@ -331,6 +332,13 @@ AC_MSG_RESULT([$suppfile])
|
|||||||
# Whether we cannot run the compiled bison.
|
# Whether we cannot run the compiled bison.
|
||||||
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
|
||||||
|
|
||||||
|
# Build bistromathic if we have the lib and both readline/readline.h
|
||||||
|
# and readline/history.h.
|
||||||
|
AM_CONDITIONAL([ENABLE_BISTROMATHIC],
|
||||||
|
[test "$gl_cv_lib_readline" != no &&
|
||||||
|
test "$ac_cv_header_readline_readline_h" = yes &&
|
||||||
|
test "$ac_cv_header_readline_history_h" = yes])
|
||||||
|
|
||||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
# Needed by tests/atlocal.in.
|
# Needed by tests/atlocal.in.
|
||||||
AC_SUBST([GCC])
|
AC_SUBST([GCC])
|
||||||
|
|||||||
+13
-4
@@ -259,14 +259,14 @@ m4_define([b4_public_types_declare],
|
|||||||
struct token
|
struct token
|
||||||
{
|
{
|
||||||
]b4_token_enums[
|
]b4_token_enums[
|
||||||
/// Backward compatibility alias.
|
/// Backward compatibility alias (Bison 3.6).
|
||||||
typedef token_kind_type yytokentype;
|
typedef token_kind_type yytokentype;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Token kind, as returned by yylex.
|
/// Token kind, as returned by yylex.
|
||||||
typedef token::yytokentype token_kind_type;
|
typedef token::yytokentype token_kind_type;
|
||||||
|
|
||||||
/// Backward compatibility alias.
|
/// Backward compatibility alias (Bison 3.6).
|
||||||
typedef token_kind_type token_type;
|
typedef token_kind_type token_type;
|
||||||
|
|
||||||
/// Symbol kinds.
|
/// Symbol kinds.
|
||||||
@@ -357,7 +357,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
Base::clear ();
|
Base::clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Backward compatibility.
|
/// Backward compatibility (Bison 3.6).
|
||||||
symbol_kind_type type_get () const YY_NOEXCEPT;
|
symbol_kind_type type_get () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// Whether empty.
|
/// Whether empty.
|
||||||
@@ -409,12 +409,15 @@ m4_define([b4_symbol_type_define],
|
|||||||
/// \a empty when empty.
|
/// \a empty when empty.
|
||||||
symbol_kind_type kind () const YY_NOEXCEPT;
|
symbol_kind_type kind () const YY_NOEXCEPT;
|
||||||
|
|
||||||
|
/// Backward compatibility (Bison 3.6).
|
||||||
|
symbol_kind_type type_get () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The symbol kind.
|
/// The symbol kind.
|
||||||
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
||||||
symbol_kind_type kind_;
|
symbol_kind_type kind_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Backward compatibility for a private implementation detail.
|
/// Backward compatibility for a private implementation detail (Bison 3.6).
|
||||||
typedef by_kind by_type;
|
typedef by_kind by_type;
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
/// "External" symbols: returned by the scanner.
|
||||||
@@ -534,6 +537,12 @@ m4_define([b4_public_types_define],
|
|||||||
{
|
{
|
||||||
return kind_;
|
return kind_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
||||||
|
]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
|
||||||
|
{
|
||||||
|
return this->kind ();
|
||||||
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+49
-1
@@ -205,7 +205,11 @@ m4_define([b4_c99_int_type],
|
|||||||
# Define private types suitable for holding small integers in C99 or later.
|
# Define private types suitable for holding small integers in C99 or later.
|
||||||
m4_define([b4_c99_int_type_define],
|
m4_define([b4_c99_int_type_define],
|
||||||
[m4_copy_force([b4_c99_int_type], [b4_int_type])dnl
|
[m4_copy_force([b4_c99_int_type], [b4_int_type])dnl
|
||||||
[/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
|
[#ifdef short
|
||||||
|
# undef short
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
|
||||||
<limits.h> and (if available) <stdint.h> are included
|
<limits.h> and (if available) <stdint.h> are included
|
||||||
so that the code can choose integer types of a good width. */
|
so that the code can choose integer types of a good width. */
|
||||||
|
|
||||||
@@ -261,6 +265,50 @@ typedef int yytype_uint16;
|
|||||||
#endif]])
|
#endif]])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_sizes_types_define
|
||||||
|
# ---------------------
|
||||||
|
# Define YYPTRDIFF_T/YYPTRDIFF_MAXIMUM, YYSIZE_T/YYSIZE_MAXIMUM,
|
||||||
|
# and YYSIZEOF.
|
||||||
|
m4_define([b4_sizes_types_define],
|
||||||
|
[[#ifndef YYPTRDIFF_T
|
||||||
|
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
|
||||||
|
# define YYPTRDIFF_T __PTRDIFF_TYPE__
|
||||||
|
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
|
||||||
|
# elif defined PTRDIFF_MAX
|
||||||
|
# ifndef ptrdiff_t
|
||||||
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# endif
|
||||||
|
# define YYPTRDIFF_T ptrdiff_t
|
||||||
|
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
|
||||||
|
# else
|
||||||
|
# define YYPTRDIFF_T long
|
||||||
|
# define YYPTRDIFF_MAXIMUM LONG_MAX
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef YYSIZE_T
|
||||||
|
# ifdef __SIZE_TYPE__
|
||||||
|
# define YYSIZE_T __SIZE_TYPE__
|
||||||
|
# elif defined size_t
|
||||||
|
# define YYSIZE_T size_t
|
||||||
|
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
||||||
|
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# define YYSIZE_T size_t
|
||||||
|
# else
|
||||||
|
# define YYSIZE_T unsigned
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define YYSIZE_MAXIMUM \
|
||||||
|
YY_CAST (YYPTRDIFF_T, \
|
||||||
|
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
|
||||||
|
? YYPTRDIFF_MAXIMUM \
|
||||||
|
: YY_CAST (YYSIZE_T, -1)))
|
||||||
|
|
||||||
|
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Return a narrow int type able to handle numbers ranging from
|
# Return a narrow int type able to handle numbers ranging from
|
||||||
|
|||||||
+52
-52
@@ -249,6 +249,7 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
]b4_c99_int_type_define[
|
]b4_c99_int_type_define[
|
||||||
|
]b4_sizes_types_define[
|
||||||
|
|
||||||
#ifndef YY_
|
#ifndef YY_
|
||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
@@ -277,9 +278,6 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
# define YYREALLOC realloc
|
# define YYREALLOC realloc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define YYSIZEMAX \
|
|
||||||
(PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : YY_CAST (ptrdiff_t, SIZE_MAX))
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
typedef bool yybool;
|
typedef bool yybool;
|
||||||
# define yytrue true
|
# define yytrue true
|
||||||
@@ -507,7 +505,7 @@ struct yyGLRState {
|
|||||||
/** Preceding state in this stack */
|
/** Preceding state in this stack */
|
||||||
yyGLRState* yypred;
|
yyGLRState* yypred;
|
||||||
/** Source position of the last token produced by my symbol */
|
/** Source position of the last token produced by my symbol */
|
||||||
ptrdiff_t yyposn;
|
YYPTRDIFF_T yyposn;
|
||||||
union {
|
union {
|
||||||
/** First in a chain of alternative reductions producing the
|
/** First in a chain of alternative reductions producing the
|
||||||
* nonterminal corresponding to this state, threaded through
|
* nonterminal corresponding to this state, threaded through
|
||||||
@@ -527,8 +525,8 @@ struct yyGLRStateSet {
|
|||||||
* operation, yylookaheadNeeds[0] is not maintained since it would merely
|
* operation, yylookaheadNeeds[0] is not maintained since it would merely
|
||||||
* duplicate yychar != ]b4_symbol(-2, id)[. */
|
* duplicate yychar != ]b4_symbol(-2, id)[. */
|
||||||
yybool* yylookaheadNeeds;
|
yybool* yylookaheadNeeds;
|
||||||
ptrdiff_t yysize;
|
YYPTRDIFF_T yysize;
|
||||||
ptrdiff_t yycapacity;
|
YYPTRDIFF_T yycapacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct yySemanticOption {
|
struct yySemanticOption {
|
||||||
@@ -568,7 +566,7 @@ struct yyGLRStack {
|
|||||||
YYJMP_BUF yyexception_buffer;
|
YYJMP_BUF yyexception_buffer;
|
||||||
yyGLRStackItem* yyitems;
|
yyGLRStackItem* yyitems;
|
||||||
yyGLRStackItem* yynextFree;
|
yyGLRStackItem* yynextFree;
|
||||||
ptrdiff_t yyspaceLeft;
|
YYPTRDIFF_T yyspaceLeft;
|
||||||
yyGLRState* yysplitPoint;
|
yyGLRState* yysplitPoint;
|
||||||
yyGLRState* yylastDeleted;
|
yyGLRState* yylastDeleted;
|
||||||
yyGLRStateSet yytops;
|
yyGLRStateSet yytops;
|
||||||
@@ -680,7 +678,7 @@ yysymbol_name (yysymbol_kind_t yysymbol)
|
|||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
int yydebug;
|
int yydebug;
|
||||||
|
|
||||||
static void yypstack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
static void yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
|
||||||
YY_ATTRIBUTE_UNUSED;
|
YY_ATTRIBUTE_UNUSED;
|
||||||
static void yypdumpstack (yyGLRStack* yystackp)
|
static void yypdumpstack (yyGLRStack* yystackp)
|
||||||
YY_ATTRIBUTE_UNUSED;
|
YY_ATTRIBUTE_UNUSED;
|
||||||
@@ -696,7 +694,7 @@ static void yypdumpstack (yyGLRStack* yystackp)
|
|||||||
[simple],
|
[simple],
|
||||||
[[]],
|
[[]],
|
||||||
[[#ifndef yystrlen
|
[[#ifndef yystrlen
|
||||||
# define yystrlen(S) (YY_CAST (ptrdiff_t, strlen (S)))
|
# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_parse_error_bmatch(
|
]b4_parse_error_bmatch(
|
||||||
@@ -731,12 +729,12 @@ yystpcpy (char *yydest, const char *yysrc)
|
|||||||
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
||||||
null, do not copy; instead, return the length of what the result
|
null, do not copy; instead, return the length of what the result
|
||||||
would have been. */
|
would have been. */
|
||||||
static ptrdiff_t
|
static YYPTRDIFF_T
|
||||||
yytnamerr (char *yyres, const char *yystr)
|
yytnamerr (char *yyres, const char *yystr)
|
||||||
{
|
{
|
||||||
if (*yystr == '"')
|
if (*yystr == '"')
|
||||||
{
|
{
|
||||||
ptrdiff_t yyn = 0;
|
YYPTRDIFF_T yyn = 0;
|
||||||
char const *yyp = yystr;
|
char const *yyp = yystr;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -1104,7 +1102,7 @@ yynewGLRStackItem (yyGLRStack* yystackp, yybool yyisState)
|
|||||||
* alternative actions for YYSTATE. Assumes that YYRHS comes from
|
* alternative actions for YYSTATE. Assumes that YYRHS comes from
|
||||||
* stack #YYK of *YYSTACKP. */
|
* stack #YYK of *YYSTACKP. */
|
||||||
static void
|
static void
|
||||||
yyaddDeferredAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyGLRState* yystate,
|
yyaddDeferredAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyGLRState* yystate,
|
||||||
yyGLRState* yyrhs, yyRuleNum yyrule)
|
yyGLRState* yyrhs, yyRuleNum yyrule)
|
||||||
{
|
{
|
||||||
yySemanticOption* yynewOption =
|
yySemanticOption* yynewOption =
|
||||||
@@ -1136,14 +1134,14 @@ yyinitStateSet (yyGLRStateSet* yyset)
|
|||||||
yyset->yycapacity = 16;
|
yyset->yycapacity = 16;
|
||||||
yyset->yystates
|
yyset->yystates
|
||||||
= YY_CAST (yyGLRState**,
|
= YY_CAST (yyGLRState**,
|
||||||
YYMALLOC (YY_CAST (size_t, yyset->yycapacity)
|
YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity)
|
||||||
* sizeof yyset->yystates[0]));
|
* sizeof yyset->yystates[0]));
|
||||||
if (! yyset->yystates)
|
if (! yyset->yystates)
|
||||||
return yyfalse;
|
return yyfalse;
|
||||||
yyset->yystates[0] = YY_NULLPTR;
|
yyset->yystates[0] = YY_NULLPTR;
|
||||||
yyset->yylookaheadNeeds
|
yyset->yylookaheadNeeds
|
||||||
= YY_CAST (yybool*,
|
= YY_CAST (yybool*,
|
||||||
YYMALLOC (YY_CAST (size_t, yyset->yycapacity)
|
YYMALLOC (YY_CAST (YYSIZE_T, yyset->yycapacity)
|
||||||
* sizeof yyset->yylookaheadNeeds[0]));
|
* sizeof yyset->yylookaheadNeeds[0]));
|
||||||
if (! yyset->yylookaheadNeeds)
|
if (! yyset->yylookaheadNeeds)
|
||||||
{
|
{
|
||||||
@@ -1152,7 +1150,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
|
|||||||
}
|
}
|
||||||
memset (yyset->yylookaheadNeeds,
|
memset (yyset->yylookaheadNeeds,
|
||||||
0,
|
0,
|
||||||
YY_CAST (size_t, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0]);
|
YY_CAST (YYSIZE_T, yyset->yycapacity) * sizeof yyset->yylookaheadNeeds[0]);
|
||||||
return yytrue;
|
return yytrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1165,14 +1163,14 @@ static void yyfreeStateSet (yyGLRStateSet* yyset)
|
|||||||
/** Initialize *YYSTACKP to a single empty stack, with total maximum
|
/** Initialize *YYSTACKP to a single empty stack, with total maximum
|
||||||
* capacity for all stacks of YYSIZE. */
|
* capacity for all stacks of YYSIZE. */
|
||||||
static yybool
|
static yybool
|
||||||
yyinitGLRStack (yyGLRStack* yystackp, ptrdiff_t yysize)
|
yyinitGLRStack (yyGLRStack* yystackp, YYPTRDIFF_T yysize)
|
||||||
{
|
{
|
||||||
yystackp->yyerrState = 0;
|
yystackp->yyerrState = 0;
|
||||||
yynerrs = 0;
|
yynerrs = 0;
|
||||||
yystackp->yyspaceLeft = yysize;
|
yystackp->yyspaceLeft = yysize;
|
||||||
yystackp->yyitems
|
yystackp->yyitems
|
||||||
= YY_CAST (yyGLRStackItem*,
|
= YY_CAST (yyGLRStackItem*,
|
||||||
YYMALLOC (YY_CAST (size_t, yysize)
|
YYMALLOC (YY_CAST (YYSIZE_T, yysize)
|
||||||
* sizeof yystackp->yynextFree[0]));
|
* sizeof yystackp->yynextFree[0]));
|
||||||
if (!yystackp->yyitems)
|
if (!yystackp->yyitems)
|
||||||
return yyfalse;
|
return yyfalse;
|
||||||
@@ -1198,9 +1196,9 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
|||||||
{
|
{
|
||||||
yyGLRStackItem* yynewItems;
|
yyGLRStackItem* yynewItems;
|
||||||
yyGLRStackItem* yyp0, *yyp1;
|
yyGLRStackItem* yyp0, *yyp1;
|
||||||
ptrdiff_t yynewSize;
|
YYPTRDIFF_T yynewSize;
|
||||||
ptrdiff_t yyn;
|
YYPTRDIFF_T yyn;
|
||||||
ptrdiff_t yysize = yystackp->yynextFree - yystackp->yyitems;
|
YYPTRDIFF_T yysize = yystackp->yynextFree - yystackp->yyitems;
|
||||||
if (YYMAXDEPTH - YYHEADROOM < yysize)
|
if (YYMAXDEPTH - YYHEADROOM < yysize)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yynewSize = 2*yysize;
|
yynewSize = 2*yysize;
|
||||||
@@ -1208,7 +1206,7 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
|||||||
yynewSize = YYMAXDEPTH;
|
yynewSize = YYMAXDEPTH;
|
||||||
yynewItems
|
yynewItems
|
||||||
= YY_CAST (yyGLRStackItem*,
|
= YY_CAST (yyGLRStackItem*,
|
||||||
YYMALLOC (YY_CAST (size_t, yynewSize)
|
YYMALLOC (YY_CAST (YYSIZE_T, yynewSize)
|
||||||
* sizeof yynewItems[0]));
|
* sizeof yynewItems[0]));
|
||||||
if (! yynewItems)
|
if (! yynewItems)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
@@ -1273,7 +1271,7 @@ yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
|||||||
|
|
||||||
/** Invalidate stack #YYK in *YYSTACKP. */
|
/** Invalidate stack #YYK in *YYSTACKP. */
|
||||||
static inline void
|
static inline void
|
||||||
yymarkStackDeleted (yyGLRStack* yystackp, ptrdiff_t yyk)
|
yymarkStackDeleted (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
|
||||||
{
|
{
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
|
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
|
||||||
@@ -1297,7 +1295,7 @@ yyundeleteLastStack (yyGLRStack* yystackp)
|
|||||||
static inline void
|
static inline void
|
||||||
yyremoveDeletes (yyGLRStack* yystackp)
|
yyremoveDeletes (yyGLRStack* yystackp)
|
||||||
{
|
{
|
||||||
ptrdiff_t yyi, yyj;
|
YYPTRDIFF_T yyi, yyj;
|
||||||
yyi = yyj = 0;
|
yyi = yyj = 0;
|
||||||
while (yyj < yystackp->yytops.yysize)
|
while (yyj < yystackp->yytops.yysize)
|
||||||
{
|
{
|
||||||
@@ -1330,8 +1328,8 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
|||||||
* state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
|
* state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
|
||||||
* value *YYVALP and source location *YYLOCP. */
|
* value *YYVALP and source location *YYLOCP. */
|
||||||
static inline void
|
static inline void
|
||||||
yyglrShift (yyGLRStack* yystackp, ptrdiff_t yyk, yy_state_t yylrState,
|
yyglrShift (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
|
||||||
ptrdiff_t yyposn,
|
YYPTRDIFF_T yyposn,
|
||||||
YYSTYPE* yyvalp]b4_locations_if([, YYLTYPE* yylocp])[)
|
YYSTYPE* yyvalp]b4_locations_if([, YYLTYPE* yylocp])[)
|
||||||
{
|
{
|
||||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||||
@@ -1351,8 +1349,8 @@ yyglrShift (yyGLRStack* yystackp, ptrdiff_t yyk, yy_state_t yylrState,
|
|||||||
* state YYLRSTATE, at input position YYPOSN, with the (unresolved)
|
* state YYLRSTATE, at input position YYPOSN, with the (unresolved)
|
||||||
* semantic value of YYRHS under the action for YYRULE. */
|
* semantic value of YYRHS under the action for YYRULE. */
|
||||||
static inline void
|
static inline void
|
||||||
yyglrShiftDefer (yyGLRStack* yystackp, ptrdiff_t yyk, yy_state_t yylrState,
|
yyglrShiftDefer (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yy_state_t yylrState,
|
||||||
ptrdiff_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
YYPTRDIFF_T yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
||||||
{
|
{
|
||||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||||
YY_ASSERT (yynewState->yyisState);
|
YY_ASSERT (yynewState->yyisState);
|
||||||
@@ -1382,7 +1380,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, ptrdiff_t yyk, yy_state_t yylrState,
|
|||||||
`----------------------------------------------------------------------*/
|
`----------------------------------------------------------------------*/
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, ptrdiff_t yyk,
|
yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, YYPTRDIFF_T yyk,
|
||||||
yyRuleNum yyrule]b4_user_formals[)
|
yyRuleNum yyrule]b4_user_formals[)
|
||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
||||||
@@ -1415,7 +1413,7 @@ yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, ptrdiff_t yyk,
|
|||||||
* and *YYLOCP to the computed location (if any). Return value is as
|
* and *YYLOCP to the computed location (if any). Return value is as
|
||||||
* for userAction. */
|
* for userAction. */
|
||||||
static inline YYRESULTTAG
|
static inline YYRESULTTAG
|
||||||
yydoAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
yydoAction (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
|
||||||
YYSTYPE* yyvalp]b4_locuser_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);
|
int yynrhs = yyrhsLength (yyrule);
|
||||||
@@ -1467,10 +1465,10 @@ yydoAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
* added to the options for the existing state's semantic value.
|
* added to the options for the existing state's semantic value.
|
||||||
*/
|
*/
|
||||||
static inline YYRESULTTAG
|
static inline YYRESULTTAG
|
||||||
yyglrReduce (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
|
||||||
yybool yyforceEval]b4_user_formals[)
|
yybool yyforceEval]b4_user_formals[)
|
||||||
{
|
{
|
||||||
ptrdiff_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
|
YYPTRDIFF_T yyposn = yystackp->yytops.yystates[yyk]->yyposn;
|
||||||
|
|
||||||
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
|
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
@@ -1492,7 +1490,7 @@ yyglrReduce (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ptrdiff_t yyi;
|
YYPTRDIFF_T yyi;
|
||||||
int yyn;
|
int yyn;
|
||||||
yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk];
|
yyGLRState* yys, *yys0 = yystackp->yytops.yystates[yyk];
|
||||||
yy_state_t yynewLRState;
|
yy_state_t yynewLRState;
|
||||||
@@ -1534,8 +1532,8 @@ yyglrReduce (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ptrdiff_t
|
static YYPTRDIFF_T
|
||||||
yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
yysplitStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
|
||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint == YY_NULLPTR)
|
if (yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
@@ -1544,8 +1542,8 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
|||||||
}
|
}
|
||||||
if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize)
|
if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize)
|
||||||
{
|
{
|
||||||
ptrdiff_t state_size = sizeof yystackp->yytops.yystates[0];
|
YYPTRDIFF_T state_size = YYSIZEOF (yystackp->yytops.yystates[0]);
|
||||||
ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size;
|
YYPTRDIFF_T half_max_capacity = YYSIZE_MAXIMUM / 2 / state_size;
|
||||||
if (half_max_capacity < yystackp->yytops.yycapacity)
|
if (half_max_capacity < yystackp->yytops.yycapacity)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yycapacity *= 2;
|
yystackp->yytops.yycapacity *= 2;
|
||||||
@@ -1554,7 +1552,7 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
|||||||
yyGLRState** yynewStates
|
yyGLRState** yynewStates
|
||||||
= YY_CAST (yyGLRState**,
|
= YY_CAST (yyGLRState**,
|
||||||
YYREALLOC (yystackp->yytops.yystates,
|
YYREALLOC (yystackp->yytops.yystates,
|
||||||
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
(YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity)
|
||||||
* sizeof yynewStates[0])));
|
* sizeof yynewStates[0])));
|
||||||
if (yynewStates == YY_NULLPTR)
|
if (yynewStates == YY_NULLPTR)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
@@ -1565,7 +1563,7 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
|||||||
yybool* yynewLookaheadNeeds
|
yybool* yynewLookaheadNeeds
|
||||||
= YY_CAST (yybool*,
|
= YY_CAST (yybool*,
|
||||||
YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
||||||
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
(YY_CAST (YYSIZE_T, yystackp->yytops.yycapacity)
|
||||||
* sizeof yynewLookaheadNeeds[0])));
|
* sizeof yynewLookaheadNeeds[0])));
|
||||||
if (yynewLookaheadNeeds == YY_NULLPTR)
|
if (yynewLookaheadNeeds == YY_NULLPTR)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
@@ -1996,8 +1994,8 @@ yycompressStack (yyGLRStack* yystackp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static YYRESULTTAG
|
static YYRESULTTAG
|
||||||
yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
yyprocessOneStack (yyGLRStack* yystackp, YYPTRDIFF_T yyk,
|
||||||
ptrdiff_t yyposn]b4_pure_formals[)
|
YYPTRDIFF_T yyposn]b4_pure_formals[)
|
||||||
{
|
{
|
||||||
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
@@ -2040,7 +2038,7 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
|||||||
for (/* nothing */; *yyconflicts; yyconflicts += 1)
|
for (/* nothing */; *yyconflicts; yyconflicts += 1)
|
||||||
{
|
{
|
||||||
YYRESULTTAG yyflag;
|
YYRESULTTAG yyflag;
|
||||||
ptrdiff_t yynewStack = yysplitStack (yystackp, yyk);
|
YYPTRDIFF_T yynewStack = yysplitStack (yystackp, yyk);
|
||||||
YY_DPRINTF ((stderr, "Splitting off stack %ld from %ld.\n",
|
YY_DPRINTF ((stderr, "Splitting off stack %ld from %ld.\n",
|
||||||
YY_CAST (long, yynewStack), YY_CAST (long, yyk)));
|
YY_CAST (long, yynewStack), YY_CAST (long, yyk)));
|
||||||
yyflag = yyglrReduce (yystackp, yynewStack,
|
yyflag = yyglrReduce (yystackp, yynewStack,
|
||||||
@@ -2121,6 +2119,8 @@ yypcontext_expected_tokens (const yyGLRStack* yystackp,
|
|||||||
yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
|
yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
|
yyarg[0] = ]b4_symbol(-2, kind)[;
|
||||||
return yycount;
|
return yycount;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
@@ -2228,7 +2228,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
one per "expected"). */
|
one per "expected"). */
|
||||||
yysymbol_kind_t yyarg[YYARGS_MAX];
|
yysymbol_kind_t yyarg[YYARGS_MAX];
|
||||||
/* Cumulated lengths of YYARG. */
|
/* Cumulated lengths of YYARG. */
|
||||||
ptrdiff_t yysize = 0;
|
YYPTRDIFF_T yysize = 0;
|
||||||
|
|
||||||
/* Actual size of YYARG. */
|
/* Actual size of YYARG. */
|
||||||
int yycount
|
int yycount
|
||||||
@@ -2259,11 +2259,11 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
int yyi;
|
int yyi;
|
||||||
for (yyi = 0; yyi < yycount; ++yyi)
|
for (yyi = 0; yyi < yycount; ++yyi)
|
||||||
{
|
{
|
||||||
ptrdiff_t yysz
|
YYPTRDIFF_T yysz
|
||||||
= ]b4_parse_error_case(
|
= ]b4_parse_error_case(
|
||||||
[verbose], [[yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]])]],
|
[verbose], [[yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]])]],
|
||||||
[[yystrlen (yysymbol_name (yyarg[yyi]))]]);[
|
[[yystrlen (yysymbol_name (yyarg[yyi]))]]);[
|
||||||
if (YYSIZEMAX - yysize < yysz)
|
if (YYSIZE_MAXIMUM - yysize < yysz)
|
||||||
yysize_overflow = yytrue;
|
yysize_overflow = yytrue;
|
||||||
else
|
else
|
||||||
yysize += yysz;
|
yysize += yysz;
|
||||||
@@ -2271,7 +2271,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!yysize_overflow)
|
if (!yysize_overflow)
|
||||||
yymsg = YY_CAST (char *, YYMALLOC (YY_CAST (size_t, yysize)));
|
yymsg = YY_CAST (char *, YYMALLOC (YY_CAST (YYSIZE_T, yysize)));
|
||||||
|
|
||||||
if (yymsg)
|
if (yymsg)
|
||||||
{
|
{
|
||||||
@@ -2348,7 +2348,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
|
|
||||||
/* Reduce to one stack. */
|
/* Reduce to one stack. */
|
||||||
{
|
{
|
||||||
ptrdiff_t yyk;
|
YYPTRDIFF_T yyk;
|
||||||
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
break;
|
break;
|
||||||
@@ -2423,7 +2423,7 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
|
|||||||
int yyresult;
|
int yyresult;
|
||||||
yyGLRStack yystack;
|
yyGLRStack yystack;
|
||||||
yyGLRStack* const yystackp = &yystack;
|
yyGLRStack* const yystackp = &yystack;
|
||||||
ptrdiff_t yyposn;
|
YYPTRDIFF_T yyposn;
|
||||||
|
|
||||||
YY_DPRINTF ((stderr, "Starting parse\n"));
|
YY_DPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
@@ -2505,7 +2505,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
yysymbol_kind_t yytoken_to_shift;
|
yysymbol_kind_t yytoken_to_shift;
|
||||||
ptrdiff_t yys;
|
YYPTRDIFF_T yys;
|
||||||
|
|
||||||
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
||||||
yystackp->yytops.yylookaheadNeeds[yys] = yychar != ]b4_symbol(-2, id)[;
|
yystackp->yytops.yylookaheadNeeds[yys] = yychar != ]b4_symbol(-2, id)[;
|
||||||
@@ -2612,8 +2612,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyGLRState** yystates = yystack.yytops.yystates;
|
yyGLRState** yystates = yystack.yytops.yystates;
|
||||||
if (yystates)
|
if (yystates)
|
||||||
{
|
{
|
||||||
ptrdiff_t yysize = yystack.yytops.yysize;
|
YYPTRDIFF_T yysize = yystack.yytops.yysize;
|
||||||
ptrdiff_t yyk;
|
YYPTRDIFF_T yyk;
|
||||||
for (yyk = 0; yyk < yysize; yyk += 1)
|
for (yyk = 0; yyk < yysize; yyk += 1)
|
||||||
if (yystates[yyk])
|
if (yystates[yyk])
|
||||||
{
|
{
|
||||||
@@ -2660,7 +2660,7 @@ yypstates (yyGLRState* yyst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
yypstack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
yypstack (yyGLRStack* yystackp, YYPTRDIFF_T yyk)
|
||||||
{
|
{
|
||||||
yypstates (yystackp->yytops.yystates[yyk]);
|
yypstates (yystackp->yytops.yystates[yyk]);
|
||||||
}
|
}
|
||||||
@@ -2705,7 +2705,7 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
|
|
||||||
YY_FPRINTF ((stderr, "Tops:"));
|
YY_FPRINTF ((stderr, "Tops:"));
|
||||||
{
|
{
|
||||||
ptrdiff_t yyi;
|
YYPTRDIFF_T yyi;
|
||||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||||
YY_FPRINTF ((stderr, "%ld: %ld; ", YY_CAST (long, yyi),
|
YY_FPRINTF ((stderr, "%ld: %ld; ", YY_CAST (long, yyi),
|
||||||
YYINDEX (yystackp->yytops.yystates[yyi])));
|
YYINDEX (yystackp->yytops.yystates[yyi])));
|
||||||
|
|||||||
@@ -1326,6 +1326,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
|
yyarg[0] = symbol_kind::]b4_symbol(-2, kind)[;
|
||||||
return yycount;
|
return yycount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -944,6 +944,8 @@ b4_dollar_popdef[]dnl
|
|||||||
yyarg[yycount++] = SymbolKind.get (yyx);
|
yyarg[yycount++] = SymbolKind.get (yyx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (yyarg != null && yycount == yyoffset && yyoffset < yyargn)
|
||||||
|
yyarg[yycount] = null;
|
||||||
return yycount - yyoffset;
|
return yycount - yyoffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-42
@@ -403,50 +403,10 @@ m4_if(b4_api_prefix, [yy], [],
|
|||||||
]b4_declare_symbol_enum[
|
]b4_declare_symbol_enum[
|
||||||
|
|
||||||
]b4_user_post_prologue[
|
]b4_user_post_prologue[
|
||||||
]b4_percent_code_get[]dnl
|
]b4_percent_code_get[
|
||||||
|
|
||||||
[#ifdef short
|
|
||||||
# undef short
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_c99_int_type_define[
|
]b4_c99_int_type_define[
|
||||||
|
|
||||||
#ifndef YYPTRDIFF_T
|
]b4_sizes_types_define[
|
||||||
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
|
|
||||||
# define YYPTRDIFF_T __PTRDIFF_TYPE__
|
|
||||||
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
|
|
||||||
# elif defined PTRDIFF_MAX
|
|
||||||
# ifndef ptrdiff_t
|
|
||||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
|
||||||
# endif
|
|
||||||
# define YYPTRDIFF_T ptrdiff_t
|
|
||||||
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
|
|
||||||
# else
|
|
||||||
# define YYPTRDIFF_T long
|
|
||||||
# define YYPTRDIFF_MAXIMUM LONG_MAX
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef YYSIZE_T
|
|
||||||
# ifdef __SIZE_TYPE__
|
|
||||||
# define YYSIZE_T __SIZE_TYPE__
|
|
||||||
# elif defined size_t
|
|
||||||
# define YYSIZE_T size_t
|
|
||||||
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
|
||||||
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
|
||||||
# define YYSIZE_T size_t
|
|
||||||
# else
|
|
||||||
# define YYSIZE_T unsigned
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define YYSIZE_MAXIMUM \
|
|
||||||
YY_CAST (YYPTRDIFF_T, \
|
|
||||||
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
|
|
||||||
? YYPTRDIFF_MAXIMUM \
|
|
||||||
: YY_CAST (YYSIZE_T, -1)))
|
|
||||||
|
|
||||||
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
|
|
||||||
|
|
||||||
/* Stored state numbers (used for stacks). */
|
/* Stored state numbers (used for stacks). */
|
||||||
typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ yy_state_t;
|
typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ yy_state_t;
|
||||||
@@ -1198,6 +1158,8 @@ yypcontext_expected_tokens (const yypcontext_t *yyctx,
|
|||||||
yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
|
yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
|
||||||
}
|
}
|
||||||
}]])[
|
}]])[
|
||||||
|
if (yyarg && yycount == 0 && 0 < yyargn)
|
||||||
|
yyarg[0] = ]b4_symbol(-2, kind)[;
|
||||||
return yycount;
|
return yycount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+66
-56
@@ -300,10 +300,7 @@ Bison Declarations
|
|||||||
Parser C-Language Interface
|
Parser C-Language Interface
|
||||||
|
|
||||||
* Parser Function:: How to call @code{yyparse} and what it returns.
|
* Parser Function:: How to call @code{yyparse} and what it returns.
|
||||||
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
|
* Push Parser Interface:: How to create, use, and destroy push parsers.
|
||||||
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
|
|
||||||
* Parser Create Function:: How to call @code{yypstate_new} and what it returns.
|
|
||||||
* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns.
|
|
||||||
* Lexical:: You must supply a function @code{yylex}
|
* Lexical:: You must supply a function @code{yylex}
|
||||||
which reads tokens.
|
which reads tokens.
|
||||||
* Error Reporting:: Passing error messages to the user.
|
* Error Reporting:: Passing error messages to the user.
|
||||||
@@ -6927,10 +6924,7 @@ in the grammar file, you are likely to run into trouble.
|
|||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Parser Function:: How to call @code{yyparse} and what it returns.
|
* Parser Function:: How to call @code{yyparse} and what it returns.
|
||||||
* Push Parser Function:: How to call @code{yypush_parse} and what it returns.
|
* Push Parser Interface:: How to create, use, and destroy push parsers.
|
||||||
* Pull Parser Function:: How to call @code{yypull_parse} and what it returns.
|
|
||||||
* Parser Create Function:: How to call @code{yypstate_new} and what it returns.
|
|
||||||
* Parser Delete Function:: How to call @code{yypstate_delete} and what it returns.
|
|
||||||
* Lexical:: You must supply a function @code{yylex}
|
* Lexical:: You must supply a function @code{yylex}
|
||||||
which reads tokens.
|
which reads tokens.
|
||||||
* Error Reporting:: Passing error messages to the user.
|
* Error Reporting:: Passing error messages to the user.
|
||||||
@@ -7033,16 +7027,40 @@ void yyerror (YYLTYPE *llocp, int *randomness, const char *msg);
|
|||||||
int yyparse (int *randomness);
|
int yyparse (int *randomness);
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@node Push Parser Function
|
@node Push Parser Interface
|
||||||
@section The Push Parser Function @code{yypush_parse}
|
@section Push Parser Interface
|
||||||
@findex yypush_parse
|
|
||||||
|
|
||||||
You call the function @code{yypush_parse} to parse a single token. This
|
@findex yypstate_new
|
||||||
|
You call the function @code{yypstate_new} to create a new parser instance.
|
||||||
|
This function is available if either the @samp{%define api.push-pull push}
|
||||||
|
or @samp{%define api.push-pull both} declaration is used. @xref{Push Decl}.
|
||||||
|
|
||||||
|
@deftypefun {yypstate*} yypstate_new (@code{void})
|
||||||
|
@anchor{yypstate_new}
|
||||||
|
Return a valid parser instance if there is memory available, 0 otherwise.
|
||||||
|
In impure mode, it will also return 0 if a parser instance is currently
|
||||||
|
allocated.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@findex yypstate_delete
|
||||||
|
You call the function @code{yypstate_delete} to delete a parser instance.
|
||||||
function is available if either the @samp{%define api.push-pull push} or
|
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}.
|
@xref{Push Decl}.
|
||||||
|
|
||||||
|
@deftypefun void yypstate_delete (@code{yypstate *}@var{yyps})
|
||||||
|
@anchor{yypstate_delete}
|
||||||
|
Reclaim the memory associated with a parser instance. After this call, you
|
||||||
|
should no longer attempt to use the parser instance.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@findex yypush_parse
|
||||||
|
You call the function @code{yypush_parse} to parse a single token. This
|
||||||
|
function is available if either the @samp{%define api.push-pull push} or
|
||||||
|
@samp{%define api.push-pull both} declaration is used. @xref{Push Decl}.
|
||||||
|
|
||||||
@deftypefun int yypush_parse (@code{yypstate *}@var{yyps})
|
@deftypefun int yypush_parse (@code{yypstate *}@var{yyps})
|
||||||
|
@anchor{yypush_parse}
|
||||||
The value returned by @code{yypush_parse} is the same as for @code{yyparse}
|
The value returned by @code{yypush_parse} is the same as for @code{yyparse}
|
||||||
with the following exception: it returns @code{YYPUSH_MORE} if more input is
|
with the following exception: it returns @code{YYPUSH_MORE} if more input is
|
||||||
required to finish parsing the grammar.
|
required to finish parsing the grammar.
|
||||||
@@ -7056,50 +7074,35 @@ reuse. For example, a calculator application which parses each input line
|
|||||||
as an expression can just keep reusing the same @code{yyps} even if an input
|
as an expression can just keep reusing the same @code{yyps} even if an input
|
||||||
was invalid.
|
was invalid.
|
||||||
|
|
||||||
@node Pull Parser Function
|
|
||||||
@section The Pull Parser Function @code{yypull_parse}
|
|
||||||
@findex yypull_parse
|
|
||||||
|
|
||||||
You call the function @code{yypull_parse} to parse the rest of the input
|
You call the function @code{yypull_parse} to parse the rest of the input
|
||||||
stream. This function is available if the @samp{%define api.push-pull both}
|
stream. This function is available if the @samp{%define api.push-pull both}
|
||||||
declaration is used.
|
declaration is used. @xref{Push Decl}.
|
||||||
@xref{Push Decl}.
|
|
||||||
|
|
||||||
@deftypefun int yypull_parse (@code{yypstate *}@var{yyps})
|
@deftypefun int yypull_parse (@code{yypstate *}@var{yyps})
|
||||||
|
@anchor{yypull_parse}
|
||||||
The value returned by @code{yypull_parse} is the same as for @code{yyparse}.
|
The value returned by @code{yypull_parse} is the same as for @code{yyparse}.
|
||||||
|
|
||||||
The parser instance @code{yyps} may be reused for new parses.
|
The parser instance @code{yyps} may be reused for new parses.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node Parser Create Function
|
@deftypefun int yypstate_expected_tokens (@code{const yypstate *}yyps, @code{yysymbol_kind_t} @var{argv}@code{[]}, @code{int} @var{argc})
|
||||||
@section The Parser Create Function @code{yystate_new}
|
Fill @var{argv} with the expected tokens, which never includes
|
||||||
@findex yypstate_new
|
@code{YYSYMBOL_YYEMPTY}, @code{YYSYMBOL_YYerror}, or
|
||||||
|
@code{YYSYMBOL_YYUNDEF}.
|
||||||
|
|
||||||
You call the function @code{yypstate_new} to create a new parser instance.
|
Never put more than @var{argc} elements into @var{argv}, and on success
|
||||||
This function is available if either the @samp{%define api.push-pull push} or
|
return the number of tokens stored in @var{argv}. If there are more
|
||||||
@samp{%define api.push-pull both} declaration is used.
|
expected tokens than @var{argc}, fill @var{argv} up to @var{argc} and return
|
||||||
@xref{Push Decl}.
|
0. If there are no expected tokens, also return 0, but set @code{argv[0]}
|
||||||
|
to @code{YYSYMBOL_YYEMPTY}.
|
||||||
|
|
||||||
@deftypefun {yypstate*} yypstate_new (@code{void})
|
When LAC is enabled, may return a negative number on errors,
|
||||||
The function will return a valid parser instance if there was memory available
|
such as @code{YYENOMEM} on memory exhaustion.
|
||||||
or 0 if no memory was available.
|
|
||||||
In impure mode, it will also return 0 if a parser instance is currently
|
If @var{argv} is null, return the size needed to store all the possible
|
||||||
allocated.
|
values, which is always less than @code{YYNTOKENS}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@node Parser Delete Function
|
|
||||||
@section The Parser Delete Function @code{yystate_delete}
|
|
||||||
@findex yypstate_delete
|
|
||||||
|
|
||||||
You call the function @code{yypstate_delete} to delete a parser instance.
|
|
||||||
function is available if either the @samp{%define api.push-pull push} or
|
|
||||||
@samp{%define api.push-pull both} declaration is used.
|
|
||||||
@xref{Push Decl}.
|
|
||||||
|
|
||||||
@deftypefun void yypstate_delete (@code{yypstate *}@var{yyps})
|
|
||||||
This function will reclaim the memory associated with a parser instance.
|
|
||||||
After this call, you should no longer attempt to use the parser instance.
|
|
||||||
@end deftypefun
|
|
||||||
|
|
||||||
@node Lexical
|
@node Lexical
|
||||||
@section The Lexical Analyzer Function @code{yylex}
|
@section The Lexical Analyzer Function @code{yylex}
|
||||||
@@ -7551,9 +7554,12 @@ Fill @var{argv} with the expected tokens, which never includes
|
|||||||
@code{YYSYMBOL_YYUNDEF}.
|
@code{YYSYMBOL_YYUNDEF}.
|
||||||
|
|
||||||
Never put more than @var{argc} elements into @var{argv}, and on success
|
Never put more than @var{argc} elements into @var{argv}, and on success
|
||||||
return the effective number of tokens stored in @var{argv}. Return 0 if
|
return the number of tokens stored in @var{argv}. If there are more
|
||||||
there are more than @var{argc} expected tokens, yet fill @var{argv} up to
|
expected tokens than @var{argc}, fill @var{argv} up to @var{argc} and return
|
||||||
@var{argc}. When LAC is enabled, may return a negative number on errors,
|
0. If there are no expected tokens, also return 0, but set @code{argv[0]}
|
||||||
|
to @code{YYSYMBOL_YYEMPTY}.
|
||||||
|
|
||||||
|
When LAC is enabled, may return a negative number on errors,
|
||||||
such as @code{YYENOMEM} on memory exhaustion.
|
such as @code{YYENOMEM} on memory exhaustion.
|
||||||
|
|
||||||
If @var{argv} is null, return the size needed to store all the possible
|
If @var{argv} is null, return the size needed to store all the possible
|
||||||
@@ -12137,9 +12143,10 @@ Fill @var{argv} with the expected tokens, which never includes
|
|||||||
@code{symbol_kind::S_YYUNDEF}.
|
@code{symbol_kind::S_YYUNDEF}.
|
||||||
|
|
||||||
Never put more than @var{argc} elements into @var{argv}, and on success
|
Never put more than @var{argc} elements into @var{argv}, and on success
|
||||||
return the effective number of tokens stored in @var{argv}. Return 0 if
|
return the number of tokens stored in @var{argv}. If there are more
|
||||||
there are more than @var{argc} expected tokens, yet fill @var{argv} up to
|
expected tokens than @var{argc}, fill @var{argv} up to @var{argc} and return
|
||||||
@var{argc}.
|
0. If there are no expected tokens, also return 0, but set @code{argv[0]}
|
||||||
|
to @code{symbol_kind::S_YYEMPTY}.
|
||||||
|
|
||||||
If @var{argv} is null, return the size needed to store all the possible
|
If @var{argv} is null, return the size needed to store all the possible
|
||||||
values, which is always less than @code{YYNTOKENS}.
|
values, which is always less than @code{YYNTOKENS}.
|
||||||
@@ -13298,9 +13305,10 @@ Fill @var{argv} with the expected tokens, which never includes
|
|||||||
@code{SymbolKind.S_YYERROR}, or @code{SymbolKind.S_YYUNDEF}.
|
@code{SymbolKind.S_YYERROR}, or @code{SymbolKind.S_YYUNDEF}.
|
||||||
|
|
||||||
Never put more than @var{argc} elements into @var{argv}, and on success
|
Never put more than @var{argc} elements into @var{argv}, and on success
|
||||||
return the effective number of tokens stored in @var{argv}. Return 0 if
|
return the number of tokens stored in @var{argv}. If there are more
|
||||||
there are more than @var{argc} expected tokens, yet fill @var{argv} up to
|
expected tokens than @var{argc}, fill @var{argv} up to @var{argc} and return
|
||||||
@var{argc}.
|
0. If there are no expected tokens, also return 0, but set @code{argv[0]}
|
||||||
|
to @code{null}.
|
||||||
|
|
||||||
If @var{argv} is null, return the size needed to store all the possible
|
If @var{argv} is null, return the size needed to store all the possible
|
||||||
values, which is always less than @code{YYNTOKENS}.
|
values, which is always less than @code{YYNTOKENS}.
|
||||||
@@ -14781,24 +14789,26 @@ Deprecated, use @code{%printer} instead (@pxref{Printer Decl}).
|
|||||||
@deffn {Function} yypstate_delete
|
@deffn {Function} yypstate_delete
|
||||||
The function to delete a parser instance, produced by Bison in push mode;
|
The function to delete a parser instance, produced by Bison in push mode;
|
||||||
call this function to delete the memory associated with a parser.
|
call this function to delete the memory associated with a parser.
|
||||||
@xref{Parser Delete Function}. Does nothing when called with a null pointer.
|
@xref{yypstate_delete,,@code{yypstate_delete}}. Does nothing when called
|
||||||
|
with a null pointer.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Function} yypstate_new
|
@deffn {Function} yypstate_new
|
||||||
The function to create a parser instance, produced by Bison in push mode;
|
The function to create a parser instance, produced by Bison in push mode;
|
||||||
call this function to create a new parser.
|
call this function to create a new parser.
|
||||||
@xref{Parser Create Function}.
|
@xref{yypstate_new,,@code{yypstate_new}}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Function} yypull_parse
|
@deffn {Function} yypull_parse
|
||||||
The parser function produced by Bison in push mode; call this function to
|
The parser function produced by Bison in push mode; call this function to
|
||||||
parse the rest of the input stream.
|
parse the rest of the input stream.
|
||||||
@xref{Pull Parser Function}.
|
@xref{yypull_parse,,@code{yypull_parse}}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Function} yypush_parse
|
@deffn {Function} yypush_parse
|
||||||
The parser function produced by Bison in push mode; call this function to
|
The parser function produced by Bison in push mode; call this function to
|
||||||
parse a single token. @xref{Push Parser Function}.
|
parse a single token.
|
||||||
|
@xref{yypush_parse,,@code{yypush_parse}}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Macro} YYRECOVERING
|
@deffn {Macro} YYRECOVERING
|
||||||
|
|||||||
+23
-9
@@ -140,17 +140,31 @@ if ! CROSS_COMPILING
|
|||||||
MAN_DEPS = %D%/bison.help %D%/bison.x $(top_srcdir)/configure
|
MAN_DEPS = %D%/bison.help %D%/bison.x $(top_srcdir)/configure
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# If we don't have help2man, just touch the target. Maintainers must
|
||||||
|
# have the real thing, so if there's a .git directory, fail hard.
|
||||||
|
#
|
||||||
|
# We shouldn't need this, but on some OS the timestamps in the tarball
|
||||||
|
# leaves us no choice. See
|
||||||
|
# https://lists.gnu.org/r/bug-bison/2020-05/msg00055.html.
|
||||||
$(top_srcdir)/%D%/bison.1: $(MAN_DEPS)
|
$(top_srcdir)/%D%/bison.1: $(MAN_DEPS)
|
||||||
$(AM_V_GEN)$(HELP2MAN) \
|
$(AM_V_GEN)if $(HELP2MAN) --version >/dev/null 2>&1; then \
|
||||||
--include=$(top_srcdir)/%D%/bison.x \
|
$(HELP2MAN) \
|
||||||
--output=$@.tmp tests/bison
|
--include=$(top_srcdir)/%D%/bison.x \
|
||||||
$(AM_V_at)if $(remove_time_stamp) $@ >$@a.tmp 2>/dev/null && \
|
--output=$@.tmp tests/bison && \
|
||||||
$(remove_time_stamp) $@.tmp | cmp $@a.tmp - >/dev/null 2>&1; then \
|
$(remove_time_stamp) $@ >$@a.tmp 2>/dev/null && \
|
||||||
touch $@; \
|
$(remove_time_stamp) $@.tmp >$@b.tmp 2>/dev/null && \
|
||||||
else \
|
if diff $@a.tmp $@b.tmp >/dev/null 2>&1; then \
|
||||||
mv $@.tmp $@; \
|
touch $@; \
|
||||||
|
else \
|
||||||
|
mv $@.tmp $@; \
|
||||||
|
fi && \
|
||||||
|
rm -f $@*.tmp; \
|
||||||
|
elif test -d $(srcdir)/.git; then \
|
||||||
|
echo >&2 "ERROR: $@: help2man is needed"; \
|
||||||
|
exit 1; \
|
||||||
|
else \
|
||||||
|
touch $@; \
|
||||||
fi
|
fi
|
||||||
$(AM_V_at)rm -f $@*.tmp
|
|
||||||
|
|
||||||
if ENABLE_YACC
|
if ENABLE_YACC
|
||||||
nodist_man_MANS = %D%/yacc.1
|
nodist_man_MANS = %D%/yacc.1
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ namespace yy
|
|||||||
int
|
int
|
||||||
main (int argc, const char *argv[])
|
main (int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
if (2 <= argc && isdigit (*argv[1]))
|
if (2 <= argc && isdigit (static_cast<unsigned char> (*argv[1])))
|
||||||
{
|
{
|
||||||
auto maxl = strtol (argv[1], nullptr, 10);
|
auto maxl = strtol (argv[1], nullptr, 10);
|
||||||
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
|
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
|
||||||
|
|||||||
@@ -28,14 +28,26 @@
|
|||||||
#
|
#
|
||||||
# On OpenBSD 6.5 the prompt is displayed, but the input is not
|
# On OpenBSD 6.5 the prompt is displayed, but the input is not
|
||||||
# repeated (!). So input "1+2*3\n" gives "> 7\n> \n" as output.
|
# repeated (!). So input "1+2*3\n" gives "> 7\n> \n" as output.
|
||||||
|
#
|
||||||
|
# On AIX, you get some escaping sequence before the prompt:
|
||||||
|
# "<ESC>[?1034h> 1+2*3". It appears to pass the terminfo capability
|
||||||
|
# "smm", to put the terminal in "meta mode": as if the user had hit
|
||||||
|
# META.
|
||||||
|
|
||||||
if ! echo '1-1' | prog | grep '>' >/dev/null; then
|
echo >perfect '> 0
|
||||||
# macOS.
|
0
|
||||||
|
> '
|
||||||
|
|
||||||
|
echo >ok '0'
|
||||||
|
echo '0' | prog >effective
|
||||||
|
|
||||||
|
if diff perfect effective >/dev/null 2>&1; then
|
||||||
|
# Alles ist gut.
|
||||||
|
strip_prompt=false
|
||||||
|
elif diff ok effective >/dev/null 2>&1; then
|
||||||
strip_prompt=true
|
strip_prompt=true
|
||||||
elif ! echo '1-1' | prog | grep '1-1' >/dev/null; then
|
else
|
||||||
# OpenBSD 6.5. I don't want to spend time on this.
|
skip "this is not the GNU Readline we expect"
|
||||||
echo "SKIP: this is not the GNU Readline we expect"
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -84,7 +96,7 @@ cat >input <<EOF
|
|||||||
EOF
|
EOF
|
||||||
run 0 '> *
|
run 0 '> *
|
||||||
> ''
|
> ''
|
||||||
err: 1.1: syntax error: expected end of file or - or ( or exit or number or function or variable before *'
|
err: 1.1: syntax error: expected end of file or - or ( or exit or number or function etc., before *'
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1 + 2 * * 3
|
1 + 2 * * 3
|
||||||
|
|||||||
@@ -19,19 +19,22 @@ bistromathicdir = $(docdir)/%D%
|
|||||||
## Bistromathics. ##
|
## Bistromathics. ##
|
||||||
## --------------- ##
|
## --------------- ##
|
||||||
|
|
||||||
check_PROGRAMS += %D%/bistromathic
|
|
||||||
TESTS += %D%/bistromathic.test
|
|
||||||
EXTRA_DIST += %D%/bistromathic.test
|
|
||||||
nodist_%C%_bistromathic_SOURCES = %D%/parse.y %D%/parse.h
|
|
||||||
%D%/parse.c: $(dependencies)
|
%D%/parse.c: $(dependencies)
|
||||||
|
|
||||||
# Don't use gnulib's system headers.
|
if ENABLE_BISTROMATHIC
|
||||||
%C%_bistromathic_CPPFLAGS = \
|
check_PROGRAMS += %D%/bistromathic
|
||||||
-DBISON_LOCALEDIR='"$(localdir)"' \
|
TESTS += %D%/bistromathic.test
|
||||||
-DLOCALEDIR='"$(localdir)"' \
|
nodist_%C%_bistromathic_SOURCES = %D%/parse.y
|
||||||
-I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
|
||||||
%C%_bistromathic_LDADD = -lm -lreadline $(LIBINTL)
|
|
||||||
|
|
||||||
|
# Don't use gnulib's system headers.
|
||||||
|
%C%_bistromathic_CPPFLAGS = \
|
||||||
|
-DBISON_LOCALEDIR='"$(localdir)"' \
|
||||||
|
-DLOCALEDIR='"$(localdir)"' \
|
||||||
|
-I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_bistromathic_LDADD = -lm $(LIBREADLINE) $(LIBINTL)
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_DIST += %D%/bistromathic.test
|
||||||
dist_bistromathic_DATA = %D%/parse.y %D%/Makefile %D%/README.md
|
dist_bistromathic_DATA = %D%/parse.y %D%/Makefile %D%/README.md
|
||||||
CLEANFILES += %D%/parse.[ch] %D%/parse.output
|
CLEANFILES += %D%/parse.[ch] %D%/parse.output
|
||||||
CLEANDIRS += %D%/*.dSYM
|
CLEANDIRS += %D%/*.dSYM
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
%require "3.6"
|
%require "3.6"
|
||||||
|
|
||||||
%code top {
|
%code top {
|
||||||
|
#include <assert.h>
|
||||||
#include <ctype.h> // isdigit
|
#include <ctype.h> // isdigit
|
||||||
#include <locale.h> // LC_ALL
|
#include <locale.h> // LC_ALL
|
||||||
#include <math.h> // cos, sin, etc.
|
#include <math.h> // cos, sin, etc.
|
||||||
@@ -316,7 +317,7 @@ error_format_string (int argc)
|
|||||||
{
|
{
|
||||||
switch (argc)
|
switch (argc)
|
||||||
{
|
{
|
||||||
default: /* Avoid compiler warnings. */
|
default: // Avoid compiler warnings.
|
||||||
case 0: return _("%@: syntax error");
|
case 0: return _("%@: syntax error");
|
||||||
case 1: return _("%@: syntax error: unexpected %u");
|
case 1: return _("%@: syntax error: unexpected %u");
|
||||||
// TRANSLATORS: '%@' is a location in a file, '%u' is an
|
// TRANSLATORS: '%@' is a location in a file, '%u' is an
|
||||||
@@ -332,7 +333,7 @@ error_format_string (int argc)
|
|||||||
case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
|
case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
|
||||||
case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
|
case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
|
||||||
case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
|
case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
|
||||||
case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e or %6e before %u");
|
case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e etc., before %u");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,12 +341,15 @@ error_format_string (int argc)
|
|||||||
int
|
int
|
||||||
yyreport_syntax_error (const yypcontext_t *ctx)
|
yyreport_syntax_error (const yypcontext_t *ctx)
|
||||||
{
|
{
|
||||||
enum { ARGS_MAX = 7 };
|
enum { ARGS_MAX = 6 };
|
||||||
yysymbol_kind_t arg[ARGS_MAX];
|
yysymbol_kind_t arg[ARGS_MAX];
|
||||||
int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX);
|
int argsize = yypcontext_expected_tokens (ctx, arg, ARGS_MAX);
|
||||||
if (argsize < 0)
|
if (argsize < 0)
|
||||||
return argsize;
|
return argsize;
|
||||||
const char *format = error_format_string (1 + argsize);
|
const int too_many_expected_tokens = argsize == 0 && arg[0] != YYSYMBOL_YYEMPTY;
|
||||||
|
if (too_many_expected_tokens)
|
||||||
|
argsize = ARGS_MAX;
|
||||||
|
const char *format = error_format_string (1 + argsize + too_many_expected_tokens);
|
||||||
|
|
||||||
while (*format)
|
while (*format)
|
||||||
// %@: location.
|
// %@: location.
|
||||||
@@ -362,7 +366,7 @@ yyreport_syntax_error (const yypcontext_t *ctx)
|
|||||||
}
|
}
|
||||||
// %0e, %1e...: expected token.
|
// %0e, %1e...: expected token.
|
||||||
else if (format[0] == '%'
|
else if (format[0] == '%'
|
||||||
&& isdigit (format[1])
|
&& isdigit ((unsigned char) format[1])
|
||||||
&& format[2] == 'e'
|
&& format[2] == 'e'
|
||||||
&& (format[1] - '0') < argsize)
|
&& (format[1] - '0') < argsize)
|
||||||
{
|
{
|
||||||
@@ -393,6 +397,22 @@ void yyerror (YYLTYPE *loc, char const *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Return a newly allocated copy of at most N bytes of STRING. In
|
||||||
|
// other words, return a copy of the initial segment of length N of
|
||||||
|
// STRING.
|
||||||
|
static char *
|
||||||
|
xstrndup (const char *string, size_t n)
|
||||||
|
{
|
||||||
|
// len = strnlen (string, n), portably.
|
||||||
|
const char *end = memchr (string, '\0', n);
|
||||||
|
size_t len = end ? (size_t) (end - string) : n;
|
||||||
|
char *new = malloc (len + 1);
|
||||||
|
assert (new);
|
||||||
|
new[len] = '\0';
|
||||||
|
return memcpy (new, string, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-----------.
|
/*-----------.
|
||||||
| Readline. |
|
| Readline. |
|
||||||
`-----------*/
|
`-----------*/
|
||||||
@@ -438,11 +458,11 @@ expected_tokens (const char *input,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attempt to complete on the contents of TEXT. START and END bound the
|
// Attempt to complete on the contents of TEXT. START and END bound
|
||||||
region of rl_line_buffer that contains the word to complete. TEXT is
|
// the region of rl_line_buffer that contains the word to complete.
|
||||||
the word to complete. We can use the entire contents of rl_line_buffer
|
// TEXT is the word to complete. We can use the entire contents of
|
||||||
in case we want to do some simple parsing. Return the array of matches,
|
// rl_line_buffer in case we want to do some simple parsing. Return
|
||||||
or NULL if there aren't any. */
|
// the array of matches, or NULL if there aren't any.
|
||||||
char **
|
char **
|
||||||
completion (const char *text, int start, int end)
|
completion (const char *text, int start, int end)
|
||||||
{
|
{
|
||||||
@@ -453,7 +473,7 @@ completion (const char *text, int start, int end)
|
|||||||
|
|
||||||
// Get list of token numbers.
|
// Get list of token numbers.
|
||||||
int tokens[YYNTOKENS];
|
int tokens[YYNTOKENS];
|
||||||
char *line = strndup (rl_line_buffer, start);
|
char *line = xstrndup (rl_line_buffer, start);
|
||||||
int ntokens = expected_tokens (line, tokens, YYNTOKENS);
|
int ntokens = expected_tokens (line, tokens, YYNTOKENS);
|
||||||
free (line);
|
free (line);
|
||||||
|
|
||||||
@@ -495,7 +515,7 @@ completion (const char *text, int start, int end)
|
|||||||
for (int j = 0; j < lcplen; ++j)
|
for (int j = 0; j < lcplen; ++j)
|
||||||
if (matches[1][j] != matches[i][j])
|
if (matches[1][j] != matches[i][j])
|
||||||
lcplen = j;
|
lcplen = j;
|
||||||
matches[0] = strndup (matches[1], lcplen);
|
matches[0] = xstrndup (matches[1], lcplen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
seq 0 >/dev/null || exit 77
|
(seq 0) >/dev/null 2>&1 || skip "gimme one seq"
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1+2*3
|
1+2*3
|
||||||
|
|||||||
+21
-7
@@ -25,7 +25,7 @@ medir=$(dirname "$1" | sed -e 's,.*examples/,,')
|
|||||||
number=1
|
number=1
|
||||||
|
|
||||||
# Exit status of this script.
|
# Exit status of this script.
|
||||||
exit=true
|
status=0
|
||||||
|
|
||||||
# top_builddir.
|
# top_builddir.
|
||||||
cwd=$(pwd)
|
cwd=$(pwd)
|
||||||
@@ -68,6 +68,20 @@ trap cleanup 0 1 2 13 15
|
|||||||
mkdir $$.dir
|
mkdir $$.dir
|
||||||
cd $$.dir
|
cd $$.dir
|
||||||
|
|
||||||
|
|
||||||
|
# skip [MSG]
|
||||||
|
# ----------
|
||||||
|
# Skip this test.
|
||||||
|
skip ()
|
||||||
|
{
|
||||||
|
if test x"$1" != x; then
|
||||||
|
echo "SKIP: $1"
|
||||||
|
fi
|
||||||
|
# See Autoconf's doc on 'trap'.
|
||||||
|
(exit 77); exit 77
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# run [-noerr, -n] EXPECTED-EXIT-STATUS EXPECTED-OUTPUT [PARSER-OPTIONS]
|
# run [-noerr, -n] EXPECTED-EXIT-STATUS EXPECTED-OUTPUT [PARSER-OPTIONS]
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# -noerr: ignore stderr, otherwise merge it into effective output.
|
# -noerr: ignore stderr, otherwise merge it into effective output.
|
||||||
@@ -115,7 +129,7 @@ run ()
|
|||||||
} >eff
|
} >eff
|
||||||
|
|
||||||
if test $sta_eff -eq $sta_exp; then
|
if test $sta_eff -eq $sta_exp; then
|
||||||
if cmp eff exp 2>/dev/null; then
|
if diff eff exp >/dev/null 2>&1; then
|
||||||
echo "$me: PASS: $number"
|
echo "$me: PASS: $number"
|
||||||
else
|
else
|
||||||
echo "$me: FAIL: $number"
|
echo "$me: FAIL: $number"
|
||||||
@@ -127,20 +141,20 @@ run ()
|
|||||||
sed -e 's/^/ /' eff
|
sed -e 's/^/ /' eff
|
||||||
echo "$me: diff:"
|
echo "$me: diff:"
|
||||||
diff -u exp eff | sed -e 's/^/ /'
|
diff -u exp eff | sed -e 's/^/ /'
|
||||||
exit=false
|
status=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "$me: FAIL: $number (expected status: $sta_exp, effective: $sta_eff)"
|
echo "$me: FAIL: $number (expected status: $sta_exp, effective: $sta_eff)"
|
||||||
cat err_eff
|
cat err_eff
|
||||||
exit=false
|
status=1
|
||||||
fi
|
fi
|
||||||
number=$(expr $number + 1)
|
number=$(expr $number + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
# We have cd'd one level deeper.
|
# We have cd'd one level deeper.
|
||||||
case $1 in
|
case $1 in
|
||||||
/*) . "$1";;
|
/*) . "$1" || status=2;;
|
||||||
*) . "../$1";;
|
*) . "../$1" || status=2;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
$exit
|
exit $status
|
||||||
|
|||||||
+1
-1
Submodule gnulib updated: 3db0ae5f4f...2ac33b29fc
+2
-2
@@ -23,7 +23,7 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#include <argmatch.h>
|
#include <argmatch.h>
|
||||||
#include <ctype.h>
|
#include <c-ctype.h>
|
||||||
#include <progname.h>
|
#include <progname.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -609,7 +609,7 @@ syntax_error (location loc,
|
|||||||
|
|
||||||
while (*format)
|
while (*format)
|
||||||
if (format[0] == '%'
|
if (format[0] == '%'
|
||||||
&& isdigit (format[1])
|
&& c_isdigit (format[1])
|
||||||
&& format[2] == '$'
|
&& format[2] == '$'
|
||||||
&& format[3] == 's'
|
&& format[3] == 's'
|
||||||
&& (format[1] - '0') < argc)
|
&& (format[1] - '0') < argc)
|
||||||
|
|||||||
+3
-2
@@ -124,10 +124,11 @@ fixits_run (void)
|
|||||||
FILE *out = xfopen (input, "w");
|
FILE *out = xfopen (input, "w");
|
||||||
size_t line = 1;
|
size_t line = 1;
|
||||||
size_t offset = 1;
|
size_t offset = 1;
|
||||||
fixit const *f = NULL;
|
void const *p = NULL;
|
||||||
gl_list_iterator_t iter = gl_list_iterator (fixits);
|
gl_list_iterator_t iter = gl_list_iterator (fixits);
|
||||||
while (gl_list_iterator_next (&iter, (const void**) &f, NULL))
|
while (gl_list_iterator_next (&iter, &p, NULL))
|
||||||
{
|
{
|
||||||
|
fixit const *f = p;
|
||||||
/* Look for the correct line. */
|
/* Look for the correct line. */
|
||||||
while (line < f->location.start.line)
|
while (line < f->location.start.line)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -92,7 +92,7 @@ goto_print (goto_number i, FILE *out)
|
|||||||
const state_number dst = to_state[i];
|
const state_number dst = to_state[i];
|
||||||
symbol_number var = states[dst]->accessing_symbol;
|
symbol_number var = states[dst]->accessing_symbol;
|
||||||
fprintf (out,
|
fprintf (out,
|
||||||
"goto[%ld] = (%d, %s, %d)", i, src, symbols[var]->tag, dst);
|
"goto[%zu] = (%d, %s, %d)", i, src, symbols[var]->tag, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
+2
-2
@@ -117,6 +117,7 @@ BUILT_SOURCES += \
|
|||||||
# definition of libbison, beware that they might expand as flags such as
|
# definition of libbison, beware that they might expand as flags such as
|
||||||
# `-lm`. Keep them here. Or use a Libtool convenience library.
|
# `-lm`. Keep them here. Or use a Libtool convenience library.
|
||||||
src_bison_LDADD = \
|
src_bison_LDADD = \
|
||||||
|
lib/libbison.a \
|
||||||
$(ISNAND_LIBM) \
|
$(ISNAND_LIBM) \
|
||||||
$(ISNANF_LIBM) \
|
$(ISNANF_LIBM) \
|
||||||
$(ISNANL_LIBM) \
|
$(ISNANL_LIBM) \
|
||||||
@@ -126,8 +127,7 @@ src_bison_LDADD = \
|
|||||||
$(LIBTHREAD) \
|
$(LIBTHREAD) \
|
||||||
$(LIB_CLOCK_GETTIME) \
|
$(LIB_CLOCK_GETTIME) \
|
||||||
$(LIB_GETHRXTIME) \
|
$(LIB_GETHRXTIME) \
|
||||||
$(LIBTEXTSTYLE) \
|
$(LIBTEXTSTYLE)
|
||||||
lib/libbison.a
|
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST += %D%/i18n-strings.c
|
EXTRA_DIST += %D%/i18n-strings.c
|
||||||
|
|||||||
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.5.91. */
|
/* A Bison parser, made by GNU Bison 3.5.93. */
|
||||||
|
|
||||||
/* Bison implementation for Yacc-like parsers in C
|
/* Bison implementation for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version. */
|
||||||
#define YYBISON_VERSION "3.5.91"
|
#define YYBISON_VERSION "3.5.93"
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
@@ -408,6 +408,7 @@ typedef int yytype_uint16;
|
|||||||
|
|
||||||
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
|
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
|
||||||
|
|
||||||
|
|
||||||
/* Stored state numbers (used for stacks). */
|
/* Stored state numbers (used for stacks). */
|
||||||
typedef yytype_uint8 yy_state_t;
|
typedef yytype_uint8 yy_state_t;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.5.91. */
|
/* A Bison parser, made by GNU Bison 3.5.93. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
|
|||||||
@@ -144,3 +144,44 @@ export LC_CTYPE
|
|||||||
|
|
||||||
# Empty if no xsltproc was found
|
# Empty if no xsltproc was found
|
||||||
: ${XSLTPROC='@XSLTPROC@'}
|
: ${XSLTPROC='@XSLTPROC@'}
|
||||||
|
|
||||||
|
|
||||||
|
# Some tests expect a precise diff format. See AT_DIFF_U_CHECK.
|
||||||
|
# See https://lists.gnu.org/r/bug-bison/2020-05/msg00049.html.
|
||||||
|
cat >conftest.1 <<EOF
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >conftest.2 <<EOF
|
||||||
|
1
|
||||||
|
22
|
||||||
|
3
|
||||||
|
4
|
||||||
|
55
|
||||||
|
6
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >conftest.expected <<EOF
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
1
|
||||||
|
-2
|
||||||
|
+22
|
||||||
|
3
|
||||||
|
4
|
||||||
|
-5
|
||||||
|
+55
|
||||||
|
6
|
||||||
|
EOF
|
||||||
|
|
||||||
|
diff -u conftest.1 conftest.2 2>/dev/null | sed -n '/^@@/,$p' | sed 's/^ $//' >conftest.diff
|
||||||
|
if diff conftest.expected conftest.diff >/dev/null; then
|
||||||
|
DIFF_U_WORKS=true
|
||||||
|
else
|
||||||
|
DIFF_U_WORKS=false
|
||||||
|
fi
|
||||||
|
rm conftest.*
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ AT_BANNER([[Diagnostics.]])
|
|||||||
|
|
||||||
|
|
||||||
# AT_TEST($1: TITLE, $2: GRAMMAR, $3: EXIT-STATUS, $4: OUTPUT-WITH-STYLE,
|
# AT_TEST($1: TITLE, $2: GRAMMAR, $3: EXIT-STATUS, $4: OUTPUT-WITH-STYLE,
|
||||||
# $5: EXTRA_ENV
|
# $5: EXTRA_ENV, $6: SKIP-IF)
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
# Run Bison on GRAMMAR with debugging style enabled, and expect
|
# Run Bison on GRAMMAR with debugging style enabled, and expect
|
||||||
# OUTPUT-WITH-STYLE as diagnostics.
|
# OUTPUT-WITH-STYLE as diagnostics.
|
||||||
@@ -33,6 +33,9 @@ AT_KEYWORDS([diagnostics])
|
|||||||
locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q`
|
locale=`locale -a | $EGREP '^en_US\.(UTF-8|utf8)$' | sed 1q`
|
||||||
AT_SKIP_IF([test x == x"$locale"])
|
AT_SKIP_IF([test x == x"$locale"])
|
||||||
|
|
||||||
|
m4_ifval([$6],
|
||||||
|
[AT_SKIP_IF([$6])])
|
||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([[input.y]], [$2])
|
AT_DATA_GRAMMAR([[input.y]], [$2])
|
||||||
@@ -261,11 +264,10 @@ input.y:17.4-17: <warning>warning:</warning> empty rule without %empty [<warning
|
|||||||
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# Likewise, but currently not portable to Cygwin.
|
|
||||||
|
# Likewise, but currently not portable to AIX and Cygwin.
|
||||||
|
# https://lists.gnu.org/r/bug-bison/2020-05/msg00050.html
|
||||||
# https://lists.gnu.org/r/bug-bison/2020-05/msg00003.html.
|
# https://lists.gnu.org/r/bug-bison/2020-05/msg00003.html.
|
||||||
case `uname -a` in
|
|
||||||
(CYGWIN*);;
|
|
||||||
(*)
|
|
||||||
AT_TEST([[Tabulations and multibyte characters]],
|
AT_TEST([[Tabulations and multibyte characters]],
|
||||||
[[%%
|
[[%%
|
||||||
e: {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}
|
e: {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}
|
||||||
@@ -276,9 +278,7 @@ e: {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}
|
|||||||
| <warning>^~~~~~~~~~~~~~</warning>
|
| <warning>^~~~~~~~~~~~~~</warning>
|
||||||
| <fixit-insert>%empty</fixit-insert>
|
| <fixit-insert>%empty</fixit-insert>
|
||||||
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
||||||
]])
|
]], [], [uname -a | $EGREP -i 'aix|cygwin'])
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
## --------------- ##
|
## --------------- ##
|
||||||
|
|||||||
+2
-7
@@ -35,14 +35,9 @@ dnl time comes, just use sed to drop the line numbers. For now, as LR(1)
|
|||||||
dnl support is rapidly evolving, let's keep that information to be careful.
|
dnl support is rapidly evolving, let's keep that information to be careful.
|
||||||
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
|
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
|
||||||
m4_pushdef([AT_LALR1_DIFF_CHECK],
|
m4_pushdef([AT_LALR1_DIFF_CHECK],
|
||||||
[dnl We need diff -u, which is not portable.
|
[AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
|
||||||
AT_CHECK([diff -u /dev/null /dev/null || exit 77], [0], [ignore])
|
|
||||||
|
|
||||||
AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
|
|
||||||
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
|
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
|
||||||
AT_CHECK([[diff -u input-lalr.output input.output \
|
AT_DIFF_U_CHECK([[input-lalr.output input.output]], [$1])])
|
||||||
| sed -n '/^@@/,$p' | sed 's/^ $//']],
|
|
||||||
[[0]], [$1])])
|
|
||||||
|
|
||||||
AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
|
AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
|
||||||
[[%define lr.type lalr
|
[[%define lr.type lalr
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ set x `LC_ALL=C ls -l '$1'` &&
|
|||||||
## ------------- ##
|
## ------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# AT_DIFF_U_CHECK(DIFF-ARGS, EXPECTED-DIFF)
|
||||||
|
# -----------------------------------------
|
||||||
|
# If diff -u works as we expect, use it, with headers stripped.
|
||||||
|
m4_define([AT_DIFF_U_CHECK],
|
||||||
|
[if $DIFF_U_WORKS; then
|
||||||
|
AT_CHECK([diff -u $1 | sed -n '/^@@/,$p' | sed 's/^ $//'], [0], [$2])
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# AT_PERL_CHECK(PERL-ARGS, ...)
|
# AT_PERL_CHECK(PERL-ARGS, ...)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# If Perl is available, run this test.
|
# If Perl is available, run this test.
|
||||||
|
|||||||
Reference in New Issue
Block a user