[857] | 1 | /*=============================================================================
|
---|
| 2 | Copyright (c) 2001-2003 Joel de Guzman
|
---|
| 3 | Copyright (c) 2001-2003 Daniel Nuffer
|
---|
| 4 | http://spirit.sourceforge.net/
|
---|
| 5 |
|
---|
| 6 | Use, modification and distribution is subject to the Boost Software
|
---|
| 7 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 8 | http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 9 | =============================================================================*/
|
---|
| 10 | #ifndef BOOST_SPIRIT_CHSET_OPERATORS_HPP
|
---|
| 11 | #define BOOST_SPIRIT_CHSET_OPERATORS_HPP
|
---|
| 12 |
|
---|
| 13 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 14 | #include <boost/spirit/utility/chset.hpp>
|
---|
| 15 |
|
---|
| 16 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 17 | namespace boost { namespace spirit {
|
---|
| 18 |
|
---|
| 19 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 20 | //
|
---|
| 21 | // chset free operators
|
---|
| 22 | //
|
---|
| 23 | // Where a and b are both chsets, implements:
|
---|
| 24 | //
|
---|
| 25 | // a | b, a & b, a - b, a ^ b
|
---|
| 26 | //
|
---|
| 27 | // Where a is a chset, implements:
|
---|
| 28 | //
|
---|
| 29 | // ~a
|
---|
| 30 | //
|
---|
| 31 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 32 | template <typename CharT>
|
---|
| 33 | chset<CharT>
|
---|
| 34 | operator~(chset<CharT> const& a);
|
---|
| 35 |
|
---|
| 36 | //////////////////////////////////
|
---|
| 37 | template <typename CharT>
|
---|
| 38 | chset<CharT>
|
---|
| 39 | operator|(chset<CharT> const& a, chset<CharT> const& b);
|
---|
| 40 |
|
---|
| 41 | //////////////////////////////////
|
---|
| 42 | template <typename CharT>
|
---|
| 43 | chset<CharT>
|
---|
| 44 | operator&(chset<CharT> const& a, chset<CharT> const& b);
|
---|
| 45 |
|
---|
| 46 | //////////////////////////////////
|
---|
| 47 | template <typename CharT>
|
---|
| 48 | chset<CharT>
|
---|
| 49 | operator-(chset<CharT> const& a, chset<CharT> const& b);
|
---|
| 50 |
|
---|
| 51 | //////////////////////////////////
|
---|
| 52 | template <typename CharT>
|
---|
| 53 | chset<CharT>
|
---|
| 54 | operator^(chset<CharT> const& a, chset<CharT> const& b);
|
---|
| 55 |
|
---|
| 56 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 57 | //
|
---|
| 58 | // range <--> chset free operators
|
---|
| 59 | //
|
---|
| 60 | // Where a is a chset and b is a range, and vice-versa, implements:
|
---|
| 61 | //
|
---|
| 62 | // a | b, a & b, a - b, a ^ b
|
---|
| 63 | //
|
---|
| 64 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 65 | template <typename CharT>
|
---|
| 66 | chset<CharT>
|
---|
| 67 | operator|(chset<CharT> const& a, range<CharT> const& b);
|
---|
| 68 |
|
---|
| 69 | //////////////////////////////////
|
---|
| 70 | template <typename CharT>
|
---|
| 71 | chset<CharT>
|
---|
| 72 | operator&(chset<CharT> const& a, range<CharT> const& b);
|
---|
| 73 |
|
---|
| 74 | //////////////////////////////////
|
---|
| 75 | template <typename CharT>
|
---|
| 76 | chset<CharT>
|
---|
| 77 | operator-(chset<CharT> const& a, range<CharT> const& b);
|
---|
| 78 |
|
---|
| 79 | //////////////////////////////////
|
---|
| 80 | template <typename CharT>
|
---|
| 81 | chset<CharT>
|
---|
| 82 | operator^(chset<CharT> const& a, range<CharT> const& b);
|
---|
| 83 |
|
---|
| 84 | //////////////////////////////////
|
---|
| 85 | template <typename CharT>
|
---|
| 86 | chset<CharT>
|
---|
| 87 | operator|(range<CharT> const& a, chset<CharT> const& b);
|
---|
| 88 |
|
---|
| 89 | //////////////////////////////////
|
---|
| 90 | template <typename CharT>
|
---|
| 91 | chset<CharT>
|
---|
| 92 | operator&(range<CharT> const& a, chset<CharT> const& b);
|
---|
| 93 |
|
---|
| 94 | //////////////////////////////////
|
---|
| 95 | template <typename CharT>
|
---|
| 96 | chset<CharT>
|
---|
| 97 | operator-(range<CharT> const& a, chset<CharT> const& b);
|
---|
| 98 |
|
---|
| 99 | //////////////////////////////////
|
---|
| 100 | template <typename CharT>
|
---|
| 101 | chset<CharT>
|
---|
| 102 | operator^(range<CharT> const& a, chset<CharT> const& b);
|
---|
| 103 |
|
---|
| 104 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 105 | //
|
---|
| 106 | // chlit <--> chset free operators
|
---|
| 107 | //
|
---|
| 108 | // Where a is a chset and b is a chlit, and vice-versa, implements:
|
---|
| 109 | //
|
---|
| 110 | // a | b, a & b, a - b, a ^ b
|
---|
| 111 | //
|
---|
| 112 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 113 | template <typename CharT>
|
---|
| 114 | chset<CharT>
|
---|
| 115 | operator|(chset<CharT> const& a, chlit<CharT> const& b);
|
---|
| 116 |
|
---|
| 117 | //////////////////////////////////
|
---|
| 118 | template <typename CharT>
|
---|
| 119 | chset<CharT>
|
---|
| 120 | operator&(chset<CharT> const& a, chlit<CharT> const& b);
|
---|
| 121 |
|
---|
| 122 | //////////////////////////////////
|
---|
| 123 | template <typename CharT>
|
---|
| 124 | chset<CharT>
|
---|
| 125 | operator-(chset<CharT> const& a, chlit<CharT> const& b);
|
---|
| 126 |
|
---|
| 127 | //////////////////////////////////
|
---|
| 128 | template <typename CharT>
|
---|
| 129 | chset<CharT>
|
---|
| 130 | operator^(chset<CharT> const& a, chlit<CharT> const& b);
|
---|
| 131 |
|
---|
| 132 | //////////////////////////////////
|
---|
| 133 | template <typename CharT>
|
---|
| 134 | chset<CharT>
|
---|
| 135 | operator|(chlit<CharT> const& a, chset<CharT> const& b);
|
---|
| 136 |
|
---|
| 137 | //////////////////////////////////
|
---|
| 138 | template <typename CharT>
|
---|
| 139 | chset<CharT>
|
---|
| 140 | operator&(chlit<CharT> const& a, chset<CharT> const& b);
|
---|
| 141 |
|
---|
| 142 | //////////////////////////////////
|
---|
| 143 | template <typename CharT>
|
---|
| 144 | chset<CharT>
|
---|
| 145 | operator-(chlit<CharT> const& a, chset<CharT> const& b);
|
---|
| 146 |
|
---|
| 147 | //////////////////////////////////
|
---|
| 148 | template <typename CharT>
|
---|
| 149 | chset<CharT>
|
---|
| 150 | operator^(chlit<CharT> const& a, chset<CharT> const& b);
|
---|
| 151 |
|
---|
| 152 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 153 | //
|
---|
| 154 | // negated_char_parser<range> <--> chset free operators
|
---|
| 155 | //
|
---|
| 156 | // Where a is a chset and b is a range, and vice-versa, implements:
|
---|
| 157 | //
|
---|
| 158 | // a | b, a & b, a - b, a ^ b
|
---|
| 159 | //
|
---|
| 160 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 161 | template <typename CharT>
|
---|
| 162 | chset<CharT>
|
---|
| 163 | operator|(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
---|
| 164 |
|
---|
| 165 | //////////////////////////////////
|
---|
| 166 | template <typename CharT>
|
---|
| 167 | chset<CharT>
|
---|
| 168 | operator&(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
---|
| 169 |
|
---|
| 170 | //////////////////////////////////
|
---|
| 171 | template <typename CharT>
|
---|
| 172 | chset<CharT>
|
---|
| 173 | operator-(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
---|
| 174 |
|
---|
| 175 | //////////////////////////////////
|
---|
| 176 | template <typename CharT>
|
---|
| 177 | chset<CharT>
|
---|
| 178 | operator^(chset<CharT> const& a, negated_char_parser<range<CharT> > const& b);
|
---|
| 179 |
|
---|
| 180 | //////////////////////////////////
|
---|
| 181 | template <typename CharT>
|
---|
| 182 | chset<CharT>
|
---|
| 183 | operator|(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
---|
| 184 |
|
---|
| 185 | //////////////////////////////////
|
---|
| 186 | template <typename CharT>
|
---|
| 187 | chset<CharT>
|
---|
| 188 | operator&(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
---|
| 189 |
|
---|
| 190 | //////////////////////////////////
|
---|
| 191 | template <typename CharT>
|
---|
| 192 | chset<CharT>
|
---|
| 193 | operator-(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
---|
| 194 |
|
---|
| 195 | //////////////////////////////////
|
---|
| 196 | template <typename CharT>
|
---|
| 197 | chset<CharT>
|
---|
| 198 | operator^(negated_char_parser<range<CharT> > const& a, chset<CharT> const& b);
|
---|
| 199 |
|
---|
| 200 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 201 | //
|
---|
| 202 | // negated_char_parser<chlit> <--> chset free operators
|
---|
| 203 | //
|
---|
| 204 | // Where a is a chset and b is a chlit, and vice-versa, implements:
|
---|
| 205 | //
|
---|
| 206 | // a | b, a & b, a - b, a ^ b
|
---|
| 207 | //
|
---|
| 208 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 209 | template <typename CharT>
|
---|
| 210 | chset<CharT>
|
---|
| 211 | operator|(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
---|
| 212 |
|
---|
| 213 | //////////////////////////////////
|
---|
| 214 | template <typename CharT>
|
---|
| 215 | chset<CharT>
|
---|
| 216 | operator&(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
---|
| 217 |
|
---|
| 218 | //////////////////////////////////
|
---|
| 219 | template <typename CharT>
|
---|
| 220 | chset<CharT>
|
---|
| 221 | operator-(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
---|
| 222 |
|
---|
| 223 | //////////////////////////////////
|
---|
| 224 | template <typename CharT>
|
---|
| 225 | chset<CharT>
|
---|
| 226 | operator^(chset<CharT> const& a, negated_char_parser<chlit<CharT> > const& b);
|
---|
| 227 |
|
---|
| 228 | //////////////////////////////////
|
---|
| 229 | template <typename CharT>
|
---|
| 230 | chset<CharT>
|
---|
| 231 | operator|(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
---|
| 232 |
|
---|
| 233 | //////////////////////////////////
|
---|
| 234 | template <typename CharT>
|
---|
| 235 | chset<CharT>
|
---|
| 236 | operator&(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
---|
| 237 |
|
---|
| 238 | //////////////////////////////////
|
---|
| 239 | template <typename CharT>
|
---|
| 240 | chset<CharT>
|
---|
| 241 | operator-(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
---|
| 242 |
|
---|
| 243 | //////////////////////////////////
|
---|
| 244 | template <typename CharT>
|
---|
| 245 | chset<CharT>
|
---|
| 246 | operator^(negated_char_parser<chlit<CharT> > const& a, chset<CharT> const& b);
|
---|
| 247 |
|
---|
| 248 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 249 | //
|
---|
| 250 | // literal primitives <--> chset free operators
|
---|
| 251 | //
|
---|
| 252 | // Where a is a chset and b is a literal primitive,
|
---|
| 253 | // and vice-versa, implements:
|
---|
| 254 | //
|
---|
| 255 | // a | b, a & b, a - b, a ^ b
|
---|
| 256 | //
|
---|
| 257 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 258 | template <typename CharT>
|
---|
| 259 | chset<CharT>
|
---|
| 260 | operator|(chset<CharT> const& a, CharT b);
|
---|
| 261 |
|
---|
| 262 | //////////////////////////////////
|
---|
| 263 | template <typename CharT>
|
---|
| 264 | chset<CharT>
|
---|
| 265 | operator&(chset<CharT> const& a, CharT b);
|
---|
| 266 |
|
---|
| 267 | //////////////////////////////////
|
---|
| 268 | template <typename CharT>
|
---|
| 269 | chset<CharT>
|
---|
| 270 | operator-(chset<CharT> const& a, CharT b);
|
---|
| 271 |
|
---|
| 272 | //////////////////////////////////
|
---|
| 273 | template <typename CharT>
|
---|
| 274 | chset<CharT>
|
---|
| 275 | operator^(chset<CharT> const& a, CharT b);
|
---|
| 276 |
|
---|
| 277 | //////////////////////////////////
|
---|
| 278 | template <typename CharT>
|
---|
| 279 | chset<CharT>
|
---|
| 280 | operator|(CharT a, chset<CharT> const& b);
|
---|
| 281 |
|
---|
| 282 | //////////////////////////////////
|
---|
| 283 | template <typename CharT>
|
---|
| 284 | chset<CharT>
|
---|
| 285 | operator&(CharT a, chset<CharT> const& b);
|
---|
| 286 |
|
---|
| 287 | //////////////////////////////////
|
---|
| 288 | template <typename CharT>
|
---|
| 289 | chset<CharT>
|
---|
| 290 | operator-(CharT a, chset<CharT> const& b);
|
---|
| 291 |
|
---|
| 292 | //////////////////////////////////
|
---|
| 293 | template <typename CharT>
|
---|
| 294 | chset<CharT>
|
---|
| 295 | operator^(CharT a, chset<CharT> const& b);
|
---|
| 296 |
|
---|
| 297 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 298 | //
|
---|
| 299 | // anychar_parser <--> chset free operators
|
---|
| 300 | //
|
---|
| 301 | // Where a is chset and b is a anychar_parser, and vice-versa, implements:
|
---|
| 302 | //
|
---|
| 303 | // a | b, a & b, a - b, a ^ b
|
---|
| 304 | //
|
---|
| 305 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 306 | template <typename CharT>
|
---|
| 307 | chset<CharT>
|
---|
| 308 | operator|(chset<CharT> const& a, anychar_parser b);
|
---|
| 309 |
|
---|
| 310 | //////////////////////////////////
|
---|
| 311 | template <typename CharT>
|
---|
| 312 | chset<CharT>
|
---|
| 313 | operator&(chset<CharT> const& a, anychar_parser b);
|
---|
| 314 |
|
---|
| 315 | //////////////////////////////////
|
---|
| 316 | template <typename CharT>
|
---|
| 317 | chset<CharT>
|
---|
| 318 | operator-(chset<CharT> const& a, anychar_parser b);
|
---|
| 319 |
|
---|
| 320 | //////////////////////////////////
|
---|
| 321 | template <typename CharT>
|
---|
| 322 | chset<CharT>
|
---|
| 323 | operator^(chset<CharT> const& a, anychar_parser b);
|
---|
| 324 |
|
---|
| 325 | //////////////////////////////////
|
---|
| 326 | template <typename CharT>
|
---|
| 327 | chset<CharT>
|
---|
| 328 | operator|(anychar_parser a, chset<CharT> const& b);
|
---|
| 329 |
|
---|
| 330 | //////////////////////////////////
|
---|
| 331 | template <typename CharT>
|
---|
| 332 | chset<CharT>
|
---|
| 333 | operator&(anychar_parser a, chset<CharT> const& b);
|
---|
| 334 |
|
---|
| 335 | //////////////////////////////////
|
---|
| 336 | template <typename CharT>
|
---|
| 337 | chset<CharT>
|
---|
| 338 | operator-(anychar_parser a, chset<CharT> const& b);
|
---|
| 339 |
|
---|
| 340 | //////////////////////////////////
|
---|
| 341 | template <typename CharT>
|
---|
| 342 | chset<CharT>
|
---|
| 343 | operator^(anychar_parser a, chset<CharT> const& b);
|
---|
| 344 |
|
---|
| 345 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 346 | //
|
---|
| 347 | // nothing_parser <--> chset free operators
|
---|
| 348 | //
|
---|
| 349 | // Where a is chset and b is nothing_parser, and vice-versa, implements:
|
---|
| 350 | //
|
---|
| 351 | // a | b, a & b, a - b, a ^ b
|
---|
| 352 | //
|
---|
| 353 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 354 | template <typename CharT>
|
---|
| 355 | chset<CharT>
|
---|
| 356 | operator|(chset<CharT> const& a, nothing_parser b);
|
---|
| 357 |
|
---|
| 358 | //////////////////////////////////
|
---|
| 359 | template <typename CharT>
|
---|
| 360 | chset<CharT>
|
---|
| 361 | operator&(chset<CharT> const& a, nothing_parser b);
|
---|
| 362 |
|
---|
| 363 | //////////////////////////////////
|
---|
| 364 | template <typename CharT>
|
---|
| 365 | chset<CharT>
|
---|
| 366 | operator-(chset<CharT> const& a, nothing_parser b);
|
---|
| 367 |
|
---|
| 368 | //////////////////////////////////
|
---|
| 369 | template <typename CharT>
|
---|
| 370 | chset<CharT>
|
---|
| 371 | operator^(chset<CharT> const& a, nothing_parser b);
|
---|
| 372 |
|
---|
| 373 | //////////////////////////////////
|
---|
| 374 | template <typename CharT>
|
---|
| 375 | chset<CharT>
|
---|
| 376 | operator|(nothing_parser a, chset<CharT> const& b);
|
---|
| 377 |
|
---|
| 378 | //////////////////////////////////
|
---|
| 379 | template <typename CharT>
|
---|
| 380 | chset<CharT>
|
---|
| 381 | operator&(nothing_parser a, chset<CharT> const& b);
|
---|
| 382 |
|
---|
| 383 | //////////////////////////////////
|
---|
| 384 | template <typename CharT>
|
---|
| 385 | chset<CharT>
|
---|
| 386 | operator-(nothing_parser a, chset<CharT> const& b);
|
---|
| 387 |
|
---|
| 388 | //////////////////////////////////
|
---|
| 389 | template <typename CharT>
|
---|
| 390 | chset<CharT>
|
---|
| 391 | operator^(nothing_parser a, chset<CharT> const& b);
|
---|
| 392 |
|
---|
| 393 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 394 | }} // namespace boost::spirit
|
---|
| 395 |
|
---|
| 396 | #endif
|
---|
| 397 |
|
---|
| 398 | #include <boost/spirit/utility/impl/chset_operators.ipp>
|
---|