Commit Graph

1002 Commits

Author SHA1 Message Date
Akim Demaille
ae7453f2ba Prototype support of %lex-param and %parse-param.
* src/parse-gram.y: Add the definition of the %lex-param and
%parse-param tokens, plus their rules.
Drop the `_' version of %glr-parser.
Add the "," token.
* src/scan-gram.l (INITIAL): Scan them.
* src/muscle_tab.c: Comment changes.
(muscle_insert, muscle_find): Rename `pair' as `probe'.
* src/muscle_tab.h (MUSCLE_INSERT_PREFIX): Remove unused.
(muscle_entry_s): The `value' member is no longer const.
Adjust all dependencies.
* src/muscle_tab.c (muscle_init): Adjust: use
MUSCLE_INSERT_STRING.
Initialize the obstack earlier.
* src/muscle_tab.h, src/muscle_tab.c (muscle_grow)
(muscle_pair_list_grow): New.
* data/c.m4 (b4_c_function_call, b4_c_args): New.
* data/yacc.c (YYLEX): Use b4_c_function_call to honor %lex-param.
* tests/calc.at: Use %locations, not --locations.
(AT_CHECK_CALC_GLR): Use %glr-parser, not %glr_parser.
2002-10-19 14:38:06 +00:00
Akim Demaille
0e57572183 * src/getargs.c (usage): Take status as argument and exit
accordingly.
Report the traditional `Try ... --help' message when status != 0.
(usage, version): Don't take a FILE * as arg, it is pointless.
(getargs): When there is an incorrect number of arguments, make it
an error, and report it GNUlically thanks to `usage ()'.
2002-10-19 14:36:40 +00:00
Akim Demaille
473d0a7567 * src/getargs.h (trace_e): Add trace_scan, and trace_parse.
* src/getargs.c (trace_types, trace_args): Adjust.
* src/reader.c (grammar_current_rule_prec_set)
(grammar_current_rule_dprec_set, grammar_current_rule_merge_set):
Standardize error messages.
And s/@prec/%prec/!
(reader): Use trace_flag to enable scanner/parser debugging,
instead of an adhoc scheme.
* src/scan-gram.l: Remove trailing debugging code.
2002-10-17 17:47:33 +00:00
Paul Eggert
f7737e2e16 (MUSCLE_TAB_H_): Was misspelled as MUSCLE_TAB_H_. 2002-10-17 06:27:41 +00:00
Paul Eggert
24c7b92b25 (AUTOMAKE_OPTIONS): Remove. 2002-10-17 01:29:01 +00:00
Akim Demaille
05846dae07 * src/tables.c (table_ninf_remap): base -> tab.
Reported by Matt Rosing.
2002-10-14 11:38:21 +00:00
Akim Demaille
7ea9a33f3b * src/print.c (print_state): Separate the list of solved conflicts
from the other items.
* tests/conflicts.at (Resolved SR Conflicts): Adjust.
2002-10-13 19:35:59 +00:00
Akim Demaille
ea99527d23 Let nondeterministic skeletons be usable with deterministic
tables.
With the patch, GAWK compiled by GCC without -O2 passes its test
suite using a GLR parser driven by LALR tables.  It fails with -O2
because `struct stat' gives two different answers on my machine:
88 (definition of an auto var) and later 96 (memset on this var).
Hence the stack is badly corrumpted.  The headers inclusion is to
blame: if I move the awk.h inclusion before GLR's system header
inclusion, the two struct stat have the same size.
* src/tables.c (pack_table): Always create conflict_table.
(token_actions): Always create conflict_list.
* data/glr.c (YYFLAG): Remove, unused.
2002-10-13 18:50:40 +00:00
Paul Eggert
3b7d4eb2cd Regenerate. 2002-10-13 09:09:49 +00:00
Paul Eggert
efcb44dd47 (rule_length): New static var.
Use it to keep track of the rule length in the scanner, since
we can't expect the parser to be in lock-step sync with the scanner.
(handle_action_dollar, handle_action_at): Use this var.
2002-10-13 08:38:39 +00:00
Paul Eggert
3f4c0f8017 (grammar_current_rule_check):
Don't worry about the default action if $$ is untyped.
Prevents bogus warnings reported by Jim Gifford in
<http://mail.gnu.org/pipermail/bug-bison/2002-October/001673.html>.
2002-10-13 03:52:53 +00:00
Akim Demaille
eb71459201 * tests/regression.at Characters Escapes): New.
* src/scan-gram.l (SC_ESCAPED_CHARACTER): Accept ' in strings and
characters.
Reported by Jan Nieuwenhuizen.
2002-10-11 11:23:19 +00:00
Paul Eggert
242a6e484e (reader): SHRT_MAX -> SYMBOL_NUMBER_MAX. 2002-10-05 05:47:51 +00:00
Paul Eggert
01eb033cf5 (SYMBOL_NUMBER_MAX): New macro. 2002-10-05 05:47:14 +00:00
Paul Eggert
1c303b00fe (GOTO_NUMBER_MAX): INT_MAX -> SHRT_MAX. 2002-10-05 05:46:42 +00:00
Paul Eggert
f704e33362 (ITEM_NUMBER_MIN): MIN_MAX -> INT_MIN. 2002-10-05 05:46:08 +00:00
Paul Eggert
9abb46d527 (AM_CFLAGS): Renamed from CFLAGS.
(AM_YFLAGS): Renamed from YFLAGS.
2002-10-05 04:54:54 +00:00
Akim Demaille
a75649b395 Remove. 2002-09-27 14:50:35 +00:00
Akim Demaille
b906441c95 Playing with autoscan.
* src/reader.c (get_merge_function): Use xstrdup, not strdup.
* src/files.c (skeleton_find): Remove, unused.
* m4/memcmp.m4: New, from the Coreutils 4.5.1.
* m4/prereq.m4 (jm_PREREQ_QUOTEARG): Run jm_FUNC_MEMCMP.
2002-09-13 16:12:21 +00:00
Akim Demaille
3d38c03a86 * src/parse-gram.y: Associate a human readable string to each
token type.
* tests/regression.at (Invalid inputs): Adjust.
2002-09-10 13:52:33 +00:00
Akim Demaille
427c0dda0c * src/assoc.c, src/closure.c, src/gram.c, src/injections.c,
* src/lalr.c, src/LR0.c, src/relation.c, src/tables.c: Don't
translate maintainer only messages.
2002-09-04 10:18:15 +00:00
Akim Demaille
3f8237696f Typo. 2002-09-04 10:07:33 +00:00
Akim Demaille
9503bbd27d Regen. 2002-09-04 09:58:12 +00:00
Paul Eggert
04b6e11ebb Regenerate. 2002-08-12 15:25:59 +00:00
Paul Eggert
63400d5d02 (table_grow, pack_vector): Wrap strings in _() if
they need translation.
2002-08-12 14:55:23 +00:00
Paul Eggert
04c5cba268 (alloca): Use same pattern as ../lib/error.c.
Do not include <ctype.h>; no longer needed.
Do not include <malloc.h>; no longer needed (and generates
warnings on OpenBSD 3.0).
2002-08-12 14:54:27 +00:00
Paul Eggert
d7163c0a58 (symbol_get): Don't cast LHS of an assignment;
this is a GCC extension and is not portable to other compilers.
2002-08-12 14:53:26 +00:00
Paul Eggert
db2cc12fd0 Wrap strings in _() if they need translation.
Use strings rather than escapes when possible,
to minimize the number of warnings from xgettext.

(handle_action_dollar, handle_action_at): Don't use isdigit,
as it mishandles negative chars and it may not work as expected
outside the C locale.
2002-08-12 14:52:47 +00:00
Paul Eggert
7e78575709 (relation_transpose): Wrap strings in _() if they need translation. 2002-08-12 14:50:38 +00:00
Paul Eggert
f9a85a156a Fix spelling in comment. 2002-08-12 14:49:45 +00:00
Paul Eggert
c81bad8950 Cast result of bindtextdomain and textdomain
to void, to avoid a GCC warning when --disable-nls is in effect.
2002-08-12 14:41:48 +00:00
Paul Eggert
158e69f984 (lookaheads_print): Wrap strings in _() if they need translation. 2002-08-12 14:40:55 +00:00
Paul Eggert
211e7860a2 (injections_compute): Wrap strings in _() if
they need translation.
2002-08-12 14:40:07 +00:00
Paul Eggert
e3fbd37fc0 (grammar_dump): Wrap strings in _() if they need translation.
Do not assume ptrdiff_t fits in int.
2002-08-12 14:39:16 +00:00
Paul Eggert
a11166dddc (compute_header_macro): Remove; unused. 2002-08-12 14:38:04 +00:00
Paul Eggert
9ff012ca23 (strerror_r): Remove decl; not needed.
(strerror): Use same pattern as ../lib/error.c.
2002-08-12 14:36:57 +00:00
Paul Eggert
3d70dbe593 (print_closure, set_firsts, closure): Wrap strings in _() if they need
translation.
2002-08-12 14:36:09 +00:00
Paul Eggert
91e1aa523d (assoc_to_string): Wrap strings in _() if they need translation. 2002-08-12 14:34:51 +00:00
Paul Eggert
00a6930855 (INCLUDES): Do not include from the intl directory, which has been removed. 2002-08-12 14:33:54 +00:00
Paul Eggert
6fc82eafd5 (state_list_append, new_itemsets, get_state, append_states, generate_states):
Wrap strings in _() if they need translation.
2002-08-12 14:33:12 +00:00
Akim Demaille
c8f002c7d3 * src/conflicts.c (conflicts_output): Don't output rules never
reduced here, since anyway that computation doesn't work.
* src/gram.h, src/gram.h (rule_filter_t, rule_useful_p)
(rule_useless_p, rule_never_reduced_p): New.
(grammar_rules_partial_print): Use a filter instead of a range.
Display the title only if needed.
(grammar_rules_print): Adjust.
(grammar_rules_never_reduced_report): New.
* src/tables.c (action_row): Move the computation of rules never
reduced to...
(token_actions): here.
* src/main.c (main): Make the parser before making the report, so
that rules never reduced are computed.
Call grammar_rules_never_reduced_report.
* src/print.c (print_results): Report rules never reduced.
* tests/conflicts.at, tests/reduce.at: Adjust.
2002-08-02 08:05:01 +00:00
Akim Demaille
cd08e51eda Instead of attaching lookaheads and duplicating the rules being
reduced by a state, attach the lookaheads to the reductions.
* src/state.h (state_t): Remove the `lookaheads',
`lookaheads_rule' member.
(reductions_t): Add a `lookaheads' member.
Use a regular array for the `rules'.
* src/state.c (reductions_new): Initialize the lookaheads member
to 0.
(state_rule_lookaheads_print): Adjust.
* src/state.h, src/state.c (state_reductions_find): New.
* src/conflicts.c (resolve_sr_conflict, set_conflicts)
(count_rr_conflicts): Adjust.
* src/lalr.c (LArule): Remove.
(add_lookback_edge): Adjust.
(state_lookaheads_count): New.
(states_lookaheads_initialize): Merge into...
(initialize_LA): this.
(lalr_free): Adjust.
* src/main.c (main): Don't free nullable and derives too early: it
is used by --verbose.
* src/print.c, src/print_graph.c, src/tables.c: Adjust.
2002-08-01 18:14:30 +00:00
Akim Demaille
bb0027a9ac * src/derives.h, src/derives.c (derives): A `rule_t***' instead of
`rule_number_t**'.
(set_derives, free_derives): Rename as...
(derives_compute, derives_free): this.
Adjust all dependencies.
* src/nullable.c (set_nullable, free_nullable): Rename as...
(nullable_compute, nullable_free): these.
(rule_list_t): Store rule_t *, not rule_number_t.
* src/state.c (state_rule_lookaheads_print): Directly compare rule
pointers, instead of their numbers.
* src/main.c (main): Call nullable_free, and derives_free earlier,
as they were lo longer used.
2002-08-01 18:13:29 +00:00
Akim Demaille
3325ddc49c * lib/timevar.c (get_time): Include children time.
* src/lalr.h (LA, LArule): Don't export them: used with the
state_t.
* src/lalr.c (LA, LArule): Static.
* src/lalr.h, src/lalr.c (lalr_free): New.
* src/main.c (main): Call it.
* src/tables.c (pack_vector): Check whether loc is >= to the
table_size, not >.
(pack_tables): Don't free froms, tos, conflict_tos, and pos...
(tables_generate): do it, since that's also it which allocates
them.
Don't free LA and LArule, main does.
2002-08-01 18:12:11 +00:00
Akim Demaille
c6f1a33c06 Separate parser tables computation and output.
* src/output.c (nvectors, base_t, base, base_ninf, conflict_table)
(conflict_list, conflict_list_cnt, table, check, table_ninf)
(yydefgoto, yydefact, high): Move to...
* src/tables.h, src/tables.c: here.
* src/output.c (vector_number_t, VECTOR_NUMBER_MAX)
(VECTOR_NUMBER_MIN, state_number_to_vector_number)
(symbol_number_to_vector_number, nvectors, BASE_MAX, BASE_MIN)
(froms, tos, conflict_tos, tally, width, action_t, ACTION_MAX)
(ACTION_MIN, actrow, order, nentries, pos, conflrow)
(conflict_list_free, table_size, lowzero, table_grow, conflict_row)
(action_row, save_row, token_actions, save_column, default_goto)
(goto_actions, sort_actions, matching_state, pack_vector)
(table_ninf_remap, pack_table, prepare_actions): Move to...
* src/tables.c: here.
* src/tables.h, src/tables.c(tables_generate, tables_free): New.
* src/output.c (token_actions, output_base, output_conflicts)
(output_check): Merge into...
(prepare_actions): this.
(actions_output): Rename as...
(user_actions_output): this.
* src/main.c (main): Call tables_generate and tables_free.
2002-07-31 21:52:00 +00:00
Akim Demaille
1509d42fcb Steal GCC's --time-report support.
* lib/timevar.c, lib/timevar.h, lib/timevar.def: New,
stolen/adjusted from GCC.
* m4/stage.m4: Remove time related checks.
* m4/timevar.m4: New.
* configure.in: Adjust.
* src/system.h: Adjust to using timevar.h.
* src/getargs.h, src/getargs.c: Support trace_time for
--trace=time.
* src/main.c (stage): Remove.
(main): Replace `stage' invocations with timevar calls.
* src/output.c: Insert pertinent timevar calls.
2002-07-31 19:52:13 +00:00
Akim Demaille
273a74fa89 Let --trace have arguments.
* src/getargs.h (enum trace_e): New.
* src/getargs.c (trace_args, trace_types, trace_argmatch): New.
(long_options, short_options): --trace/-T takes an optional
argument.
Change all the uses of trace_flag to reflect the new flags.
* tests/sets.at (Firsts, Nullable, Broken Closure): Use --trace=sets.
Strengthen `stage' portability.
* m4/stage.m4 (BISON_PREREQ_STAGE): New.
* configure.in: Use it.
Don't check for malloc.h and sys/times.h.
* src/system.h: Include them when appropriate.
* src/main.c (stage): Compile only when mallinfo, struct mallinfo,
times and struct tms are available.
2002-07-31 19:49:52 +00:00
Akim Demaille
52489d4445 Normalize conflict related messages.
* src/complain.h, src/complain.c (warn, complain): New.
* src/conflicts.c (conflicts_print): Use them.
(conflict_report_yacc): New, extracted from...
(conflicts_print): here.
* tests/conflicts.at, tests/existing.at: Adjust.
2002-07-30 11:09:59 +00:00
Akim Demaille
e8832397ea Report rules which are never reduced by the parser: those hidden
by conflicts.
* src/LR0.c (save_reductions): Don't make the final state too
different: save its reduction (accept) instead of having a state
without any action (no shift or goto, no reduce).
Note: the final state is now a ``regular'' state, i.e., the
parsers now contain `reduce 0' as default reduction.
Nevertheless, since they decide to `accept' when yystate =
final_state, they still will not reduce rule 0.
* src/print.c (print_actions, print_reduction): Adjust.
* src/output.c (action_row): Track reduced rules.
(token_actions): Report rules never reduced.
* tests/conflicts.at, tests/regression.at: Adjust.
2002-07-30 11:06:50 +00:00
Akim Demaille
caf23d249c `stage' was accidently included in a previous patch.
Initiate its autoconfiscation.
* configure.in: Look for malloc.h and sys/times.h.
* src/main.c (stage): Adjust.
Report only when trace_flag.
2002-07-30 08:15:04 +00:00