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.
Paul Eggert [Sat, 7 Dec 2002 05:58:38 +0000 (05:58 +0000)]
Do not include <quotearg.h>; no longer needed.
(boundary): New type.
(location_t): Use it. This allows locations to span file boundaries.
All member uses changed: file -> start.file or end.file (as needed),
first_line -> start.line, first_column -> start.column,
last_line -> end.line, last_column -> end.column.
(equal_boundaries): New function.
(LOCATION_RESET, LOCATION_STEP): Remove.
(LOCATION_PRINT): Remove. All callers changed to use location_print.
(empty_location): Now const.
(location_print): New decl.
Paul Eggert [Sat, 7 Dec 2002 05:57:32 +0000 (05:57 +0000)]
* src/location.c: Include <quotearg.h>.
(empty_location): Now const.
(location_print): New function. Follow the recommendation of the
GNU Coding Standards for locations that span file boundaries.
Paul Eggert [Sat, 7 Dec 2002 05:50:45 +0000 (05:50 +0000)]
(Table of Symbols): YYERROR_VERBOSE should
be #defined in the prologue, not in the Bison declarations.
This fixes Debian Bug 102878, reported by Shaul Karl.
Paul Eggert [Sun, 1 Dec 2002 02:37:56 +0000 (02:37 +0000)]
(no_cr_read, extend_location): Move to epilogue,
and put only a forward declaration in the prologue. This is for
consistency with the other scanner helper functions.