chset_operators.hpp 11 KB

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