]> git.saurik.com Git - bison.git/blame - src/location.h
(symbol_number): Renamed from symbol_number_t.
[bison.git] / src / location.h
CommitLineData
0c15323d 1/* Locations for Bison
8f759107 2 Copyright (C) 2002 Free Software Foundation, Inc.
0c15323d
AD
3
4 This file is part of Bison, the GNU Compiler Compiler.
5
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)
9 any later version.
10
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.
15
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. */
20
21#ifndef LOCATION_H_
22# define LOCATION_H_
23
8f759107
PE
24/* A boundary between two characters. */
25typedef struct
0c15323d 26{
8f759107
PE
27 /* The name of the file that contains the boundary. */
28 char const *file;
29
30 /* The (origin-1) line that contains the boundary. */
31 int line;
32
33 /* The (origin-1) column just after the boundary. This is neither a
34 byte count, nor a character count; it is a column count. */
35 int column;
36
37} boundary;
38
39/* Return nonzero if A and B are equal boundaries. */
40static inline bool
41equal_boundaries (boundary a, boundary b)
42{
43 return (a.column == b.column
44 && a.line == b.line
45 && a.file == b.file);
46}
47
48/* A location, that is, a region of source code. */
49typedef struct
50{
51 /* Boundary just before the location starts. */
52 boundary start;
53
54 /* Boundary just after the location ends. */
55 boundary end;
56
69b8cc09 57} location;
8f759107 58
69b8cc09 59#define YYLTYPE location
0c15323d 60
69b8cc09 61extern location const empty_location;
8f759107 62
69b8cc09 63void location_print (FILE *, location);
8f759107
PE
64
65#endif /* ! defined LOCATION_H_ */