mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
27
data/c.m4
27
data/c.m4
@@ -1,4 +1,4 @@
|
||||
m4_divert(-1) -*- C -*-
|
||||
m4_divert(-1) *- Autoconf -*-
|
||||
|
||||
# C M4 Macros for Bison.
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
@@ -122,13 +122,36 @@ m4_map([b4_token_define], [$@])
|
||||
])
|
||||
|
||||
|
||||
## --------------------- ##
|
||||
## Calling C functions. ##
|
||||
## --------------------- ##
|
||||
|
||||
|
||||
# b4_c_function_call(NAME, RETURN-VALUE, [TYPE1, NAME1], ...)
|
||||
# -----------------------------------------------------------
|
||||
# Call the function NAME with arguments NAME1, NAME2 etc.
|
||||
m4_define([b4_c_function_call],
|
||||
[$1 (b4_c_args(m4_shiftn(2, $@)))[]dnl
|
||||
])
|
||||
|
||||
|
||||
# b4_c_args([TYPE1, NAME1], ...)
|
||||
# ------------------------------
|
||||
# Output the arguments NAME1, NAME2...
|
||||
m4_define([b4_c_args],
|
||||
[m4_map_sep([b4_c_arg], [, ], [$@])])
|
||||
|
||||
m4_define([b4_c_arg],
|
||||
[$2])
|
||||
|
||||
|
||||
## ---------------------------------------------- ##
|
||||
## Declaring C functions in both K&R and ANSI-C. ##
|
||||
## ---------------------------------------------- ##
|
||||
|
||||
|
||||
# b4_c_function(NAME, RETURN-VALUE, [TYPE1, NAME1], ...)
|
||||
# ------------------------------------------------
|
||||
# ------------------------------------------------------
|
||||
# Declare the function NAME.
|
||||
m4_define([b4_c_function],
|
||||
[$2
|
||||
|
||||
13
data/yacc.c
13
data/yacc.c
@@ -506,13 +506,14 @@ while (0)
|
||||
|
||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||
|
||||
b4_pure_if(
|
||||
[#ifdef YYLEX_PARAM
|
||||
# define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]), YYLEX_PARAM)
|
||||
#ifdef YYLEX_PARAM
|
||||
# define YYLEX yylex (b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])YYLEX_PARAM)
|
||||
#else
|
||||
# define YYLEX yylex (&yylval[]b4_location_if([, &yylloc]))
|
||||
#endif],
|
||||
[#define YYLEX yylex ()])
|
||||
# define YYLEX b4_c_function_call([yylex],
|
||||
b4_pure_if([[[[]], [[&yylval]]],
|
||||
b4_location_if([[[], [&yylloc]],])])
|
||||
m4_fst(b4_lex_param))
|
||||
#endif
|
||||
|
||||
/* Enable debugging if requested. */
|
||||
#if YYDEBUG
|
||||
|
||||
Reference in New Issue
Block a user