]> git.saurik.com Git - bison.git/blame - data/c.m4
YYPARSE_PARAM: drop support
[bison.git] / data / c.m4
CommitLineData
08af01c2 1 -*- Autoconf -*-
fb8135fa
AD
2
3# C M4 Macros for Bison.
7d424de1 4
34136e65 5# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
fb8135fa 6
f16b0819 7# This program is free software: you can redistribute it and/or modify
fb8135fa 8# it under the terms of the GNU General Public License as published by
f16b0819 9# the Free Software Foundation, either version 3 of the License, or
fb8135fa 10# (at your option) any later version.
f16b0819 11#
fb8135fa
AD
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
f16b0819 16#
fb8135fa 17# You should have received a copy of the GNU General Public License
f16b0819 18# along with this program. If not, see <http://www.gnu.org/licenses/>.
fb8135fa 19
cd735a8c 20m4_include(b4_pkgdatadir/[c-like.m4])
22172d47
AD
21
22# b4_tocpp(STRING)
23# ----------------
24# Convert STRING into a valid C macro name.
25m4_define([b4_tocpp],
26[m4_toupper(m4_bpatsubst(m4_quote($1), [[^a-zA-Z0-9]+], [_]))])
27
28
29# b4_cpp_guard(FILE)
30# ------------------
31# A valid C macro name to use as a CPP header guard for FILE.
32m4_define([b4_cpp_guard],
33[b4_tocpp(m4_defn([b4_prefix])/[$1])])
34
35
36# b4_cpp_guard_open(FILE)
37# b4_cpp_guard_close(FILE)
38# ------------------------
39# Open/close CPP inclusion guards for FILE.
40m4_define([b4_cpp_guard_open],
41[#ifndef b4_cpp_guard([$1])
42# define b4_cpp_guard([$1])])
43
44m4_define([b4_cpp_guard_close],
45[#endif b4_comment([!b4_cpp_guard([$1])])])
46
47
2a8d363a
AD
48## ---------------- ##
49## Identification. ##
50## ---------------- ##
fb8135fa 51
6ab1adbe
AD
52# b4_comment_(TEXT, OPEN, CONTINUE, END)
53# -------------------------------------
30bb2edc
AD
54# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
55# Avoid adding indentation to the first line, as the indentation comes
6ab1adbe
AD
56# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
57#
58# Prefix all the output lines with PREFIX.
59m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
30bb2edc 60\(.\)], [
6ab1adbe
AD
61$3\1])$4])
62
63
64# b4_c_comment(TEXT, [PREFIX])
65# ----------------------------
66# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
67# Avoid adding indentation to the first line, as the indentation comes
68# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]).
69#
70# Prefix all the output lines with PREFIX.
71m4_define([b4_c_comment],
72[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
73
74
75# b4_comment(TEXT, [PREFIX])
76# --------------------------
77# By default, C comments.
78m4_define([b4_comment], [b4_c_comment($@)])
79
fb8135fa 80
2a8d363a
AD
81# b4_identification
82# -----------------
d9df47b6
JD
83# Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or
84# b4_pull_flag if they use the values of the %define variables api.pure or
67212941 85# api.push-pull.
2a8d363a 86m4_define([b4_identification],
d9df47b6
JD
87[[/* Identify Bison output. */
88#define YYBISON 1
2a8d363a 89
55f64b82 90/* Bison version. */
d9df47b6 91#define YYBISON_VERSION "]b4_version["
55f64b82 92
2a8d363a 93/* Skeleton name. */
d9df47b6 94#define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
2a8d363a
AD
95
96/* Pure parsers. */
d9df47b6
JD
97#define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[
98
99/* Push parsers. */
100#define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[
101
102/* Pull parsers. */
103#define YYPULL ]b4_pull_flag])[
d9df47b6 104]])
2a8d363a
AD
105
106
7ec2d4cd
AD
107## ---------------- ##
108## Default values. ##
109## ---------------- ##
110
4b3847c3
AD
111# b4_api_prefix, b4_api_PREFIX
112# ----------------------------
113# Corresponds to %define api.prefix
114b4_percent_define_default([[api.prefix]], [[yy]])
115m4_define([b4_api_prefix],
116[b4_percent_define_get([[api.prefix]])])
117m4_define([b4_api_PREFIX],
118[m4_toupper(b4_api_prefix)])
119
120
121# b4_prefix
122# ---------
123# If the %name-prefix is not given, it is api.prefix.
124m4_define_default([b4_prefix], [b4_api_prefix])
125
1b818f33 126# If the %union is not named, its name is YYSTYPE.
4b3847c3 127m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
7ec2d4cd 128
cd48d21d 129
2a8d363a
AD
130## ------------------------ ##
131## Pure/impure interfaces. ##
132## ------------------------ ##
133
2a8d363a
AD
134# b4_user_args
135# ------------
136m4_define([b4_user_args],
137[m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])])
138
139
140# b4_parse_param
141# --------------
142# If defined, b4_parse_param arrives double quoted, but below we prefer
143# it to be single quoted.
2a8d363a 144m4_define([b4_parse_param],
7ecec4dd 145b4_parse_param)
2a8d363a 146
8f7e3cf9 147
613d8952
AD
148# b4_parse_param_for(DECL, FORMAL, BODY)
149# ---------------------------------------
150# Iterate over the user parameters, binding the declaration to DECL,
151# the formal name to FORMAL, and evaluating the BODY.
152m4_define([b4_parse_param_for],
153[m4_foreach([$1_$2], m4_defn([b4_parse_param]),
6bbb2ed5 154[m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
613d8952
AD
155m4_pushdef([$2], m4_shift($1_$2))dnl
156$3[]dnl
157m4_popdef([$2])dnl
158m4_popdef([$1])dnl
159])])
160
beadb220
AD
161# b4_parse_param_use([VAL], [LOC])
162# --------------------------------
163# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
613d8952 164m4_define([b4_parse_param_use],
1e5d6540
AD
165[m4_ifvaln([$1], [ YYUSE([$1]);])dnl
166b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
beadb220 167b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
613d8952
AD
168])dnl
169])
2a8d363a 170
8e1687ae 171
fb8135fa
AD
172## ------------ ##
173## Data Types. ##
174## ------------ ##
175
a762e609
AD
176# b4_int_type(MIN, MAX)
177# ---------------------
178# Return the smallest int type able to handle numbers ranging from
179# MIN to MAX (included).
180m4_define([b4_int_type],
181[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
f1886bb2 182 b4_ints_in($@, [-128], [127]), [1], [signed char],
a762e609 183
779e7ceb
PE
184 b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
185 b4_ints_in($@, [-32768], [32767]), [1], [short int],
a762e609
AD
186
187 m4_eval([0 <= $1]), [1], [unsigned int],
188
e9690142 189 [int])])
a762e609 190
f1886bb2 191
a762e609
AD
192# b4_int_type_for(NAME)
193# ---------------------
194# Return the smallest int type able to handle numbers ranging from
195# `NAME_min' to `NAME_max' (included).
196m4_define([b4_int_type_for],
197[b4_int_type($1_min, $1_max)])
fb8135fa 198
cf98343c 199
87412882
JD
200# b4_table_value_equals(TABLE, VALUE, LITERAL)
201# --------------------------------------------
202# Without inducing a comparison warning from the compiler, check if the
203# literal value LITERAL equals VALUE from table TABLE, which must have
f2b30bdf
JD
204# TABLE_min and TABLE_max defined. YYID must be defined as an identity
205# function that suppresses warnings about constant conditions.
87412882
JD
206m4_define([b4_table_value_equals],
207[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
208 || m4_indir([b4_]$1[_max]) < $3), [1],
209 [[YYID (0)]],
210 [[((]$2[) == (]$3[))]])])
cf98343c 211
ef51bfa7 212
8e1687ae
PE
213## ---------##
214## Values. ##
215## ---------##
216
8e1687ae 217
ef51bfa7
AD
218# b4_null_define
219# --------------
220# Portability issues: define a YY_NULL appropriate for the current
221# language (C, C++98, or C++11).
222m4_define([b4_null_define],
223[# ifndef YY_NULL
224# if defined __cplusplus && 201103L <= __cplusplus
225# define YY_NULL nullptr
226# else
227# define YY_NULL 0
228# endif
229# endif[]dnl
230])
231
232
233# b4_null
234# -------
235# Return a null pointer constant.
236m4_define([b4_null], [YY_NULL])
8e1687ae 237
ba206cf4
AD
238# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
239# -------------------------------------------------------------
0991e29b 240# Define "yy<TABLE-NAME>" which contents is CONTENT.
ba206cf4 241m4_define([b4_integral_parser_table_define],
1e5d6540 242[m4_ifvaln([$3], [b4_c_comment([$3], [ ])])dnl
0991e29b
AD
243static const b4_int_type_for([$2]) yy$1[[]] =
244{
245 $2
246};dnl
247])
cf98343c
AD
248
249
fb8135fa
AD
250## ------------------------- ##
251## Assigning token numbers. ##
252## ------------------------- ##
253
e3990e3c
AD
254# b4_token_define(TOKEN-NUM)
255# --------------------------
fb8135fa
AD
256# Output the definition of this token as #define.
257m4_define([b4_token_define],
e3990e3c 258[b4_token_format([#define %s %s], [$1])])
fb8135fa 259
e3990e3c
AD
260# b4_token_defines
261# ----------------
262# Output the definition of the tokens.
cf147260 263m4_define([b4_token_defines],
e3990e3c
AD
264[b4_any_token_visible_if([/* Tokens. */
265m4_join([
266], b4_symbol_map([b4_token_define]))
267])])
cf147260
AD
268
269
e3990e3c
AD
270# b4_token_enum(TOKEN-NUM)
271# ------------------------
fb8135fa
AD
272# Output the definition of this token as an enum.
273m4_define([b4_token_enum],
e3990e3c 274[b4_token_format([%s = %s], [$1])])
fb8135fa
AD
275
276
e3990e3c
AD
277# b4_token_enums
278# --------------
cf147260
AD
279# Output the definition of the tokens (if there are) as enums.
280m4_define([b4_token_enums],
e3990e3c 281[b4_any_token_visible_if([[/* Tokens. */
4b3847c3
AD
282#ifndef ]b4_api_PREFIX[TOKENTYPE
283# define ]b4_api_PREFIX[TOKENTYPE
e3990e3c
AD
284 /* Put the tokens into the symbol table, so that GDB and other debuggers
285 know about them. */
286 enum ]b4_api_prefix[tokentype
287 {
288 ]m4_join([,
289 ],
290 b4_symbol_map([b4_token_enum]))[
291 };
095b9f05 292#endif
4b3847c3 293]])])
cf147260
AD
294
295
e3990e3c
AD
296# b4_token_enums_defines
297# ----------------------
298# Output the definition of the tokens (if there are any) as enums and,
299# if POSIX Yacc is enabled, as #defines.
cf147260 300m4_define([b4_token_enums_defines],
e3990e3c 301[b4_token_enums[]b4_yacc_if([b4_token_defines])])
4a2a22f4
AD
302
303
1fa5d8bb
AD
304## ----------------- ##
305## Semantic Values. ##
306## ----------------- ##
307
308
309# b4_symbol_value(VAL, [TYPE])
310# ----------------------------
311# Given a semantic value VAL ($$, $1 etc.), extract its value of type
312# TYPE if TYPE is given, otherwise just return VAL. The result can be
313# used safetly, it is put in parens to avoid nasty precedence issues.
314# TYPE is *not* put in braces, provide some if needed.
315m4_define([b4_symbol_value],
316[($1[]m4_ifval([$2], [.$2]))])
317
318
ae7453f2 319
71b56f46
AD
320## ---------------------- ##
321## Defining C functions. ##
322## ---------------------- ##
4a2a22f4
AD
323
324
0245f82d
AD
325# b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
326# ----------------------------------------------------------
71b56f46 327# Declare the function NAME in C.
0245f82d 328m4_define([b4_c_function_def],
0245f82d 329[$2
71b56f46 330$1 (b4_c_formals(m4_shift2($@)))[]dnl
0245f82d
AD
331])
332
333
71b56f46
AD
334# b4_c_formals([DECL1, NAME1], ...)
335# ---------------------------------
336# The formal arguments of a C function definition.
337m4_define([b4_c_formals],
6bbb2ed5
EB
338[m4_if([$#], [0], [void],
339 [$#$1], [1], [void],
71b56f46 340 [m4_map_sep([b4_c_formal], [, ], [$@])])])
4a2a22f4 341
71b56f46 342m4_define([b4_c_formal],
0245f82d 343[$1])
4a2a22f4
AD
344
345
4a2a22f4 346
71b56f46
AD
347## ----------------------- ##
348## Declaring C functions. ##
349## ----------------------- ##
21964f43
AD
350
351
0245f82d
AD
352# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
353# -----------------------------------------------------------
354# Declare the function NAME.
355m4_define([b4_c_function_decl],
71b56f46 356[$2 $1 (b4_c_formals(m4_shift2($@)));[]dnl
0245f82d
AD
357])
358
359
360
361
362## --------------------- ##
363## Calling C functions. ##
364## --------------------- ##
365
366
367# b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
368# -----------------------------------------------------------
369# Call the function NAME with arguments NAME1, NAME2 etc.
370m4_define([b4_c_function_call],
a3764451 371[$1 (b4_c_args(m4_shift2($@)))[]dnl
0245f82d
AD
372])
373
374
375# b4_c_args([DECL1, NAME1], ...)
376# ------------------------------
377# Output the arguments NAME1, NAME2...
378m4_define([b4_c_args],
379[m4_map_sep([b4_c_arg], [, ], [$@])])
380
381m4_define([b4_c_arg],
382[$2])
437c2d80
AD
383
384
385## ----------- ##
386## Synclines. ##
387## ----------- ##
388
90b9908d 389# b4_sync_start(LINE, FILE)
8ec0a172 390# -----------------------
90b9908d 391m4_define([b4_sync_start], [[#]line $1 $2])
8ec0a172 392
613d8952
AD
393
394## -------------- ##
395## User actions. ##
396## -------------- ##
397
8e1687ae
PE
398# b4_case(LABEL, STATEMENTS)
399# --------------------------
400m4_define([b4_case],
401[ case $1:
402$2
2141aded 403b4_syncline([@oline@], [@ofile@])
8e1687ae
PE
404 break;])
405
b0400cc6 406
ca2a6d15
PH
407# b4_predicate_case(LABEL, CONDITIONS)
408# ------------------------------------
409m4_define([b4_predicate_case],
410[ case $1:
411 if (! ($2)) YYERROR;
412b4_syncline([@oline@], [@ofile@])
413 break;])
414
415
14740648
PE
416# b4_yydestruct_generate(FUNCTION-DECLARATOR)
417# -------------------------------------------
b0400cc6 418# Generate the "yydestruct" function, which declaration is issued using
71b56f46 419# FUNCTION-DECLARATOR, which may be "b4_c_function_def".
cf147260 420m4_define_default([b4_yydestruct_generate],
b0400cc6
AD
421[[/*-----------------------------------------------.
422| Release the memory associated to this symbol. |
423`-----------------------------------------------*/
424
12ce2df6 425/*ARGSUSED*/
b0400cc6
AD
426]$1([yydestruct],
427 [static void],
a0e68930 428 [[const char *yymsg], [yymsg]],
7bd6c77e 429 [[int yytype], [yytype]],
4b367315 430 [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
327afc7c 431b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
4b367315 432m4_ifset([b4_parse_param], [, b4_parse_param]))[
b0400cc6 433{
1e5d6540
AD
434]b4_parse_param_use([yyvaluep], [yylocationp])dnl
435[ if (!yymsg)
a0e68930
AD
436 yymsg = "Deleting";
437 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
438
b0400cc6
AD
439 switch (yytype)
440 {
3bb21113
AD
441]b4_symbol_foreach([b4_symbol_destructor])dnl
442[ default:
e9690142 443 break;
b0400cc6
AD
444 }
445}]dnl
446])
7bd6c77e
AD
447
448
a0af42fc
AD
449# b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
450# ------------------------------------------------
451# Generate the "yy_symbol_print" function, which declaration is issued using
71b56f46 452# FUNCTION-DECLARATOR, which may be "b4_c_function_def".
a0af42fc
AD
453m4_define_default([b4_yy_symbol_print_generate],
454[[
455/*--------------------------------.
14740648
PE
456| Print this symbol on YYOUTPUT. |
457`--------------------------------*/
7bd6c77e 458
12ce2df6 459/*ARGSUSED*/
a0af42fc 460]$1([yy_symbol_value_print],
7bd6c77e 461 [static void],
e9690142
JD
462 [[FILE *yyoutput], [yyoutput]],
463 [[int yytype], [yytype]],
464 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
50cce58e 465b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
4b367315 466m4_ifset([b4_parse_param], [, b4_parse_param]))[
7bd6c77e 467{
c5026327
AD
468 FILE *yyo = yyoutput;
469]b4_parse_param_use([yyo], [yylocationp])dnl
1e5d6540 470[ if (!yyvaluep)
fc257703
AD
471 return;]
472dnl glr.c does not feature yytoknum.
473m4_if(b4_skeleton, ["yacc.c"],
474[[# ifdef YYPRINT
619404e3
AD
475 if (yytype < YYNTOKENS)
476 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
477# endif
fc257703
AD
478]])dnl
479[ switch (yytype)
7bd6c77e 480 {
3bb21113 481]b4_symbol_foreach([b4_symbol_printer])dnl
3fc16193 482[ default:
e9690142 483 break;
7bd6c77e 484 }
a0af42fc
AD
485}
486
487
488/*--------------------------------.
489| Print this symbol on YYOUTPUT. |
490`--------------------------------*/
491
492]$1([yy_symbol_print],
493 [static void],
e9690142
JD
494 [[FILE *yyoutput], [yyoutput]],
495 [[int yytype], [yytype]],
496 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
50cce58e 497b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
a0af42fc
AD
498m4_ifset([b4_parse_param], [, b4_parse_param]))[
499{
500 if (yytype < YYNTOKENS)
501 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
502 else
503 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
504
327afc7c 505]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
a0af42fc
AD
506 YYFPRINTF (yyoutput, ": ");
507])dnl
508[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
327afc7c 509b4_locations_if([, yylocationp])[]b4_user_args[);
2f4f028d 510 YYFPRINTF (yyoutput, ")");
4b367315
AD
511}]dnl
512])
c0828abf
AD
513
514## -------------- ##
515## Declarations. ##
516## -------------- ##
517
518# b4_declare_yylstype
4b3847c3 519# -------------------
756257ee
AD
520# Declarations that might either go into the header (if --defines) or
521# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
c0828abf 522m4_define([b4_declare_yylstype],
4b3847c3 523[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
c0828abf
AD
524]m4_ifdef([b4_stype],
525[[typedef union ]b4_union_name[
526{
527]b4_user_stype[
4b3847c3
AD
528} ]b4_api_PREFIX[STYPE;
529# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
c0828abf 530[m4_if(b4_tag_seen_flag, 0,
4b3847c3
AD
531[[typedef int ]b4_api_PREFIX[STYPE;
532# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
4b3847c3 533# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
c0828abf
AD
534#endif]b4_locations_if([[
535
4b3847c3
AD
536#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
537typedef struct ]b4_api_PREFIX[LTYPE
c0828abf
AD
538{
539 int first_line;
540 int first_column;
541 int last_line;
542 int last_column;
4b3847c3 543} ]b4_api_PREFIX[LTYPE;
4b3847c3
AD
544# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
545# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
c0828abf 546#endif]])
756257ee 547
4b3847c3
AD
548b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
549]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
c0828abf 550])
56ca3d8f 551
5f108727 552# b4_YYDEBUG_define
56ca3d8f 553# ------------------
5f108727 554m4_define([b4_YYDEBUG_define],
56ca3d8f 555[[/* Enabling traces. */
5f108727
AD
556]m4_if(b4_api_prefix, [yy],
557[[#ifndef YYDEBUG
e436fa67 558# define YYDEBUG ]b4_parse_trace_if([1], [0])[
5f108727
AD
559#endif]],
560[[#ifndef ]b4_api_PREFIX[DEBUG
561# if defined YYDEBUG
56ca3d8f 562#if YYDEBUG
5f108727
AD
563# define ]b4_api_PREFIX[DEBUG 1
564# else
565# define ]b4_api_PREFIX[DEBUG 0
566# endif
567# else /* ! defined YYDEBUG */
ccdc1577 568# define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
5f108727
AD
569# endif /* ! defined ]b4_api_PREFIX[DEBUG */
570#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
571])
572
573# b4_declare_yydebug
574# ------------------
575m4_define([b4_declare_yydebug],
576[b4_YYDEBUG_define[
577#if ]b4_api_PREFIX[DEBUG
56ca3d8f
AD
578extern int ]b4_prefix[debug;
579#endif][]dnl
580])
426903aa
AD
581
582# b4_yylloc_default_define
583# ------------------------
584# Define YYLLOC_DEFAULT.
585m4_define([b4_yylloc_default_define],
586[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
587 If N is 0, then set CURRENT to the empty location which ends
588 the previous symbol: RHS[0] (always defined). */
589
590#ifndef YYLLOC_DEFAULT
591# define YYLLOC_DEFAULT(Current, Rhs, N) \
592 do \
593 if (YYID (N)) \
594 { \
595 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
596 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
597 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
598 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
599 } \
600 else \
601 { \
602 (Current).first_line = (Current).last_line = \
603 YYRHSLOC (Rhs, 0).last_line; \
604 (Current).first_column = (Current).last_column = \
605 YYRHSLOC (Rhs, 0).last_column; \
606 } \
607 while (YYID (0))
608#endif
609]])