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.
Paul Eggert [Sat, 30 Nov 2002 07:42:37 +0000 (07:42 +0000)]
Emphasize that yylex and yyerror must be declared before being used.
E.g., one should typically declare them in the prologue. Use GNU
coding style in examples. Put "const" consistently after the type it
modifies. Mention that C99 supports "inline". Mention that yyerror
traditionally returns "int".
Paul Eggert [Fri, 29 Nov 2002 08:43:12 +0000 (08:43 +0000)]
(Parser Function, Pure Calling, Error Reporting, Table of Symbols):
%parse-param and %lex-param now take just one argument, the
declaration; the argument name is deduced from the declaration.