mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-15 13:45:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0535d2a608 | ||
|
|
52ce2a008b | ||
|
|
12f4091de4 | ||
|
|
8ece778cb8 | ||
|
|
f80890c4bb | ||
|
|
1ebc2ac55c | ||
|
|
94952779b6 | ||
|
|
4d9fa28ba8 |
+1
-1
@@ -1 +1 @@
|
|||||||
3.6.1
|
3.6.2
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.6.3 (2020-06-03) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Incorrect comments in the generated parsers.
|
||||||
|
|
||||||
|
Warnings in push parsers (yacc.c).
|
||||||
|
|
||||||
|
Incorrect display of gotos in LAC traces (lalr1.cc).
|
||||||
|
|
||||||
* Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
|
* Noteworthy changes in release 3.6.2 (2020-05-17) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ Quoc Peyrot [email protected]
|
|||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
|
Ryan [email protected]
|
||||||
Rich Wilson [email protected]
|
Rich Wilson [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
Rici Lake [email protected]
|
Rici Lake [email protected]
|
||||||
|
|||||||
+3
-1
@@ -135,7 +135,9 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
-Wpointer-arith -Wshadow
|
-Wpointer-arith -Wshadow
|
||||||
-Wwrite-strings
|
-Wwrite-strings
|
||||||
-wr188 -wr2259 -wr3179'
|
-wr188 -wr2259 -wr3179'
|
||||||
warn_c='-Wbad-function-cast -Wstrict-prototypes'
|
warn_c='-Wbad-function-cast
|
||||||
|
-Wmissing-prototypes
|
||||||
|
-Wstrict-prototypes'
|
||||||
warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template
|
warn_cxx='-Wextra-semi -Wnoexcept -Wold-style-cast -Wundefined-func-template
|
||||||
-Wweak-vtables'
|
-Wweak-vtables'
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ dist_skeletons_DATA = \
|
|||||||
data/skeletons/lalr1.java \
|
data/skeletons/lalr1.java \
|
||||||
data/skeletons/location.cc \
|
data/skeletons/location.cc \
|
||||||
data/skeletons/stack.hh \
|
data/skeletons/stack.hh \
|
||||||
|
data/skeletons/traceon.m4 \
|
||||||
data/skeletons/variant.hh \
|
data/skeletons/variant.hh \
|
||||||
data/skeletons/yacc.c
|
data/skeletons/yacc.c
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,27 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# m4_gsub(STRING, RE1, SUBST1, RE2, SUBST2, ...)
|
||||||
|
# ----------------------------------------------
|
||||||
|
# m4 equivalent of
|
||||||
|
#
|
||||||
|
# $_ = STRING;
|
||||||
|
# s/RE1/SUBST1/g;
|
||||||
|
# s/RE2/SUBST2/g;
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# Really similar to m4_bpatsubsts, but behaves properly with quotes.
|
||||||
|
# See m4.at's "Generating Comments". Super inelegant, but so far, I
|
||||||
|
# did not find any better solution.
|
||||||
|
m4_define([b4_gsub],
|
||||||
|
[m4_bpatsubst(m4_bpatsubst(m4_bpatsubst([[[[$1]]]],
|
||||||
|
[$2], [$3]),
|
||||||
|
[$4], [$5]),
|
||||||
|
[$6], [$7])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|||||||
@@ -17,6 +17,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/>.
|
||||||
|
|
||||||
|
|
||||||
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
# _b4_comment(TEXT, OPEN, CONTINUE, END)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
||||||
@@ -27,9 +28,10 @@
|
|||||||
#
|
#
|
||||||
# Prefix all the output lines with PREFIX.
|
# Prefix all the output lines with PREFIX.
|
||||||
m4_define([_b4_comment],
|
m4_define([_b4_comment],
|
||||||
[$2[]m4_bpatsubsts(m4_expand([$1]),
|
[$2[]b4_gsub(m4_expand([$1]),
|
||||||
[[*]/], [*\\/],
|
[[*]/], [*\\/],
|
||||||
[/[*]], [/\\*], [
|
[/[*]], [/\\*],
|
||||||
|
[
|
||||||
\(.\)], [
|
\(.\)], [
|
||||||
$3\1])$4])
|
$3\1])$4])
|
||||||
|
|
||||||
|
|||||||
@@ -1411,7 +1411,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
: yylac_stack_.back ());
|
: yylac_stack_.back ());
|
||||||
// Push the resulting state of the reduction.
|
// Push the resulting state of the reduction.
|
||||||
state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
|
state_type state = yy_lr_goto_state_ (top_state, yyr1_[yyrule]);
|
||||||
YYCDEBUG << " G" << state;
|
YYCDEBUG << " G" << int (state);
|
||||||
yylac_stack_.push_back (state);
|
yylac_stack_.push_back (state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dnl GNU M4 treats -dV in a position-independent manner.
|
||||||
|
m4_debugmode(V)m4_traceon()dnl
|
||||||
@@ -1480,7 +1480,7 @@ yypull_parse (yypstate *yyps]b4_user_formals[)
|
|||||||
]b4_parse_state_variable_macros([b4_pstate_macro_define])[
|
]b4_parse_state_variable_macros([b4_pstate_macro_define])[
|
||||||
|
|
||||||
/* Initialize the parser data structure. */
|
/* Initialize the parser data structure. */
|
||||||
void
|
static void
|
||||||
yypstate_clear (yypstate *yyps)
|
yypstate_clear (yypstate *yyps)
|
||||||
{
|
{
|
||||||
]b4_initialize_parser_state_variables[
|
]b4_initialize_parser_state_variables[
|
||||||
|
|||||||
+9
-5
@@ -1879,6 +1879,7 @@ Here is the code for the lexical analyzer:
|
|||||||
and tabs, and returns 0 for end-of-input. */
|
and tabs, and returns 0 for end-of-input. */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@group
|
@group
|
||||||
@@ -1895,7 +1896,8 @@ yylex (void)
|
|||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
@{
|
@{
|
||||||
ungetc (c, stdin);
|
ungetc (c, stdin);
|
||||||
scanf ("%lf", &yylval);
|
if (scanf ("%lf", &yylval) != 1)
|
||||||
|
abort ();
|
||||||
return NUM;
|
return NUM;
|
||||||
@}
|
@}
|
||||||
@end group
|
@end group
|
||||||
@@ -2728,7 +2730,8 @@ yylex (void)
|
|||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
@{
|
@{
|
||||||
ungetc (c, stdin);
|
ungetc (c, stdin);
|
||||||
scanf ("%lf", &yylval.NUM);
|
if (scanf ("%lf", &yylval.NUM) != 1)
|
||||||
|
abort ();
|
||||||
return NUM;
|
return NUM;
|
||||||
@}
|
@}
|
||||||
@end group
|
@end group
|
||||||
@@ -2755,10 +2758,10 @@ Bison generated a definition of @code{YYSTYPE} with a member named
|
|||||||
if (bufsize <= i)
|
if (bufsize <= i)
|
||||||
@{
|
@{
|
||||||
bufsize = 2 * bufsize + 40;
|
bufsize = 2 * bufsize + 40;
|
||||||
symbuf = realloc (symbuf, bufsize);
|
symbuf = realloc (symbuf, (size_t) bufsize);
|
||||||
@}
|
@}
|
||||||
/* Add this character to the buffer. */
|
/* Add this character to the buffer. */
|
||||||
symbuf[i++] = c;
|
symbuf[i++] = (char) c;
|
||||||
/* Get another character. */
|
/* Get another character. */
|
||||||
c = getchar ();
|
c = getchar ();
|
||||||
@}
|
@}
|
||||||
@@ -10629,7 +10632,7 @@ when there were errors. No file was generated (except the reports generated
|
|||||||
by @option{--verbose}, etc.). In particular, the output files that possibly
|
by @option{--verbose}, etc.). In particular, the output files that possibly
|
||||||
existed were not changed.
|
existed were not changed.
|
||||||
|
|
||||||
@item 63 (mistmatch)
|
@item 63 (mismatch)
|
||||||
when @command{bison} does not meet the version requirements of the grammar
|
when @command{bison} does not meet the version requirements of the grammar
|
||||||
file. @xref{Require Decl}. No file was generated or changed.
|
file. @xref{Require Decl}. No file was generated or changed.
|
||||||
@end table
|
@end table
|
||||||
@@ -15269,6 +15272,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
|
|||||||
@c LocalWords: YYUNDEF SymbolKind yypcontext YYENOMEM TOKENMAX getBundle
|
@c LocalWords: YYUNDEF SymbolKind yypcontext YYENOMEM TOKENMAX getBundle
|
||||||
@c LocalWords: ResourceBundle myResources getString getName getToken
|
@c LocalWords: ResourceBundle myResources getString getName getToken
|
||||||
@c LocalWords: getLocation getExpectedTokens reportSyntaxError bistromathic
|
@c LocalWords: getLocation getExpectedTokens reportSyntaxError bistromathic
|
||||||
|
@c LocalWords: TokenKind
|
||||||
|
|
||||||
@c Local Variables:
|
@c Local Variables:
|
||||||
@c ispell-dictionary: "american"
|
@c ispell-dictionary: "american"
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ echo >perfect '> 0
|
|||||||
echo >ok '0'
|
echo >ok '0'
|
||||||
echo '0' | prog >effective
|
echo '0' | prog >effective
|
||||||
|
|
||||||
echo "checking for readline output"
|
echo "checking for readline output..."
|
||||||
if diff perfect effective; then
|
if diff perfect effective; then
|
||||||
# Alles ist gut.
|
# Alles ist gut.
|
||||||
strip_prompt=false
|
strip_prompt=false
|
||||||
@@ -269,8 +269,8 @@ fi
|
|||||||
# On Windows10/MSYS2 the ^G coming from <tab> completion is not
|
# On Windows10/MSYS2 the ^G coming from <tab> completion is not
|
||||||
# emitted the same way
|
# emitted the same way
|
||||||
# (https://lists.gnu.org/r/bug-bison/2020-05/msg00076.html).
|
# (https://lists.gnu.org/r/bug-bison/2020-05/msg00076.html).
|
||||||
echo "checking for kernel name"
|
echo "checking for kernel name... $(uname -s)"
|
||||||
case `uname -s` in
|
case $(uname -s) in
|
||||||
(MSYS*)
|
(MSYS*)
|
||||||
echo "SKIP: this is Windows/MSYS"
|
echo "SKIP: this is Windows/MSYS"
|
||||||
exit $status
|
exit $status
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ if ENABLE_BISTROMATHIC
|
|||||||
-DBISON_LOCALEDIR='"$(localdir)"' \
|
-DBISON_LOCALEDIR='"$(localdir)"' \
|
||||||
-DLOCALEDIR='"$(localdir)"' \
|
-DLOCALEDIR='"$(localdir)"' \
|
||||||
-I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
-I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_bistromathic_CFLAGS = $(TEST_CFLAGS)
|
||||||
%C%_bistromathic_LDADD = -lm $(LIBREADLINE) $(LIBINTL)
|
%C%_bistromathic_LDADD = -lm $(LIBREADLINE) $(LIBINTL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
%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.
|
||||||
@@ -218,7 +217,7 @@ getsym (char const *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// How many symbols are registered.
|
// How many symbols are registered.
|
||||||
int
|
static int
|
||||||
symbol_count (void)
|
symbol_count (void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@@ -312,7 +311,7 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
`---------*/
|
`---------*/
|
||||||
|
|
||||||
|
|
||||||
const char *
|
static const char *
|
||||||
error_format_string (int argc)
|
error_format_string (int argc)
|
||||||
{
|
{
|
||||||
switch (argc)
|
switch (argc)
|
||||||
@@ -407,7 +406,8 @@ xstrndup (const char *string, size_t n)
|
|||||||
const char *end = memchr (string, '\0', n);
|
const char *end = memchr (string, '\0', n);
|
||||||
size_t len = end ? (size_t) (end - string) : n;
|
size_t len = end ? (size_t) (end - string) : n;
|
||||||
char *new = malloc (len + 1);
|
char *new = malloc (len + 1);
|
||||||
assert (new);
|
if (!new)
|
||||||
|
abort ();
|
||||||
new[len] = '\0';
|
new[len] = '\0';
|
||||||
return memcpy (new, string, len);
|
return memcpy (new, string, len);
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,8 @@ xstrndup (const char *string, size_t n)
|
|||||||
`-----------*/
|
`-----------*/
|
||||||
|
|
||||||
// Parse (and execute) this line.
|
// Parse (and execute) this line.
|
||||||
int process_line (YYLTYPE *lloc, const char *line)
|
static int
|
||||||
|
process_line (YYLTYPE *lloc, const char *line)
|
||||||
{
|
{
|
||||||
yypstate *ps = yypstate_new ();
|
yypstate *ps = yypstate_new ();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
@@ -433,7 +434,8 @@ int process_line (YYLTYPE *lloc, const char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the list of possible tokens after INPUT was read.
|
// Get the list of possible tokens after INPUT was read.
|
||||||
int
|
// Returns a nonnegative.
|
||||||
|
static int
|
||||||
expected_tokens (const char *input,
|
expected_tokens (const char *input,
|
||||||
int *tokens, int ntokens)
|
int *tokens, int ntokens)
|
||||||
{
|
{
|
||||||
@@ -454,6 +456,8 @@ expected_tokens (const char *input,
|
|||||||
|
|
||||||
// Then query for the accepted tokens at this point.
|
// Then query for the accepted tokens at this point.
|
||||||
int res = yypstate_expected_tokens (ps, tokens, ntokens);
|
int res = yypstate_expected_tokens (ps, tokens, ntokens);
|
||||||
|
if (res < 0)
|
||||||
|
abort ();
|
||||||
yypstate_delete (ps);
|
yypstate_delete (ps);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -463,7 +467,7 @@ expected_tokens (const char *input,
|
|||||||
// TEXT is the word to complete. We can use the entire contents of
|
// TEXT is the word to complete. We can use the entire contents of
|
||||||
// rl_line_buffer in case we want to do some simple parsing. Return
|
// rl_line_buffer in case we want to do some simple parsing. Return
|
||||||
// the array of matches, or NULL if there aren't any.
|
// the array of matches, or NULL if there aren't any.
|
||||||
char **
|
static char **
|
||||||
completion (const char *text, int start, int end)
|
completion (const char *text, int start, int end)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "completion (\"%.*s[%.*s]%s\")\n",
|
YYDPRINTF ((stderr, "completion (\"%.*s[%.*s]%s\")\n",
|
||||||
@@ -473,14 +477,17 @@ 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 = xstrndup (rl_line_buffer, start);
|
char *line = xstrndup (rl_line_buffer, (size_t) start);
|
||||||
int ntokens = expected_tokens (line, tokens, YYNTOKENS);
|
int ntokens = expected_tokens (line, tokens, YYNTOKENS);
|
||||||
free (line);
|
free (line);
|
||||||
|
|
||||||
// Build MATCHES, the list of possible completions.
|
// Build MATCHES, the list of possible completions.
|
||||||
const int len = strlen (text);
|
const size_t len = strlen (text);
|
||||||
// Need initial prefix and final NULL.
|
// Need initial prefix and final NULL.
|
||||||
char **matches = calloc (ntokens + symbol_count () + 2, sizeof *matches);
|
char **matches
|
||||||
|
= calloc ((size_t) ntokens + (size_t) symbol_count () + 2, sizeof *matches);
|
||||||
|
if (!matches)
|
||||||
|
abort ();
|
||||||
int match = 1;
|
int match = 1;
|
||||||
for (int i = 0; i < ntokens; ++i)
|
for (int i = 0; i < ntokens; ++i)
|
||||||
switch (tokens[i])
|
switch (tokens[i])
|
||||||
@@ -510,9 +517,9 @@ completion (const char *text, int start, int end)
|
|||||||
matches[0] = strdup (text);
|
matches[0] = strdup (text);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int lcplen = strlen (matches[1]);
|
size_t lcplen = strlen (matches[1]);
|
||||||
for (int i = 2; i < match && lcplen; ++i)
|
for (int i = 2; i < match && lcplen; ++i)
|
||||||
for (int j = 0; j < lcplen; ++j)
|
for (size_t 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] = xstrndup (matches[1], lcplen);
|
matches[0] = xstrndup (matches[1], lcplen);
|
||||||
@@ -536,7 +543,8 @@ completion (const char *text, int start, int end)
|
|||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_readline (void)
|
static void
|
||||||
|
init_readline (void)
|
||||||
{
|
{
|
||||||
// Allow conditional parsing of the ~/.inputrc file.
|
// Allow conditional parsing of the ~/.inputrc file.
|
||||||
rl_readline_name = "bistromathic";
|
rl_readline_name = "bistromathic";
|
||||||
@@ -555,7 +563,8 @@ void init_readline (void)
|
|||||||
| Main. |
|
| Main. |
|
||||||
`-------*/
|
`-------*/
|
||||||
|
|
||||||
int main (int argc, char const* argv[])
|
int
|
||||||
|
main (int argc, char const* argv[])
|
||||||
{
|
{
|
||||||
#if defined ENABLE_NLS && ENABLE_NLS
|
#if defined ENABLE_NLS && ENABLE_NLS
|
||||||
// Set up internationalization.
|
// Set up internationalization.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
%code top {
|
%code top {
|
||||||
#include <ctype.h> /* isdigit. */
|
#include <ctype.h> /* isdigit. */
|
||||||
#include <stdio.h> /* For printf, etc. */
|
#include <stdio.h> /* printf. */
|
||||||
|
#include <stdlib.h> /* abort. */
|
||||||
#include <string.h> /* strcmp. */
|
#include <string.h> /* strcmp. */
|
||||||
|
|
||||||
int yylex (void);
|
int yylex (void);
|
||||||
@@ -73,7 +74,8 @@ yylex (void)
|
|||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
{
|
{
|
||||||
ungetc (c, stdin);
|
ungetc (c, stdin);
|
||||||
scanf ("%lf", &yylval.NUM);
|
if (scanf ("%lf", &yylval.NUM) != 1)
|
||||||
|
abort ();
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ nodist_%C%_calc_SOURCES = %D%/calc.y
|
|||||||
|
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_calc_CFLAGS = $(TEST_CFLAGS)
|
||||||
|
|
||||||
dist_calc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
dist_calc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
||||||
CLEANFILES += %D%/calc.[ch] %D%/calc.output %D%/scan.c
|
CLEANFILES += %D%/calc.[ch] %D%/calc.output %D%/scan.c
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ if FLEX_WORKS
|
|||||||
nodist_%C%_lexcalc_SOURCES = %D%/parse.y %D%/parse.h %D%/scan.l
|
nodist_%C%_lexcalc_SOURCES = %D%/parse.y %D%/parse.h %D%/scan.l
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_lexcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_lexcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
# Fighting warnings triggered by Flex is just too painful.
|
||||||
|
# %C%_lexcalc_CFLAGS = $(TEST_CFLAGS)
|
||||||
endif FLEX_WORKS
|
endif FLEX_WORKS
|
||||||
|
|
||||||
%D%/parse.c: $(dependencies)
|
%D%/parse.c: $(dependencies)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
%option nodefault noinput nounput noyywrap
|
%option nodefault noinput nounput noyywrap
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <errno.h> /* errno, ERANGE */
|
#include <errno.h> /* errno, ERANGE */
|
||||||
#include <limits.h> /* INT_MIN */
|
#include <limits.h> /* INT_MIN */
|
||||||
#include <stdlib.h> /* strtol */
|
#include <stdlib.h> /* strtol */
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
// Each time a rule is matched, advance the end cursor/position.
|
// Each time a rule is matched, advance the end cursor/position.
|
||||||
#define YY_USER_ACTION \
|
#define YY_USER_ACTION \
|
||||||
yylloc->last_column += yyleng;
|
yylloc->last_column += (int) yyleng;
|
||||||
|
|
||||||
// Move the first position onto the last.
|
// Move the first position onto the last.
|
||||||
#define LOCATION_STEP() \
|
#define LOCATION_STEP() \
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
|
|||||||
%D%/mfcalc.c: $(dependencies)
|
%D%/mfcalc.c: $(dependencies)
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_mfcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_mfcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_mfcalc_CFLAGS = $(TEST_CFLAGS)
|
||||||
%C%_mfcalc_LDADD = -lm
|
%C%_mfcalc_LDADD = -lm
|
||||||
|
|
||||||
dist_TESTS += %D%/mfcalc.test
|
dist_TESTS += %D%/mfcalc.test
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
%code top {
|
%code top {
|
||||||
#include <ctype.h> /* isdigit. */
|
#include <ctype.h> /* isdigit. */
|
||||||
#include <stdbool.h>
|
#include <stdio.h> /* printf. */
|
||||||
#include <stdio.h> /* For printf, etc. */
|
#include <stdlib.h> /* abort. */
|
||||||
#include <string.h> /* strcmp. */
|
#include <string.h> /* strcmp. */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,8 @@ yylex (YYSTYPE *yylval)
|
|||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
{
|
{
|
||||||
ungetc (c, stdin);
|
ungetc (c, stdin);
|
||||||
scanf ("%lf", &yylval->NUM);
|
if (scanf ("%lf", &yylval->NUM) != 1)
|
||||||
|
abort ();
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ nodist_%C%_calc_SOURCES = %D%/calc.y
|
|||||||
|
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
%C%_calc_CFLAGS = $(TEST_CFLAGS)
|
||||||
|
|
||||||
dist_pushcalc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
dist_pushcalc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
|
||||||
CLEANFILES += %D%/calc.[ch] %D%/calc.output
|
CLEANFILES += %D%/calc.[ch] %D%/calc.output
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ if FLEX_WORKS
|
|||||||
BUILT_SOURCES += $(nodist_%C%_reccalc_SOURCES)
|
BUILT_SOURCES += $(nodist_%C%_reccalc_SOURCES)
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_reccalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
%C%_reccalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
|
||||||
|
# Fighting warnings triggered by Flex is just too painful.
|
||||||
|
# %C%_reccalc_CFLAGS = $(TEST_CFLAGS)
|
||||||
endif FLEX_WORKS
|
endif FLEX_WORKS
|
||||||
|
|
||||||
%D%/parse.c: $(dependencies)
|
%D%/parse.c: $(dependencies)
|
||||||
|
|||||||
@@ -32,9 +32,9 @@
|
|||||||
do \
|
do \
|
||||||
capacity = capacity ? 2 * capacity : 128; \
|
capacity = capacity ? 2 * capacity : 128; \
|
||||||
while (capacity < size + yyleng + 1); \
|
while (capacity < size + yyleng + 1); \
|
||||||
str = realloc (str, capacity); \
|
str = realloc (str, (size_t) capacity); \
|
||||||
} \
|
} \
|
||||||
memcpy (str + size, yytext, yyleng); \
|
memcpy (str + size, yytext, (size_t) yyleng); \
|
||||||
size += yyleng; \
|
size += yyleng; \
|
||||||
assert (size < capacity); \
|
assert (size < capacity); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
|
|||||||
%D%/rpcalc.c: $(dependencies)
|
%D%/rpcalc.c: $(dependencies)
|
||||||
# Don't use gnulib's system headers.
|
# Don't use gnulib's system headers.
|
||||||
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||||
|
%C%_rpcalc_CFLAGS = $(TEST_CFLAGS)
|
||||||
%C%_rpcalc_LDADD = -lm
|
%C%_rpcalc_LDADD = -lm
|
||||||
|
|
||||||
dist_TESTS += %D%/rpcalc.test
|
dist_TESTS += %D%/rpcalc.test
|
||||||
|
|||||||
@@ -35,6 +35,9 @@
|
|||||||
dist_noinst_SCRIPTS = %D%/extexi %D%/test
|
dist_noinst_SCRIPTS = %D%/extexi %D%/test
|
||||||
TEST_LOG_COMPILER = $(SHELL) $(top_srcdir)/%D%/test
|
TEST_LOG_COMPILER = $(SHELL) $(top_srcdir)/%D%/test
|
||||||
|
|
||||||
|
TEST_CFLAGS = \
|
||||||
|
$(WARN_CFLAGS) $(WARN_CFLAGS_TEST) $(WERROR_CFLAGS)
|
||||||
|
|
||||||
AM_CXXFLAGS = \
|
AM_CXXFLAGS = \
|
||||||
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -36,10 +36,11 @@ strip_prompt=false
|
|||||||
|
|
||||||
# If diff supports --strip-trailing-cr, use it, to avoid EOL issues
|
# If diff supports --strip-trailing-cr, use it, to avoid EOL issues
|
||||||
# when testing Java programs on Windows.
|
# when testing Java programs on Windows.
|
||||||
echo "checking for diff --strip-trailing-cr"
|
echo "checking for diff --strip-trailing-cr..."
|
||||||
if diff --strip-trailing-cr "$1" "$1"; then
|
if diff --strip-trailing-cr "$1" "$1"; then
|
||||||
diff_opts=--strip-trailing-cr
|
diff_opts=--strip-trailing-cr
|
||||||
fi
|
fi
|
||||||
|
echo "checking for diff --strip-trailing-cr... $diff_opts"
|
||||||
|
|
||||||
# The exercised program.
|
# The exercised program.
|
||||||
abs_medir=$cwd/examples/$medir
|
abs_medir=$cwd/examples/$medir
|
||||||
|
|||||||
+3
-1
@@ -257,7 +257,8 @@ static const argmatch_trace_doc argmatch_trace_docs[] =
|
|||||||
{ "sets", "grammar sets: firsts, nullable etc." },
|
{ "sets", "grammar sets: firsts, nullable etc." },
|
||||||
{ "muscles", "m4 definitions passed to the skeleton" },
|
{ "muscles", "m4 definitions passed to the skeleton" },
|
||||||
{ "tools", "m4 invocation" },
|
{ "tools", "m4 invocation" },
|
||||||
{ "m4", "m4 traces" },
|
{ "m4-early", "m4 traces starting from the start" },
|
||||||
|
{ "m4", "m4 traces starting from the skeleton evaluation" },
|
||||||
{ "skeleton", "skeleton postprocessing" },
|
{ "skeleton", "skeleton postprocessing" },
|
||||||
{ "time", "time consumption" },
|
{ "time", "time consumption" },
|
||||||
{ "ielr", "IELR conversion" },
|
{ "ielr", "IELR conversion" },
|
||||||
@@ -279,6 +280,7 @@ static const argmatch_trace_arg argmatch_trace_args[] =
|
|||||||
{ "sets", trace_sets },
|
{ "sets", trace_sets },
|
||||||
{ "muscles", trace_muscles },
|
{ "muscles", trace_muscles },
|
||||||
{ "tools", trace_tools },
|
{ "tools", trace_tools },
|
||||||
|
{ "m4-early", trace_m4_early },
|
||||||
{ "m4", trace_m4 },
|
{ "m4", trace_m4 },
|
||||||
{ "skeleton", trace_skeleton },
|
{ "skeleton", trace_skeleton },
|
||||||
{ "time", trace_time },
|
{ "time", trace_time },
|
||||||
|
|||||||
+6
-5
@@ -100,11 +100,12 @@ enum trace
|
|||||||
trace_grammar = 1 << 7, /**< Reading, reducing the grammar. */
|
trace_grammar = 1 << 7, /**< Reading, reducing the grammar. */
|
||||||
trace_time = 1 << 8, /**< Time consumption. */
|
trace_time = 1 << 8, /**< Time consumption. */
|
||||||
trace_skeleton = 1 << 9, /**< Skeleton postprocessing. */
|
trace_skeleton = 1 << 9, /**< Skeleton postprocessing. */
|
||||||
trace_m4 = 1 << 10, /**< M4 traces. */
|
trace_m4_early = 1 << 10, /**< M4 early traces. */
|
||||||
trace_muscles = 1 << 11, /**< M4 definitions of the muscles. */
|
trace_m4 = 1 << 11, /**< M4 traces. */
|
||||||
trace_ielr = 1 << 12, /**< IELR conversion. */
|
trace_muscles = 1 << 12, /**< M4 definitions of the muscles. */
|
||||||
trace_closure = 1 << 13, /**< Input/output of closure(). */
|
trace_ielr = 1 << 13, /**< IELR conversion. */
|
||||||
trace_locations = 1 << 14, /**< Full display of locations. */
|
trace_closure = 1 << 14, /**< Input/output of closure(). */
|
||||||
|
trace_locations = 1 << 15, /**< Full display of locations. */
|
||||||
trace_all = ~0 /**< All of the above. */
|
trace_all = ~0 /**< All of the above. */
|
||||||
};
|
};
|
||||||
/** What debug items bison displays during its run. */
|
/** What debug items bison displays during its run. */
|
||||||
|
|||||||
+18
-13
@@ -687,6 +687,7 @@ output_skeleton (void)
|
|||||||
char *skeldir = xpath_join (datadir, "skeletons");
|
char *skeldir = xpath_join (datadir, "skeletons");
|
||||||
char *m4sugar = xpath_join (datadir, "m4sugar/m4sugar.m4");
|
char *m4sugar = xpath_join (datadir, "m4sugar/m4sugar.m4");
|
||||||
char *m4bison = xpath_join (skeldir, "bison.m4");
|
char *m4bison = xpath_join (skeldir, "bison.m4");
|
||||||
|
char *traceon = xpath_join (skeldir, "traceon.m4");
|
||||||
char *skel = (IS_PATH_WITH_DIR (skeleton)
|
char *skel = (IS_PATH_WITH_DIR (skeleton)
|
||||||
? xstrdup (skeleton)
|
? xstrdup (skeleton)
|
||||||
: xpath_join (skeldir, skeleton));
|
: xpath_join (skeldir, skeleton));
|
||||||
@@ -698,21 +699,10 @@ output_skeleton (void)
|
|||||||
|
|
||||||
/* Create an m4 subprocess connected to us via two pipes. */
|
/* Create an m4 subprocess connected to us via two pipes. */
|
||||||
|
|
||||||
if (trace_flag & trace_tools)
|
|
||||||
fprintf (stderr, "running: %s %s - %s %s\n",
|
|
||||||
m4, m4sugar, m4bison, skel);
|
|
||||||
|
|
||||||
/* Some future version of GNU M4 (most likely 1.6) may treat the -dV in a
|
|
||||||
position-dependent manner. Keep it as the first argument so that all
|
|
||||||
files are traced.
|
|
||||||
|
|
||||||
See the thread starting at
|
|
||||||
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
|
|
||||||
for details. */
|
|
||||||
int filter_fd[2];
|
int filter_fd[2];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
{
|
{
|
||||||
char const *argv[10];
|
char const *argv[11];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
argv[i++] = m4;
|
argv[i++] = m4;
|
||||||
|
|
||||||
@@ -730,15 +720,29 @@ output_skeleton (void)
|
|||||||
|
|
||||||
argv[i++] = "-I";
|
argv[i++] = "-I";
|
||||||
argv[i++] = datadir;
|
argv[i++] = datadir;
|
||||||
if (trace_flag & trace_m4)
|
/* Some future version of GNU M4 (most likely 1.6) may treat the
|
||||||
|
-dV in a position-dependent manner. See the thread starting at
|
||||||
|
<http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
|
||||||
|
for details. */
|
||||||
|
if (trace_flag & trace_m4_early)
|
||||||
argv[i++] = "-dV";
|
argv[i++] = "-dV";
|
||||||
argv[i++] = m4sugar;
|
argv[i++] = m4sugar;
|
||||||
argv[i++] = "-";
|
argv[i++] = "-";
|
||||||
argv[i++] = m4bison;
|
argv[i++] = m4bison;
|
||||||
|
if (trace_flag & trace_m4)
|
||||||
|
argv[i++] = traceon;
|
||||||
argv[i++] = skel;
|
argv[i++] = skel;
|
||||||
argv[i++] = NULL;
|
argv[i++] = NULL;
|
||||||
aver (i <= ARRAY_CARDINALITY (argv));
|
aver (i <= ARRAY_CARDINALITY (argv));
|
||||||
|
|
||||||
|
if (trace_flag & trace_tools)
|
||||||
|
{
|
||||||
|
fputs ("running:", stderr);
|
||||||
|
for (int j = 0; argv[j]; ++j)
|
||||||
|
fprintf (stderr, " %s", argv[j]);
|
||||||
|
fputc ('\n', stderr);
|
||||||
|
}
|
||||||
|
|
||||||
/* The ugly cast is because gnulib gets the const-ness wrong. */
|
/* The ugly cast is because gnulib gets the const-ness wrong. */
|
||||||
pid = create_pipe_bidi ("m4", m4, (char **)(void*)argv, false, true,
|
pid = create_pipe_bidi ("m4", m4, (char **)(void*)argv, false, true,
|
||||||
true, filter_fd);
|
true, filter_fd);
|
||||||
@@ -747,6 +751,7 @@ output_skeleton (void)
|
|||||||
free (skeldir);
|
free (skeldir);
|
||||||
free (m4sugar);
|
free (m4sugar);
|
||||||
free (m4bison);
|
free (m4bison);
|
||||||
|
free (traceon);
|
||||||
free (skel);
|
free (skel);
|
||||||
|
|
||||||
if (trace_flag & trace_muscles)
|
if (trace_flag & trace_muscles)
|
||||||
|
|||||||
+28
-2
@@ -29,18 +29,44 @@ AT_DATA([input.m4],
|
|||||||
[[m4@&t@_include(b4_skeletonsdir/[c.m4])
|
[[m4@&t@_include(b4_skeletonsdir/[c.m4])
|
||||||
|
|
||||||
b4_output_begin([output.txt])
|
b4_output_begin([output.txt])
|
||||||
|
|
||||||
|
b4_gsub([[abcd]],
|
||||||
|
[a], [b])
|
||||||
|
b4_gsub([[abcd]],
|
||||||
|
[a], [b],
|
||||||
|
[b], [c],
|
||||||
|
[c], [d])
|
||||||
|
|
||||||
|
_b4_comment([["/* () */"]])
|
||||||
|
_b4_comment([["/* ( */"]])
|
||||||
|
_b4_comment([["/* ) */"]])
|
||||||
|
_b4_comment([["/* [] */"]])
|
||||||
|
|
||||||
b4_comment([["/* () */"]])
|
b4_comment([["/* () */"]])
|
||||||
b4_comment([["/* ( */"]])
|
b4_comment([["/* ( */"]])
|
||||||
b4_comment([["/* ) */"]])
|
b4_comment([["/* ) */"]])
|
||||||
|
b4_comment([["/* [] */"]])
|
||||||
|
|
||||||
b4_output_end([output.txt])
|
b4_output_end([output.txt])
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-S ./input.m4 input.y])
|
AT_BISON_CHECK([-S ./input.m4 input.y])
|
||||||
|
|
||||||
AT_CHECK([cat output.txt], [],
|
AT_CHECK([cat output.txt], [],
|
||||||
[/* "/\* () *\/" */
|
[[
|
||||||
|
[bbcd]
|
||||||
|
[dddd]
|
||||||
|
|
||||||
|
"/\* () *\/"
|
||||||
|
"/\* ( *\/"
|
||||||
|
"/\* ) *\/"
|
||||||
|
"/\* [] *\/"
|
||||||
|
|
||||||
|
/* "/\* () *\/" */
|
||||||
/* "/\* ( *\/" */
|
/* "/\* ( *\/" */
|
||||||
/* "/\* ) *\/" */
|
/* "/\* ) *\/" */
|
||||||
])
|
/* "/\* [] *\/" */
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
Reference in New Issue
Block a user