Commit Graph

114 Commits

Author SHA1 Message Date
Akim Demaille
e9071366c3 Extract the parsing of user actions from the grammar scanner.
As a consequence, the relation between the grammar scanner and
parser is much simpler.  We can also split "composite tokens" back
into simple tokens.
* src/gram.h (ITEM_NUMBER_MAX, RULE_NUMBER_MAX): New.
* src/scan-gram.l (add_column_width, adjust_location): Move to and
rename as...
* src/location.h, src/location.c (add_column_width)
(location_compute): these.
Fix the column count: the initial column is 0.
(location_print): Be robust to ending column being 0.
* src/location.h (boundary_set): New.
* src/main.c: Adjust to scanner_free being renamed as
gram_scanner_free.
* src/output.c: Include scan-code.h.
* src/parse-gram.y: Include scan-gram.h and scan-code.h.
Use boundary_set.
(PERCENT_DESTRUCTOR, PERCENT_PRINTER, PERCENT_INITIAL_ACTION)
(PERCENT_LEX_PARAM, PERCENT_PARSE_PARAM): Remove the {...} part,
which is now, again, a separate token.
Adjust all dependencies.
Whereever actions with $ and @ are used, use translate_code.
(action): Remove this nonterminal which is now useless.
* src/reader.c: Include assert.h, scan-gram.h and scan-code.h.
(grammar_current_rule_action_append): Use translate_code.
(packgram): Bound check ruleno, itemno, and rule_length.
* src/reader.h (gram_in, gram__flex_debug, scanner_cursor)
(last_string, last_braced_code_loc, max_left_semantic_context)
(scanner_initialize, scanner_free, scanner_last_string_free)
(gram_out, gram_lineno, YY_DECL_): Move to...
* src/scan-gram.h: this new file.
(YY_DECL): Rename as...
(GRAM_DECL): this.
* src/scan-code.h, src/scan-code.l, src/scan-code-c.c: New.
* src/scan-gram.l (gram_get_lineno, gram_get_in, gram_get_out):
(gram_get_leng, gram_get_text, gram_set_lineno, gram_set_in):
(gram_set_out, gram_get_debug, gram_set_debug, gram_lex_destroy):
Move these declarations, and...
(obstack_for_string, STRING_GROW, STRING_FINISH, STRING_FREE):
these to...
* src/flex-scanner.h: this new file.
* src/scan-gram.l (rule_length, rule_length_overflow)
(increment_rule_length): Remove.
(last_braced_code_loc): Rename as...
(gram_last_braced_code_loc): this.
Adjust to the changes of the parser.
Move all the handling of $ and @ into...
* src/scan-code.l: here.
* src/scan-gram.l (handle_dollar, handle_at): Remove.
(handle_action_dollar, handle_action_at): Move to...
* src/scan-code.l: here.
* src/Makefile.am (bison_SOURCES): Add flex-scanner.h,
scan-code.h, scan-code-c.c, scan-gram.h.
(EXTRA_bison_SOURCES): Add scan-code.l.
(BUILT_SOURCES): Add scan-code.c.
(yacc): Be robust to white spaces.
* tests/conflicts.at, tests/input.at, tests/reduce.at,
* tests/regression.at: Adjust the column numbers.
* tests/regression.at: Adjust the error message.
2006-06-06 16:40:06 +00:00
Paul Eggert
e4f0316ae0 Regenerate. 2006-05-27 00:29:38 +00:00
Paul Eggert
566ac1b4a7 Regenerate. 2006-05-21 08:01:24 +00:00
Paul Eggert
aca1717341 Regenerate. 2006-05-19 21:46:46 +00:00
Akim Demaille
4e83ea15f7 * src/output.h, src/output.c (error_verbose): Move to...
* src/getargs.h, src/getargs.c: here.
Sort the flags.
Adjust dependencies.
2006-05-14 19:14:10 +00:00
Paul Eggert
04c12cb83d Regenerate. 2006-05-14 07:01:49 +00:00
Paul Eggert
765f22f0f4 Regenerate. 2006-02-17 00:23:08 +00:00
Joel E. Denny
3f0014152b During deterministic GLR operation, user actions should be able to
influence the parse by changing yychar.  To make this easier to fix and
to make glr.c easier to evolve in general, don't maintain yytoken in
parallel with yychar; just compute yytoken when needed.
* tests/glr-regression.at (Incorrect lookahead during deterministic
GLR): Check that setting yychar in a user action has the intended
effect.
* data/glr.c (yyGLRStack): Remove yytokenp member.
(yyclearin): Don't set *yytokenp.
(yyprocessOneStack, yyreportSyntaxError, yyrecoverSyntaxError): Examine
yychar rather than *yytokenp to determine the current lookahead.
Compute yytoken locally when needed.
(yyparse): Likewise.  Remove the local yytoken that yytokenp used to
point to.

* doc/bison.texinfo (Bison Options): Remove stray sentence fragment
after `--report' documentation.
2006-01-30 11:15:15 +00:00
Paul Eggert
a7086c4f27 Regenerate. 2006-01-30 08:52:20 +00:00
Paul Eggert
bf8b3d9821 Regenerate. 2006-01-23 08:42:45 +00:00
Paul Eggert
2e4c30fa07 Regenerate. 2006-01-04 23:40:11 +00:00
Paul Eggert
f52b276c55 Regenerate. 2006-01-03 22:39:33 +00:00
Akim Demaille
8f3596a633 * src/reader.c (grammar_current_rule_check): Also check that $$
is used.
Take the rule to check as argument, hence rename as...
(grammar_rule_check): this.
* src/reader.h, src/reader.c (grammar_rule_begin, grammar_rule_end):
Rename as...
(grammar_rule_begin, grammar_rule_end): these, for consistency.
(grammar_midrule_action, grammar_symbol_append): Now static.
* tests/torture.at (input): Don't rely on the default action
being always performed.
* tests/calc.at: "Set" $$ even when the action is "cut" with
YYERROR or other.
* tests/actions.at (Exotic Dollars): Instead of using unused
values, check that the warning is issued.
2005-12-27 17:50:00 +00:00
Paul Eggert
3b0ffc7ec1 Regenerate. 2005-12-23 00:24:39 +00:00
Paul Eggert
72c4d3365a Regenerate. 2005-12-09 23:53:57 +00:00
Paul Eggert
7029f8927f Regenerate. 2005-12-09 22:44:37 +00:00
Paul Eggert
66809587a7 Regenerate. 2005-12-01 20:04:06 +00:00
Akim Demaille
4b3673159e * data/c.m4 (b4_yydestruct_generate, b4_yysymprint_generate): Pass
the %parse-params.
* data/glr.c (YY_SYMBOL_PRINT, yydestroyGLRState): Adjust.
* data/yacc.c (b4_Pure_if): Rename as...
(b4_yacc_pure_if): this.
(YY_SYMBOL_PRINT, yyparse): Adjust.
* doc/bison.texinfo: Formatting changes.
2005-10-21 11:36:22 +00:00
Paul Eggert
2ed284440f Regenerate. 2005-10-13 06:24:04 +00:00
Akim Demaille
9b8a5ce03b * src/parse-gram.y (version_check): Exit 63 to please missing
(stands for "version mismatch).
* tests/input.at, doc/bison.texinfo: Adjust.
2005-10-12 10:15:12 +00:00
Paul Eggert
52d9d4112f Regenerate. 2005-10-11 05:39:59 +00:00
Paul Eggert
e764d4df76 Regenerate. 2005-10-06 07:18:53 +00:00
Paul Eggert
74e543d21f Regenerate. 2005-10-05 21:28:55 +00:00
Paul Eggert
2aee5b7e1e Regenerate. 2005-10-02 21:25:33 +00:00
Akim Demaille
b50d2359d7 * bootstrap (gnulib_modules): Add strverscmp.
* lib/.cvsignore: Add strverscmp.c, strverscmp.h.
* m4/.cvsignore: Add strverscmp.m4.
* src/parse-gram.y (%require): New token, new rule.
(version_check): New.
* src/scan-gram.l (%require): Adjust.
* tests/input.at (AT_REQUIRE): New.
Use it.
* doc/bison.texinfo (Require Decl): New.
(Calc++ Parser): Use %require.
2005-10-02 18:49:15 +00:00
Akim Demaille
fb9712a962 Alexandre Duret-Lutz <adl@gnu.org>
Move the token type and YYSTYPE in the parser class.
* data/lalr1.cc (stack.hh, location.hh): Include earlier.
(parser::token): New, from the moved free definition of tokens.
(parser::semantic_value): Now a full definition instead of an
indirection to YYSTYPE.
(b4_post_prologue): No longer included in the header file, but
in the implementation file.
* doc/bison.texi (C+ Language Interface): Update.
* src/parse-gram.y: Support unary %define.
* tests/actions.at: Define global_tokens_and_yystype for backward
compatibility until we update the tests.
* tests/calc.at: Idem.
(first_line, first_column, last_line, last_column): Define for lalr1.cc
to simplify the code.
2005-09-30 17:57:05 +00:00
Paul Eggert
58b90cc2d8 Regenerate. 2005-09-21 20:08:58 +00:00
Paul Eggert
2fc90989b7 Regenerate. 2005-09-21 19:54:58 +00:00
Paul Eggert
ac2434287d Regenerate. 2005-09-20 23:09:18 +00:00
Paul Eggert
2abdfeefce Regenerate. 2005-09-20 06:07:30 +00:00
Paul Eggert
f5109f5af0 Regenerate. 2005-09-16 22:55:33 +00:00
Paul Eggert
ec5d1a8a24 Regenerate. 2005-08-22 02:33:18 +00:00
Paul Eggert
19e251af0f Regenerate. 2005-08-22 00:11:30 +00:00
Paul Eggert
e0045d49b6 Regenerate. 2005-07-25 03:41:34 +00:00
Paul Eggert
5f3df3960e Regenerate. 2005-07-24 07:26:45 +00:00
Paul Eggert
9cbfdc9e01 Regenerate. 2005-07-21 20:55:33 +00:00
Paul Eggert
d11e0cfa89 Regenerate. 2005-07-19 07:10:32 +00:00
Paul Eggert
6088a2a04d Regenerate. 2005-07-19 03:38:13 +00:00
Akim Demaille
82b248ada6 * src/parse-gram.y: Use %printer instead of YYPRINT. 2005-07-12 13:54:41 +00:00
Paul Eggert
5f6da1c0f8 Regenerate. 2005-07-09 08:27:02 +00:00
Paul Eggert
0925ebb4fa * data/yacc.c (malloc, free) [defined __cplusplus]: Wrap inside extern "C" {}. 2005-06-09 20:44:28 +00:00
Paul Eggert
73e561d51a Regenerate. 2005-05-30 17:25:18 +00:00
Paul Eggert
4b43d40257 Regenerate. 2005-05-27 23:22:19 +00:00
Paul Eggert
bd134904da Regenerate. 2005-05-22 05:20:48 +00:00
Paul Eggert
0fb669f9d6 Update FSF postal mail address. 2005-05-14 06:49:48 +00:00
Paul Eggert
7768896a25 Regenerate. 2005-05-02 04:56:45 +00:00
Paul Eggert
9f666b5106 Regenerate. 2005-04-17 08:14:52 +00:00
Paul Eggert
2ce37586de Regenerate. 2005-04-16 06:34:20 +00:00
Paul Eggert
ffc9da3a52 Regenerate. 2005-04-14 00:09:11 +00:00
Paul Eggert
4b3017faf2 Regenerate. 2005-03-17 19:22:00 +00:00