Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67379 - in trunk/libs/spirit: example/scheme/example/sexpr example/scheme/input example/scheme/output example/scheme/qi test/qi test/support
From: hartmut.kaiser_at_[hidden]
Date: 2010-12-20 21:50:50


Author: hkaiser
Date: 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
New Revision: 67379
URL: http://svn.boost.org/trac/boost/changeset/67379

Log:
Spirit: adding uninitialized utree node type
Text files modified:
   trunk/libs/spirit/example/scheme/example/sexpr/sexpr_output_test.cpp | 12 ++++++------
   trunk/libs/spirit/example/scheme/input/parse_sexpr_impl.hpp | 4 ++--
   trunk/libs/spirit/example/scheme/input/sexpr.hpp | 18 +++++++++---------
   trunk/libs/spirit/example/scheme/output/sexpr.hpp | 24 ++++++++++++------------
   trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp | 4 ++--
   trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp | 4 ++--
   trunk/libs/spirit/test/qi/utree.cpp | 3 ++-
   trunk/libs/spirit/test/support/utree_test.cpp | 12 +++++++-----
   8 files changed, 42 insertions(+), 39 deletions(-)

Modified: trunk/libs/spirit/example/scheme/example/sexpr/sexpr_output_test.cpp
==============================================================================
--- trunk/libs/spirit/example/scheme/example/sexpr/sexpr_output_test.cpp (original)
+++ trunk/libs/spirit/example/scheme/example/sexpr/sexpr_output_test.cpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -84,8 +84,8 @@
         return -1;
     }
 
- boost::spirit::utree result;
- if (client::parse_sexpr_from_file(filename_in, result))
+ boost::spirit::utree result(boost::spirit::nil);
+// if (client::parse_sexpr_from_file(filename_in, result))
     {
         if (client::generate_sexpr_to_file(result, filename_out))
         {
@@ -96,10 +96,10 @@
             std::cout << "generate error" << std::endl;
         }
     }
- else
- {
- std::cout << "parse error" << std::endl;
- }
+// else
+// {
+// std::cout << "parse error" << std::endl;
+// }
 
     return 0;
 }

Modified: trunk/libs/spirit/example/scheme/input/parse_sexpr_impl.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/input/parse_sexpr_impl.hpp (original)
+++ trunk/libs/spirit/example/scheme/input/parse_sexpr_impl.hpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -125,7 +125,7 @@
         utree& result,
         std::string const& source_file)
     {
- return parse_sexpr(in.get<utf8_string_range>(), result, source_file);
+ return parse_sexpr(in.get<utf8_string_range_type>(), result, source_file);
     }
 
     bool parse_sexpr_list(
@@ -133,7 +133,7 @@
         utree& result,
         std::string const& source_file)
     {
- return parse_sexpr_list(in.get<utf8_string_range>(), result, source_file);
+ return parse_sexpr_list(in.get<utf8_string_range_type>(), result, source_file);
     }
 }}
 

Modified: trunk/libs/spirit/example/scheme/input/sexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/input/sexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/input/sexpr.hpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -56,13 +56,13 @@
     using boost::spirit::shallow;
     using boost::spirit::stored_function;
     using boost::spirit::function_base;
- using boost::spirit::binary_string;
- using boost::spirit::utf8_symbol;
- using boost::spirit::utf8_string;
- using boost::spirit::binary_range;
- using boost::spirit::utf8_symbol_range;
- using boost::spirit::utf8_string_range;
- using boost::spirit::nil;
+ using boost::spirit::binary_string_type;
+ using boost::spirit::utf8_symbol_type;
+ using boost::spirit::utf8_string_type;
+ using boost::spirit::binary_range_type;
+ using boost::spirit::utf8_symbol_range_type;
+ using boost::spirit::utf8_string_range_type;
+ using boost::spirit::nil_type;
 
     typedef boost::uint32_t uchar; // a unicode code point
 
@@ -148,8 +148,8 @@
             start, element, list;
         rule<Iterator, int()> integer;
         rule<Iterator, utree()> atom;
- rule<Iterator, utf8_symbol()> symbol;
- rule<Iterator, binary_string()> byte_str;
+ rule<Iterator, utf8_symbol_type()> symbol;
+ rule<Iterator, binary_string_type()> byte_str;
         scheme::input::string<Iterator> string;
 
         function<ErrorHandler> const error_handler;

Modified: trunk/libs/spirit/example/scheme/output/sexpr.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/output/sexpr.hpp (original)
+++ trunk/libs/spirit/example/scheme/output/sexpr.hpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -10,7 +10,7 @@
 
 #include <boost/cstdint.hpp>
 #include <boost/mpl/bool.hpp>
-#include <boost/spirit/home/support/utree/utree_traits.hpp>
+#include <boost/spirit/include/support_utree.hpp>
 #include <boost/spirit/include/karma.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -34,13 +34,13 @@
     using boost::spirit::shallow;
     using boost::spirit::stored_function;
     using boost::spirit::function_base;
- using boost::spirit::binary_string;
- using boost::spirit::utf8_symbol;
- using boost::spirit::utf8_string;
- using boost::spirit::binary_range;
- using boost::spirit::utf8_symbol_range;
- using boost::spirit::utf8_string_range;
- using boost::spirit::nil;
+ using boost::spirit::binary_string_type;
+ using boost::spirit::utf8_symbol_type;
+ using boost::spirit::utf8_string_type;
+ using boost::spirit::binary_range_type;
+ using boost::spirit::utf8_symbol_range_type;
+ using boost::spirit::utf8_string_range_type;
+ using boost::spirit::nil_type;
 
     template <typename OutputIterator>
     struct sexpr : grammar<OutputIterator, space_type, utree()>
@@ -81,10 +81,10 @@
 
         rule<OutputIterator, space_type, utree()> start;
         rule<OutputIterator, space_type, utree_list()> list;
- rule<OutputIterator, utf8_symbol_range()> symbol;
- rule<OutputIterator, utf8_string_range()> string_;
- rule<OutputIterator, binary_range()> byte_str;
- rule<OutputIterator, nil()> nil_;
+ rule<OutputIterator, utf8_symbol_range_type()> symbol;
+ rule<OutputIterator, utf8_string_range_type()> string_;
+ rule<OutputIterator, binary_range_type()> byte_str;
+ rule<OutputIterator, nil_type()> nil_;
         rule<OutputIterator, space_type, utree()> ref_;
     };
 }}

Modified: trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/qiexpr_generator.hpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -42,7 +42,7 @@
     using boost::spirit::binary_range;
     using boost::spirit::utf8_symbol_range;
     using boost::spirit::utf8_string_range;
- using boost::spirit::nil;
+ using boost::spirit::nil_type;
 
     ///////////////////////////////////////////////////////////////////////////
     namespace traits
@@ -171,7 +171,7 @@
         delimiting_rule_type start, alternative, permutation, sequence, term;
         delimiting_rule_type grammar_, rule_;
         delimiting_rule_type rule_name, primitive0_rule, alternative_rule;
- rule<OutputIterator, nil()> nil_;
+ rule<OutputIterator, nil_type()> nil_;
         rule<OutputIterator, utf8_string()> literal;
         rule<OutputIterator, utf8_symbol(std::string)> symbol;
         rule<OutputIterator, utf8_symbol()> any_symbol;

Modified: trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp (original)
+++ trunk/libs/spirit/example/scheme/qi/qiexpr_parser.hpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -54,7 +54,7 @@
     using boost::spirit::binary_range;
     using boost::spirit::utf8_symbol_range;
     using boost::spirit::utf8_string_range;
- using boost::spirit::nil;
+ using boost::spirit::nil_type;
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator>
@@ -98,7 +98,7 @@
         // element is the symbol this function object has been constructed from
         struct make_list_node
         {
- template <typename T1, typename T2 = nil>
+ template <typename T1, typename T2 = nil_type>
             struct result { typedef void type; };
 
             explicit make_list_node(char const* symbol_)

Modified: trunk/libs/spirit/test/qi/utree.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/utree.cpp (original)
+++ trunk/libs/spirit/test/qi/utree.cpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -168,7 +168,8 @@
             ut.which() == utree_type::string_type && check(ut, "\"x\""));
         ut.clear();
         BOOST_TEST(test_attr("", -char_, ut) &&
- ut.which() == utree_type::nil_type && check(ut, "<nil>"));
+ ut.which() == utree_type::uninitialized_type &&
+ check(ut, "<uninitialized>"));
     }
 
     // as_string

Modified: trunk/libs/spirit/test/support/utree_test.cpp
==============================================================================
--- trunk/libs/spirit/test/support/utree_test.cpp (original)
+++ trunk/libs/spirit/test/support/utree_test.cpp 2010-12-20 21:50:47 EST (Mon, 20 Dec 2010)
@@ -33,6 +33,8 @@
 int main()
 {
     using boost::spirit::utree;
+ using boost::spirit::nil;
+ using boost::spirit::uninitialized;
 
     {
         // test the size
@@ -42,7 +44,7 @@
     }
 
     {
- utree val;
+ utree val(nil);
         BOOST_TEST(check(val, "<nil>"));
     }
 
@@ -98,7 +100,7 @@
         BOOST_TEST(check(val, "( 123 \"Chuckie\" ( 123.456 \"Mah Doggie\" ) )"));
         BOOST_TEST(check(val.front(), "123"));
 
- utree val3;
+ utree val3(nil);
         val3.swap(val);
         BOOST_TEST(val3.size() == 3);
         BOOST_TEST(check(val, "<nil>"));
@@ -138,7 +140,7 @@
     }
 
     {
- utree a, b;
+ utree a(nil), b(nil);
         BOOST_TEST(a == b);
         a = 123;
         BOOST_TEST(a != b);
@@ -147,7 +149,7 @@
         a = 100.00;
         BOOST_TEST(a < b);
 
- b = a = utree();
+ b = a = utree(uninitialized);
         BOOST_TEST(a == b);
         a.push_back(1);
         a.push_back("two");
@@ -162,7 +164,7 @@
     }
 
     {
- utree a;
+ utree a(nil);
         a.push_back(1);
         a.push_back(2);
         a.push_back(3);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk