Commit Graph

5114 Commits

Author SHA1 Message Date
Akim Demaille
0904099dd5 regen 2012-12-28 11:37:22 +01:00
Akim Demaille
d2e3c807dc syncline: one line is enough
So far we were issuing two lines for each syncline change:

  /* Line 356 of yacc.c  */
  #line 1 "src/parse-gram.y"

This is a lot of clutter, especially when reading diffs, as these
lines change often.  Fuse them into a single, shorter, line:

  #line 1 "src/parse-gram.y" /* yacc.c:356  */

* data/bison.m4 (b4_syncline): Issue a single line.
Comment improvements.
(b4_sync_start, b4_sync_end): Issue a shorter comment.
* data/c++.m4 (b4_semantic_type_declare): b4_user_code must be
on its own line as it might start with a "#line" directive.
2012-12-28 11:37:22 +01:00
Akim Demaille
258b45c86b regen 2012-12-28 11:37:21 +01:00
Akim Demaille
c5ae8e85aa maint: restore ANSI 89 compliance
* data/bison.m4, src/conflicts.c, src/files.c, src/output.c,
* src/symtab.c: Use /* ... */ comments only.
Declare variables before statements.
2012-12-28 11:37:21 +01:00
Akim Demaille
fd7f0289bc graph: minor simplification
* src/gram.c (print_lhs): Use %*s to indent.
* src/print_graph.c (print_lhs): Use obstack_printf.
Became simple enough to be inlined in...
(print_core): here.
Use a "rule*" instead of an index in "rules[]".
2012-12-28 10:36:54 +01:00
Akim Demaille
510c8497f8 closure, gram: add missing const
* src/closure.h, src/closure.c, src/gram.h, src/gram.c: Add some missing
const where appropriate.
2012-12-28 10:31:15 +01:00
Theophile Ranquet
432a008d34 carets: properly display when no line feed is present
* src/location.c (location_caret): finish the line with one whether or not it
is present in input. Rewrite code without getline.
(cleanup_caret): Reset the caret_info global.
* bootstrap.conf: No longer require getline.
2012-12-27 17:57:03 +01:00
Theophile Ranquet
c1b2677ad0 scanner: reintroduce unput for missing end tokens
Unput was no longer used since a POSIX-compatiblity issue with Flex 2.5.31,
which has been adressed in newer versions of Flex.  See this discussion:
<http://lists.gnu.org/archive/html/bug-bison/2003-04/msg00029.html>

This partially reverts commit aa4180418f.

* src/scan-gram.l (unexpected_end): Here.
* tests/input.at: Adjust for new order of error reports.
2012-12-27 17:57:03 +01:00
Akim Demaille
11aef5e95b tables: scope reduction
* src/tables.c (default_goto): Make it easier to understand.
2012-12-27 10:52:42 +01:00
Akim Demaille
0a9042a652 regen 2012-12-27 10:33:46 +01:00
Akim Demaille
6f0a6f274c skeletons: fix comments
The commit 38de4e570f underquoted the
content of the comments, which resulted in losing square brackets in
the comments.  Besides, some other invocations were underquoting the
effective arguments.

* data/c.m4 (b4_comment_): Properly quote the comment.
(b4_comment_, b4_comment): Move to...
* data/c-like.m4: here, so that...
* data/java.m4: can use it instead of its own copy.
* data/bison.m4 (b4_integral_parser_tables_map): Fix some comments.

* data/lalr1.cc, data/lalr1.java, data/yacc.c: Comment fixes.

* data/lalr1.cc: Reorder a bit to factor some CPP directives.
2012-12-27 10:30:14 +01:00
Akim Demaille
e672a4ba5e maint: which -> whose
Apparently, I was confusing both.

* data/bison.m4, data/c.m4, data/glr.c, data/lalr1.cc, data/yacc.c:
Use "whose" where appropriate.
2012-12-27 09:45:17 +01:00
Akim Demaille
465df9c65c tables: scope reduction
* src/tables.c (matching_state): here.
2012-12-26 18:17:21 +01:00
Akim Demaille
33f7f342c3 tables: scope reduction
* src/tables.c (token_actions): here.
2012-12-26 18:17:20 +01:00
Akim Demaille
c95f5dadd6 tables: scope reduction
* src/tables.c (save_row): here.
2012-12-26 18:14:47 +01:00
Akim Demaille
28be3b8e53 tables: scope reduction
* src/tables.c (save_column, pack_vector): Reduce the scope to
emphasize the structure of the code.
Rename the returned value "res" to make understanding easier.
2012-12-26 18:03:51 +01:00
Akim Demaille
e697f05b35 tables: use size_t where appropriate
These changes aim at making the code easier to understand.

* src/tables.c (tally): This is a size, always >= 0, so make it
a size_t.
2012-12-26 17:55:02 +01:00
Akim Demaille
db598939b8 tables: style changes
* src/tables.c: Prefer < to >.
Fix/complete some comments.
Remove useless parens.
2012-12-26 17:53:01 +01:00
Akim Demaille
64b3612ab1 skeletons: no longer call yylex via a CPP macro
The YYLEX existed only to support YYLEX_PARAM, which is now removed.
This macro was a nuisance, since incorrect yylex calls where pointed
the macro _use_, instead of its definition.

* data/c.m4 (b4_lex_formals, b4_lex): New.
* data/glr.c, data/yacc.c: Use it.
* data/lalr1.cc (b4_lex): New.
Use it.

squash! skeletons: no longer call yylex via a CPP macro
2012-12-26 10:38:59 +01:00
Akim Demaille
40bb6f78f8 YYLEX_PARAM: drop support
* data/yacc.c, doc/bison.texi: Remove YYLEX_PARAM support.
* NEWS: Document it.
2012-12-26 10:38:59 +01:00
Akim Demaille
304b384ea3 examples: minor improvements
* examples/variant.yy: Don't use debug_stream(), obsoleted.
Use <*>.
2012-12-26 10:38:59 +01:00
Akim Demaille
3fd1d6b2f3 skeletons: factor comments about symbols
* data/variant.hh (b4_char_sizeof_): Rename as...
* data/bison.m4 (b4_symbol_tag_comment): this.
Provide more documentation about b4_symbol_*.
2012-12-26 10:38:58 +01:00
Akim Demaille
4d9bdbe384 c: improve the definition of public types
* data/c.m4 (b4_token_enum): Improve comments.
(b4_value_type_define, b4_location_type_define): New, extracted
from...
(b4_declare_yylstype): here.
Separate the typedefs from the union/struct definitions.
2012-12-26 10:38:58 +01:00
Akim Demaille
ae8880deec doc: update variant usage
* doc/bison.texi, examples/variant.yy: Use "%define api.value.type variant",
instead of "%define variant".
2012-12-26 10:31:42 +01:00
Akim Demaille
1a06f28efc tests: check the "%define variant" is deprecated.
* tests/input.at: Rename some AT_SETUP to avoid that
AT_SETUP_STRIP thinks they contain %define directives.
("%define" backward compatibility): Merge tests together
to speed up the test suite, and to make maintenance easier
(multiple AT_CHECK means multiple runs of the test suite to
be sure to have updated all the error messages).
Check the "%define variant" is properly obsoleted.
2012-12-26 10:31:42 +01:00
Akim Demaille
bc6038978f %define variables: support value changes in deprecation
* src/muscle-tab.c (define_directive): Be robust to "assignment"
containing '='.
(muscle_percent_variable_update): Upgrade "variant" to "api.value.type".
Support such upgrade patterns.
Adjust callers.

* data/bison.m4: Use api.value.type for variants.
* tests/c++.at: Adjust tests.
2012-12-23 11:14:11 +01:00
Akim Demaille
53f8e4096d diagnostics: treat obsolete %define variable names as obsolete directives
Instead of

  warning: deprecated %define variable name: 'namespace', use 'api.namespace' [-Wdeprecated]

display (in -fno-caret mode):

  warning: deprecated directive: '%define namespace foo', use '%define api.namespace foo' [-Wdeprecated]

and (in -fcaret mode):

  warning: deprecated directive, use '%define api.namespace toto' [-Wdeprecated]
   %define namespace toto
           ^^^^^^^^^

This is in preparation of cases where not only the variable is
renamed, but the values are too:

  warning: deprecated directive: '%define variant', use '%define api.value.type variant' [-Wdeprecated]

* src/muscle-tab.c (define_directive): New.
(muscle_percent_variable_update): Take the value as argument, and use it
in the diagnostics.
Loop with a pointer instead of an index.
* tests/input.at (%define backward compatibility): Adjust.
2012-12-23 10:27:40 +01:00
Akim Demaille
1dc927a7d4 diagnostics: factor the deprecated directive message
* src/complain.h, src/complain.c (deprecated_directive): New.
* src/muscle-tab.c: Use it.
2012-12-23 10:27:40 +01:00
Akim Demaille
55439a1cea variant: produce stable results
Improve the output by ensuring a well defined order for type switches.

* src/uniqstr.h: Style changes for macro arguments.
(UNIQSTR_CMP): Replace by...
(uniqstr_cmp): this.
* src/uniqstr.c (uniqstr_cmp): New.
Produce well defined results.
* src/output.c: Use it.
2012-12-23 10:23:32 +01:00
Akim Demaille
e38106582f uniqstr: formatting changes
* src/uniqstr.h: Sort functions by object type.
2012-12-23 10:23:32 +01:00
Akim Demaille
acb741cd8c skeletons: fix an error message
* data/bison.m4 (b4_flag_if): Display the invalid value.
2012-12-23 10:23:32 +01:00
Akim Demaille
781eaf908d tests: improve titles
* tests/local.at (AT_SETUP_STRIP): New.
(AT_SETUP): Use it to shorten the test titles: remove %defines, %language
and %skeleton whose arguments suffice.
* tests/synclines.at: Use more precise AT_SETUP.
2012-12-23 10:23:32 +01:00
Akim Demaille
ac826bc4b1 c++: comment changes
* data/c++.m4, data/glr.cc, data/lalr1.cc: Convert some /* ... */
comments to //.
2012-12-23 10:23:14 +01:00
Akim Demaille
38de4e570f c++: use // comments in the output
This is mostly used for the license header, the synclines, and the
generated tables:

-  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.    */
+  // STOS_[STATE-NUM] -- The (internal number of the) accessing
+  // symbol of state STATE-NUM.
   static const unsigned char yystos_[];

* data/c.m4: Comment changes.
(b4_comment_): Expand the text argument.
Before this change, we were actually formatting M4 code as a
C comment, and then expand it.
(b4_comment): Fix the closing of comments: there is no reason to
add the (line) prefix before the closing "*/".
* data/c++.m4 (b4_comment): New.
2012-12-23 09:53:45 +01:00
Akim Demaille
bd04adb4c8 maint: disable sc_prohibit_test_backticks
* cfg.mk: here.
And fix typos.
Reported by Stefano Lattarini.
2012-12-21 18:12:47 +01:00
Akim Demaille
0fe9720964 maint: more syntax-checks
* cfg.mk (sc_prohibit_tab_based_indentation, sc_prohibit_test_backticks)
(sc_preprocessor_indentation, sc_space_before_open_paren): New,
stolen from Coreutils (2e9f5ca4ebbbdb6a9fa2dd3d5add3f7720a172d7).
2012-12-21 17:07:11 +01:00
Akim Demaille
5cd907c478 debug: no longer generate tabs
* src/closure.c, src/derives.c, src/nullable.c, tests/sets.at: Use
spaces.
2012-12-21 16:54:02 +01:00
Akim Demaille
a99ec53eb1 style changes: run cppi
Run it in src/ for a start.

* src/AnnotationList.h, src/InadequacyList.h, src/Sbitset.h,
* src/closure.c, src/complain.h, src/flex-scanner.h, src/getargs.h,
* src/gram.h, src/graphviz.h, src/ielr.h, src/location.h,
* src/muscle-tab.h, src/named-ref.h, src/relation.h, src/scan-code.h,
* src/state.h, src/symtab.h, src/system.h, src/uniqstr.h:
Reindent preprocessor directives.
2012-12-21 16:54:01 +01:00
Akim Demaille
975bdced50 style changes: untabify
* data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl, m4/flex.m4,
* tests/glr-regression.at, tests/torture.at: here.
2012-12-21 16:53:57 +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
7be08dfbe7 variants: prohibit simple copies
The "variant" structure provides a means to store, in a typeless way,
C++ objects.  Manipulating it without provide the type of the stored
content is doomed to failure.  So provide a means to copy in a type
safe way, and prohibit typeless assignments.

* data/c++.m4 (symbol_type::move): New.
* data/lalr1.cc: Use it.
* data/variant.hh (b4_variant_define): Provide variant::copy.
Let variant::operator= abort.
We cannot undefine it, yet, as it is still uses by the implicit
assigment in symbols, which must also be disabled.
2012-12-19 11:30:22 +01:00
Akim Demaille
35f70d169f variant: more assertions
Equip variants with more checking code.  Provide a means to request
includes.

* data/variant.hh (b4_variant_includes): New.
* data/lalr1.cc: Use it.
* data/variant.hh (variant::built): Define at the end, as a private member.
(variant::tname): New.
Somewhat makes "built" useless, but let's keep both for a start, in
case using "typeinfo" is considered unacceptable in some environments.
Fix some formatting issues.
2012-12-19 11:30:22 +01:00
Akim Demaille
7c0d37283d gnulib: update 2012-12-19 11:30:22 +01:00
Akim Demaille
eaf690a700 skeletons: fix output directives
* data/lalr1.cc, data/location.cc, data/glr.cc: Use b4_output_begin.
Broken during a merge.
2012-12-19 11:29:51 +01:00
Akim Demaille
56441943d0 yacc.c: style changes
* data/yacc.c (b4_lex_param): Provide arguments with a name.
2012-12-19 11:26:01 +01:00
Akim Demaille
65e0291619 glr.cc: simplifying the handling of parse/lex params
The fact that glr.cc uses glr.c makes the handling of parse params
more complex, as the parser object of glr.cc must be passed to the
parse function of glr.c.  Yet not all the functions need access to
the parser object.

* data/glr.cc (b4_parse_param_wrap): New.
Use them.
2012-12-19 11:26:00 +01:00
Akim Demaille
ca90437a61 glr: rename lex params
* data/glr.c (b4_lex_param): Rename as...
(b4_lex_formals): this, for consistency.
Provide arguments a name.
(LEX): Adjust.
2012-12-19 11:26:00 +01:00
Akim Demaille
ea45ade792 glr.c: move function declaration earlier
* data/glr.c (yypstack, yypdumpstack): Declare earlier, to make
it easier to call them from other functions.
2012-12-19 11:26:00 +01:00
Akim Demaille
f9f1b3ebbb %define variables: backward compatibility
* src/muscle-tab.c (muscle_percent_variable_update): Accept lex_symbol.
Reported by Roland Levillain.
2012-12-19 11:26:00 +01:00
Akim Demaille
ea9e670d72 diagnostics: improve -fcaret for list of accepted values
Instead of

  input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'pull'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'push'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'both'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^

report

  input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
   %define api.push_pull "neither"
           ^^^^^^^^^^^^^
  input.y:1.9-21:     accepted value: 'pull'
  input.y:1.9-21:     accepted value: 'push'
  input.y:1.9-21:     accepted value: 'both'

* src/complain.h (no_caret): New.
* src/complain.c (error_message): Use it.
* src/muscle-tab.c (muscle_percent_define_check_values): Use it.
* src/scan-skel.l (flag): Ditto.
* tests/input.at: Adjust and check.
2012-12-16 15:16:42 +01:00