Commit Graph

34 Commits

Author SHA1 Message Date
Akim Demaille
d7e8aaa271 package: bump copyrights to 2021
Run 'make update-copyright'.
2021-01-16 16:11:17 +01:00
Martin Rehak
2ca158c893 examples: avoid "unbound variable" errors
When the shell option `nounset` is set, we may get "unbound variable"
errors.
https://lists.gnu.org/r/bug-bison/2020-11/msg00013.html

* examples/test (diff_opts): Be sure to initialize it.
2020-11-20 06:42:39 +01:00
Akim Demaille
8e70880af1 tests: show logs
* examples/c/bistromathic/bistromathic.test, examples/test: here.
2020-05-23 13:47:31 +02:00
Akim Demaille
d26d10ad6c examples: beware of portability issue on Windows
Reported by Jannick.
https://lists.gnu.org/r/bug-bison/2020-05/msg00040.html
https://lists.gnu.org/r/bug-bison/2020-05/msg00066.html

* examples/test (diff_opts): Use --strip-trailing-cr if supported, to
avoid \n vs. \r\n issues.
* examples/c/bistromathic/bistromathic.test: When on MSYS, don't try
to check autocompletion.
2020-05-08 09:45:29 +02:00
Akim Demaille
cb9f4cb543 examples: fix handling of syntax errors
The shell grammar does not allow empty statements in then/else part of
an if, but examples/test failed to catch the syntax errors from the
script it ran.  So exited with success anyway.

You would expect 'set -e' to suffice, but with bash 3.2 actually it
does not.  As a matter of fact, I could find a way to have this behave
properly:

    $ cat test.sh
    set -e
    cleanup ()
    {
      status=$?
      echo "cleanup: $status"
      exit $status
    }
    trap cleanup 0 1 2 13 15
    . $1
    s=$?
    echo "test.sh: $s"
    exit $s

    $ cat bistro.test
    if true; then
    fi

    $ /bin/sh ./test.sh ./bistro.test
    ./bistro.test: line 2: syntax error near unexpected token `fi'
    cleanup: 0
    $ echo $?
    0

Remove the set -e (or the trap), and tada, it works...  So we have to
deal with the error by hand.

* examples/test ($exit): Replace with...
($status): this.
Preserve the exit status of the test case.
* examples/c/bistromathic/bistromathic.test: Fix syntax error.
2020-05-05 08:21:12 +02:00
Akim Demaille
6135fdc152 examples: beware of portability issues with sh's trap
On AIX 7.2, when invoking "exit 77", we actually exit with 127.  The
"cleanup" function, called via trap, received an incorrect exit
status, something described in Autoconf's doc.
Reported by Bruno Haible.
https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00029.html
https://lists.gnu.org/archive/html/bug-bison/2020-05/msg00047.html

* examples/test (skip): New.
* examples/c/bistromathic/bistromathic.test,
* examples/c/reccalc/reccalc.test: Use it, to ensure $? is set to 77
when the trap is called.
2020-05-04 06:48:00 +02:00
Akim Demaille
df752784c2 examples: beware of portability issues with cmp
As someone wrote nearly 20 years ago in Autoconf's documentation,
don't use cmp to compare text files, but diff.
https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=abad4f0576a7dc361e5385e19c7681449103cdb1
Reported by Jannick.

* examples/test: Use diff, not cmp.
2020-05-03 17:53:47 +02:00
Akim Demaille
4c641c5189 tests: beware of portability of readline
* examples/test: here.
2020-04-29 07:01:22 +02:00
Akim Demaille
58e79539fc c: don't emit an error message when the scanner returns YYERRCODE
* data/skeletons/yacc.c (yyparse): When the scanner returns YYERRCODE,
go directly to error recovery (yyerrlab1).
However, don't keep the error token as lookahead, that token is too
special.
* data/skeletons/lalr1.cc: Likewise.

* examples/c/bistromathic/parse.y (yylex): Use that feature to report
nicely invalid characters.
* examples/c/bistromathic/bistromathic.test: Check that.
* examples/test: Neutralize gratuitous differences such as rule
position.

* tests/calc.at: Check that case in C only.
The other case seem to be working, but that's an illusion that the
next commit will address (in fact, they can enter endless loops, and
report the error several times anyway).
2020-04-26 18:05:30 +02:00
Akim Demaille
c90110efd3 examples: bistromathic: when quitting, close the current line
When the user ctrl-d the line, we left the cursor not at col 0.
Let's fix that.
This revealed a few short-comings in the testing framework.

* examples/test (run): Also display the diffs.
And support -n.
* examples/c/bistromathic/bistromathic.test
* examples/c/bistromathic/parse.y
2020-04-26 16:08:47 +02:00
Akim Demaille
8b5fb7c4c3 examples: beware of readline on macOS
macOS' version of readline does not repeat stdin on stdout in
non-interactive mode, contrary to the current version of GNU readline.

* examples/test: Add support for strip_prompt.
* examples/c/bistromathic/bistromathic.test (strip_prompt): Set it
when needed.
Early exit when needed.
2020-04-18 10:37:13 +02:00
Akim Demaille
c4a7e7a1ab examples: bistromathic: strengthen tests
* examples/c/bistromathic/bistromathic.test: here.
* examples/test: Be clearer on failing tests.
2020-02-29 12:22:31 +01:00
Akim Demaille
3197d0fac9 examples: be more robust to spaces in paths
Reported by Nikki Valen.
https://lists.gnu.org/r/bug-bison/2020-01/msg00032.html

* examples/test ($prog): Remove, replaced by...
(prog): This new function, which pays attention to quoting shell
variables.
2020-01-27 07:22:22 +01:00
Akim Demaille
f374310119 examples: add a complete example with all the bells and whistles
* examples/c/bistromathic/Makefile,
* examples/c/bistromathic/README.md,
* examples/c/bistromathic/bistromathic.test,
* examples/c/bistromathic/local.mk,
* examples/c/bistromathic/parse.y,
* examples/c/bistromathic/scan.l:
New.

* Makefile.am (AM_YFLAGS_WITH_LINES): Add -Wdangling-alias.
* examples/test: Make failure errors easier to read.
2020-01-27 06:41:11 +01:00
Akim Demaille
8036635251 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-05 10:26:35 +01:00
Kiyoshi Kanazawa
83ebc8bdb6 tests: don't depend on the user's definition of SHELL
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00031.html

* examples/test (SHELL): Set it to /bin/sh.
2019-01-27 07:06:44 +01:00
Akim Demaille
2471733f1a package: bump copyrights to 2019 2019-01-05 14:58:05 +01:00
Akim Demaille
85d303b713 examples: sort them per language and complete them
Convert some of the READMEs to Markdown, which is now more common, and
nicely displayed in some git hosting services.

Add missing READMEs and Makefiles.  Generate XML, HTML and Dot files.  Be
sure to ship the test files.  Complete CLEANFILES to remove all generated
files.

* examples/calc++: Move into...
* examples/c++: here.
* examples/mfcalc, examples/rpcalc: Move into...
* examples/c: here.

* examples/README.md, examples/c++/calc++/Makefile, examples/c/local.mk,
* examples/c/mfcalc/Makefile, examples/c/rpcalc/Makefile,
* examples/d/README.md, examples/java/README.md:
New files.

* examples/test (medir): Be robust to deeper directory nesting.
2018-12-09 13:55:05 +01:00
Akim Demaille
d2386a35f5 java: add an example
* examples/java/Calc.y: New, based on test 495: "Calculator
parse.error=verbose %locations".
* examples/java/Calc.test, examples/java/local.mk: New.

* configure.ac (ENABLE_JAVA): New.
* examples/test (prog): Be ready to run Java programs.
2018-12-01 11:13:08 +01:00
Akim Demaille
ca8039e612 tests: don't expect the shell to support 'local'
It doesn't work on Solaris 11.3 x86/64.
Reported by Kiyoshi Kanazawa.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00051.html

* examples/test: Don't use 'local'.
2018-10-30 19:13:38 +01:00
Akim Demaille
f3110c9b9a examples: check the errors
* examples/test (run): Check stderr, unless -noerr is passed.
* examples/calc++/calc++.test, examples/mfcalc/mfcalc.test: Check
errors.
2018-10-26 07:42:28 +02:00
Akim Demaille
a4dce889a4 doc: an introductory example for C++
Suggested by Victor Khomenko.
http://lists.gnu.org/archive/html/bug-bison/2018-08/msg00037.html

* doc/bison.texi (A Simple C++ Example): New.
* examples/c++/local.mk, examples/c++/simple.test: New.
Extract, check, and install this new example.
* examples/local.mk: Adjust.
* examples/test: Adjust to the case where the dirname differs
from the test name.
2018-10-24 06:18:57 +02:00
Josh Soref
3aed6a21f5 spelling: builddir 2018-10-05 07:01:04 +02:00
Akim Demaille
d908fb3f18 examples: beware of shell portability issues
This completes 2d7e743802.

Some shells don't grok "local var=`cmd`" very well: they need the rhs
to be quoted.

    ./examples/test: 72: local: you.,: bad variable name
    FAIL examples/variant.test (exit status: 2)

Reported by Étienne Renault.

* examples/test (run): Quote the values in 'local' assignments.
2018-09-06 13:51:19 +02:00
Akim Demaille
2d7e743802 examples: beware of shell portability issues
Some shells don't grok `local var=$val` very well: they need the rhs
to be quoted.

    ./examples/test: 66: local: you.,: bad variable name
    FAIL examples/variant.test (exit status: 2)

Reported by Étienne Renault.

* examples/test (run): Quote the values in 'local' assignments.
2018-09-02 09:37:53 +02:00
Akim Demaille
b610f43f25 examples: check the variant example
* examples/mfcalc/local.mk, examples/rpcalc/local.mk: Define the
programs in a more natural order, source, preproc, then linker.

* examples/test: Be ready to work on programs that are not in
a subdir.
* examples/variant.test: New.
* examples/local.mk: Use it.
* examples/variant.yy: Don't use 0 for nullptr.
Use a more natural output for a list of string.
2018-08-19 17:47:59 +02:00
Akim Demaille
2e9e591889 Update copyright years
Run `make update-copyright`.
2018-05-12 18:18:41 +02:00
Akim Demaille
3209eb1c4c package: bump to 2015
Which also requires:

* gnulib: Update.
2015-01-04 17:49:13 +01:00
Akim Demaille
fc51acddb4 package: bump to 2014
* AUTHORS, ChangeLog-2012, Makefile.am, NEWS, PACKAGING, README,
* README-alpha, README-hacking, THANKS, TODO, bootstrap.conf,
* build-aux/darwin11.4.0.valgrind, build-aux/local.mk,
* build-aux/update-b4-copyright,
* build-aux/update-package-copyright-year, cfg.mk, configure.ac,
* data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4,
* data/c-like.m4, data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc,
* data/java-skel.m4, data/java.m4, data/lalr1.cc, data/lalr1.java,
* data/local.mk, data/location.cc, data/stack.hh, data/variant.hh,
* data/xslt/bison.xsl, data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl,
* data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint,
* djgpp/README.in, djgpp/config.bat, djgpp/config.sed,
* djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat,
* djgpp/local.mk, djgpp/subpipe.c, djgpp/subpipe.h,
* djgpp/testsuite.sed, doc/bison.texi, doc/local.mk, doc/refcard.tex,
* etc/README, etc/bench.pl.in, etc/local.mk,
* examples/calc++/calc++.test, examples/calc++/local.mk,
* examples/extexi, examples/local.mk, examples/mfcalc/local.mk,
* examples/mfcalc/mfcalc.test, examples/rpcalc/local.mk,
* examples/rpcalc/rpcalc.test, examples/test, examples/variant.yy,
* lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c,
* lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h,
* lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c,
* lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h,
* lib/local.mk, lib/main.c, lib/timevar.c, lib/timevar.def,
* lib/timevar.h, lib/vbitset.c, lib/vbitset.h, lib/yyerror.c,
* m4/bison-i18n.m4, m4/c-working.m4, m4/cxx.m4, m4/flex.m4,
* m4/timevar.m4, src/AnnotationList.c, src/AnnotationList.h,
* src/InadequacyList.c, src/InadequacyList.h, src/LR0.c, src/LR0.h,
* src/Sbitset.c, src/Sbitset.h, src/assoc.c, src/assoc.h,
* src/closure.c, src/closure.h, src/complain.c, src/complain.h,
* src/conflicts.c, src/conflicts.h, src/derives.c, src/derives.h,
* src/files.c, src/files.h, src/flex-scanner.h, src/getargs.c,
* src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c,
* src/graphviz.h, src/ielr.c, src/ielr.h, src/lalr.c, src/lalr.h,
* src/local.mk, src/location.c, src/location.h, src/main.c,
* src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c,
* src/named-ref.h, src/nullable.c, src/nullable.h, src/output.c,
* src/output.h, src/parse-gram.c, src/parse-gram.y, src/print-xml.c,
* src/print-xml.h, src/print.c, src/print.h, src/print_graph.c,
* src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c,
* src/reduce.h, src/relation.c, src/relation.h, src/scan-code.h,
* src/scan-code.l, src/scan-gram.h, src/scan-gram.l, src/scan-skel.h,
* src/scan-skel.l, src/state.c, src/state.h, src/symlist.c,
* src/symlist.h, src/symtab.c, src/symtab.h, src/system.h,
* src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h,
* tests/actions.at, tests/atlocal.in, tests/bison.in, tests/c++.at,
* tests/calc.at, tests/conflicts.at, tests/cxx-type.at,
* tests/existing.at, tests/glr-regression.at, tests/headers.at,
* tests/input.at, tests/java.at, tests/javapush.at, tests/local.at,
* tests/local.mk, tests/named-refs.at, tests/output.at, tests/push.at,
* tests/reduce.at, tests/regression.at, tests/sets.at,
* tests/skeletons.at, tests/synclines.at, tests/testsuite.at,
* tests/torture.at, tests/types.at:
here.
2014-02-03 15:27:02 +01:00
Akim Demaille
7d6bad1959 maint: update copyright years
Suggested by Stefano Lattarini.
Run "make update-copyright".
2013-01-12 16:14:16 +01:00
Akim Demaille
a89a5b1442 tests: be robust to set -e.
* examples/test (run): here.
2012-12-21 13:24:51 +01:00
Akim Demaille
b611359d90 tests: fix VPATH issue
* examples/test: With an absolute VPATH build, "../" is incorrect.
2012-07-20 18:23:44 +02:00
Akim Demaille
24ec083743 doc: check the rpcalc.
* doc/bison.texinfo: Tag rpcalc.y snippets.
	Add missing includes.
	(Rpcalc Rules): Don't issue leading tabs.
	Complete an Info menu.
	Use @result.
	* examples/rpcalc/local.mk: New.
	* examples/rpcalc/rpcalc.test: New.
	* examples/local.mk: Use them.
	* examples/mfcalc/mfcalc.test: Remove dup test.
	* examples/test: Disable debug traces.
2012-02-19 13:16:15 +01:00
Akim Demaille
5a9c6b89d0 examples: factor the test suite.
* examples/mfcalc/test, examples/calc++/test: Extract the
	common bits into...
	* examples/test: here.
	(cwd): New.
	Use it to avoid a race on the temporary directory.
	Reported by Jim Meyering.
	* examples/mfcalc/test, examples/calc++/test: Rename into...
	* examples/mfcalc/mfcalc.test, examples/calc++/calc++.test: these.
	* examples/calc++/local.mk, examples/mfcalc/local.mk,
	* examples/local.mk: Adjust.
2012-02-17 15:49:00 +01:00