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.
This commit is contained in:
Akim Demaille
2002-10-19 14:38:06 +00:00
parent 0e57572183
commit ae7453f2ba
13 changed files with 1322 additions and 1140 deletions

View File

@@ -113,36 +113,42 @@ braced_code_t current_braced_code = action_braced_code;
%token PERCENT_RIGHT "%right"
%token PERCENT_NONASSOC "%nonassoc"
%token PERCENT_EXPECT "%expect"
%token PERCENT_START "%start"
%token PERCENT_PREC "%prec"
%token PERCENT_DPREC "%dprec"
%token PERCENT_MERGE "%merge"
%token PERCENT_VERBOSE "%verbose"
%token PERCENT_ERROR_VERBOSE "%error-verbose"
%token PERCENT_OUTPUT "%output"
%token PERCENT_FILE_PREFIX "%file-prefix"
%token PERCENT_NAME_PREFIX "%name-prefix"
%token PERCENT_DEFINE "%define"
%token PERCENT_PURE_PARSER "%pure-parser"
%token PERCENT_GLR_PARSER "%glr-parser"
/*----------------------.
| Global Declarations. |
`----------------------*/
%token PERCENT_DEFINES "%defines"
%token PERCENT_YACC "%yacc"
%token PERCENT_DEBUG "%debug"
%token PERCENT_LOCATIONS "%locations"
%token PERCENT_NO_LINES "%no-lines"
%token PERCENT_SKELETON "%skeleton"
%token PERCENT_TOKEN_TABLE "%token-table"
%token
PERCENT_DEBUG "%debug"
PERCENT_DEFINE "%define"
PERCENT_DEFINES "%defines"
PERCENT_ERROR_VERBOSE "%error-verbose"
PERCENT_EXPECT "%expect"
PERCENT_FILE_PREFIX "%file-prefix"
PERCENT_GLR_PARSER "%glr-parser"
PERCENT_LEX_PARAM "%lex-param"
PERCENT_LOCATIONS "%locations"
PERCENT_NAME_PREFIX "%name-prefix"
PERCENT_NO_LINES "%no-lines"
PERCENT_OUTPUT "%output"
PERCENT_PARSE_PARAM "%parse-param"
PERCENT_PURE_PARSER "%pure-parser"
PERCENT_SKELETON "%skeleton"
PERCENT_START "%start"
PERCENT_TOKEN_TABLE "%token-table"
PERCENT_VERBOSE "%verbose"
PERCENT_YACC "%yacc"
;
%token TYPE "type"
%token EQUAL "="
%token SEMICOLON ";"
%token COLON ":"
%token COMMA ","
%token PIPE "|"
%token ID "identifier"
%token PERCENT_PERCENT "%%"
@@ -186,12 +192,16 @@ declaration:
| "%error-verbose" { error_verbose = 1; }
| "%expect" INT { expected_conflicts = $2; }
| "%file-prefix" "=" string_content { spec_file_prefix = $3; }
| "%glr-parser" { glr_parser = 1; }
| "%lex-param" string_content "," string_content
{ muscle_pair_list_grow ("lex_param", $2, $4); }
| "%locations" { locations_flag = 1; }
| "%name-prefix" "=" string_content { spec_name_prefix = $3; }
| "%no-lines" { no_lines_flag = 1; }
| "%output" "=" string_content { spec_outfile = $3; }
| "%parse-param" string_content "," string_content
{ muscle_pair_list_grow ("parse_param", $2, $4); }
| "%pure-parser" { pure_parser = 1; }
| "%glr-parser" { glr_parser = 1; }
| "%skeleton" string_content { skeleton = $2; }
| "%token-table" { token_table_flag = 1; }
| "%verbose" { report_flag = 1; }