2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of Bison, the GNU Compiler Compiler.
6 Bison is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 Bison 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.
16 You should have received a copy of the GNU General Public License
17 along with Bison; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
23 # include "quotearg.h"
25 typedef struct location_s
33 #define YYLTYPE location_t
36 # define LOCATION_RESET(Loc) \
39 (Loc).first_column = (Loc).first_line = 1; \
40 (Loc).last_column = (Loc).last_line = 1; \
43 /* Advance of NUM columns. */
44 # define LOCATION_COLUMNS(Loc, Num) \
46 (Loc).last_column += Num; \
50 /* Advance of NUM lines. */
51 # define LOCATION_LINES(Loc, Num) \
53 (Loc).last_column = 1; \
54 (Loc).last_line += Num; \
58 /* Restart: move the first cursor to the last position. */
59 # define LOCATION_STEP(Loc) \
61 (Loc).first_column = (Loc).last_column; \
62 (Loc).first_line = (Loc).last_line; \
66 /* Output LOC on the stream OUT. */
67 # define LOCATION_PRINT(Out, Loc) \
69 fprintf (stderr, "%s:", quotearg_style (escape_quoting_style, \
71 if ((Loc).first_line != (Loc).last_line) \
72 fprintf (Out, "%d.%d-%d.%d", \
73 (Loc).first_line, (Loc).first_column, \
74 (Loc).last_line, (Loc).last_column - 1); \
75 else if ((Loc).first_column < (Loc).last_column - 1) \
76 fprintf (Out, "%d.%d-%d", (Loc).first_line, \
77 (Loc).first_column, (Loc).last_column - 1); \
79 fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \
84 extern location_t empty_location
;
85 #endif /* !LOCATION_H_ */