Update of /cvsroot/boost/boost/boost/spirit/tree/msvc
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17162

Modified Files:
      Tag: SPIRIT_1_6
        common.hpp 
Log Message:
Applied Tobias Schwinger's patches

Index: common.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/spirit/tree/msvc/Attic/common.hpp,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- common.hpp  22 Jan 2005 12:57:46 -0000      1.1.2.4
+++ common.hpp  26 Feb 2007 23:06:40 -0000      1.1.2.5
@@ -906,7 +906,6 @@
     typedef no_tree_gen_node_parser<T> self_t;
     typedef no_tree_gen_node_parser_gen parser_generator_t;
     typedef unary_parser_category parser_category_t;
-//    typedef no_tree_gen_node_parser<T> const &embed_t;
 
     no_tree_gen_node_parser(T const& a)
     : unary<T, parser<no_tree_gen_node_parser<T> > >(a) {}
@@ -924,7 +923,8 @@
             action_policy_t
         > policies_t;
 
-        return this->subject().parse(scanner.change_policies(policies_t()));
+        return this->subject().parse(scanner.change_policies(
+            policies_t(scanner, match_policy(), scanner)));
     }
 };
 
@@ -955,6 +955,79 @@
 //////////////////////////////////
 const no_tree_gen_node_parser_gen no_node_d = no_tree_gen_node_parser_gen();
 
+//////////////////////////////////
+
+struct leaf_node_parser_gen;
+
+template<typename T>
+struct leaf_node_parser
+:   public unary<T, parser<leaf_node_parser<T> > >
+{
+    typedef leaf_node_parser<T> self_t;
+    typedef leaf_node_parser_gen parser_generator_t;
+    typedef unary_parser_category parser_category_t;
+
+    leaf_node_parser(T const& a)
+    : unary<T, parser<leaf_node_parser<T> > >(a) {}
+
+    template <typename ScannerT>
+    typename parser_result<self_t, ScannerT>::type
+    parse(ScannerT const& scanner) const
+    {
+        typedef typename ScannerT::iteration_policy_t iteration_policy_t;
+        typedef match_policy match_policy_t;
+        typedef typename ScannerT::action_policy_t action_policy_t;
+        typedef scanner_policies<
+            iteration_policy_t,
+            match_policy_t,
+            action_policy_t
+        > policies_t;
+
+        typedef typename ScannerT::iterator_t iterator_t;
+        typedef typename parser_result<self_t, ScannerT>::type result_t;
+        typedef typename result_t::node_factory_t factory_t;
+
+        iterator_t from = scanner.first;
+        result_t hit = impl::contiguous_parser_parse<result_t>(this->subject(),
+            scanner.change_policies(
+                policies_t(scanner,match_policy(),scanner)), scanner);
+
+        if (hit)
+            return result_t(hit.length(),
+                factory_t::create_node(from, scanner.first, true));
+        else
+            return result_t(hit.length());
+    }
+};
+
+struct leaf_node_parser_gen
+{
+    template <typename T>
+    struct result {
+
+        typedef leaf_node_parser<T> type;
+    };
+
+    template <typename T>
+    static leaf_node_parser<T>
+    generate(parser<T> const& s)
+    {
+        return leaf_node_parser<T>(s.derived());
+    }
+
+    template <typename T>
+    leaf_node_parser<T>
+    operator[](parser<T> const& s) const
+    {
+        return leaf_node_parser<T>(s.derived());
+    }
+};
+
+const leaf_node_parser_gen leaf_node_d = leaf_node_parser_gen();
+const leaf_node_parser_gen token_node_d = leaf_node_parser_gen();
+
+  //////////////////////////////////
+
 namespace impl {
 
 #if BOOST_WORKAROUND(BOOST_MSVC , <= 1300)
@@ -1064,7 +1137,7 @@
 const node_parser_gen<discard_node_op> discard_node_d =
     node_parser_gen<discard_node_op>();
 
-struct leaf_node_op
+struct reduced_node_op
 {
     template <typename MatchT>
     void operator()(MatchT& m) const
@@ -1081,10 +1154,9 @@
     }
 };
 
-const node_parser_gen<leaf_node_op> leaf_node_d =
-    node_parser_gen<leaf_node_op>();
-const node_parser_gen<leaf_node_op> token_node_d =
-    node_parser_gen<leaf_node_op>();
+const node_parser_gen<reduced_node_op> reduced_node_d =
+    node_parser_gen<reduced_node_op>();
+
 
 struct infix_node_op
 {


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to