diff options
Diffstat (limited to 'Solvers/dreal4/bazel-bin/dreal/dr/location.hh')
-rwxr-xr-x | Solvers/dreal4/bazel-bin/dreal/dr/location.hh | 332 |
1 files changed, 332 insertions, 0 deletions
diff --git a/Solvers/dreal4/bazel-bin/dreal/dr/location.hh b/Solvers/dreal4/bazel-bin/dreal/dr/location.hh new file mode 100755 index 00000000..26f50a47 --- /dev/null +++ b/Solvers/dreal4/bazel-bin/dreal/dr/location.hh | |||
@@ -0,0 +1,332 @@ | |||
1 | // A Bison parser, made by GNU Bison 3.5. | ||
2 | |||
3 | // Locations for Bison parsers in C++ | ||
4 | |||
5 | // Copyright (C) 2002-2015, 2018-2019 Free Software Foundation, Inc. | ||
6 | |||
7 | // This program is free software: you can redistribute it and/or modify | ||
8 | // it under the terms of the GNU General Public License as published by | ||
9 | // the Free Software Foundation, either version 3 of the License, or | ||
10 | // (at your option) any later version. | ||
11 | |||
12 | // This program is distributed in the hope that it will be useful, | ||
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | // GNU General Public License for more details. | ||
16 | |||
17 | // You should have received a copy of the GNU General Public License | ||
18 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | |||
20 | // As a special exception, you may create a larger work that contains | ||
21 | // part or all of the Bison parser skeleton and distribute that work | ||
22 | // under terms of your choice, so long as that work isn't itself a | ||
23 | // parser generator using the skeleton or a modified version thereof | ||
24 | // as a parser skeleton. Alternatively, if you modify or redistribute | ||
25 | // the parser skeleton itself, you may (at your option) remove this | ||
26 | // special exception, which will cause the skeleton and the resulting | ||
27 | // Bison output files to be licensed under the GNU General Public | ||
28 | // License without this special exception. | ||
29 | |||
30 | // This special exception was added by the Free Software Foundation in | ||
31 | // version 2.2 of Bison. | ||
32 | |||
33 | /** | ||
34 | ** \file bazel-out/k8-opt/bin/dreal/dr/location.hh | ||
35 | ** Define the dreal::location class. | ||
36 | */ | ||
37 | |||
38 | #ifndef YY_DREAL_BAZEL_OUT_K8_OPT_BIN_DREAL_DR_LOCATION_HH_INCLUDED | ||
39 | # define YY_DREAL_BAZEL_OUT_K8_OPT_BIN_DREAL_DR_LOCATION_HH_INCLUDED | ||
40 | |||
41 | # include <iostream> | ||
42 | # include <string> | ||
43 | |||
44 | # ifndef YY_NULLPTR | ||
45 | # if defined __cplusplus | ||
46 | # if 201103L <= __cplusplus | ||
47 | # define YY_NULLPTR nullptr | ||
48 | # else | ||
49 | # define YY_NULLPTR 0 | ||
50 | # endif | ||
51 | # else | ||
52 | # define YY_NULLPTR ((void*)0) | ||
53 | # endif | ||
54 | # endif | ||
55 | |||
56 | namespace dreal { | ||
57 | #line 58 "bazel-out/k8-opt/bin/dreal/dr/location.hh" | ||
58 | |||
59 | /// A point in a source file. | ||
60 | class position | ||
61 | { | ||
62 | public: | ||
63 | /// Type for line and column numbers. | ||
64 | typedef int counter_type; | ||
65 | |||
66 | /// Construct a position. | ||
67 | explicit position (std::string* f = YY_NULLPTR, | ||
68 | counter_type l = 1, | ||
69 | counter_type c = 1) | ||
70 | : filename (f) | ||
71 | , line (l) | ||
72 | , column (c) | ||
73 | {} | ||
74 | |||
75 | |||
76 | /// Initialization. | ||
77 | void initialize (std::string* fn = YY_NULLPTR, | ||
78 | counter_type l = 1, | ||
79 | counter_type c = 1) | ||
80 | { | ||
81 | filename = fn; | ||
82 | line = l; | ||
83 | column = c; | ||
84 | } | ||
85 | |||
86 | /** \name Line and Column related manipulators | ||
87 | ** \{ */ | ||
88 | /// (line related) Advance to the COUNT next lines. | ||
89 | void lines (counter_type count = 1) | ||
90 | { | ||
91 | if (count) | ||
92 | { | ||
93 | column = 1; | ||
94 | line = add_ (line, count, 1); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /// (column related) Advance to the COUNT next columns. | ||
99 | void columns (counter_type count = 1) | ||
100 | { | ||
101 | column = add_ (column, count, 1); | ||
102 | } | ||
103 | /** \} */ | ||
104 | |||
105 | /// File name to which this position refers. | ||
106 | std::string* filename; | ||
107 | /// Current line number. | ||
108 | counter_type line; | ||
109 | /// Current column number. | ||
110 | counter_type column; | ||
111 | |||
112 | private: | ||
113 | /// Compute max (min, lhs+rhs). | ||
114 | static counter_type add_ (counter_type lhs, counter_type rhs, counter_type min) | ||
115 | { | ||
116 | return lhs + rhs < min ? min : lhs + rhs; | ||
117 | } | ||
118 | }; | ||
119 | |||
120 | /// Add \a width columns, in place. | ||
121 | inline position& | ||
122 | operator+= (position& res, position::counter_type width) | ||
123 | { | ||
124 | res.columns (width); | ||
125 | return res; | ||
126 | } | ||
127 | |||
128 | /// Add \a width columns. | ||
129 | inline position | ||
130 | operator+ (position res, position::counter_type width) | ||
131 | { | ||
132 | return res += width; | ||
133 | } | ||
134 | |||
135 | /// Subtract \a width columns, in place. | ||
136 | inline position& | ||
137 | operator-= (position& res, position::counter_type width) | ||
138 | { | ||
139 | return res += -width; | ||
140 | } | ||
141 | |||
142 | /// Subtract \a width columns. | ||
143 | inline position | ||
144 | operator- (position res, position::counter_type width) | ||
145 | { | ||
146 | return res -= width; | ||
147 | } | ||
148 | |||
149 | /// Compare two position objects. | ||
150 | inline bool | ||
151 | operator== (const position& pos1, const position& pos2) | ||
152 | { | ||
153 | return (pos1.line == pos2.line | ||
154 | && pos1.column == pos2.column | ||
155 | && (pos1.filename == pos2.filename | ||
156 | || (pos1.filename && pos2.filename | ||
157 | && *pos1.filename == *pos2.filename))); | ||
158 | } | ||
159 | |||
160 | /// Compare two position objects. | ||
161 | inline bool | ||
162 | operator!= (const position& pos1, const position& pos2) | ||
163 | { | ||
164 | return !(pos1 == pos2); | ||
165 | } | ||
166 | |||
167 | /** \brief Intercept output stream redirection. | ||
168 | ** \param ostr the destination output stream | ||
169 | ** \param pos a reference to the position to redirect | ||
170 | */ | ||
171 | template <typename YYChar> | ||
172 | std::basic_ostream<YYChar>& | ||
173 | operator<< (std::basic_ostream<YYChar>& ostr, const position& pos) | ||
174 | { | ||
175 | if (pos.filename) | ||
176 | ostr << *pos.filename << ':'; | ||
177 | return ostr << pos.line << '.' << pos.column; | ||
178 | } | ||
179 | |||
180 | /// Two points in a source file. | ||
181 | class location | ||
182 | { | ||
183 | public: | ||
184 | /// Type for line and column numbers. | ||
185 | typedef position::counter_type counter_type; | ||
186 | |||
187 | /// Construct a location from \a b to \a e. | ||
188 | location (const position& b, const position& e) | ||
189 | : begin (b) | ||
190 | , end (e) | ||
191 | {} | ||
192 | |||
193 | /// Construct a 0-width location in \a p. | ||
194 | explicit location (const position& p = position ()) | ||
195 | : begin (p) | ||
196 | , end (p) | ||
197 | {} | ||
198 | |||
199 | /// Construct a 0-width location in \a f, \a l, \a c. | ||
200 | explicit location (std::string* f, | ||
201 | counter_type l = 1, | ||
202 | counter_type c = 1) | ||
203 | : begin (f, l, c) | ||
204 | , end (f, l, c) | ||
205 | {} | ||
206 | |||
207 | |||
208 | /// Initialization. | ||
209 | void initialize (std::string* f = YY_NULLPTR, | ||
210 | counter_type l = 1, | ||
211 | counter_type c = 1) | ||
212 | { | ||
213 | begin.initialize (f, l, c); | ||
214 | end = begin; | ||
215 | } | ||
216 | |||
217 | /** \name Line and Column related manipulators | ||
218 | ** \{ */ | ||
219 | public: | ||
220 | /// Reset initial location to final location. | ||
221 | void step () | ||
222 | { | ||
223 | begin = end; | ||
224 | } | ||
225 | |||
226 | /// Extend the current location to the COUNT next columns. | ||
227 | void columns (counter_type count = 1) | ||
228 | { | ||
229 | end += count; | ||
230 | } | ||
231 | |||
232 | /// Extend the current location to the COUNT next lines. | ||
233 | void lines (counter_type count = 1) | ||
234 | { | ||
235 | end.lines (count); | ||
236 | } | ||
237 | /** \} */ | ||
238 | |||
239 | |||
240 | public: | ||
241 | /// Beginning of the located region. | ||
242 | position begin; | ||
243 | /// End of the located region. | ||
244 | position end; | ||
245 | }; | ||
246 | |||
247 | /// Join two locations, in place. | ||
248 | inline location& | ||
249 | operator+= (location& res, const location& end) | ||
250 | { | ||
251 | res.end = end.end; | ||
252 | return res; | ||
253 | } | ||
254 | |||
255 | /// Join two locations. | ||
256 | inline location | ||
257 | operator+ (location res, const location& end) | ||
258 | { | ||
259 | return res += end; | ||
260 | } | ||
261 | |||
262 | /// Add \a width columns to the end position, in place. | ||
263 | inline location& | ||
264 | operator+= (location& res, location::counter_type width) | ||
265 | { | ||
266 | res.columns (width); | ||
267 | return res; | ||
268 | } | ||
269 | |||
270 | /// Add \a width columns to the end position. | ||
271 | inline location | ||
272 | operator+ (location res, location::counter_type width) | ||
273 | { | ||
274 | return res += width; | ||
275 | } | ||
276 | |||
277 | /// Subtract \a width columns to the end position, in place. | ||
278 | inline location& | ||
279 | operator-= (location& res, location::counter_type width) | ||
280 | { | ||
281 | return res += -width; | ||
282 | } | ||
283 | |||
284 | /// Subtract \a width columns to the end position. | ||
285 | inline location | ||
286 | operator- (location res, location::counter_type width) | ||
287 | { | ||
288 | return res -= width; | ||
289 | } | ||
290 | |||
291 | /// Compare two location objects. | ||
292 | inline bool | ||
293 | operator== (const location& loc1, const location& loc2) | ||
294 | { | ||
295 | return loc1.begin == loc2.begin && loc1.end == loc2.end; | ||
296 | } | ||
297 | |||
298 | /// Compare two location objects. | ||
299 | inline bool | ||
300 | operator!= (const location& loc1, const location& loc2) | ||
301 | { | ||
302 | return !(loc1 == loc2); | ||
303 | } | ||
304 | |||
305 | /** \brief Intercept output stream redirection. | ||
306 | ** \param ostr the destination output stream | ||
307 | ** \param loc a reference to the location to redirect | ||
308 | ** | ||
309 | ** Avoid duplicate information. | ||
310 | */ | ||
311 | template <typename YYChar> | ||
312 | std::basic_ostream<YYChar>& | ||
313 | operator<< (std::basic_ostream<YYChar>& ostr, const location& loc) | ||
314 | { | ||
315 | location::counter_type end_col | ||
316 | = 0 < loc.end.column ? loc.end.column - 1 : 0; | ||
317 | ostr << loc.begin; | ||
318 | if (loc.end.filename | ||
319 | && (!loc.begin.filename | ||
320 | || *loc.begin.filename != *loc.end.filename)) | ||
321 | ostr << '-' << loc.end.filename << ':' << loc.end.line << '.' << end_col; | ||
322 | else if (loc.begin.line < loc.end.line) | ||
323 | ostr << '-' << loc.end.line << '.' << end_col; | ||
324 | else if (loc.begin.column < end_col) | ||
325 | ostr << '-' << end_col; | ||
326 | return ostr; | ||
327 | } | ||
328 | |||
329 | } // dreal | ||
330 | #line 331 "bazel-out/k8-opt/bin/dreal/dr/location.hh" | ||
331 | |||
332 | #endif // !YY_DREAL_BAZEL_OUT_K8_OPT_BIN_DREAL_DR_LOCATION_HH_INCLUDED | ||