]>
git.saurik.com Git - bison.git/blob - src/location.h
3 Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
4 Software Foundation, Inc.
6 This file is part of Bison, the GNU Compiler Compiler.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 /* A boundary between two characters. */
29 /* The name of the file that contains the boundary. */
32 /* If nonnegative, the (origin-1) line that contains the boundary.
33 If this is INT_MAX, the line number has overflowed.
35 Meaningless and not displayed if negative.
39 /* If nonnegative, the (origin-1) column just after the boundary.
40 This is neither a byte count, nor a character count; it is a
41 column count. If this is INT_MAX, the column number has
44 Meaningless and not displayed if negative.
50 /* Set the position of \a a. */
52 boundary_set (boundary
*b
, const char *f
, int l
, int c
)
59 /* Return nonzero if A and B are equal boundaries. */
61 equal_boundaries (boundary a
, boundary b
)
63 return (a
.column
== b
.column
65 && UNIQSTR_EQ (a
.file
, b
.file
));
68 /* A location, that is, a region of source code. */
71 /* Boundary just before the location starts. */
74 /* Boundary just after the location ends. */
79 #define YYLTYPE location
81 #define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
82 extern location
const empty_location
;
84 /* Set *LOC and adjust scanner cursor to account for token TOKEN of
86 void location_compute (location
*loc
,
87 boundary
*cur
, char const *token
, size_t size
);
89 void location_print (FILE *out
, location loc
);
91 /* LOC_STR must be formatted as `file:line.column', it will be modified. */
92 void boundary_set_from_string (boundary
*bound
, char *loc_str
);
94 #endif /* ! defined LOCATION_H_ */