1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
$NetBSD: patch-ab,v 1.1 2005/03/01 00:13:44 dmcmahill Exp $
--- src/parser.y.orig 2004-03-16 05:45:43.000000000 +0000
+++ src/parser.y 2005-02-28 21:12:13.000000000 +0000
@@ -62,10 +62,24 @@
values. I need to supply an explicit version to account for the
text field, that otherwise won't be copied. */
-# define YYLLOC_DEFAULT(Current, Rhs, 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; \
- Current.text = Rhs[1].text;
+
+# 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; \
+ (Current).text = YYRHSLOC(Rhs, 1).text; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC(Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC(Rhs, 0).last_column; \
+ (Current).text = YYRHSLOC(Rhs, 0).text; \
+ } \
+ while (0)
%}
|