mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
(YYRHSLOC): New macro, taken from glr.c.
(YYLLOC_DEFAULT): Use the same macro as glr.c.
This commit is contained in:
33
data/yacc.c
33
data/yacc.c
@@ -510,22 +510,25 @@ while (0)
|
||||
If N is 0, then set CURRENT to the empty location which ends
|
||||
the previous symbol: RHS[0] (always defined). */
|
||||
|
||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||
#ifndef YYLLOC_DEFAULT
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do { \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).first_line = (Rhs)[1].first_line; \
|
||||
(Current).first_column = (Rhs)[1].first_column; \
|
||||
(Current).last_line = (Rhs)[N].last_line; \
|
||||
(Current).last_column = (Rhs)[N].last_column; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).first_line = (Current).last_line = (Rhs)[0].last_line; \
|
||||
(Current).first_column = (Current).last_column = (Rhs)[0].last_column; \
|
||||
} \
|
||||
} while(0)
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
|
||||
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
|
||||
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
|
||||
(Current).last_column = YYRHSLOC(Rhs, N).last_column; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).first_line = (Current).last_line = \
|
||||
YYRHSLOC(Rhs, 0).last_line; \
|
||||
(Current).first_column = (Current).last_column = \
|
||||
YYRHSLOC(Rhs, 0).last_column; \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user