Paul Eggert [Sun, 15 Dec 2002 09:20:24 +0000 (09:20 +0000)]
Undo most of the 2002-11-12 yychar -> yytoken patch, as it broke
GCC 3.2.1 (which depends on yychar == YYEMPTY when there is no
lookahead symbol, and which sets yychar in parser actions) and it
disagreed with the Bison documentation. This should fix the bug
reported by Andrew Walrond in
<http://mail.gnu.org/pipermail/bug-bison/2002-December/001949.html>.
(YYTRANSLATE): Don't check for negative argument,
as the caller now does that.
(yyclearin, YYBACKUP, yyparse): Use yychar, not yytoken.
(YYEMPTY): Parenthesize right hand side, since others use it.
(yyparse): Don't assume that our generated code is the only code
that sets yychar.
Paul Eggert [Fri, 13 Dec 2002 09:33:23 +0000 (09:33 +0000)]
Fix a bad interaction with flex 2.5.23 reported by Bruce Lilly in
<http://mail.gnu.org/pipermail/bug-bison/2002-November/001929.html>.
(YYLTYPE, struct yyltype): Do not define unless
locations are requested.
(union yyalloc): Do not depend on YYLTYPE_IS_TRIVIAL unless
locations are requested.
Paul Eggert [Fri, 13 Dec 2002 08:47:15 +0000 (08:47 +0000)]
(uniqstr_print): Now inline. Return bool, not int.
(uniqstr_print_processor): New function, to avoid casts.
(uniqstrs_new, hash_initialize, uniqstrs_do):
Use new functions instead of casting old functions unportably.
(hash_compare_uniqstr): Remove unnecessary casts.
Paul Eggert [Fri, 13 Dec 2002 08:45:38 +0000 (08:45 +0000)]
(state_number_to_vector_number,
symbol_number_to_vector_number):
Now inline functions rather than macros, to avoid casts.
(table_size): Now int, to pacify GCC.
(table_grow, table_ninf_remap): Use signed table size.
(save_row): Don't bother initializing locals when not needed.
(default_goto, goto_actions, pack_vector): Remove unnecessary casts.
Paul Eggert [Fri, 13 Dec 2002 08:44:28 +0000 (08:44 +0000)]
(alloca): Remove; decl no longer needed.
(<stddef.h>): Include, for offsetof.
(<inttypes.>, <stdint.h>): Include if available.
(uintptr_t): New type, if system lacks it.
(CALLOC, MALLOC, REALLOC): New macros.
All uses of XCALLOC, XMALLOC, and XREALLOC changed to use these
new macros.
Paul Eggert [Fri, 13 Dec 2002 08:42:03 +0000 (08:42 +0000)]
(symbol_check_defined,
symbol_check_alias_consistency, symbol_pack, symbol_translation,
hash_compare_symbol, hash_symbol):
Now inline. Return bool, not int.
(symbol_check_defined_processor,
symbol_check_alias_consistency_processor, symbol_pack_processor,
symbol_translation_processor, hash_symbol_comparator,
hash_symbol_hasher): New functions, to avoid casts.
(symbols_new, symbols_do, symbols_check_defined,
symbols_token_translations_init):
Use new functions instead of casting old functions unportably.
(symbol_free): Remove; unused.
(symbol_get): Remove cast in lhs of assignment.
(symbols_do): Now static. Accept generic arguments, not hashing-related ones.
Paul Eggert [Fri, 13 Dec 2002 08:37:52 +0000 (08:37 +0000)]
(state_compare): Now inline. Return bool, not int.
(state_comparator, stage_hasher): New function, to avoid casts.
(state_hash_new): Use new functions instead of casting old functions unportably.
(state_hash_lookup): Use MALLOC rather than alloca, so that we don't
have to worry about alloca.
(TRANSITIONS_ALLOC, ERRS_ALLOC, REDUCTIONS_ALLOC,
STATE_ALLOC): Remove.
(transitions_new, errs_new, reductions_new, state_new): Use malloc
rather than calloc, and use offsetof to avoid allocating slightly
too much storage.
(state_new): Initialize all members.
(state_hash): Use unsigned accumulator, not signed.
Paul Eggert [Fri, 13 Dec 2002 08:29:05 +0000 (08:29 +0000)]
(muscle_m4_output): Now inline. Return bool, not int.
(muscle_m4_output_processor): New function, to avoid casts.
(muscles_m4_output): Use new functions instead
of casting old functions unportably.
Paul Eggert [Fri, 13 Dec 2002 08:26:46 +0000 (08:26 +0000)]
(set_goto_map): Do not subtract from the returned value of malloc.
(add_lookback_edge): Use malloc rather than calloc,
since the resulting storage is always stored into.
Paul Eggert [Fri, 13 Dec 2002 08:25:31 +0000 (08:25 +0000)]
(symbol_number_as_item_number,
item_number_as_symbol_number, rule_number_as_item_number,
item_number_as_rule_number): Now inline functions rather
than macros, to avoid casts.
(int_of_rule_number): Remove; no longer used.
Paul Eggert [Fri, 13 Dec 2002 04:50:32 +0000 (04:50 +0000)]
(derives_compute): Do not subtract NTOKENS from
the pointer DSET returned by malloc; this isn't portable.
Instead, always use DSET[i - NTOKENS] rather than DSET[i].
Similarly for DERIVES.
(derives_compute): Do not bother invoking
int_of_rule_number, since rule numbers are integers.
All uses of XCALLOC, XMALLOC, and XREALLOC changed to use new macros
CALLOC, MALLOC, REALLOC. All uses of XFREE changed to free.
Paul Eggert [Wed, 11 Dec 2002 06:59:06 +0000 (06:59 +0000)]
(G_EXPAND): Renamed from G_STRETCH.
(G_LONG_STRAIGHT_PHASE): Renamed from G_STRAIGHT_PHASE.
(N_EXPAND): Renamed from N_STRETCH.
(G_NODE_ALIGNMENT): Renamed from G_NODE_ALIGNEMENT.
Paul Eggert [Wed, 11 Dec 2002 06:50:40 +0000 (06:50 +0000)]
(state_number): Renamed from state_number_t.
(struct state): Renamed from struct state_s.
(state): Renamed from state_t.
(transitions): Renamed from transitions_t. Unused (and
misspelled) transtion_s tag removed.
(errs): Renamed from errs_t. Unused errs_s tag removed.
(reductions): Renamed from reductions_t. Unused tag
reductions_s removed.
(STATE_NUMBER_MAXIMUM): Renamed from STATE_NUMBER_MAX.
Include "gram.h".
Paul Eggert [Wed, 11 Dec 2002 06:48:18 +0000 (06:48 +0000)]
(<INITIAL>{int}): Use set_errno and get_errno instead of errno.
(<SC_ESCAPED_STRING,SC_ESCAPED_CHARACTER>\\x[0-9abcdefABCDEF]+): Likewise.
(handle_action_dollar, handle_action_at): Likewise.
(obstack_for_string): Renamed from string_obstack.
Paul Eggert [Wed, 11 Dec 2002 06:33:22 +0000 (06:33 +0000)]
(item_number): Renamed from item_number_t.
(rule_number): Renamed from rule_number_t.
(struct rule_s): Remove the "rule_s" part; not used.
(rule): Renamed from rule_t.
(rule_filter): Renamed from rule_filter_t.
(ITEM_NUMBER_MAX, ITEM_NUMBER_MIN, RULE_NUMBER_MAX):
Remove; unused.
Paul Eggert [Mon, 9 Dec 2002 04:48:38 +0000 (04:48 +0000)]
* data/glr.c, data/lalr1.cc, data/yacc.c: Do not use __file__,
since this causes problems when __file__ contains character
sequences like "@" that are treated specially by src/scan-skel.l.
Instead, just use the file's basename. This fixes the bug
reported by Martin Mokrejs in
<http://mail.gnu.org/pipermail/bug-bison/2002-December/001949.html>.
Paul Eggert [Sat, 7 Dec 2002 06:14:27 +0000 (06:14 +0000)]
Include "files.h".
(YY_USER_INIT): Initialize scanner_cursor instead
of *loc.
(STEP): Remove. No longer needed, now that adjust_location does
the work. All uses removed.
(scanner_cursor): New var.
(adjust_location): Renamed from extend_location. It now sets
*loc and adjusts the scanner cursor. All uses changed.
Don't bother testing for CR.
(handle_syncline): Remove location arg; now updates scanner cursor.
All callers changed.
(unexpected_end_of_file): Now accepts start boundary of token or
comment, not location. All callers changed. Update scanner cursor,
not the location.
(SC_AFTER_IDENTIFIER): New state.
(context_state): Renamed from c_context. All uses changed.
(id_loc, code_start, token_start): New local vars.
(<INITIAL,SC_AFTER_IDENTIFIER>): New initial context. Move all
processing of Yacc white space and equivalents here.
(<INITIAL>{id}): Save id_loc. Begin state SC_AFTER_IDENTIFIER
instead of returning ID immediately, since we need to search for
a subsequent colon.
(<INITIAL>"'", "\""): Save token_start.
(<INITIAL>"%{", "{", "%%"): Save code_start.
(<SC_AFTER_IDENTIFIER>): New state, looking for a colon.
(<SC_YACC_COMMENT>, <SC_COMMENT>, <SC_LINE_COMMENT>):
BEGIN context_state at end, not INITIAL.
(<SC_ESCAPED_STRING>"\"", <SC_ESCAPED_CHARACTER>"'",
<SC_BRACED_CODE>"}", <SC_PROLOGUE>"%}", <SC_EPILOGUE><<EOF>>):
Return correct token start.
(<SC_BRACED_CODE,SC_PROLOGUE,SC_EPILOGUE>): Save start boundary when
the start of a character, string or multiline comment is found.