`----------------------*/
%token
+ PERCENT_AFTER_HEADER "%after-header"
+ PERCENT_BEFORE_HEADER "%before-header"
PERCENT_DEBUG "%debug"
PERCENT_DEFAULT_PREC "%default-prec"
PERCENT_DEFINE "%define"
PERCENT_DEFINES "%defines"
+ PERCENT_END_HEADER "%end-header"
PERCENT_ERROR_VERBOSE "%error-verbose"
PERCENT_EXPECT "%expect"
PERCENT_EXPECT_RR "%expect-rr"
PERCENT_REQUIRE "%require"
PERCENT_SKELETON "%skeleton"
PERCENT_START "%start"
+ PERCENT_START_HEADER "%start-header"
PERCENT_TOKEN_TABLE "%token-table"
PERCENT_VERBOSE "%verbose"
PERCENT_YACC "%yacc"
declaration:
grammar_declaration
-| PROLOGUE { prologue_augment (translate_code ($1, @1),
- @1); }
+| PROLOGUE
+ {
+ prologue_augment (translate_code ($1, @1), @1, typed);
+ }
+| "%after-header" "{...}"
+ {
+ /* Remove the '{', and replace the '}' with '\n'. */
+ $2[strlen ($2) - 1] = '\n';
+ prologue_augment (translate_code ($2+1, @2), @2, true);
+ }
+| "%before-header" "{...}"
+ {
+ /* Remove the '{', and replace the '}' with '\n'. */
+ $2[strlen ($2) - 1] = '\n';
+ prologue_augment (translate_code ($2+1, @2), @2, false);
+ }
| "%debug" { debug_flag = true; }
| "%define" string_content
{
}
| "%define" string_content string_content { muscle_insert ($2, $3); }
| "%defines" { defines_flag = true; }
+| "%end-header" "{...}"
+ {
+ /* Remove the '{', and replace the '}' with '\n'. */
+ $2[strlen ($2) - 1] = '\n';
+ muscle_code_grow ("end_header", translate_code ($2+1, @2), @2);
+ }
| "%error-verbose" { error_verbose = true; }
| "%expect" INT { expected_sr_conflicts = $2; }
| "%expect-rr" INT { expected_rr_conflicts = $2; }
| "%pure-parser" { pure_parser = true; }
| "%require" string_content { version_check (&@2, $2); }
| "%skeleton" string_content { skeleton = $2; }
+| "%start-header" "{...}"
+ {
+ /* Remove the '{', and replace the '}' with '\n'. */
+ $2[strlen ($2) - 1] = '\n';
+ muscle_code_grow ("start_header", translate_code ($2+1, @2), @2);
+ }
| "%token-table" { token_table_flag = true; }
| "%verbose" { report_flag = report_states; }
| "%yacc" { yacc_flag = true; }
| rhs symbol
{ grammar_current_rule_symbol_append ($2, @2); }
| rhs "{...}"
- { grammar_current_rule_action_append (gram_last_string,
- gram_last_braced_code_loc); }
+ { grammar_current_rule_action_append ($2, @2); }
| rhs "%prec" symbol
{ grammar_current_rule_prec_set ($3, @3); }
| rhs "%dprec" INT