1 | /*============================================================================= |
---|
2 | Phoenix V1.2.1 |
---|
3 | Copyright (c) 2001-2003 Joel de Guzman |
---|
4 | |
---|
5 | Use, modification and distribution is subject to the Boost Software |
---|
6 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
7 | http://www.boost.org/LICENSE_1_0.txt) |
---|
8 | ==============================================================================*/ |
---|
9 | #include <iostream> |
---|
10 | #include <boost/detail/lightweight_test.hpp> |
---|
11 | |
---|
12 | #define PHOENIX_LIMIT 15 |
---|
13 | #include <boost/spirit/phoenix/primitives.hpp> |
---|
14 | |
---|
15 | using namespace phoenix; |
---|
16 | using namespace std; |
---|
17 | |
---|
18 | /////////////////////////////////////////////////////////////////////////////// |
---|
19 | int |
---|
20 | main() |
---|
21 | { |
---|
22 | char c1 = '1'; |
---|
23 | int i1 = 1, i2 = 2, i = 4; |
---|
24 | const char* s2 = "2"; |
---|
25 | |
---|
26 | /////////////////////////////////////////////////////////////////////////////// |
---|
27 | // |
---|
28 | // Values, variables and arguments |
---|
29 | // |
---|
30 | /////////////////////////////////////////////////////////////////////////////// |
---|
31 | cout << val("Hello")() << val(' ')() << val("World")() << endl; |
---|
32 | |
---|
33 | BOOST_TEST(arg1(c1) == c1); |
---|
34 | BOOST_TEST(arg1(i1, i2) == i1); |
---|
35 | BOOST_TEST(arg2(i1, s2) == s2); |
---|
36 | |
---|
37 | BOOST_TEST(val(3)() == 3); |
---|
38 | BOOST_TEST(var(i)() == 4); |
---|
39 | BOOST_TEST(var(++i)() == 5); |
---|
40 | |
---|
41 | return boost::report_errors(); |
---|
42 | } |
---|