Commit Graph

4970 Commits

Author SHA1 Message Date
Theophile Ranquet
85935600ad graphs: address an issue with R/R conflicts
All disabled reductions should now be shown as such.

* src/graphviz.c (output_red): Here.
(conclude_red): New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-18 16:17:10 +02:00
Akim Demaille
d949eefdd3 news: spell check
* NEWS: here.
2012-10-16 15:29:33 +02:00
Akim Demaille
8ea6525e3a Merge branch 'maint'
* origin/maint:
  java: use api.location.type and api.position.type

Conflicts:
	NEWS
	data/java.m4
	doc/bison.texi
	tests/java.at
2012-10-16 15:26:55 +02:00
Akim Demaille
f3bc338643 variables: use singular in %define variable names
See http://lists.gnu.org/archive/html/bison-patches/2012-02/msg00045.html

* doc/bison.texi, src/lalr.c, src/main.c, src/muscle-tab.c,
* src/print.c, src/reader.c, src/tables.c, tests/conflicts.at,
* tests/input.at, tests/reduce.at:
s/lr.default-reductions/lr.default-reduction/
s/lr.keep-unreachable-states/lr.keep-unreachable-state/.
* NEWS: Document.
2012-10-16 14:08:21 +02:00
Akim Demaille
715978d726 java: fixes
* data/java.m4: Remove stray M4 characters.
2012-10-16 11:04:03 +02:00
Akim Demaille
2a6b66c5fd api.tokens.prefix -> api.token.prefix
See
http://lists.gnu.org/archive/html/bison-patches/2012-02/msg00045.html
Note that api.tokens.prefix has not been released, yet.

* NEWS, data/bison.m4, doc/bison.texi, tests/c++.at,
* tests/calc.at, tests/java.at, tests/local.at: Do it.
* src/muscle-tab.c (muscle_percent_variable_update): Ensure
backward compatibility.
2012-10-16 10:51:38 +02:00
Theophile Ranquet
f60321dc59 scan-skel.l: shift complain_args arguments
Because argv[0] is never used, shift it out from the argument list.

* src/complain.c (complain_args): Here.
* src/scan-skel.l (at_complain): Adjust argv and argc.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-15 17:11:50 +02:00
Theophile Ranquet
56f0d1d187 scan-skel.l: formatting changes
* src/scan-skel.l (fail_for_at_directive_too_few_args): Here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-15 17:11:41 +02:00
Akim Demaille
7287be84f1 java: use api.location.type and api.position.type
* data/java.m4: here.
* NEWS, doc/bison.texi, tests/java.at: Adjust.
2012-10-12 13:00:59 +02:00
Akim Demaille
f6b561d9f9 Merge branch 'maint'
* origin/maint:
  tests: check %no-lines
  tests: minor simplification
  graphs: stylistic changes.
  graphs: minor style changes
  graphs: show reductions
  graphs: style: prefix state number with "state"
  graphs: style: use left justification for states
  graphs: style: prefix rules and change shapes
  obstack: import obstack_finish0 from master
  c++: api.location.type
  muscles: a function for backward compatibility
  maint: more macros

Conflicts:
	data/glr.cc
	data/java.m4
	data/lalr1.cc
	doc/bison.texi
	src/muscle-tab.c
	src/system.h
	tests/calc.at
2012-10-12 12:49:57 +02:00
Akim Demaille
e94ca80bbb tests: check %no-lines
* tests/synclines.at: here.
2012-10-12 12:25:53 +02:00
Akim Demaille
d74d8cb6c5 tests: minor simplification
* tests/headers.at (Several parsers): Use *.y even for C++.
2012-10-12 10:09:40 +02:00
Akim Demaille
43eb7674aa graphs: stylistic changes.
* src/graphviz.c (output_red): Comment and formatting changes.
2012-10-11 16:58:03 +02:00
Theophile Ranquet
d79683fa95 graphs: minor style changes
* src/graphviz.c (output_red): Fix C90 issues.
Reduce variable scopes.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-11 16:50:37 +02:00
Theophile Ranquet
83bae26d3f graphs: show reductions
* src/graphviz.c (output_red): New, show reductions on the graph.
(no_reduce_bitset_init): New, initialize a bitset.
(print_token): New, print a lookahead token.
(escape): New, print "foo" as \"foo\" because Dot doesn't like quotes within
a label.

* src/graphviz.h : Adjust.
* src/print_graph.c (print_actions): Call output_red here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-11 15:59:55 +02:00
Theophile Ranquet
9fc99ca350 graphs: style: prefix state number with "state"
* src/print_graph.c (print_core): Here.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-11 15:59:35 +02:00
Theophile Ranquet
a13121f759 graphs: style: use left justification for states
The label text of nodes is centered "by default" (by the use of '\n' as
a line feed). This gives bad readability to the grammar rules shown in
state nodes, a left justification is much nicer. This is done by using '\l'
as the line feed.

In order to allow \l in the DOT file, changes to the quoting system seem
necessary.

* src/print_graph.c (print_core): Escape tokens here, instead of...
* src/graphviz.c (output_node): Here...
(escape): Using this, new.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-11 15:46:43 +02:00
Theophile Ranquet
2be37f19fe graphs: style: prefix rules and change shapes
* src/graphviz.c (start_graph): Use box rather than ellipsis.
* src/print_graph.c (print_core): Prefix rules with their number.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-11 09:31:32 +02:00
Theophile Ranquet
47a31596c6 obstack: import obstack_finish0 from master
* src/system.h (obstack_finish0): New.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-11 09:30:18 +02:00
Akim Demaille
23d13411c8 Merge branch 'maint'
* origin/maint:
  NEWS: warnings with clang
  warnings: avoid warnings from clang
  tests: no longer disable -O compiler options
  yacc.c: initialize yylval in pure-parser mode
  skeletons: style changes
  lalr1.cc: document exception safety
  lalr1.cc: check exception safety of error handling
  lalr1.cc: check (and fix) %printer exception safety
  lalr1.cc: check (and fix) %initial-action exception safety
  lalr1.cc: fix exception safety
  lalr1.cc: check exception safety.
  lalr1.cc: indentation fixes.
  lalr1.cc: don't leave macros define to nothing
  tests: minor improvements
  tests: use $PERL instead of perl
  build: look for Perl in configure.
  tests: fix sed portability issues
  tests: diff -u is not portable

Conflicts:
	data/c.m4
	data/glr.c
	data/lalr1.cc
	data/yacc.c
	doc/Makefile.am
	tests/atlocal.in
	tests/calc.at
2012-10-11 09:12:43 +02:00
Akim Demaille
db8ab2be33 c++: api.location.type
This feature was introduced in 95a2de5695
(which is part of 2.5), but not documented.  Give it a proper name, and
make it public.

* data/c++.m4, data/lalr1.cc, data/glr.cc, data/java.m4: Use
api.location.type instead of location_type.
* src/muscle-tab.c (muscle_percent_variable_update): Map the latter to
the former.
* tests/local.at: Adjust.
* tests/calc.at: Use api.location.type.
Leave tests/java.at with location_type, at least for the time being,
to cover both names.
* doc/bison.texi: Document api.location.type.
(User Defined Location Type): New.
* NEWS: Update.
2012-10-09 15:59:18 +02:00
Akim Demaille
2aa5b25995 muscles: a function for backward compatibility
Based on commit 171ad99d64 from master.

* src/muscle-tab.c (muscle_percent_variable_update): New.
(muscle_percent_define_insert): Use it.
Define the variables with their initial value.
2012-10-09 15:58:37 +02:00
Akim Demaille
211c818502 maint: more macros
* src/output.c (ARRAY_CARDINALITY): Move to...
* src/system.h: here.
(STREQ, STRNEQ): new.
2012-10-09 12:13:09 +02:00
Akim Demaille
c12c4c507d NEWS: warnings with clang
* NEWS: here.
2012-10-08 13:48:13 +02:00
Akim Demaille
34076080cd warnings: avoid warnings from clang
Fix the following warning

  parse-gram.c:2078:14: error: equality comparison with extraneous parentheses
                        [-Werror,-Wparentheses-equality]
    if (((yyn) == (-91)))
         ~~~~~~^~~~~~~~
  parse-gram.c:2078:14: note: remove extraneous parentheses around the
                        comparison to silence this warning
    if (((yyn) == (-91)))
        ~      ^       ~
  parse-gram.c:2078:14: note: use '=' to turn this equality comparison into
                        an assignment
    if (((yyn) == (-91)))
               ^~
               =
  1 error generated.

and the following one:

  input.cc:740:1: error: function declared 'noreturn' should not return
                         [-Werror,-Winvalid-noreturn]
  static void yyMemoryExhausted (yyGLRStack* yystackp)
    __attribute__ ((__noreturn__));
  static void
  yyMemoryExhausted (yyGLRStack* yystackp)
  {
    YYLONGJMP (yystackp->yyexception_buffer, 2);
  }
  ^
  1 warning and 1 error generated.

This is Apple clang version 3.1 (tags/Apple/clang-318.0.61).

* data/c.m4 (b4_table_value_equals): Use (!!(A == B)) instead of (A == B)
to avoid this warning.
Any reasonable compiler should generate the same code.
* src/uniqstr.h (UNIQSTR_EQ): Likewise.
* data/glr.c (LONGJMP): abort after longjmp to pacify clang.
2012-10-08 09:51:52 +02:00
Akim Demaille
321d3e35d5 tests: no longer disable -O compiler options
Tests are running without -O since
f377f69fec because some warnings (about
yylval not being initialized) show only when GCC is given -O2.  The
previous patch fixes the warnings. Run the test suite with compiler
options unmodified.

* tests/atlocal.in (O0CFLAGS, O0CXXFLAGS): Remove, use CFLAGS and
CXXFLAGS.
2012-10-08 09:51:08 +02:00
Paul Eggert
e365aa4c3d yacc.c: initialize yylval in pure-parser mode
See http://lists.gnu.org/archive/html/bison-patches/2012-08/msg00024.html
(spreading over September and October).

* data/yacc.c (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN)
(YY_IGNORE_MAYBE_UNINITIALIZED_END, YYLVAL_INITIALIZE):
New macros.  Use them to suppress an unwanted GCC diagnostic.
2012-10-08 09:47:44 +02:00
Akim Demaille
c5178eb75d skeletons: style changes
* data/yacc.c, data/glr.c: Prefer Title case for (CPP) macro arguments.
2012-10-08 09:34:40 +02:00
Akim Demaille
d3e4409ad1 lalr1.cc: document exception safety
* NEWS: here.
* doc/bison.texi (Destructor Decl, C++ Parser Interface): and there.
2012-10-06 19:53:45 +02:00
Akim Demaille
e8b86af83d lalr1.cc: check exception safety of error handling
* tests/c++.at (Exception safety): Don't use swap here, it
is useless.
Cover more test cases: yyerror, YYERROR, YYABORT, and
error recovery.
(Object): Instead of just keeping a counter of instances, keep
a list of them.
2012-10-06 19:53:45 +02:00
Akim Demaille
25a6ad2f10 lalr1.cc: check (and fix) %printer exception safety
* tests/c++.at (Exception safety): Let the parser support the --debug
option.
On 'p', throw an exception from the %printer.
* data/lalr1.cc (yyparse): Do not display the values we discard, as it
uses %printer, which might have thrown the exception.
2012-10-06 19:53:45 +02:00
Akim Demaille
a26424642b lalr1.cc: check (and fix) %initial-action exception safety
* data/lalr1.cc: Check size > 1, rather than size != 1, when cleaning
the stack, as at the beginning, size is 0.
* tests/c++.at (Exception safety): Check exception safety in
%initial-action.
2012-10-06 19:53:45 +02:00
Akim Demaille
7e1fabbeae lalr1.cc: fix exception safety
lalr1.cc does not reclaim its memory when ended by an exception.

Reported by Oleksii Taran:
http://lists.gnu.org/archive/html/help-bison/2012-09/msg00000.html

* data/lalr1.cc (yyparse): Protect the whole yyparse by a try-catch
block that cleans the stack and the lookahead.
2012-10-06 19:53:45 +02:00
Akim Demaille
cff926615f lalr1.cc: check exception safety.
* tests/c++.at (Exception safety): New.
2012-10-06 19:53:45 +02:00
Akim Demaille
117c794200 lalr1.cc: indentation fixes.
* data/lalr1.cc (yyparse): here.
Untabify a block of code.
2012-10-06 19:53:45 +02:00
Akim Demaille
88322b77b1 lalr1.cc: don't leave macros define to nothing
* data/lalr1.cc (YY_SYMBOL_PRINT, YY_REDUCE_PRINT, YY_STACK_PRINT):
Define to something so that, for instance, "if (foo) YY_SYMBOL_PRINT"
is valid even when !YYDEBUG.
2012-10-06 19:53:45 +02:00
Akim Demaille
535ee0cb54 tests: minor improvements
* tests/c++.at: Space changes.
Use AT_YYERROR_DEFINE.
* tests/local.at (AT_YYERROR_DEFINE): Issue errors on unknown languages.
2012-10-06 19:53:45 +02:00
Akim Demaille
ff020c3061 tests: use $PERL instead of perl
* tests/atlocal.in (PERL): New.
Sort.
* tests/calc.at, tests/input.at, tests/local.at, tests/regression.at,
* tests/skeletons.at, tests/synclines.at, tests/torture.at: here.
2012-10-05 09:34:53 +02:00
Akim Demaille
45fdfd8108 build: look for Perl in configure.
Bison uses "/usr/bin/perl" or "perl" in several places, and it does
not appear to be a problem.  But, at least to make it simpler to
change PERL on the make command line, check for perl in configure.

* configure.ac (PERL): New.
* doc/Doxyfile.in, doc/Makefile.am, tests/bison.in: Use it.
2012-10-05 09:34:52 +02:00
Akim Demaille
a727e7124d tests: fix sed portability issues
Reported by Didier Godefroy,
<http://lists.gnu.org/archive/html/bug-bison/2012-10/msg00005.html>.

* tests/calc.at (AT_CHECK_SPACES): Use Perl.
2012-10-05 09:34:16 +02:00
Akim Demaille
a1a77e1fcc tests: diff -u is not portable
Reported by Didier Godefroy
<http://lists.gnu.org/archive/html/bug-bison/2012-10/msg00006.html>.

* tests/existing.at (AT_LALR1_DIFF_CHECK): Skip if diff -u does not
work.
2012-10-05 08:57:29 +02:00
Akim Demaille
2b45240d6c Merge branch 'maint'
* origin/maint:
  maint: word changes
  lalr1.cc: fix test suite portability
  maint: fix an erroneous include
  tests: check that headers are self contained
  doc: add missing documentation for --report

Conflicts:
	NEWS
	data/location.cc
2012-10-04 17:16:00 +02:00
Akim Demaille
fc5618b338 scan-skel: use the scanner to reject all invalid directives
* src/scan-skel.l: Use a simpler and more consistent pattern escaping
scheme.
Catch all the invalid directives here by just removing the previous
catch-all-but-alphabetical rule.
2012-10-04 17:13:38 +02:00
Theophile Ranquet
92f39ba6dc scan-skel: recognize the @directives directly in scanner
* src/scan-skel.l (at_directive, at_init): New.
(at_ptr): New, function pointer used to call the right at_directive
function (at_basename, etc.).
(outname): Rename as...
(out_name): this, for consistency with out_lineno.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-04 17:13:38 +02:00
Theophile Ranquet
896517cdf0 scan-skel: split @directive functions
* src/scan-skel.l (at_directive_perform): Split as...
(at_basename, at_complain, at_output): these.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-04 17:13:38 +02:00
Theophile Ranquet
c6c8de1609 errors: support indented context info in m4 macros
* TODO: Address the issue, so remove it.
* data/bison.m4: Use b4_error with [[note]] rather than a complain_at
for context information.
* src/complain.c (complain_args): Take an additional argument, an
indentation pointer, to allow the dispatching of context information.
* src/complain.h (complain_args): Adjust prototype.
* src/scan-skel.l (at_directive_perform): Recognize the new @note mark.
* tests/input.at: Adjust.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-04 17:13:38 +02:00
Theophile Ranquet
0505df0cba errors: factor b4_error @directives
Instead of @complain, @warn, and @fatal, use a unique @complain
directive. This directive's first argument is "complain", "warn", etc.

* data/bison.m4 (m4_error): Here.
* src/scan-skel.l (at_directive_perform): Adjust.
(flag): Replace the switch by safer and more explicit if branches.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-04 17:13:38 +02:00
Theophile Ranquet
b999409e09 errors: pointerize complain_at_indent
* src/complain.c (complain_at_indent): Rename as...
(complaint_indent): This, and take the location as a pointer.
* src/complain.h, src/muscle-tab.c, src/reader.c, src/scan-code.l,
src/symtab.c: Adjust.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
2012-10-04 17:13:37 +02:00
Akim Demaille
10b009fa50 maint: word changes
* README-hacking (Typical errors): Improve wording.
2012-10-04 11:45:09 +02:00
Akim Demaille
ec78bdab6d lalr1.cc: fix test suite portability
Reported by Rob Vermaas' Hydra build farm on x86_64-darwin 10.2.0 with
G++ 4.6.3.

* tests/headers.at (Several parsers): Include AT_DATA_SOURCE_PROLOGUE
in the files to compile.
* data/location.cc: Do not include twice string and iostream (once
by position.hh, and then by location.hh).
* README-hacking (Typical errors): Some hints for other maintainers.
2012-10-04 11:42:26 +02:00