]> git.saurik.com Git - bison.git/blob - data/c.m4
glr.cc, lalr1.cc: define b4_shared_declarations
[bison.git] / data / c.m4
1 -*- Autoconf -*-
2
3 # C M4 Macros for Bison.
4
5 # Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
6
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
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.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 m4_include(b4_pkgdatadir/[c-like.m4])
21
22 # b4_tocpp(STRING)
23 # ----------------
24 # Convert STRING into a valid C macro name.
25 m4_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.
32 m4_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.
40 m4_define([b4_cpp_guard_open],
41 [#ifndef b4_cpp_guard([$1])
42 # define b4_cpp_guard([$1])])
43
44 m4_define([b4_cpp_guard_close],
45 [#endif b4_comment([!b4_cpp_guard([$1])])])
46
47
48 ## ---------------- ##
49 ## Identification. ##
50 ## ---------------- ##
51
52 # b4_comment_(TEXT, OPEN, CONTINUE, END)
53 # -------------------------------------
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
56 # from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
57 #
58 # Prefix all the output lines with PREFIX.
59 m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
60 \(.\)], [
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.
71 m4_define([b4_c_comment],
72 [b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
73
74
75 # b4_comment(TEXT, [PREFIX])
76 # --------------------------
77 # By default, C comments.
78 m4_define([b4_comment], [b4_c_comment($@)])
79
80
81 # b4_identification
82 # -----------------
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
85 # api.push-pull.
86 m4_define([b4_identification],
87 [[/* Identify Bison output. */
88 #define YYBISON 1
89
90 /* Bison version. */
91 #define YYBISON_VERSION "]b4_version["
92
93 /* Skeleton name. */
94 #define YYSKELETON_NAME ]b4_skeleton[]m4_ifdef([b4_pure_flag], [[
95
96 /* Pure parsers. */
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])[
104 ]])
105
106
107 ## ---------------- ##
108 ## Default values. ##
109 ## ---------------- ##
110
111 # b4_api_prefix, b4_api_PREFIX
112 # ----------------------------
113 # Corresponds to %define api.prefix
114 b4_percent_define_default([[api.prefix]], [[yy]])
115 m4_define([b4_api_prefix],
116 [b4_percent_define_get([[api.prefix]])])
117 m4_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.
124 m4_define_default([b4_prefix], [b4_api_prefix])
125
126 # If the %union is not named, its name is YYSTYPE.
127 m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
128
129
130 ## ------------------------ ##
131 ## Pure/impure interfaces. ##
132 ## ------------------------ ##
133
134 # b4_user_args
135 # ------------
136 m4_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.
144 m4_define([b4_parse_param],
145 b4_parse_param)
146
147
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.
152 m4_define([b4_parse_param_for],
153 [m4_foreach([$1_$2], m4_defn([b4_parse_param]),
154 [m4_pushdef([$1], m4_unquote(m4_car($1_$2)))dnl
155 m4_pushdef([$2], m4_shift($1_$2))dnl
156 $3[]dnl
157 m4_popdef([$2])dnl
158 m4_popdef([$1])dnl
159 ])])
160
161 # b4_parse_param_use([VAL], [LOC])
162 # --------------------------------
163 # `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
164 m4_define([b4_parse_param_use],
165 [m4_ifvaln([$1], [ YYUSE([$1]);])dnl
166 b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
167 b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
168 ])dnl
169 ])
170
171
172 ## ------------ ##
173 ## Data Types. ##
174 ## ------------ ##
175
176 # b4_int_type(MIN, MAX)
177 # ---------------------
178 # Return the smallest int type able to handle numbers ranging from
179 # MIN to MAX (included).
180 m4_define([b4_int_type],
181 [m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
182 b4_ints_in($@, [-128], [127]), [1], [signed char],
183
184 b4_ints_in($@, [0], [65535]), [1], [unsigned short int],
185 b4_ints_in($@, [-32768], [32767]), [1], [short int],
186
187 m4_eval([0 <= $1]), [1], [unsigned int],
188
189 [int])])
190
191
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).
196 m4_define([b4_int_type_for],
197 [b4_int_type($1_min, $1_max)])
198
199
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
204 # TABLE_min and TABLE_max defined. YYID must be defined as an identity
205 # function that suppresses warnings about constant conditions.
206 m4_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[))]])])
211
212
213 ## ---------##
214 ## Values. ##
215 ## ---------##
216
217
218 # b4_null_define
219 # --------------
220 # Portability issues: define a YY_NULL appropriate for the current
221 # language (C, C++98, or C++11).
222 m4_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.
236 m4_define([b4_null], [YY_NULL])
237
238 # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
239 # -------------------------------------------------------------
240 # Define "yy<TABLE-NAME>" which contents is CONTENT.
241 m4_define([b4_integral_parser_table_define],
242 [m4_ifvaln([$3], [b4_c_comment([$3], [ ])])dnl
243 static const b4_int_type_for([$2]) yy$1[[]] =
244 {
245 $2
246 };dnl
247 ])
248
249
250 ## ------------------------- ##
251 ## Assigning token numbers. ##
252 ## ------------------------- ##
253
254 # b4_token_define(TOKEN-NUM)
255 # --------------------------
256 # Output the definition of this token as #define.
257 m4_define([b4_token_define],
258 [b4_token_format([#define %s %s], [$1])])
259
260 # b4_token_defines
261 # ----------------
262 # Output the definition of the tokens.
263 m4_define([b4_token_defines],
264 [b4_any_token_visible_if([/* Tokens. */
265 m4_join([
266 ], b4_symbol_map([b4_token_define]))
267 ])])
268
269
270 # b4_token_enum(TOKEN-NUM)
271 # ------------------------
272 # Output the definition of this token as an enum.
273 m4_define([b4_token_enum],
274 [b4_token_format([%s = %s], [$1])])
275
276
277 # b4_token_enums
278 # --------------
279 # Output the definition of the tokens (if there are) as enums.
280 m4_define([b4_token_enums],
281 [b4_any_token_visible_if([[/* Tokens. */
282 #ifndef ]b4_api_PREFIX[TOKENTYPE
283 # define ]b4_api_PREFIX[TOKENTYPE
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 };
292 #endif
293 ]])])
294
295
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.
300 m4_define([b4_token_enums_defines],
301 [b4_token_enums[]b4_yacc_if([b4_token_defines])])
302
303
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.
315 m4_define([b4_symbol_value],
316 [($1[]m4_ifval([$2], [.$2]))])
317
318
319
320 ## --------------------------------------------- ##
321 ## Defining C functions in both K&R and ANSI-C. ##
322 ## --------------------------------------------- ##
323
324
325 # b4_modern_c
326 # -----------
327 # A predicate useful in #if to determine whether C is ancient or modern.
328 #
329 # If __STDC__ is defined, the compiler is modern. IBM xlc 7.0 when run
330 # as 'cc' doesn't define __STDC__ (or __STDC_VERSION__) for pedantic
331 # reasons, but it defines __C99__FUNC__ so check that as well.
332 # Microsoft C normally doesn't define these macros, but it defines _MSC_VER.
333 # Consider a C++ compiler to be modern if it defines __cplusplus.
334 #
335 m4_define([b4_c_modern],
336 [[(defined __STDC__ || defined __C99__FUNC__ \
337 || defined __cplusplus || defined _MSC_VER)]])
338
339 # b4_c_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
340 # ----------------------------------------------------------
341 # Declare the function NAME.
342 m4_define([b4_c_function_def],
343 [#if b4_c_modern
344 b4_c_ansi_function_def($@)
345 #else
346 $2
347 $1 (b4_c_knr_formal_names(m4_shift2($@)))
348 b4_c_knr_formal_decls(m4_shift2($@))
349 #endif[]dnl
350 ])
351
352
353 # b4_c_ansi_function_def(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
354 # ---------------------------------------------------------------
355 # Declare the function NAME in ANSI.
356 m4_define([b4_c_ansi_function_def],
357 [$2
358 $1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
359 ])
360
361
362 # b4_c_ansi_formals([DECL1, NAME1], ...)
363 # --------------------------------------
364 # Output the arguments ANSI-C definition.
365 m4_define([b4_c_ansi_formals],
366 [m4_if([$#], [0], [void],
367 [$#$1], [1], [void],
368 [m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
369
370 m4_define([b4_c_ansi_formal],
371 [$1])
372
373
374 # b4_c_knr_formal_names([DECL1, NAME1], ...)
375 # ------------------------------------------
376 # Output the argument names.
377 m4_define([b4_c_knr_formal_names],
378 [m4_map_sep([b4_c_knr_formal_name], [, ], [$@])])
379
380 m4_define([b4_c_knr_formal_name],
381 [$2])
382
383
384 # b4_c_knr_formal_decls([DECL1, NAME1], ...)
385 # ------------------------------------------
386 # Output the K&R argument declarations.
387 m4_define([b4_c_knr_formal_decls],
388 [m4_map_sep([b4_c_knr_formal_decl],
389 [
390 ],
391 [$@])])
392
393 m4_define([b4_c_knr_formal_decl],
394 [ $1;])
395
396
397
398 ## ------------------------------------------------------------ ##
399 ## Declaring (prototyping) C functions in both K&R and ANSI-C. ##
400 ## ------------------------------------------------------------ ##
401
402
403 # b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
404 # -----------------------------------------------------------
405 # Declare the function NAME.
406 m4_define([b4_c_function_decl],
407 [#if b4_c_modern
408 b4_c_ansi_function_decl($@)
409 #else
410 $2 $1 ();
411 #endif[]dnl
412 ])
413
414
415 # b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
416 # ----------------------------------------------------------------
417 # Declare the function NAME.
418 m4_define([b4_c_ansi_function_decl],
419 [$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
420 ])
421
422
423
424
425 ## --------------------- ##
426 ## Calling C functions. ##
427 ## --------------------- ##
428
429
430 # b4_c_function_call(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
431 # -----------------------------------------------------------
432 # Call the function NAME with arguments NAME1, NAME2 etc.
433 m4_define([b4_c_function_call],
434 [$1 (b4_c_args(m4_shift2($@)))[]dnl
435 ])
436
437
438 # b4_c_args([DECL1, NAME1], ...)
439 # ------------------------------
440 # Output the arguments NAME1, NAME2...
441 m4_define([b4_c_args],
442 [m4_map_sep([b4_c_arg], [, ], [$@])])
443
444 m4_define([b4_c_arg],
445 [$2])
446
447
448 ## ----------- ##
449 ## Synclines. ##
450 ## ----------- ##
451
452 # b4_sync_start(LINE, FILE)
453 # -----------------------
454 m4_define([b4_sync_start], [[#]line $1 $2])
455
456
457 ## -------------- ##
458 ## User actions. ##
459 ## -------------- ##
460
461 # b4_case(LABEL, STATEMENTS)
462 # --------------------------
463 m4_define([b4_case],
464 [ case $1:
465 $2
466 b4_syncline([@oline@], [@ofile@])
467 break;])
468
469
470 # b4_predicate_case(LABEL, CONDITIONS)
471 # ------------------------------------
472 m4_define([b4_predicate_case],
473 [ case $1:
474 if (! ($2)) YYERROR;
475 b4_syncline([@oline@], [@ofile@])
476 break;])
477
478
479 # b4_yydestruct_generate(FUNCTION-DECLARATOR)
480 # -------------------------------------------
481 # Generate the "yydestruct" function, which declaration is issued using
482 # FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
483 # or "b4_c_function_def" for K&R.
484 m4_define_default([b4_yydestruct_generate],
485 [[/*-----------------------------------------------.
486 | Release the memory associated to this symbol. |
487 `-----------------------------------------------*/
488
489 /*ARGSUSED*/
490 ]$1([yydestruct],
491 [static void],
492 [[const char *yymsg], [yymsg]],
493 [[int yytype], [yytype]],
494 [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
495 b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
496 m4_ifset([b4_parse_param], [, b4_parse_param]))[
497 {
498 ]b4_parse_param_use([yyvaluep], [yylocationp])dnl
499 [ if (!yymsg)
500 yymsg = "Deleting";
501 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
502
503 switch (yytype)
504 {
505 ]b4_symbol_foreach([b4_symbol_destructor])dnl
506 [ default:
507 break;
508 }
509 }]dnl
510 ])
511
512
513 # b4_yy_symbol_print_generate(FUNCTION-DECLARATOR)
514 # ------------------------------------------------
515 # Generate the "yy_symbol_print" function, which declaration is issued using
516 # FUNCTION-DECLARATOR, which may be "b4_c_ansi_function_def" for ISO C
517 # or "b4_c_function_def" for K&R.
518 m4_define_default([b4_yy_symbol_print_generate],
519 [[
520 /*--------------------------------.
521 | Print this symbol on YYOUTPUT. |
522 `--------------------------------*/
523
524 /*ARGSUSED*/
525 ]$1([yy_symbol_value_print],
526 [static void],
527 [[FILE *yyoutput], [yyoutput]],
528 [[int yytype], [yytype]],
529 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
530 b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
531 m4_ifset([b4_parse_param], [, b4_parse_param]))[
532 {
533 FILE *yyo = yyoutput;
534 ]b4_parse_param_use([yyo], [yylocationp])dnl
535 [ if (!yyvaluep)
536 return;]
537 dnl glr.c does not feature yytoknum.
538 m4_if(b4_skeleton, ["yacc.c"],
539 [[# ifdef YYPRINT
540 if (yytype < YYNTOKENS)
541 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
542 # endif
543 ]])dnl
544 [ switch (yytype)
545 {
546 ]b4_symbol_foreach([b4_symbol_printer])dnl
547 [ default:
548 break;
549 }
550 }
551
552
553 /*--------------------------------.
554 | Print this symbol on YYOUTPUT. |
555 `--------------------------------*/
556
557 ]$1([yy_symbol_print],
558 [static void],
559 [[FILE *yyoutput], [yyoutput]],
560 [[int yytype], [yytype]],
561 [[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
562 b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
563 m4_ifset([b4_parse_param], [, b4_parse_param]))[
564 {
565 if (yytype < YYNTOKENS)
566 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
567 else
568 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
569
570 ]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
571 YYFPRINTF (yyoutput, ": ");
572 ])dnl
573 [ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
574 b4_locations_if([, yylocationp])[]b4_user_args[);
575 YYFPRINTF (yyoutput, ")");
576 }]dnl
577 ])
578
579 ## -------------- ##
580 ## Declarations. ##
581 ## -------------- ##
582
583 # b4_declare_yylstype
584 # -------------------
585 # Declarations that might either go into the header (if --defines) or
586 # in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
587 m4_define([b4_declare_yylstype],
588 [[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
589 ]m4_ifdef([b4_stype],
590 [[typedef union ]b4_union_name[
591 {
592 ]b4_user_stype[
593 } ]b4_api_PREFIX[STYPE;
594 # define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
595 [m4_if(b4_tag_seen_flag, 0,
596 [[typedef int ]b4_api_PREFIX[STYPE;
597 # define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
598 # define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
599 #endif]b4_locations_if([[
600
601 #if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
602 typedef struct ]b4_api_PREFIX[LTYPE
603 {
604 int first_line;
605 int first_column;
606 int last_line;
607 int last_column;
608 } ]b4_api_PREFIX[LTYPE;
609 # define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
610 # define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
611 #endif]])
612
613 b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
614 ]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
615 ])
616
617 # b4_YYDEBUG_define
618 # ------------------
619 m4_define([b4_YYDEBUG_define],
620 [[/* Enabling traces. */
621 ]m4_if(b4_api_prefix, [yy],
622 [[#ifndef YYDEBUG
623 # define YYDEBUG ]b4_parse_trace_if([1], [0])[
624 #endif]],
625 [[#ifndef ]b4_api_PREFIX[DEBUG
626 # if defined YYDEBUG
627 #if YYDEBUG
628 # define ]b4_api_PREFIX[DEBUG 1
629 # else
630 # define ]b4_api_PREFIX[DEBUG 0
631 # endif
632 # else /* ! defined YYDEBUG */
633 # define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
634 # endif /* ! defined ]b4_api_PREFIX[DEBUG */
635 #endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
636 ])
637
638 # b4_declare_yydebug
639 # ------------------
640 m4_define([b4_declare_yydebug],
641 [b4_YYDEBUG_define[
642 #if ]b4_api_PREFIX[DEBUG
643 extern int ]b4_prefix[debug;
644 #endif][]dnl
645 ])
646
647 # b4_yylloc_default_define
648 # ------------------------
649 # Define YYLLOC_DEFAULT.
650 m4_define([b4_yylloc_default_define],
651 [[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
652 If N is 0, then set CURRENT to the empty location which ends
653 the previous symbol: RHS[0] (always defined). */
654
655 #ifndef YYLLOC_DEFAULT
656 # define YYLLOC_DEFAULT(Current, Rhs, N) \
657 do \
658 if (YYID (N)) \
659 { \
660 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
661 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
662 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
663 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
664 } \
665 else \
666 { \
667 (Current).first_line = (Current).last_line = \
668 YYRHSLOC (Rhs, 0).last_line; \
669 (Current).first_column = (Current).last_column = \
670 YYRHSLOC (Rhs, 0).last_column; \
671 } \
672 while (YYID (0))
673 #endif
674 ]])