]>
Commit | Line | Data |
---|---|---|
08af01c2 | 1 | -*- Autoconf -*- |
fb8135fa AD |
2 | |
3 | # C M4 Macros for Bison. | |
1462fcee | 4 | # Copyright (C) 2002, 2004-2010 Free Software Foundation, Inc. |
fb8135fa | 5 | |
f16b0819 | 6 | # This program is free software: you can redistribute it and/or modify |
fb8135fa | 7 | # it under the terms of the GNU General Public License as published by |
f16b0819 | 8 | # the Free Software Foundation, either version 3 of the License, or |
fb8135fa | 9 | # (at your option) any later version. |
f16b0819 | 10 | # |
fb8135fa AD |
11 | # This program is distributed in the hope that it will be useful, |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
f16b0819 | 15 | # |
fb8135fa | 16 | # You should have received a copy of the GNU General Public License |
f16b0819 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb8135fa | 18 | |
2a8d363a AD |
19 | ## ---------------- ## |
20 | ## Identification. ## | |
21 | ## ---------------- ## | |
fb8135fa | 22 | |
90b9908d PB |
23 | # b4_comment(TEXT) |
24 | # ---------------- | |
25 | m4_define([b4_comment], [/* m4_bpatsubst([$1], [ | |
26 | ], [ | |
27 | ]) */]) | |
fb8135fa | 28 | |
2a8d363a AD |
29 | # b4_identification |
30 | # ----------------- | |
d9df47b6 JD |
31 | # Depends on individual skeletons to define b4_pure_flag, b4_push_flag, or |
32 | # b4_pull_flag if they use the values of the %define variables api.pure or | |
812775a0 | 33 | # api.push-pull. |
2a8d363a | 34 | m4_define([b4_identification], |
d9df47b6 JD |
35 | [[/* Identify Bison output. */ |
36 | #define YYBISON 1 | |
2a8d363a | 37 | |
55f64b82 | 38 | /* Bison version. */ |
d9df47b6 | 39 | #define YYBISON_VERSION "]b4_version[" |
55f64b82 | 40 | |
2a8d363a | 41 | /* Skeleton name. */ |
d9df47b6 | 42 | #define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[ |
2a8d363a AD |
43 | |
44 | /* Pure parsers. */ | |
d9df47b6 JD |
45 | #define YYPURE ]b4_pure_flag])[]m4_ifdef([b4_push_flag], [[ |
46 | ||
47 | /* Push parsers. */ | |
48 | #define YYPUSH ]b4_push_flag])[]m4_ifdef([b4_pull_flag], [[ | |
49 | ||
50 | /* Pull parsers. */ | |
51 | #define YYPULL ]b4_pull_flag])[ | |
2a8d363a AD |
52 | |
53 | /* Using locations. */ | |
d9df47b6 JD |
54 | #define YYLSP_NEEDED ]b4_locations_flag[ |
55 | ]]) | |
2a8d363a AD |
56 | |
57 | ||
7ec2d4cd AD |
58 | ## ---------------- ## |
59 | ## Default values. ## | |
60 | ## ---------------- ## | |
61 | ||
1b818f33 AD |
62 | # If the %union is not named, its name is YYSTYPE. |
63 | m4_define_default([b4_union_name], [YYSTYPE]) | |
7ec2d4cd | 64 | |
90b9908d PB |
65 | # If the %name-prefix is not given, it is yy. |
66 | m4_define_default([b4_prefix], [yy]) | |
cd48d21d | 67 | |
2a8d363a AD |
68 | ## ------------------------ ## |
69 | ## Pure/impure interfaces. ## | |
70 | ## ------------------------ ## | |
71 | ||
2a8d363a AD |
72 | # b4_user_args |
73 | # ------------ | |
74 | m4_define([b4_user_args], | |
75 | [m4_ifset([b4_parse_param], [, b4_c_args(b4_parse_param)])]) | |
76 | ||
77 | ||
78 | # b4_parse_param | |
79 | # -------------- | |
80 | # If defined, b4_parse_param arrives double quoted, but below we prefer | |
81 | # it to be single quoted. | |
2a8d363a | 82 | m4_define([b4_parse_param], |
7ecec4dd | 83 | b4_parse_param) |
2a8d363a | 84 | |
8f7e3cf9 | 85 | |
613d8952 AD |
86 | # b4_parse_param_for(DECL, FORMAL, BODY) |
87 | # --------------------------------------- | |
88 | # Iterate over the user parameters, binding the declaration to DECL, | |
89 | # the formal name to FORMAL, and evaluating the BODY. | |
90 | m4_define([b4_parse_param_for], | |
91 | [m4_foreach([$1_$2], m4_defn([b4_parse_param]), | |
6bbb2ed5 | 92 | [m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl |
613d8952 AD |
93 | m4_pushdef([$2], m4_shift($1_$2))dnl |
94 | $3[]dnl | |
95 | m4_popdef([$2])dnl | |
96 | m4_popdef([$1])dnl | |
97 | ])]) | |
98 | ||
99 | # b4_parse_param_use | |
100 | # ------------------ | |
101 | # `YYUSE' all the parse-params. | |
613d8952 AD |
102 | m4_define([b4_parse_param_use], |
103 | [b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); | |
104 | ])dnl | |
105 | ]) | |
2a8d363a | 106 | |
8e1687ae | 107 | |
fb8135fa AD |
108 | ## ------------ ## |
109 | ## Data Types. ## | |
110 | ## ------------ ## | |
111 | ||
a762e609 AD |
112 | # b4_int_type(MIN, MAX) |
113 | # --------------------- | |
114 | # Return the smallest int type able to handle numbers ranging from | |
115 | # MIN to MAX (included). | |
116 | m4_define([b4_int_type], | |
117 | [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char], | |
f1886bb2 | 118 | b4_ints_in($@, [-128], [127]), [1], [signed char], |
a762e609 | 119 | |
779e7ceb PE |
120 | b4_ints_in($@, [0], [65535]), [1], [unsigned short int], |
121 | b4_ints_in($@, [-32768], [32767]), [1], [short int], | |
a762e609 AD |
122 | |
123 | m4_eval([0 <= $1]), [1], [unsigned int], | |
124 | ||
02650b7f | 125 | [int])]) |
a762e609 | 126 | |
f1886bb2 | 127 | |
a762e609 AD |
128 | # b4_int_type_for(NAME) |
129 | # --------------------- | |
130 | # Return the smallest int type able to handle numbers ranging from | |
131 | # `NAME_min' to `NAME_max' (included). | |
132 | m4_define([b4_int_type_for], | |
133 | [b4_int_type($1_min, $1_max)]) | |
fb8135fa | 134 | |
cf98343c | 135 | |
77373efa JD |
136 | # b4_table_value_equals(TABLE, VALUE, LITERAL) |
137 | # -------------------------------------------- | |
138 | # Without inducing a comparison warning from the compiler, check if the | |
139 | # literal value LITERAL equals VALUE from table TABLE, which must have | |
d5eb0826 JD |
140 | # TABLE_min and TABLE_max defined. YYID must be defined as an identity |
141 | # function that suppresses warnings about constant conditions. | |
77373efa JD |
142 | m4_define([b4_table_value_equals], |
143 | [m4_if(m4_eval($3 < m4_indir([b4_]$1[_min]) | |
144 | || m4_indir([b4_]$1[_max]) < $3), [1], | |
145 | [[YYID (0)]], | |
146 | [[((]$2[) == (]$3[))]])]) | |
cf98343c | 147 | |
8e1687ae PE |
148 | ## ---------## |
149 | ## Values. ## | |
150 | ## ---------## | |
151 | ||
152 | # b4_null | |
153 | --------- | |
154 | # Return a null pointer constant. NULL infringes on the user name | |
155 | # space in C, so use 0 rather than NULL. | |
156 | m4_define([b4_null], [0]) | |
157 | ||
158 | ||
cf98343c AD |
159 | |
160 | ||
fb8135fa AD |
161 | ## ------------------------- ## |
162 | ## Assigning token numbers. ## | |
163 | ## ------------------------- ## | |
164 | ||
165 | # b4_token_define(TOKEN-NAME, TOKEN-NUMBER) | |
166 | # ----------------------------------------- | |
167 | # Output the definition of this token as #define. | |
168 | m4_define([b4_token_define], | |
169 | [#define $1 $2 | |
170 | ]) | |
171 | ||
172 | ||
cf147260 AD |
173 | # b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) |
174 | # ------------------------------------------------------- | |
175 | # Output the definition of the tokens (if there are) as #defines. | |
176 | m4_define([b4_token_defines], | |
6bbb2ed5 | 177 | [m4_if([$#$1], [1], [], |
cf147260 AD |
178 | [/* Tokens. */ |
179 | m4_map([b4_token_define], [$@])]) | |
180 | ]) | |
181 | ||
182 | ||
fb8135fa AD |
183 | # b4_token_enum(TOKEN-NAME, TOKEN-NUMBER) |
184 | # --------------------------------------- | |
185 | # Output the definition of this token as an enum. | |
186 | m4_define([b4_token_enum], | |
187 | [$1 = $2]) | |
188 | ||
189 | ||
cf147260 AD |
190 | # b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) |
191 | # ----------------------------------------------------- | |
192 | # Output the definition of the tokens (if there are) as enums. | |
193 | m4_define([b4_token_enums], | |
6bbb2ed5 | 194 | [m4_if([$#$1], [1], [], |
fb8135fa | 195 | [/* Tokens. */ |
6b8c3254 PE |
196 | #ifndef YYTOKENTYPE |
197 | # define YYTOKENTYPE | |
fb8135fa AD |
198 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
199 | know about them. */ | |
200 | enum yytokentype { | |
201 | m4_map_sep([ b4_token_enum], [, | |
202 | ], | |
02650b7f | 203 | [$@]) |
fb8135fa | 204 | }; |
095b9f05 | 205 | #endif |
cf147260 AD |
206 | ])]) |
207 | ||
208 | ||
209 | # b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER) | |
210 | # ------------------------------------------------------------- | |
b931235e JD |
211 | # Output the definition of the tokens (if there are any) as enums and, if POSIX |
212 | # Yacc is enabled, as #defines. | |
cf147260 | 213 | m4_define([b4_token_enums_defines], |
b931235e | 214 | [b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], []) |
fb8135fa | 215 | ]) |
4a2a22f4 AD |
216 | |
217 | ||
ae7453f2 | 218 | |
0245f82d AD |
219 | ## --------------------------------------------- ## |
220 | ## Defining C functions in both K&R and ANSI-C. ## | |
221 | ## --------------------------------------------- ## | |
4a2a22f4 AD |
222 | |
223 | ||
1b9c21fb PE |
224 | # b4_modern_c |
225 | # ----------- | |
226 | # A predicate useful in #if to determine whether C is ancient or modern. | |
227 | # | |
228 | # If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run | |
229 | # as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic | |
230 | # reasons, but it defines __C99__FUNC__ so check that as well. | |
231 | # Microsoft C normally doesn't define these macros, but it defines _MSC_VER. | |
7a0db73e | 232 | # Consider a C++ compiler to be modern if it defines __cplusplus. |
1b9c21fb PE |
233 | # |
234 | m4_define([b4_c_modern], | |
02650b7f PE |
235 | [[(defined __STDC__ || defined __C99__FUNC__ \ |
236 | || defined __cplusplus || defined _MSC_VER)]]) | |
1b9c21fb | 237 | |
0245f82d AD |
238 | # b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...) |
239 | # ---------------------------------------------------------- | |
4a2a22f4 | 240 | # Declare the function NAME. |
0245f82d | 241 | m4_define([b4_c_function_def], |
1b9c21fb | 242 | [#if b4_c_modern |
0245f82d | 243 | b4_c_ansi_function_def($@) |
4a2a22f4 | 244 | #else |
0245f82d | 245 | $2 |
a3764451 EB |
246 | $1 (b4_c_knr_formal_names(m4_shift2($@))) |
247 | b4_c_knr_formal_decls(m4_shift2($@)) | |
4a2a22f4 AD |
248 | #endif[]dnl |
249 | ]) | |
250 | ||
251 | ||
0245f82d AD |
252 | # b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...) |
253 | # --------------------------------------------------------------- | |
254 | # Declare the function NAME in ANSI. | |
255 | m4_define([b4_c_ansi_function_def], | |
256 | [$2 | |
a3764451 | 257 | $1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl |
0245f82d AD |
258 | ]) |
259 | ||
260 | ||
261 | # b4_c_ansi_formals([DECL1, NAME1], ...) | |
262 | # -------------------------------------- | |
4a2a22f4 | 263 | # Output the arguments ANSI-C definition. |
0245f82d | 264 | m4_define([b4_c_ansi_formals], |
6bbb2ed5 EB |
265 | [m4_if([$#], [0], [void], |
266 | [$#$1], [1], [void], | |
02650b7f | 267 | [m4_map_sep([b4_c_ansi_formal], [, ], [$@])])]) |
4a2a22f4 | 268 | |
0245f82d AD |
269 | m4_define([b4_c_ansi_formal], |
270 | [$1]) | |
4a2a22f4 AD |
271 | |
272 | ||
0245f82d AD |
273 | # b4_c_knr_formal_names([DECL1, NAME1], ...) |
274 | # ------------------------------------------ | |
4a2a22f4 | 275 | # Output the argument names. |
0245f82d AD |
276 | m4_define([b4_c_knr_formal_names], |
277 | [m4_map_sep([b4_c_knr_formal_name], [, ], [$@])]) | |
4a2a22f4 | 278 | |
0245f82d | 279 | m4_define([b4_c_knr_formal_name], |
4a2a22f4 AD |
280 | [$2]) |
281 | ||
282 | ||
0245f82d AD |
283 | # b4_c_knr_formal_decls([DECL1, NAME1], ...) |
284 | # ------------------------------------------ | |
4a2a22f4 | 285 | # Output the K&R argument declarations. |
0245f82d AD |
286 | m4_define([b4_c_knr_formal_decls], |
287 | [m4_map_sep([b4_c_knr_formal_decl], | |
02650b7f | 288 | [ |
4a2a22f4 | 289 | ], |
02650b7f | 290 | [$@])]) |
4a2a22f4 | 291 | |
0245f82d AD |
292 | m4_define([b4_c_knr_formal_decl], |
293 | [ $1;]) | |
21964f43 AD |
294 | |
295 | ||
296 | ||
0245f82d AD |
297 | ## ------------------------------------------------------------ ## |
298 | ## Declaring (prototyping) C functions in both K&R and ANSI-C. ## | |
299 | ## ------------------------------------------------------------ ## | |
21964f43 AD |
300 | |
301 | ||
0245f82d AD |
302 | # b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...) |
303 | # ----------------------------------------------------------- | |
304 | # Declare the function NAME. | |
305 | m4_define([b4_c_function_decl], | |
02650b7f | 306 | [#if defined __STDC__ || defined __cplusplus |
0245f82d AD |
307 | b4_c_ansi_function_decl($@) |
308 | #else | |
309 | $2 $1 (); | |
310 | #endif[]dnl | |
311 | ]) | |
21964f43 AD |
312 | |
313 | ||
0245f82d AD |
314 | # b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...) |
315 | # ---------------------------------------------------------------- | |
316 | # Declare the function NAME. | |
317 | m4_define([b4_c_ansi_function_decl], | |
a3764451 | 318 | [$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl |
0245f82d AD |
319 | ]) |
320 | ||
321 | ||
322 | ||
323 | ||
324 | ## --------------------- ## | |
325 | ## Calling C functions. ## | |
326 | ## --------------------- ## | |
327 | ||
328 | ||
329 | # b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...) | |
330 | # ----------------------------------------------------------- | |
331 | # Call the function NAME with arguments NAME1, NAME2 etc. | |
332 | m4_define([b4_c_function_call], | |
a3764451 | 333 | [$1 (b4_c_args(m4_shift2($@)))[]dnl |
0245f82d AD |
334 | ]) |
335 | ||
336 | ||
337 | # b4_c_args([DECL1, NAME1], ...) | |
338 | # ------------------------------ | |
339 | # Output the arguments NAME1, NAME2... | |
340 | m4_define([b4_c_args], | |
341 | [m4_map_sep([b4_c_arg], [, ], [$@])]) | |
342 | ||
343 | m4_define([b4_c_arg], | |
344 | [$2]) | |
437c2d80 AD |
345 | |
346 | ||
347 | ## ----------- ## | |
348 | ## Synclines. ## | |
349 | ## ----------- ## | |
350 | ||
90b9908d | 351 | # b4_sync_start(LINE, FILE) |
8ec0a172 | 352 | # ----------------------- |
90b9908d | 353 | m4_define([b4_sync_start], [[#]line $1 $2]) |
8ec0a172 | 354 | |
613d8952 AD |
355 | |
356 | ## -------------- ## | |
357 | ## User actions. ## | |
358 | ## -------------- ## | |
359 | ||
8e1687ae PE |
360 | # b4_case(LABEL, STATEMENTS) |
361 | # -------------------------- | |
362 | m4_define([b4_case], | |
363 | [ case $1: | |
364 | $2 | |
365 | break;]) | |
366 | ||
b0400cc6 AD |
367 | # b4_symbol_actions(FILENAME, LINENO, |
368 | # SYMBOL-TAG, SYMBOL-NUM, | |
369 | # SYMBOL-ACTION, SYMBOL-TYPENAME) | |
370 | # ------------------------------------------------- | |
371 | m4_define([b4_symbol_actions], | |
60c82948 PE |
372 | [m4_pushdef([b4_dollar_dollar], |
373 | [m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl | |
7bd6c77e | 374 | m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl |
b0400cc6 AD |
375 | case $4: /* $3 */ |
376 | b4_syncline([$2], [$1]) | |
02650b7f | 377 | $5; |
b0400cc6 | 378 | b4_syncline([@oline@], [@ofile@]) |
02650b7f | 379 | break; |
b0400cc6 AD |
380 | m4_popdef([b4_at_dollar])dnl |
381 | m4_popdef([b4_dollar_dollar])dnl | |
382 | ]) | |
383 | ||
384 | ||
14740648 PE |
385 | # b4_yydestruct_generate(FUNCTION-DECLARATOR) |
386 | # ------------------------------------------- | |
b0400cc6 | 387 | # Generate the "yydestruct" function, which declaration is issued using |
14740648 | 388 | # FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C |
b0400cc6 | 389 | # or "b4_c_function_def" for K&R. |
cf147260 | 390 | m4_define_default([b4_yydestruct_generate], |
b0400cc6 AD |
391 | [[/*-----------------------------------------------. |
392 | | Release the memory associated to this symbol. | | |
393 | `-----------------------------------------------*/ | |
394 | ||
12ce2df6 | 395 | /*ARGSUSED*/ |
b0400cc6 AD |
396 | ]$1([yydestruct], |
397 | [static void], | |
a0e68930 | 398 | [[const char *yymsg], [yymsg]], |
7bd6c77e | 399 | [[int yytype], [yytype]], |
4b367315 | 400 | [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl |
327afc7c | 401 | b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl |
4b367315 | 402 | m4_ifset([b4_parse_param], [, b4_parse_param]))[ |
b0400cc6 | 403 | { |
2a4647a3 | 404 | YYUSE (yyvaluep); |
327afc7c | 405 | ]b4_locations_if([ YYUSE (yylocationp); |
613d8952 AD |
406 | ])dnl |
407 | b4_parse_param_use[]dnl | |
408 | [ | |
a0e68930 AD |
409 | if (!yymsg) |
410 | yymsg = "Deleting"; | |
411 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | |
412 | ||
b0400cc6 AD |
413 | switch (yytype) |
414 | { | |
415 | ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[ | |
416 | default: | |
02650b7f | 417 | break; |
b0400cc6 AD |
418 | } |
419 | }]dnl | |
420 | ]) | |
7bd6c77e AD |
421 | |
422 | ||
a0af42fc AD |
423 | # b4_yy_symbol_print_generate(FUNCTION-DECLARATOR) |
424 | # ------------------------------------------------ | |
425 | # Generate the "yy_symbol_print" function, which declaration is issued using | |
14740648 | 426 | # FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C |
7bd6c77e | 427 | # or "b4_c_function_def" for K&R. |
a0af42fc AD |
428 | m4_define_default([b4_yy_symbol_print_generate], |
429 | [[ | |
430 | /*--------------------------------. | |
14740648 PE |
431 | | Print this symbol on YYOUTPUT. | |
432 | `--------------------------------*/ | |
7bd6c77e | 433 | |
12ce2df6 | 434 | /*ARGSUSED*/ |
a0af42fc | 435 | ]$1([yy_symbol_value_print], |
7bd6c77e | 436 | [static void], |
02650b7f PE |
437 | [[FILE *yyoutput], [yyoutput]], |
438 | [[int yytype], [yytype]], | |
50cce58e PE |
439 | [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl |
440 | b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl | |
4b367315 | 441 | m4_ifset([b4_parse_param], [, b4_parse_param]))[ |
7bd6c77e | 442 | { |
05449a2c JD |
443 | if (!yyvaluep) |
444 | return; | |
327afc7c | 445 | ]b4_locations_if([ YYUSE (yylocationp); |
7bd6c77e | 446 | ])dnl |
613d8952 | 447 | b4_parse_param_use[]dnl |
a0af42fc | 448 | [# ifdef YYPRINT |
619404e3 AD |
449 | if (yytype < YYNTOKENS) |
450 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | |
c66dfadd PE |
451 | # else |
452 | YYUSE (yyoutput); | |
619404e3 | 453 | # endif |
7bd6c77e AD |
454 | switch (yytype) |
455 | { | |
3fc16193 AD |
456 | ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl |
457 | [ default: | |
02650b7f | 458 | break; |
7bd6c77e | 459 | } |
a0af42fc AD |
460 | } |
461 | ||
462 | ||
463 | /*--------------------------------. | |
464 | | Print this symbol on YYOUTPUT. | | |
465 | `--------------------------------*/ | |
466 | ||
467 | ]$1([yy_symbol_print], | |
468 | [static void], | |
02650b7f PE |
469 | [[FILE *yyoutput], [yyoutput]], |
470 | [[int yytype], [yytype]], | |
50cce58e PE |
471 | [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl |
472 | b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl | |
a0af42fc AD |
473 | m4_ifset([b4_parse_param], [, b4_parse_param]))[ |
474 | { | |
475 | if (yytype < YYNTOKENS) | |
476 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | |
477 | else | |
478 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | |
479 | ||
327afc7c | 480 | ]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp); |
a0af42fc AD |
481 | YYFPRINTF (yyoutput, ": "); |
482 | ])dnl | |
483 | [ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl | |
327afc7c | 484 | b4_locations_if([, yylocationp])[]b4_user_args[); |
2f4f028d | 485 | YYFPRINTF (yyoutput, ")"); |
4b367315 AD |
486 | }]dnl |
487 | ]) |