Commit Graph

6415 Commits

Author SHA1 Message Date
Akim Demaille
1161649446 preserve the indentation in the ouput
Preserve the actions' initial indentation.  For instance, on

    | %define api.value.type {int}
    | %%
    | exp: exp '/' exp { if ($3)
    |                     $$ = $1 + $3;
    |                   else
    |                     $$ = 0; }

we used to generate

    |     { if (yyvsp[0])
    |                     yyval = yyvsp[-2] + yyvsp[0];
    |                   else
    |                    yyval = 0; }

now we produce

    |                  { if (yyvsp[0])
    |                     yyval = yyvsp[-2] + yyvsp[0];
    |                   else
    |                     yyval = 0; }

See https://lists.gnu.org/archive/html/bison-patches/2019-06/msg00012.html.

* data/skeletons/bison.m4 (b4_symbol_action): Output the code in
column 0, leave indentation matters to the C code.
* src/output.c (user_actions_output): Preserve the incoming
indentation in the output.
(prepare_symbol_definitions): Likewise for %printer/%destructor.
* tests/synclines.at (Output columns): New.
2019-07-02 07:38:52 +02:00
Akim Demaille
13577a809e style: prefer passing locations by pointer
The code is inconsistent: sometimes we pass by value, sometimes by
reference.  Let's stick to the last, more conventional for large
values in C.

* src/scan-code.l: Pass locations by reference.
2019-07-01 07:23:42 +02:00
Akim Demaille
afc219a765 c++: avoid duplicate definition of YYUSE
Reported by Frank Heckenbach.
https://lists.gnu.org/archive/html/bug-bison/2019-06/msg00009.html

* data/skeletons/lalr1.cc (b4_shared_declarations): Remove the
duplicate definition of YYUSE, the other one coming from
b4_attribute_define.
2019-06-30 19:19:43 +02:00
Akim Demaille
21aa4b2713 style: comment changes
* examples/c/lexcalc/local.mk, examples/c/reccalc/local.mk:
Here.
2019-06-27 07:57:21 +02:00
Akim Demaille
63f4dca78f tests: restructure for clarity
* tests/calc.at (AT_CALC_MAIN, AT_CALC_LEX): Rewrite on top of
AT_LANG_DISPATCH.
2019-06-23 19:26:13 +02:00
Akim Demaille
0984f70e08 d: track locations
* configure.ac (DCFLAGS): Pass -g.
* data/skeletons/d.m4 (b4_locations_if): Remove, let bison.m4's one do
its job.
* data/skeletons/lalr1.d (position): Leave filename empty by default.
(position::toString): Don't print empty file names.
(location::this): New ctor.
(location::toString): Match the implementations of C/C++.
(yy_semantic_null): Leave undefined, the previous implementation does
not compile.
* tests/calc.at: Improve the implementation for D.
Enable more checks, in particular using locations.
* tests/local.at (AT_YYERROR_DEFINE(d)): Fix its implementation.
2019-06-23 11:20:18 +02:00
Akim Demaille
f26bd45da3 d: style changes
* data/skeletons/lalr1.d: Use a more traditional quotation scheme.
Formatting changes.
2019-06-23 11:20:16 +02:00
Akim Demaille
a3adc1701b d: put internal details inside the parser
Avoid name clashes, etc.

* data/skeletons/lalr1.d (YYStackElement, YYStack): Move inside the
parser.
2019-06-23 11:19:46 +02:00
Akim Demaille
7ab275214b gnulib: update 2019-06-22 09:03:19 +02:00
Akim Demaille
0428c429a1 remove "experimental" warnings
Sadly enough, AFAIK, there were never answers to the "More user
feedback will help to stabilize it" sentences.  Remove them.

* src/getargs.c: IELR, canonical LR and XML output are here to stay,
and they are no more experimental than some other features.
* doc/bison.texi: Likewise.
Also remove "experimental" warning for Java, LAC, LR tuning options,
and named references.
2019-06-22 08:29:06 +02:00
Akim Demaille
14fb2cc820 CI: propagate sftp failures
* .travis.yml (stage: "compile"): here.
2019-06-22 08:29:06 +02:00
Akim Demaille
faf033957c d: honor %define parse.trace
* data/skeletons/lalr1.d: Don't generate debug code if parse.trace is
not enabled.
2019-06-20 06:57:27 +02:00
Akim Demaille
0555e25a41 d: style changes
* data/skeletons/lalr1.d: here.
2019-06-20 06:57:27 +02:00
Akim Demaille
cde8c0a0e6 d: prefer delegation to duplication
* data/skeletons/lalr1.d: Delegate the construction of the scanner.
2019-06-20 06:57:27 +02:00
Akim Demaille
5b525e86a5 d: enable #line output
* data/skeletons/d.m4 (b4_sync_start): New.
2019-06-20 06:57:27 +02:00
Akim Demaille
df77a98edf d: style changes
* data/skeletons/lalr1.d: here.
* examples/d/calc.y: Remove incorrect support for decimal numbers.
Formatting changes.
2019-06-20 06:57:27 +02:00
Akim Demaille
c23fa0fc97 style: reduce scopes in glr.c
* data/skeletons/glr.c: here.
2019-06-20 06:57:27 +02:00
Akim Demaille
08c0571613 java: honor %define parse.trace
* data/skeletons/lalr1.java: Don't generate debug code if parse.trace
is not enabled.
2019-06-20 06:57:27 +02:00
Akim Demaille
f2b210a901 java: fix support for api.prefix
* data/skeletons/java.m4: here.
* tests/java.at: Check it.
2019-06-19 19:15:31 +02:00
Akim Demaille
66ac4acc6c java: style changes
* data/skeletons/lalr1.java: Use more conventional function names for
Java.
Prefer < and <= to => and >.
Use the same approach for m4 quotation as in the other skeletons.
Fix indentation issues.

* tests/calc.at, tests/java.at, tests/javapush.at: Fix quotation style.
(main): Use 'args', not 'argv', the former seems more conventional and
is used elsewhere in Bison.
Prefer character literals to integers to denote characters.
* examples/java/Calc.y: Likewise.
2019-06-19 19:15:26 +02:00
Akim Demaille
cd0f25df5f CI: avoid useless git costs
Travis answered favorably to my suggestion to provide a means to
disable git clone on some jobs (issue 7542).  See
https://docs.travis-ci.com/user/customizing-the-build/#disabling-git-clone.

* .travis.yml: Disable git globally, enable it for i. the compile job,
and ii. the test job on ICC which needs the install-icc.sh script.
2019-06-15 10:28:50 +02:00
Akim Demaille
0f46038589 style: simplify strings to translate
* src/conflicts.c (log_resolution): Don't translate indentation.
2019-06-12 21:41:16 +02:00
Akim Demaille
1105cf841b style: reduce scopes, propagate const
* src/conflicts.c (conflicts_output): here.
2019-06-12 21:41:16 +02:00
Akim Demaille
a298a6d82b style: use clearer types
* src/conflicts.c (conflicts): Array of Booleans.
2019-06-12 06:59:31 +02:00
Akim Demaille
5f33acefd1 tests: prefer %empty
* tests/regression.at: here.
2019-06-11 20:40:36 +02:00
Akim Demaille
849ba01b8b CI: factor
* .travis.yml (Clang 7 libc++ and ASAN part 2): Reuse bits from "Clang
7 libc++ and ASAN part 1".
2019-06-09 11:11:14 +02:00
Akim Demaille
29c9cb3188 lr0: more debug traces
* src/lr0.c (kernel_check): New.
(new_itemsets, save_reductions): Add traces.
2019-06-09 11:11:12 +02:00
Akim Demaille
ec4d49e129 traces: add some colors
This is an experiment.  Maybe more styles will be used (in which case
a short-hand function will be useful), maybe it will be just reverted.
* data/bison-default.css (.traces0): New.
* src/lalr.c (lalr): Use it.
2019-06-09 08:36:01 +02:00
Akim Demaille
d84b245c63 tests: make sure the default action properly works in C++
See e3fdc37049: in C++ we generate
explicitly the code for the default action instead of simply copying
blindly the semantic value buffer.  This is important when copying
raw memory is not enough, as exemplified by move-only types.

This is currently tested by examples/c++/variant.yy and variant-11.yy.
But it is safer to also have a test in the main test suite.

* tests/local.at (AT_REQUIRE_CXX_STD): Fix.
(AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS): Define/undefine
AT_BISON_OPTIONS.
* tests/c++.at (Default action): New.
2019-06-09 08:36:01 +02:00
Akim Demaille
73797b2552 tests: main: support -s and -p
* tests/local.at (AT_MAIN_DEFINE(c), AT_MAIN_DEFINE(c++)): here.
2019-06-09 08:36:01 +02:00
Akim Demaille
dfef525920 tests: remove useless support of '.' in integers
* tests/calc.at: here.
* doc/bison.texi: Avoid uninitialized variables.
2019-06-04 08:36:43 +02:00
Akim Demaille
7f017ae1c9 tests: refactor checks on sets
It will be convenient to check sets elsewhere.

* tests/sets.at (AT_EXTRACT_SETS): Transform into...
* tests/local.at (AT_SETS_CHECK): this.
* tests/sets.at: Adjust.
2019-05-29 08:38:16 +02:00
Akim Demaille
65126716d7 update-test: some file names have dashes in them
* build-aux/update-test (log): Rename as...
(trace): this, to avoid clashes with the log variable.
(getargs): Clarify the type of the arguments.
2019-05-29 08:26:20 +02:00
Akim Demaille
1dcd6068dd tests: take SHELL into account
Reported by Dennis Clarke.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00053.html

* examples/local.mk, tests/local.mk: here.
2019-05-26 15:29:37 +02:00
Akim Demaille
02f16dc799 gnulib: update to get gnulib translations
This update contains a fix needed for gnulib-po to work properly.
https://lists.gnu.org/archive/html/bug-gnulib/2019-05/msg00146.html
2019-05-26 09:35:31 +02:00
Akim Demaille
aa21c457f2 doc: clarify the purpose of symbol_type constructors
Reported by Frank Heckenbach.
http://lists.gnu.org/archive/html/bug-bison/2019-02/msg00006.html

* doc/bison.texi (Complete Symbols): Here.
2019-05-25 10:28:12 +02:00
Akim Demaille
9f26e6d6b3 thanks: fix an address 2019-05-22 18:09:04 +02:00
Akim Demaille
8d3e782e05 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-05-22 07:45:49 +02:00
Akim Demaille
1c671bad33 version 3.4.1
* NEWS: Record release date.
v3.4.1
2019-05-22 07:28:15 +02:00
Akim Demaille
88cd9570b6 NEWS: update 2019-05-22 07:22:51 +02:00
Akim Demaille
c423ad17e7 CI: remove useless apt-get update
The apt addons already ran it for us, it is not needed.

* .travis.yml: here.
2019-05-20 09:35:24 +02:00
Akim Demaille
9114b267a8 c++: beware of to_string portability issues
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00033.html

* m4/bison-cxx-std.m4 (_BISON_CXXSTD_11_snippet): Check it.
2019-05-20 06:27:55 +02:00
Akim Demaille
70c3f3ade5 doc: avoid Texinfo portability issues
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00024.html
Fixed by Karl Berry.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00034.html

* doc/bison.texi: Don't specify the langage, rely on the default.
Avoid blank pages.
2019-05-20 06:12:47 +02:00
Akim Demaille
1934304acf examples: don't run those that require f?lex when it's not available
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00026.html

* configure.ac (FLEX_WORKS): New.
* examples/c/lexcalc/local.mk, examples/c/reccalc/local.mk: Use it.
2019-05-19 18:41:59 +02:00
Akim Demaille
c8e57e8159 diagnostics: don't crash when libtextstyle is installed
Reported by neok m4700.
https://lists.gnu.org/archive/html/bison-patches/2019-05/msg00025.html
https://github.com/akimd/bison/pull/11

* src/complain.c (complain_init_color): style_file_prepare _needs_ a
string as second argument.
2019-05-19 18:16:47 +02:00
Akim Demaille
1e49f5e1e6 CI: avoid useless git costs
The final gain is small: 2h2min instead 2h9min.  But that is still an
improvement.

* .travis.yml (git.depth): Make the clone very shallow.
(git.submodules): Don't clone gnulib in test jobs.
(jobs.include.compile.script): Do it here.
2019-05-19 17:52:28 +02:00
Akim Demaille
49aae94bed fix: copyable instead of copiable
Reported by Frank Heckenbach.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00020.html

* data/skeletons/lalr1.cc, doc/bison.texi: here.
2019-05-19 13:53:15 +02:00
Akim Demaille
e191bf7b9f maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-05-19 11:36:06 +02:00
Akim Demaille
f520e150eb version 3.4
* NEWS: Record release date.
v3.4
2019-05-19 11:19:47 +02:00
Akim Demaille
75db37c564 fix: use copiable, not copyable
Reported by Hans Åberg.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00017.html

* data/skeletons/lalr1.cc, doc/bison.texi: here.
2019-05-19 11:17:44 +02:00